config-guardian
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseConfig Guardian
配置守护程序
Overview
概述
Use this workflow whenever editing or running . It prevents invalid config, creates backups, validates against schema, and enables rollback.
~/.openclaw/openclaw.jsonopenclaw config set/apply每当编辑或执行命令时,均可使用此工作流。它能防止无效配置、创建备份、基于Schema验证配置,并支持回滚操作。
~/.openclaw/openclaw.jsonopenclaw config set/applyWorkflow (use every time)
工作流(每次修改都需遵循)
-
Preflight
- Confirm the requested change and scope.
- Check for sensitive keys (tokens, credentials).
-
Backup
- Run to create a timestamped snapshot.
scripts/backup_config.sh
- Run
-
Validate (before change)
- Run .
scripts/validate_config.sh - If validation fails, stop and report.
- Run
-
Apply change
- Prefer for small changes.
openclaw config set <path> <value> - For complex edits, edit the file directly and keep diffs minimal.
- Prefer
-
Validate (after change)
- Run again.
scripts/validate_config.sh - If it fails, restore from backup with .
scripts/restore_config.sh
- Run
-
Restart (only with explicit approval)
- If change requires restart, ask for approval first.
- Use .
openclaw gateway restart
-
预检
- 确认所需修改内容及范围。
- 检查是否包含敏感密钥(令牌、凭证)。
-
备份
- 执行脚本创建带时间戳的快照。
scripts/backup_config.sh
- 执行
-
验证(修改前)
- 执行脚本。
scripts/validate_config.sh - 若验证失败,立即停止操作并上报问题。
- 执行
-
应用修改
- 对于小范围修改,优先使用命令。
openclaw config set <path> <value> - 对于复杂编辑,可直接修改配置文件,并尽量减少差异。
- 对于小范围修改,优先使用
-
验证(修改后)
- 再次执行脚本。
scripts/validate_config.sh - 若验证失败,使用脚本从备份恢复配置。
scripts/restore_config.sh
- 再次执行
-
重启(仅在获得明确批准后执行)
- 若修改需要重启,需先获得用户批准。
- 使用命令执行重启。
openclaw gateway restart
Guardrails
防护规则
- Never restart or apply config without explicit user approval.
- Never remove keys or reorder blocks unless requested.
- Always keep a backup before edits.
- If unsure about schema: run and stop on errors.
openclaw doctor --non-interactive
- 禁止在未获得用户明确批准的情况下重启或应用配置。
- 禁止在未收到请求的情况下删除密钥或调整配置块顺序。
- 必须在编辑前创建备份。
- 若对Schema有疑问:执行命令,遇到错误立即停止操作。
openclaw doctor --non-interactive
Scripts
脚本说明
- — create timestamped backup
scripts/backup_config.sh - — validate config via OpenClaw doctor
scripts/validate_config.sh - — diff current config vs backup
scripts/diff_config.sh - — restore backup
scripts/restore_config.sh
- — 创建带时间戳的配置备份
scripts/backup_config.sh - — 通过OpenClaw doctor验证配置
scripts/validate_config.sh - — 对比当前配置与备份的差异
scripts/diff_config.sh - — 从备份恢复配置
scripts/restore_config.sh
Validation
验证说明
- Use for schema validation
openclaw doctor --non-interactive - This checks against the actual schema that the gateway uses
- Warns about unknown keys, invalid types, and security issues
- 使用命令进行Schema验证
openclaw doctor --non-interactive - 该命令会基于网关实际使用的Schema进行检查
- 会针对未知密钥、无效类型及安全问题发出警告