← 返回
未分类 中文

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...
OpenClaw代理的自恢复与自动修复系统。监控代理健康,检测故障(崩溃的定时任务、损坏的技能、配置损坏、内存问题等)。
stevojarvisai-star stevojarvisai-star 来源
未分类 clawhub v1.0.0 1 版本 99854.9 Key: 无需
★ 0
Stars
📥 688
下载
💾 2
安装
1
版本
#latest

概述

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 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 (default: 300), --max-heals 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

SubsystemChecksAuto-Heals
-------------------------------
CronFailed runs, timeouts, consecutive errorsRestart jobs, clear error state
MemoryFile sizes >1MB, growth rate, duplicatesArchive old files, compact
ConfigJSON validity, required fields, deprecated keysFix syntax, add defaults
SessionsZombie processes, bloated contextsKill zombies, archive contexts
SkillsSyntax errors, missing deps, broken importsLog issue, skip broken skill
NetworkAPI endpoints, DNS, SSL certsRetry 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
}

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-03 04:36 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

Phoenix Scraper

stevojarvisai-star
弹性的多层网页抓取工具,具备自动故障转移功能。适用于抓取可能由JavaScript渲染、受机器人防护或被防爬阻止的网页内容。
★ 0 📥 394

Memory Onboarding Wizard

stevojarvisai-star
一条命令启动新的OpenClaw代理记忆系统,通过3个快速问题设置MEMORY.md、日常记忆文件、HEARTBEAT.md和USER.md。
★ 0 📥 426

Agent Trading Bot

stevojarvisai-star
AI驱动的交易机器人框架OpenClaw,连接加密货币交易所(Binance、Hyperliquid、Bluefin)和预测市场(Polymarket、Kalshi),通过API实现对接。
★ 0 📥 516