Install
openclaw skills install system-guardian金刚罩 — OpenClaw 系统守护:配置安全(pre-validate + 自动备份 + 失败回滚)、健康巡检、资源优化、故障自愈。刀枪不入,百毒不侵。
openclaw skills install system-guardian让 OpenClaw 更强壮、更高效、不容易崩溃。
永远不要直接跑 openclaw gateway restart,使用:
bash ~/.openclaw/skills/system-guardian/scripts/safe-restart.sh
流程:
校验配置 → 自动备份(3件套) → 重启 Gateway → 健康检查 → 失败则自动回滚
详细步骤:
openclaw config validate — 配置语法和字段校验~/.openclaw/backups/:
openclaw.json.<timestamp>.bak — 主配置env.<timestamp>.bak — 环境变量ai.openclaw.gateway.plist.<timestamp>.bak — macOS 开机自启配置openclaw gateway restartopenclaw gateway status修改 openclaw.json 前调用:
bash ~/.openclaw/skills/system-guardian/scripts/config-guard.sh check
检查项目:
${VAR} 引用 .env)或 inline(密钥直接写在 openclaw.json 中),两种都支持bash ~/.openclaw/skills/system-guardian/scripts/health-patrol.sh
检查项目(13 项):
根据当前系统状态给出优化建议:
当需要修改配置或重启 Gateway 时,按以下流程操作:
1. 修改 openclaw.json
2. 运行 config-guard.sh check 验证
3. 如果验证通过 → 运行 safe-restart.sh
4. 如果验证失败 → 修复问题后重试
铁律:任何配置变更必须经过 safe-restart.sh,禁止直接 openclaw gateway restart
{
"name": "system-health-patrol",
"description": "每日凌晨 4:00 系统健康巡检 + 资源清理",
"schedule": { "kind": "cron", "expr": "0 4 * * *", "tz": "Asia/Shanghai" },
"sessionTarget": "isolated",
"delivery": { "mode": "none" },
"payload": {
"kind": "agentTurn",
"model": "anthropic/claude-sonnet-4-6",
"timeoutSeconds": 120,
"message": "运行系统健康巡检:bash ~/.openclaw/skills/system-guardian/scripts/health-patrol.sh\n读取输出并总结巡检结果。如果发现 CRITICAL 或 WARNING,输出问题说明和建议处理方式。如果全部 OK,输出:系统健康 ✅ 无异常。"
}
}
巡检产生的数据存储在 ~/.openclaw/data/system-guardian/:
baseline.csv — 性能基线时序数据(Gateway 内存、磁盘、Session 数等)config-audit.log — 配置变更审计日志(时间 + hash + diff).config-hash / .config-snapshot.json — 用于变更检测