Self-Healing Agent
/install self-healing-agent
Self-Healing Agent
Automated failure detection, diagnosis, and recovery for OpenClaw agents. The watchdog that keeps your agent running.
Quick Start
# Full health check — scan all systems, diagnose issues, suggest fixes
python3 scripts/self-healing-agent.py check
# Auto-heal — detect and fix what it can automatically
python3 scripts/self-healing-agent.py heal
# Monitor mode — run continuously, fix issues as they appear
python3 scripts/self-healing-agent.py monitor --interval 300
# Check specific subsystem
python3 scripts/self-healing-agent.py check --target cron
python3 scripts/self-healing-agent.py check --target memory
python3 scripts/self-healing-agent.py check --target config
python3 scripts/self-healing-agent.py check --target sessions
Commands
check — Health Check
Runs diagnostic suite:
- Cron health — Failed jobs, consecutive errors, stuck jobs, timeout patterns
- Memory health — File sizes, bloated sessions, orphaned files, growth rate
- Config health — Valid JSON, required fields present, deprecated settings
- Session health — Active sessions, zombie processes, memory usage
- Skill health — Broken scripts, missing dependencies, syntax errors
- Network health — API endpoint reachability, DNS resolution, SSL cert validity
Options: --target \x3Csubsystem> to check one area, --json for machine output.
heal — Auto-Repair
For each detected issue, applies the safest fix:
- Restarts failed cron jobs (after diagnosing root cause)
- Clears bloated session files (with backup)
- Fixes JSON syntax errors in config (common trailing comma, etc.)
- Removes orphaned process files
- Restores corrupted memory files from git history
- Rotates oversized log files
Options: --dry-run to preview, --aggressive for riskier fixes.
monitor — Continuous Watchdog
Runs in a loop, checking health every N seconds:
- Logs findings to
memory/self-healing-log.json - Auto-heals fixable issues
- Escalates unfixable issues to the agent's main session
- Tracks MTTR (mean time to recovery) and failure patterns
Options: --interval \x3Cseconds> (default: 300), --max-heals \x3Cn> per cycle.
report — Health Report
Generates a markdown health report covering:
- Last 24h failure count and types
- MTTR statistics
- Most common failure modes
- Recommendations for prevention
What It Monitors
| Subsystem | Checks | Auto-Heals |
|---|---|---|
| Cron | Failed runs, timeouts, consecutive errors | Restart jobs, clear error state |
| Memory | File sizes >1MB, growth rate, duplicates | Archive old files, compact |
| Config | JSON validity, required fields, deprecated keys | Fix syntax, add defaults |
| Sessions | Zombie processes, bloated contexts | Kill zombies, archive contexts |
| Skills | Syntax errors, missing deps, broken imports | Log issue, skip broken skill |
| Network | API endpoints, DNS, SSL certs | Retry with backoff, switch endpoints |
Healing Log
All actions are logged to memory/self-healing-log.json:
{
"timestamp": "2026-04-05T06:00:00Z",
"issue": "cron job 'daily-intel' failed 3 consecutive times",
"diagnosis": "Script timeout — API rate limit hit",
"action": "Reset error count, added 30s backoff, restarted",
"result": "success",
"mttr_seconds": 12
}
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install self-healing-agent - 安装完成后,直接呼叫该 Skill 的名称或使用
/self-healing-agent触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
Self-Healing Agent 是什么?
Self-recovery and auto-repair system for OpenClaw agents. Monitors agent health, detects failures (crashed cron jobs, broken skills, config corruption, memor... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 251 次。
如何安装 Self-Healing Agent?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install self-healing-agent」即可一键安装,无需额外配置。
Self-Healing Agent 是免费的吗?
是的,Self-Healing Agent 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Self-Healing Agent 支持哪些平台?
Self-Healing Agent 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Self-Healing Agent?
由 stevojarvisai-star(@stevojarvisai-star)开发并维护,当前版本 v1.0.0。