← 返回 Skills 市场
halfmoon82

Config Modification

作者 halfmoon82 · GitHub ↗ · v2.6.0 · MIT-0
cross-platform ⚠ suspicious
639
总下载
0
收藏
3
当前安装
8
版本数
在 OpenClaw 中安装
/install config-modification
功能描述
Enforces a two-layer guarded process for modifying critical JSON config files with immediate syntax checks and periodic health validation to prevent faulty c...
使用说明 (SKILL.md)

Skill: config-modification v2.5

配置文件修改安全流程(fswatch 联动 + 拦截矩阵 + 四联校验 + 自动回滚)

Powered by halfmoon82


⚠️ Security & Permissions Declaration

This skill performs the following privileged operations — all are intentional and user-initiated:

Operation Purpose Scope
Read/write ~/.openclaw/openclaw.json Validate and protect config changes Local file only
Create backup snapshots Enable rollback on failure ~/.openclaw/backup/ only
Run local Python scripts JSON validation, schema checks, diff No network access
Monitor file system via fswatch/kqueue Detect config changes automatically Watches only OpenClaw config files
Restart OpenClaw Gateway Apply config changes Local service only

What this skill does NOT do:

  • Does NOT send data to external servers
  • Does NOT access credentials or API keys directly
  • Does NOT modify files outside ~/.openclaw/
  • Does NOT run with elevated (sudo/root) privileges

Requires: Python 3.8+, fswatch (macOS/Linux), local OpenClaw installation


🚀 快速开始

# 触发配置修改安全流程
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 \x3Caction> \x3Cconfig_path>

# 执行四联校验
python3 config_modification_v2.py check \x3Cconfig_path>

# 完整修改周期 (推荐)
python3 config_modification_v2.py full-cycle \x3Cconfig_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_fail critical rollback telegram, log
diff_critical high rollback telegram, log
rollback_fail critical alert_only telegram, log, signal
health_fail medium retry_then_rollback log
partial_fail low notify_only log

文件结构

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 所有
═══════════════════════════════════════════════════════════

注意事项

  1. 路径: 所有脚本位于 ~/.openclaw/workspace/skills/config-modification/
  2. 依赖: Python 3.9+, curl, fswatch (macOS) / inotify (Linux)
  3. 快照: 自动保存到 ~/.openclaw/backup/snapshots/
  4. 日志:
    • ~/.openclaw/logs/config-fswatch-guard.log
    • ~/.openclaw/logs/quad-check.log
    • ~/.openclaw/logs/alerts.log

版本: 2.4.0 | 更新: 2026-03-09 | Powered by halfmoon82

