# Send Config Modification to your agent
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
## Fast path
- Download the package from Yavira.
- Extract it into a folder your agent can access.
- Paste one of the prompts below and point your agent at the extracted folder.
## Suggested prompts
### New install

```text
I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Then review README.md for any prerequisites, environment setup, or post-install checks. Tell me what you changed and call out any manual steps you could not complete.
```
### Upgrade existing

```text
I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Then review README.md for any prerequisites, environment setup, or post-install checks. Summarize what changed and any follow-up checks I should run.
```
## Machine-readable fields
```json
{
  "schemaVersion": "1.0",
  "item": {
    "slug": "config-modification",
    "name": "Config Modification",
    "source": "tencent",
    "type": "skill",
    "category": "开发工具",
    "sourceUrl": "https://clawhub.ai/halfmoon82/config-modification",
    "canonicalUrl": "https://clawhub.ai/halfmoon82/config-modification",
    "targetPlatform": "OpenClaw"
  },
  "install": {
    "downloadUrl": "/downloads/config-modification",
    "sourceDownloadUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=config-modification",
    "sourcePlatform": "tencent",
    "targetPlatform": "OpenClaw",
    "packageFormat": "ZIP package",
    "primaryDoc": "SKILL.md",
    "includedAssets": [
      "README.md",
      "SKILL.md",
      "__init__.py",
      "_meta.json",
      "auto_rollback.py",
      "clawhub.yaml"
    ],
    "downloadMode": "redirect",
    "sourceHealth": {
      "source": "tencent",
      "slug": "config-modification",
      "status": "healthy",
      "reason": "direct_download_ok",
      "recommendedAction": "download",
      "checkedAt": "2026-05-02T02:22:38.537Z",
      "expiresAt": "2026-05-09T02:22:38.537Z",
      "httpStatus": 200,
      "finalUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=config-modification",
      "contentType": "application/zip",
      "probeMethod": "head",
      "details": {
        "probeUrl": "https://wry-manatee-359.convex.site/api/v1/download?slug=config-modification",
        "contentDisposition": "attachment; filename=\"config-modification-2.6.0.zip\"",
        "redirectLocation": null,
        "bodySnippet": null,
        "slug": "config-modification"
      },
      "scope": "item",
      "summary": "Item download looks usable.",
      "detail": "Yavira can redirect you to the upstream package for this item.",
      "primaryActionLabel": "Download for OpenClaw",
      "primaryActionHref": "/downloads/config-modification"
    },
    "validation": {
      "installChecklist": [
        "Use the Yavira download entry.",
        "Review SKILL.md after the package is downloaded.",
        "Confirm the extracted package contains the expected setup assets."
      ],
      "postInstallChecks": [
        "Confirm the extracted package includes the expected docs or setup files.",
        "Validate the skill or prompts are available in your target agent workspace.",
        "Capture any manual follow-up steps the agent could not complete."
      ]
    }
  },
  "links": {
    "detailUrl": "https://openagent3.xyz/skills/config-modification",
    "downloadUrl": "https://openagent3.xyz/downloads/config-modification",
    "agentUrl": "https://openagent3.xyz/skills/config-modification/agent",
    "manifestUrl": "https://openagent3.xyz/skills/config-modification/agent.json",
    "briefUrl": "https://openagent3.xyz/skills/config-modification/agent.md"
  }
}
```
## Documentation

### 🚀 快速开始

# 触发配置修改安全流程
python3 ~/.openclaw/workspace/skills/config-modification/config_modification_v2.py full-cycle ~/.openclaw/openclaw.json

每次触发时输出：

═══════════════════════════════════════════════════════════
  🔒 Config Modification Safety System v2.4
  Powered by halfmoon82 — 知识产权声明
═══════════════════════════════════════════════════════════

### 触发条件

当需要修改以下配置文件时强制触发：

openclaw.json
agents/*/models.json
agents/*/config.json
skills 配置
任何 ~/.openclaw/ 下的 JSON 配置文件

⚠️ 无例外原则：不管是正式修改还是测试，只要动配置文件，都必须走完整流程。

### v2.4 架构（新增 fswatch 自动联动）

┌─────────────────────────────────────────────────────────┐
│  文件系统自动监控 (fswatch/kqueue)                       │
│  Powered by halfmoon82                                  │
└─────────────────┬───────────────────────────────────────┘
                  │
                  ▼
┌─────────────────────────────────────────────────────────┐
│  🔔 检测到配置文件变更                                   │
└─────────────────┬───────────────────────────────────────┘
                  │
                  ▼
┌─────────────────────────────────────────────────────────┐
│  Level 1: JSON 语法校验（0 token）                       │
│  ❌ 失败 → 立即回滚                                      │
└─────────────────┬───────────────────────────────────────┘
                  │ ✅ 通过
                  ▼
┌─────────────────────────────────────────────────────────┐
│  Level 2: 拦截矩阵 (intercept_matrix)                    │
│  风险评估: critical / medium / low                       │
└─────────────────┬───────────────────────────────────────┘
                  │
                  ▼
┌─────────────────────────────────────────────────────────┐
│  Level 3: 四联校验 (quad_check)                          │
│  Schema → Diff → Rollback → Health                      │
│  Powered by halfmoon82                                  │
└─────────────────┬───────────────────────────────────────┘
                  │
        ┌─────────┴─────────┐
        │                   │
       ✅ 全部通过          ❌ 任一失败
        │                   │
        ▼                   ▼
