Auto-monitor and recover OpenClaw Gateway with intelligent rate limiting.
Install health guardian:
bash
bash ~/.openclaw/skills/openclaw-health-guardian/scripts/install.sh
Verify installation:
bash
launchctl list | grep openclaw
FeatureValueDescriptionCheck Interval5 minutesLaunchAgent StartIntervalCooldown180 secondsMinimum between restartsRate Limit5/hourMax restarts per hourHTTP Timeout5 secondscurl --max-timeAuto NotifyTerminal popupAppleScript alert on failure
Install guardian bash
bash ~/.openclaw/skills/openclaw-health-guardian/scripts/install.sh
Verify service running bash
launchctl list | grep com.openclaw.healthcheck
Monitor logs bash
tail -f ~/.openclaw/logs/health-check.log
Test manually (optional) bash
bash ~/.openclaw/scripts/openclaw-health-check.sh
CommandPurposelaunchctl list | grep openclawCheck service statustail -f ~/.openclaw/logs/health-check.logView real-time logsbash ~/.openclaw/scripts/openclaw-health-check.shManual checklaunchctl unload ~/Library/LaunchAgents/com.openclaw.healthcheck.plistStop servicelaunchctl load ~/Library/LaunchAgents/com.openclaw.healthcheck.plistStart service
After installation:
text
~/.openclaw/
├── scripts/
│ └── openclaw-health-check.sh # Main script
├── state/
│ ├── last_restart # Timestamp
│ ├── restart_count # Hourly counter
│ └── hour_marker # Hour tracking
└── logs/
├── health-check.log # Main log
├── health-check-daemon.log # Daemon stdout
└── health-check-daemon-error.log # Daemon stderr
~/Library/LaunchAgents/
└── com.openclaw.healthcheck.plist # LaunchAgent config
Normal:
text
[2026-03-16 10:28:47] No issues found. OpenClaw is healthy!
Cooldown triggered:
text
[2026-03-16 10:30:05] 冷却期内 (120s/180s),跳过重启操作
Rate limit triggered:
text
[2026-03-16 10:30:05] 本小时已达重启上限(5次),跳过
Restart executed:
text
[2026-03-16 10:30:02] 已记录重启事件 (冷却: 180s, 限流: 5/小时)
[2026-03-16 10:30:05] Gateway restart completed successfully
bash
# Stop and remove service
launchctl unload ~/Library/LaunchAgents/com.openclaw.healthcheck.plist
rm ~/Library/LaunchAgents/com.openclaw.healthcheck.plist
# Remove scripts and logs
rm ~/.openclaw/scripts/openclaw-health-check.sh
rm -rf ~/.openclaw/state/
rm ~/.openclaw/logs/health-check*.log
references/technical-details.md - Implementation detailsreferences/troubleshooting.md - Common issues