OreoAndYuumi

mmxagent-guardian

開發程式設計v1.0.3
作者:OreoAndYuumi更新於 2026-05-17共 3 個版本 · 最新版本釋出於 2026-03-19@clawhub_oreoandyuumi/mmxagent-guardian
Git 輔助

據 AlphaMoat 統計,截至 2026-10,mmxagent-guardian 累計下載 10,537 次、獲 0 個星標,按累計下載量在本次參與排名的 10,914 個 AI 技能中排名第 2,586 位,在「開發程式設計」分類(1,069 個)中排名第 191 位。

列表預設按累計下載量排序,也可按星標排序;詳情頁排名按累計下載量計算。

累計下載
1.1萬
星標
-
全站下載量排名
#2,586
全站前 24% · 「開發程式設計」前 18%
平台累計下載星標評論
ClawHub ↗9489--
SkillHub ↗1.1萬-—

各平台的計數口徑不同,統計時間不一致。

這個技能是做什麼的

修改檔案時儲存增量 diff 加修改前完整快照(支援回滾);刪除檔案移入 ~/.openclaw/minivcs/trash/(支援恢復)。保留期:重要檔案(系統路徑、配置目錄等)14 天,普通檔案 7 天;node_modules、.git 等生成/快取目錄自動跳過。二進位制檔案不能做文字 diff,會整份存 .bak 副本,超過 50 MB 會觸發體積警告,需使用者確認。操作前必須向使用者說明路徑、操作型別、影響與本地儲存行為;首次記錄沒有歷史快照、不可回滾;保護資料僅存本地,本技能不提供加密或遠端同步。執行需要 Python 3。

資料釋出於 2026-10-27

可以用來做什麼

  • 在修改檔案前自動留存可回滾的快照與 diff
  • 以受保護方式刪除檔案並支援隨時恢復
  • 按重要程度管理記錄保留期與到期清理確認

什麼時候用

  • 想讓智慧體的檔案修改可撤銷、刪除可恢復時
  • 編輯系統配置或重要專案檔案前想要保險時
  • 希望刪除操作先經確認且留有本地備份時

示例提示詞

以下是根據技能文件生成的示例,不代表實際執行結果。

修改這份配置檔案,並保留可回滾的記錄。
刪除這個舊指令碼,但先告訴我恢復方式。
檢視目前所有可以回滾的修改記錄。

月度資料趨勢

累計下載1.1萬
403875281.1萬2026-03 · 累計下載 45192026-05 · 累計下載 84502026-06 · 累計下載 87302026-07 · 累計下載 90862026-08 · 累計下載 92132026-09 · 累計下載 95252026-10 · 累計下載 1.1萬26-0326-0926-10
星標-
0112026-03 · 星標 -2026-05 · 星標 -2026-06 · 星標 -2026-07 · 星標 -2026-08 · 星標 -2026-09 · 星標 -2026-10 · 星標 -26-0326-0926-10

2026-09 起統計方法調整:同名技能按作者分別統計,並覆蓋全部技能。圖中虛線為調整前的月份,與之後的資料不直接比較,也不計算跨越調整的增長。

月份累計下載環比星標
2026-101.1萬—-
2026-099525—-
2026-089213+1.4%-
2026-079086+4.1%-
2026-068730+3.3%-
2026-058450—-
2026-034519—-

SKILL.md 原文

以下是作者釋出的原始檔案,按純文字顯示,本站未做修改或稽核;其中的連結不可點選,命令請核實後再執行。抓取於 2026-10-23。

17 KB · ClawHub v1.0.3
---
name: mmxagent-guardian
version: 1.0.3
description: Provide file protection while users work with openclaw. All file operations are version-indexed and support delete recovery and modification rollback.
---

# File Protection and Version Management

This Skill uses MiniVCS to track all file operations with version history.
展開全部(共 394 行)
**Runtime requirement**: Python 3 is required to run `scripts/minivcs/minivcs.py`.