安全使用建议
This skill appears to implement a reasonable local config-guard, but take these precautions before installing or enabling it: - Missing helper scripts: The code calls rollback/backup helper scripts at ~/.openclaw/workspace/.lib/config-rollback-guard.py and similar paths, which are not included in the skill bundle. Confirm those scripts exist and inspect them — otherwise rollbacks/backups may fail or behave unexpectedly. - Notifications: The code mentions telegram/signal channels but only writes a local alert_queue.json. Verify how alerts are delivered and where notification credentials would be kept; do not assume tokens are handled safely elsewhere. - Test in staging: The skill will call subprocesses and may restart the OpenClaw gateway. Test the full flow in a non-production environment to ensure the referenced binaries/scripts are present and safe. - Verify restart behavior: The guard attempts to run a local 'openclaw' binary (or a fallback node path). Ensure that path resolution is correct and that automatic restarts are acceptable in your environment. - Ask the author or maintainer for: (1) the missing rollback/backup scripts, (2) documentation of how alerts are delivered and where credentials (if any) reside, and (3) confirmation about fswatch vs kqueue/polling requirements. If you cannot obtain those, treat the skill as risky and avoid enabling automatic/daemon operation.
功能分析
Type: OpenClaw Skill Name: config-modification Version: 2.6.0 The config-modification skill bundle is a comprehensive safety utility designed to protect OpenClaw configuration files from corruption. It implements a 'Quad-Check' system (Schema, Diff, Rollback, Health) and uses a daemon (config-fswatch-guard.py) to monitor file changes via kqueue or polling. While it performs high-privilege actions such as monitoring system files, executing sub-processes to restart services, and setting up persistence via launchctl, these behaviors are explicitly documented in SKILL.md and README.md as necessary for its stated purpose. There is no evidence of data exfiltration, unauthorized remote access, or malicious intent.
能力评估
Purpose & Capability
The skill's name/description (protecting ~/.openclaw JSON configs) aligns with the code: it reads/writes ~/.openclaw, snapshots backups, performs schema/diff/health checks and can restart the local OpenClaw gateway. However, the code repeatedly invokes external helper scripts (e.g., ~/.openclaw/workspace/.lib/config-rollback-guard.py and a backup script) that are not present in the skill manifest. meta.json lists system dependency 'curl' though I saw no use of curl in included files. SKILL.md mentions fswatch but the guard implements kqueue/polling in Python (fswatch binary not actually required). These mismatches (missing referenced scripts and small dependency/implementation differences) are unexplained and should be clarified.
Instruction Scope
Runtime instructions and code are mostly scoped to local config management under ~/.openclaw and do not declare external credential access. The skill will: monitor files, create snapshots under ~/.openclaw/backup, run local Python scripts, and attempt to restart the OpenClaw gateway via a local binary. It uses subprocess.run to call rollback/backup scripts and to restart the gateway; because the rollback/backup scripts are referenced but not included, this could cause failures or unexpected behavior. The SKILL.md asserts 'Does NOT send data to external servers' — the code does reference notification channels (telegram/signal) but only queues alerts to a local alert_queue.json; no outbound HTTP calls were found in the included files. Still, instructions grant broad discretion to run local commands and restart services, so test in a safe environment first.
Install Mechanism
There is no external install spec (no downloads or package installs) and the code is included in the skill bundle, which is lower install risk. No archives or remote URLs are fetched by the skill itself. The main install risk arises from runtime subprocess calls to local rollback/backup scripts (expected to exist elsewhere on disk) and launching a guard daemon — those runtime actions will modify local state but are not caused by a remote installer.
Credentials
The skill declares no required environment variables or credentials, and the included code does not attempt to read external secrets. It logs alerts and may queue messages for 'telegram'/'signal' channels, but authentication tokens for those channels are not requested or present in the code — this is plausible (queueing for a separate delivery agent) but should be documented. Overall, the environment access (only ~/.openclaw and local services) is proportionate to the stated purpose, but the lack of included rollback scripts and the alert queue mechanism raise questions about where credentials (if needed for notifications) are stored and how alerts are delivered.
Persistence & Privilege
The skill does not request 'always: true' and is user-invocable; it intends to run a long-lived guard process (config-fswatch-guard.py) but that is normal for a filesystem-monitoring tool and requires explicit startup by the user. It does not request elevated privileges in code (no sudo calls). Autonomous invocation is allowed (default) — combined with the ability to restart the gateway this widens impact if enabled by an agent, so run with care.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install config-modification
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /config-modification 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v2.6.0
config-modification v2.6.0 - Added SECURITY & Permissions Declaration section to documentation for greater transparency. - Added NOTICE.md for legal and compliance information. - Added README_CN.md for Chinese-language documentation support. - Updated SKILL.md with new security practices and skill boundaries. - Minor code and documentation adjustments to reflect new compliance and security standards.
v2.5.0
**v2.5.0 introduces automatic file monitoring and workflow enhancements.** - Added fswatch-based automatic daemon (config-fswatch-guard.py) for real-time config file change detection and triggering of safety checks. - Updated documentation and architecture: new fswatch guard integration, revised health check endpoint, and stronger "Powered by halfmoon82" branding. - Expanded and reorganized file structure to include new guard script and fswatch integration docs. - Minor updates to existing core files for compatibility with automatic monitoring workflow.
v2.3.2
修复 verify() 验证逻辑缺陷:原 404 算通过不触发回滚;新增 Gateway 进程检查 + gateway.log 错误扫描(model not allowed),检测到无效模型配置时强制回滚
v2.3.1
- Updated version to 2.3.1. - Minor adjustments to configuration and documentation files (clawhub.yaml, config_modification_v2.py). - No breaking changes or architecture modifications.
v2.3.0
**config-modification v2.3.0 — Major upgrade: New intercept matrix, quad-check, and auto-rollback system.** - Introduced a comprehensive intercept matrix for risk-based config change assessment. - Added four-level validation (“quad-check”): Schema, Diff, Rollback, Health. - Implemented automated rollback and alerting on critical failures. - Unified all logic into new Python modules: intercept_matrix.py, quad_check.py, auto_rollback.py, config_modification_v2.py. - Expanded support to `agents/*/models.json`, `agents/*/config.json`, and stricter path checks. - Streamlined CLI for intercept, check, rollback, and full-cycle operations.
v2.2.0
**Major safety and process upgrades — stricter validation, schema checks, and restart rules for all config modifications.** - Expanded required workflow to 8 steps, introducing “Step 0” schema and documentation checks before any change. - Added mandatory field schema validation (禁止猜命令/猜配置; 强制查文档+schema 合法性) before editing configs. - Introduced dual post-edit validation: JSON syntax check and `openclaw doctor` health check both required. - Enforced only safe gateway restart methods (`openclaw gateway restart`); explicitly forbid dangerous actions like kill+start or stop+start quick succession. - Updated key constraints: waiting for user confirmation before every action is now strictly required, and schema-guessing is banned. - Documented all new constraints and safety procedures in the full process and “铁律” rules.
v2.1.0
## config-modification v2.1.0 - 增加新一条铁律:与 Observability/Schema 能力严格隔离,仅允许只读和建议,禁止配置写操作。 - 明确禁止观测类能力执行 config.apply、config.patch、gateway.config.* 及所有 .json 写入。 - 更新应急手册与约束细则,强化配置安全操作边界。 - 其余双层守护与回滚机制流程无改动。
v2.0.0
Version 2.0.0 - Introduced a dual-guard safety process for config modifications: instant interception with fswatch and periodic health monitoring via cron. - Enforced a 6-step mandatory workflow for all config changes, covering authorization, backup, syntax validation, health checks, and automated rollback. - Added clear division of responsibility: fswatch for immediate syntax issues; cron for runtime/semantic errors. - Documented key scripts, emergency manual recovery instructions, and iron-clad process constraints. - Included a test record showing effectiveness of dual guard system.
元数据
Slug config-modification
版本 2.6.0
许可证 MIT-0
累计安装 4
当前安装数 3
历史版本数 8
常见问题

Config Modification 是什么?

Enforces a two-layer guarded process for modifying critical JSON config files with immediate syntax checks and periodic health validation to prevent faulty c... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 639 次。

如何安装 Config Modification?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install config-modification」即可一键安装,无需额外配置。

Config Modification 是免费的吗?

是的,Config Modification 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Config Modification 支持哪些平台?

Config Modification 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Config Modification?

由 halfmoon82(@halfmoon82)开发并维护,当前版本 v2.6.0。

💬 留言讨论