openclaw-guardian
OpenClaw Guardian
Guardian is a standalone bash watchdog that keeps OpenClaw Gateway alive 24/7.
Repair ladder:
- Detect Gateway down (every 30s)
- Run
openclaw doctor --fix(up to 3 attempts) - If still down →
git reset --hardto last stable commit, restart Gateway - If all fails → cooldown 300s, resume monitoring
- Daily automatic git snapshot of workspace
Setup Steps
1. Initialize git (required for rollback)
cd ~/.openclaw/workspace
git config --global user.email "guardian@example.com"
git config --global user.name "Guardian"
git init && git add -A && git commit -m "initial"
Skip if repo already exists. Without git, doctor --fix still works; rollback is skipped.
2. Install guardian.sh
Copy scripts/guardian.sh from this skill to ~/.openclaw/guardian.sh:
cp scripts/guardian.sh ~/.openclaw/guardian.sh
chmod +x ~/.openclaw/guardian.sh
3. Start Guardian
Container / no systemd (nohup):
nohup ~/.openclaw/guardian.sh >> /tmp/openclaw-guardian.log 2>&1 &
Linux VPS with systemd: See references/setup.md → Pattern B.
4. Auto-start on container restart
Add to ~/.openclaw/start-gateway.sh (before the final exec line):
pkill -f "guardian.sh" 2>/dev/null || true
nohup /home/ubuntu/.openclaw/guardian.sh >> /tmp/openclaw-guardian.log 2>&1 &
5. Optional: Discord alerts
export DISCORD_WEBHOOK_URL="https://discord.com/api/webhooks/..."
Or add to start-gateway.sh as a persistent export.
Verify
pgrep -a -f "guardian.sh" # confirm process running
tail -f /tmp/openclaw-guardian.log # watch live logs
Configuration
All settings via environment variables. Defaults work out of the box.
See references/setup.md for full variable reference, systemd config, and architecture diagram.
Notes
- Guardian coexists with
gw-watchdog.sh— run both for layered resilience - Rollback targets the 2nd-newest non-auto commit (skips daily-backup, rollback, auto-backup commits)
- Log path:
/tmp/openclaw-guardian.log
More from leoyeai/openclaw-master-skills
readgzh
ReadGZH — Let AI read full-text WeChat Official Account articles. Supports standard articles and image-post formats.
4tushare-finance
获取中国金融市场数据(A股、港股、美股、基金、期货、债券)。支持220+个Tushare Pro接口:股票行情、财务报表、宏观经济指标。当用户请求股价数据、财务分析、指数行情、GDP/CPI等宏观数据时使用。
3find-skills
Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.
2firecrawl
|
1system-time
Get accurate system time in various formats and timezones. Use when the user needs to know the current time, date, timestamp, or wants to convert between timezones. Supports ISO 8601, Unix timestamp, human-readable formats, and timezone conversions.
1humanizer
>
1