**Script location**: `scripts/minivcs/minivcs.py` in the same directory as this `SKILL.md`
(Before executing, first determine the directory containing this file. It is referred to as `$SKILL_DIR` below.)

**Core mechanism:**
- **Modify**: Saves an incremental diff plus a full snapshot from before the modification, **supporting rollback**
- **Delete**: Moves the full file into `~/.openclaw/minivcs/trash/`, **supporting restore**
- **All files are indexed**, with different retention periods based on importance
- **After every operation, the full record table is scanned automatically** to find expired records and ask the user for confirmation

**Usage limitations:**
- **Binary files (images, PDFs, audio/video, etc.)**: Text diffs cannot be generated. For binary-file protection, MiniVCS stores a full local `.bak` copy instead. This applies to binary-file backup/rollback protection, and deletion protection also stores a full local copy in `~/.openclaw/minivcs/trash/`. The user must be informed before the operation because storage usage may be relatively high.
- **The first record cannot be rolled back**: When a file is recorded for the first time, there is not yet any historical baseline, so that record has no snapshot. After that, each call to `record_modify` following an edit automatically saves a snapshot, allowing rollback to the state before any edit.
- **Local storage notice**: Protection data is stored locally under `~/.openclaw/minivcs/`. This Skill does not provide encryption or remote sync.

---

## Prerequisite Check: Confirm Python Is Installed

**Before performing any operation, you must first check whether Python 3 is installed in the user's environment. This Skill requires Python 3 and should not run without it.**

### How to check

```bash
# macOS / Linux
python3 --version

# Windows (PowerShell)
python --version
```

- If the output is `Python 3.x.x`, it is installed and you can continue
- If it says `command not found` or `is not recognized as an internal or external command`, stop and tell the user that this Skill requires Python 3

### Dependency boundary

If Python 3 is missing:

- Do **not** run dependency installation commands from this Skill
- Do **not** run remote install scripts such as `curl | bash`
- Do **not** write to shell config files such as `~/.zshrc` or `~/.bash_profile`
- Do **not** modify global environment variables on the user's behalf from this Skill
- Tell the user that Python 3 is required, and ask them to install it first or explicitly authorize a separate environment-setup flow

> **Note**: On some Windows systems the command is `python`, while on macOS/Linux it is `python3`.
> In all commands below that use `python`, replace it with the correct command for the actual environment.

---

## Retention Policy