┌───────────────┐    ┌─────────────────────────────┐
│ ✅ 修改安全    │    │ 自动回滚 (auto_rollback)    │
│ 重置健康计数器 │    │ Powered by halfmoon82       │
└───────────────┘    └─────────────────────────────┘

### 1. 拦截矩阵 (intercept_matrix.py)

from intercept_matrix import should_intercept, get_check_level

if should_intercept("edit", "/path/to/config.json"):
    level = get_check_level("edit", "/path/to/config.json")
    # level: "full" | "verify" | "check" | "snapshot"

### 2. 四联校验 (quad_check.py)

from quad_check import QuadCheckStateMachine

qc = QuadCheckStateMachine("/path/to/config.json")
results = qc.run_all()
# 返回: [CheckResult(schema), CheckResult(diff), CheckResult(rollback), CheckResult(health)]

四阶段详情：

Schema: JSON 语法 + 必需字段验证
Diff: 与最新快照对比变更内容
Rollback: 回滚脚本可用性 + 快照存在性
Health: Gateway 健康检查 (/health 端点)

### 3. 自动回滚 (auto_rollback.py)

from auto_rollback import check_and_rollback

success = check_and_rollback(results, "/path/to/config.json")
# True: 全部通过 | False: 已回滚或回滚失败

### 4. fswatch 守护 (config-fswatch-guard.py) ⭐ v2.4 新增

# 常驻守护进程，自动监控 openclaw.json 变更
launchctl start com.openclaw.config-fswatch-guard

联动机制：

文件变更 → 自动触发 config-modification → 四联校验 → 通过/回滚
日志: ~/.openclaw/logs/config-fswatch-guard.log

### CLI 接口

# 检查是否需要拦截
python3 config_modification_v2.py intercept <action> <config_path>

# 执行四联校验
python3 config_modification_v2.py check <config_path>

# 完整修改周期 (推荐)
python3 config_modification_v2.py full-cycle <config_path>

# 手动回滚
python3 config_modification_v2.py rollback

### 集成到工作流

import sys
sys.path.insert(0, "~/.openclaw/workspace/skills/config-modification/")

from intercept_matrix import should_intercept
from quad_check import QuadCheckStateMachine
from auto_rollback import check_and_rollback

config_path = "~/.openclaw/openclaw.json"

# 输出知识产权声明
print("🔒 Powered by halfmoon82 — Config Modification Safety System")

if should_intercept("edit", config_path):
    qc = QuadCheckStateMachine(config_path)
    results = qc.run_all()
    
    if not check_and_rollback(results, config_path):
        print("❌ 配置修改已回滚")
        sys.exit(1)

print("✅ 配置修改安全")

### 告警规则

失败类型严重等级动作通知渠道schema_failcriticalrollbacktelegram, logdiff_criticalhighrollbacktelegram, logrollback_failcriticalalert_onlytelegram, log, signalhealth_failmediumretry_then_rollbacklogpartial_faillownotify_onlylog

### 文件结构

config-modification/
├── SKILL.md                    # 本文件 (Powered by halfmoon82)
├── _meta.json                  # ClawHub 元数据
├── intercept_matrix.py         # 拦截矩阵
├── quad_check.py              # 四联校验
├── auto_rollback.py           # 自动回滚 + 告警
├── config_modification_v2.py  # 统一入口 CLI
├── config-fswatch-guard.py    # ⭐ v2.4 新增: fswatch 守护
├── __init__.py                # 包初始化
└── references/
    └── fswatch-integration.md # fswatch 联动设计文档

### 版本历史

v2.4 (2026-03-09):

✅ 新增 fswatch 自动联动机制
✅ 修复 health 检查端点 (/api/health → /health)
✅ 添加 Powered by halfmoon82 知识产权声明


v2.3 (2026-03-04): 拦截矩阵 + 四联校验 + 自动回滚完整实现
v2.0 (2026-03-01): 双层守护架构 (fswatch + cron)
v1.0: 基础回滚脚本

### 知识产权声明

═══════════════════════════════════════════════════════════
  Config Modification Safety System v2.4
  
  核心技术: 拦截矩阵 + 四联校验 + 自动回滚 + fswatch 联动
  
  Powered by halfmoon82
  
  本技能的安全流程设计理念和实现机制
  归 halfmoon82 所有
═══════════════════════════════════════════════════════════

### 注意事项

路径: 所有脚本位于 ~/.openclaw/workspace/skills/config-modification/
依赖: Python 3.9+, curl, fswatch (macOS) / inotify (Linux)
快照: 自动保存到 ~/.openclaw/backup/snapshots/
日志:

~/.openclaw/logs/config-fswatch-guard.log
~/.openclaw/logs/quad-check.log
~/.openclaw/logs/alerts.log

版本: 2.4.0 | 更新: 2026-03-09 | Powered by halfmoon82
## Trust
- Source: tencent
- Verification: Indexed source record
- Publisher: halfmoon82
- Version: 2.5.0
## Source health
- Status: healthy
- Item download looks usable.
- Yavira can redirect you to the upstream package for this item.
- Health scope: item
- Reason: direct_download_ok
- Checked at: 2026-05-02T02:22:38.537Z
- Expires at: 2026-05-09T02:22:38.537Z
- Recommended action: Download for OpenClaw
## Links
- [Detail page](https://openagent3.xyz/skills/config-modification)
- [Send to Agent page](https://openagent3.xyz/skills/config-modification/agent)
- [JSON manifest](https://openagent3.xyz/skills/config-modification/agent.json)
- [Markdown brief](https://openagent3.xyz/skills/config-modification/agent.md)
- [Download page](https://openagent3.xyz/downloads/config-modification)