| File Type | Retention Days | Decision Rule |
|---------|---------|---------|
| Important files | **14 days** | System paths (`/etc/`, `/root/`, `/usr/local/etc/`, `/opt/`), user config directories (`~/.ssh/`, `~/.gnupg/`, `~/.config/`, `~/.openclaw/`, `~/.kube/`, `~/.docker/`, `~/.aws/`, `~/.azure/`, `~/.local/share/`), Windows system directories (`C:\Windows\`, `C:\ProgramData\`, `C:\Program Files\`), config files (`.yaml/.toml/.env`, etc.), entry files (`main.py/index.ts`, etc.) |
| Normal files | **7 days** | All other files |

When each record is created, the `expireAt` (expiration timestamp) and `expireAtDatetime` (human-readable time) fields are set automatically.

---

## Excluded Paths (Auto-Skip)

Files whose path contains any of the following segments are **automatically skipped** by `record_modify` and `record_delete`. These are generated, vendored, or cache directories that should not be version-tracked:

`node_modules`, `.git`, `__pycache__`, `.venv`, `venv`, `.tox`, `.mypy_cache`, `.pytest_cache`, `.ruff_cache`, `dist`, `build`, `.next`, `.nuxt`, `.turbo`

When a file is skipped, the return value will contain `"skipped": true` and a `"reason"` field. The Agent should inform the user that the file was not tracked and explain why.

---

## Binary File Size Warning

When a binary file exceeds **50 MB**, the return value from `record_modify` (binary backup) will include:
- `"sizeWarning": true`
- `"sizeWarningMessage"`: a human-readable description of the file size and threshold

**When `sizeWarning` is present, the Agent must explicitly inform the user of the file size and ask for confirmation before proceeding with any further binary backup operations on similarly large files.**

---

## Operation Flow

### Step 1: Initialize the MiniVCS Working Directory

On first use, the storage directory is created automatically. No extra action is required:

```bash
python "$SKILL_DIR/scripts/minivcs/minivcs.py" history --project-root <project_root>
```

All data is stored uniformly in `~/.openclaw/minivcs/`:
```
~/.openclaw/minivcs/
  logs.json     # operation log (includes the expireAt field)
  diffs/        # incremental patches for text file modifications
  bases/        # baseline for the next comparison (named by full relative path, so no same-name conflicts)
  snapshots/    # full snapshots before text file modifications (used for rollback)
  trash/        # full backups of deleted files (used for restore)
  backups/      # full `.bak` copies of binary files (used for rollback)
```

---

### Step 2: Ask the User for Confirmation Before the Operation

**Before deleting or modifying a file, you must explain the following to the user and wait for confirmation:**

1. The file path to be operated on
2. The operation type (modify / delete)
3. The purpose and intent of the operation
4. The possible impact
5. **Explain the local storage behavior: this Skill stores protection data under `~/.openclaw/minivcs/`**
6. **For text-file modifications, explain that MiniVCS stores diffs and snapshots so the file can be rolled back**
7. **For deletions, explain that MiniVCS stores a full local copy in `~/.openclaw/minivcs/trash/` so the file can be restored**
8. **If the file is binary, explicitly explain that protection uses a full local copy rather than a text diff, and ask whether the user wants that local copy to be stored before deletion or binary-file protection**
9. **If a binary backup returns `sizeWarning: true`, the Agent must display the file size and warning message to the user, and ask for explicit confirmation before proceeding**

If the file is binary and the user does **not** want a local stored copy, do not treat the operation as a protected delete/rollback flow under this Skill.

If the path is auto-skipped (return contains `"skipped": true`), inform the user that the file was not tracked and state the reason.

Example before the operation:
```
I am about to operate on the following file. Please confirm:
- File: /path/to/file.py
- Operation: delete
- Reason: This file has been replaced by a newer version and is no longer used
- Impact: Need to confirm that no other module imports this file
- Local storage: A full local copy will be stored under ~/.openclaw/minivcs/trash/ so the file can be restored later
- Protection: The stored copy will be retained for 7 days (14 days for important files), and can be restored at any time during that period
Do you want to continue?
```

Example for a binary file before deletion:
```
I am about to delete the following binary file. Please confirm:
- File: /path/to/file.pdf
- Operation: delete
- Reason: This file is no longer needed
- Impact: The original file will be removed from its current location
- Local storage: To protect this binary file, I need to store one full local copy under ~/.openclaw/minivcs/trash/
- Note: Binary files are protected with full copies rather than text diffs, so this may use more disk space
Do you want me to keep that local backup before deletion?
```

After the operation completes, **you must inform the user of the record result**, for example:
```
# After a modification is completed
The modification to path/to/file.py has been completed, and this change has been recorded (Record ID: 1710000000000).
- Change summary: +5 lines, -2 lines
- Retention period: 7 days (expires at: 2026-03-20 10:00:00)
- Rollback available: yes (use restore 1710000000000 to recover the state before the modification)
If you want to view the diff or roll it back, let me know.

# After a deletion is completed
path/to/file.py has been moved to the trash and backed up (Record ID: 1710000001000).
- Retention period: 14 days (expires at: 2026-03-27 10:00:00) [important file]
If you want to restore this file, let me know.
```

---

### Step 3: Operate on Files with MiniVCS

#### Modify a file (supports rollback)

**Just call `record` once after each edit**. The snapshot chain is formed automatically and supports rolling back to any historical state:

```
First time using this file → record() → base established (no snapshot, first record cannot be rolled back)
Edit → C1                → record() → snapshot=initial content,  R1 rollback available
Edit → C2                → record() → snapshot=C1,               R2 rollback available → restoring R2 gives C1
Edit → C3                → record() → snapshot=C2,               R3 rollback available → restoring R3 gives C2 (that is, the state at time t2)
```

```bash
# Run once after each edit is completed
python "$SKILL_DIR/scripts/minivcs/minivcs.py" record <file_path> --project-root <project_root>
# Output containing "Rollback: available" means the snapshot has been saved and can be rolled back
```

Python API:
```python
import sys, os
sys.path.insert(0, os.path.join(SKILL_DIR, "scripts", "minivcs"))
from minivcs import MiniVCS

vcs = MiniVCS(project_root="/path/to/project")

# Call once after each edit
result = vcs.record_modify("path/to/file.py")
# result includes:
# {
#   "success": True,
#   "recordId": "...",
#   "summary": "+5 lines, -2 lines",
#   "canRollback": True,   # True when a snapshot exists; False for the first record
#   "snapshotFile": "...",
#   "isImportant": False,
#   "retentionDays": 7,
#   "due_for_cleanup": [...]
# }
```

#### Delete a file (supports restore)

**Do not delete the file directly**. Use `record_delete` instead, and the file is moved into `trash` automatically.

Before running `record_delete`:

- Tell the user that a full local copy will be stored in `~/.openclaw/minivcs/trash/`
- If the file is binary, explicitly ask whether they want that local copy to be stored
- Only proceed with protected deletion after the user confirms the local storage behavior

```bash
python "$SKILL_DIR/scripts/minivcs/minivcs.py" delete <file_path> --project-root <project_root>
```

Python API:
```python
result = vcs.record_delete("path/to/file.py")
# result includes:
# {
#   "success": True,
#   "recordId": "...",
#   "trashFile": "~/.openclaw/minivcs/trash/1234567_file.py.bak",
#   "isImportant": True,
#   "retentionDays": 14,
#   "due_for_cleanup": [...]
# }
```

#### Restore / Roll back

The same `restore` command handles both scenarios:

```bash
# DELETE record -> restore the file to its original path
# MODIFY record (with snapshot) -> roll back to the state before the modification
python "$SKILL_DIR/scripts/minivcs/minivcs.py" restore <record_id> --project-root <project_root>
```

Python API:
```python
result = vcs.restore_file(record_id="...")
# After DELETE succeeds: the record is marked as RESTORED and no longer appears in the trash list
# After MODIFY succeeds: the record is marked as ROLLED_BACK
# Repeated restore: returns {"success": False, "error": "already been restored/rolled_back"}
```

---

### Step 4: Handle Expired Cleanup Notifications (must be done after every operation)

After each call to `record_modify` or `record_delete`, the return value contains the `due_for_cleanup` field.

**If `due_for_cleanup` is not empty, the Agent must:**

1. Show the user the list of expired records (sorted from earliest to latest)
2. Ask which ones can be deleted and which ones need an extension

Example display format:
```
The following N historical records have expired. Please confirm whether they can be cleaned up:

[1] ID=1710000000000  File=src/old.py  Action=MODIFY
    Recorded at=2026-03-01 10:00:00  Expires at=2026-03-08 10:00:00

[2] ID=1710000001000  File=config.yaml  Action=DELETE  [important file]
    Recorded at=2026-02-28 09:00:00  Expires at=2026-03-14 09:00:00

Can these records be deleted? (delete all / specify which ones to extend)
```

Handling after the user responds:

```python
# The user confirms deleting all
result = vcs.delete_due_records(record_ids=["id1", "id2"])

# The user says not to delete one record yet -> extend by one retention cycle (7 days or 14 days)
result = vcs.extend_record_expiry(record_id="id1")
```

Command line:
```bash
# View all expired records
python "$SKILL_DIR/scripts/minivcs/minivcs.py" cleanup --project-root <project_root>

# Confirm cleanup
python "$SKILL_DIR/scripts/minivcs/minivcs.py" cleanup --confirm --project-root <project_root>

# Extend one record
python "$SKILL_DIR/scripts/minivcs/minivcs.py" extend <record_id> --project-root <project_root>
```

---

## Other Common Operations

```bash
# View operation history (records marked [rollback available] can be rolled back)
python "$SKILL_DIR/scripts/minivcs/minivcs.py" history --project-root <project_root>
python "$SKILL_DIR/scripts/minivcs/minivcs.py" history <file_path> -d --project-root <project_root>

# View files in trash that have not yet been restored
python "$SKILL_DIR/scripts/minivcs/minivcs.py" trash --project-root <project_root>

# Delete a specified record (clean both the log and the physical file)
python "$SKILL_DIR/scripts/minivcs/minivcs.py" remove <record_id> --project-root <project_root>
```

---

## Record Field Reference

| Field | Type | Description |
|------|------|------|
| `recordId` | string | Unique record ID (millisecond timestamp) |
| `filePath` | string | Relative or absolute path |
| `action` | string | `MODIFY` / `DELETE` / `BINARY_BACKUP` / `RESTORED` / `ROLLED_BACK` |
| `timestamp` | number | Creation time (milliseconds) |
| `datetime` | string | Creation time (human-readable) |
| `isImportant` | bool | Whether the file is important |
| `retentionDays` | number | Retention days (7 or 14) |
| `expireAt` | number | Expiration time (milliseconds) |
| `expireAtDatetime` | string | Expiration time (human-readable) |
| `diffFile` | string | Diff patch path (MODIFY only) |
| `snapshotFile` | string | Pre-modification snapshot path (only present when MODIFY has a snapshot) |
| `trashFile` | string | Trash backup path (DELETE only) |
| `backupFile` | string | `.bak` copy path (BINARY_BACKUP only) |
| `summary` | string | Change summary |

---

## Full Operation Flow Diagram

```
The user requests a modification/deletion
       │
       ▼
[Ask for confirmation] Explain the purpose, impact, and existing protection -> wait for user confirmation
       │
       ├─── Modify file ───────────────────────────────────────────────┐
       │    1. Perform the actual modification                         │
       │    2. record_modify (Diff + snapshot -> canRollback=True)    │
       │       snapshot = content before this modification, so        │
       │       historical states can be rolled back step by step      │
       │                                                             │
       └─── Delete file ──────────────────────────────────────────────┤
            record_delete (move to trash, do not delete directly)     │
                                                                     │
                           ┌─────────────────────────────────────────┘
                           ▼
              Tell the user: Record ID / retention period / rollback or restore availability
                           │
                           ▼
              Check the returned value `due_for_cleanup`
                           │
               ┌───────────┴───────────┐
            Expired records exist    No expired records
               │                         │
               ▼                         ▼
       Show expired records            Operation complete
       (from earliest to latest)
       Ask the user for confirmation
               │
       ┌───────┴──────────┐
     Confirm deletion    Do not delete yet
       │                  │
       ▼                  ▼
delete_due_records   extend_record_expiry
                     (extend by one retention cycle)

------- When the user needs rollback/restore -------
User: "Help me restore/roll back xxx"
       │
       ▼
restore_file(record_id)
  ├── DELETE record -> restore from trash and mark as RESTORED
  └── MODIFY record (with snapshot) -> write back snapshot content and mark as ROLLED_BACK
```

「開發程式設計」分類下的熱門技能

程式設計大神.Skill開發程式設計

【全棧能力】程式設計大神.Skill:面向複雜真實專案的高階全棧程式設計助手。不止生成程式碼,而是從一句目標接手陌生程式碼庫,拆解需求、補齊實現、追到根因、完成重構、聯調前後端,並把結果推進到能執行、能驗證、能交付。覆蓋 Web、後端、指令碼、iOS、安卓、鴻蒙 ArkUI、微信小程式及其他技術棧,支援中英文工程、疑難 Bug、跨模組任務和長任務續做;用構建、日誌、真實入口、裝置或介面證據說明結果。僅問概念時直接回答,要求落地時持續推進到驗收或明確阻塞。

↓ 1125.9萬★ 82u_42bbb65f
程式設計專家Pro.Skill開發程式設計

程式設計專家 Pro:融合程式設計專家 2.0.3 工程專題與程式設計大神的鴻蒙 ArkTS/ArkUI、微信小程式和小遊戲開發資料。用於專案實現、根因除錯、審查、重構、測試、架構效能分析及多端開發驗證。支援自然語言和 @專題標識,按任務讀取包內知識;只問概念時直接回答。

↓ 626.9萬★ 32user_47d655f0
程式設計專家.Skill開發程式設計

程式設計專家.Skill P8級程式設計助手,25年實戰經驗技能Skill,全棧:Java/Php網站/軟體專案、API設計、Bug診斷、程式碼生成、程式碼審查、重構、測試用例、效能基準、技術選型、文件生成、任務拆解、Spec驅動、Karpathy規範、CMS二次開發、前端設計、MySQL/Mariadb、專案知識圖譜,以及工程紀律層(根因除錯硬閉環、階段導航、事故復盤/SLO、威脅建模/供應鏈安全、生產就緒/漸進式釋出、AI編碼治理、面向Agent程式碼可讀性、LLM應用安全)。支援 @標識 顯式呼叫跳過路由。

↓ 600.7萬★ 378user_741dc82b
dev-expert開發程式設計

程式設計專家.Skill P8級程式設計助手,25年實戰經驗技能Skill,全棧:Java/Php網站/軟體專案、API設計、Bug診斷、程式碼生成、程式碼審查、重構、測試用例、效能基準、技術選型、文件生成、任務拆解、Spec驅動、Karpathy規範、CMS二次開發、前端設計、MySQL/Mariadb、專案知識圖譜,以及工程紀律層(根因除錯硬閉環、階段導航、事故復盤/SLO、威脅建模/供應鏈安全、生產就緒/漸進式釋出、AI編碼治理、面向Agent程式碼可讀性、LLM應用安全)。支援 @標識 顯式呼叫跳過路由。

↓ 528.1萬★ 32user_814dbe54
dev-expert-pro開發程式設計

程式設計專家 Pro:融合程式設計專家 2.0.3 工程專題與程式設計大神的鴻蒙 ArkTS/ArkUI、微信小程式和小遊戲開發資料。用於專案實現、根因除錯、審查、重構、測試、架構效能分析及多端開發驗證。支援自然語言和 @專題標識,按任務讀取包內知識;只問概念時直接回答。

↓ 104.7萬★ -user_814dbe54
程式設計專家 Pro開發程式設計

程式設計專家 Pro:融合程式設計專家 2.0.3 工程專題與程式設計大神的鴻蒙 ArkTS/ArkUI、微信小程式和小遊戲開發資料。用於專案實現、根因除錯、審查、重構、測試、架構效能分析及多端開發驗證。支援自然語言和 @專題標識,按任務讀取包內知識;只問概念時直接回答。

↓ 98.2萬★ 1user_28275a78
程式設計專家.Skill開發程式設計

程式設計專家.Skill P8級程式設計助手,25年實戰經驗技能Skill,全棧:Java/Php網站/軟體專案、API設計、Bug診斷、程式碼生成、程式碼審查、重構、測試用例、效能基準、技術選型、文件生成、任務拆解、Spec驅動、Karpathy規範、CMS二次開發、前端設計、MySQL/Mariadb、專案知識圖譜,以及工程紀律層(根因除錯硬閉環、階段導航、事故復盤/SLO、威脅建模/供應鏈安全、生產就緒/漸進式釋出、AI編碼治理、面向Agent程式碼可讀性、LLM應用安全)。支援 @標識 顯式呼叫跳過路由。

↓ 70.1萬★ 6user_613b33ea
Github開發程式設計

用 gh 命令列工具檢視 GitHub 上的 PR 檢查、工作流執行與 API 查詢的技能。

↓ 48萬★ 714Peter Steinberger

資料月份:2026-10 · 下載/星標數聚合自公開技能註冊庫(ClawHub、SkillHub),按月更新。口徑說明見資料方法。