by LeoYeAI
π‘οΈ Guardian watchdog for OpenClaw Gateway β auto-monitor, self-repair via doctor --fix, git-based rollback, daily snapshots, and Discord alerts. Powered by MyClaw.ai
# Add to your Claude Code skills
git clone https://github.com/LeoYeAI/openclaw-guardianA standalone watchdog that keeps your OpenClaw Gateway alive 24/7. Built from MyClaw.ai's production infrastructure and open-sourced for the community.
Powered by MyClaw.ai β https://myclaw.ai
GUARDIAN_CHECK_INTERVAL, default: 30)openclaw doctor --fix up to 3 times (GUARDIAN_MAX_REPAIR, default: 3)git reset --hard to last stable commit, restart Gatewaygit commit snapshot of workspaceDISCORD_WEBHOOK_URL)All optional β defaults work out of the box:
| Variable | Default | Description |
|---|---|---|
| GUARDIAN_WORKSPACE | $HOME/.openclaw/workspace | Workspace path (must be a git repo) |
| GUARDIAN_LOG | /tmp/openclaw-guardian.log | Log file path |
| GUARDIAN_CHECK_INTERVAL | 30 | Health check interval (seconds) |
| GUARDIAN_MAX_REPAIR | 3 | Max doctor --fix attempts before rollback |
| GUARDIAN_COOLDOWN | 300 | Cooldown period after all repairs fail (seconds) |
| OPENCLAW_CMD | openclaw | OpenClaw CLI command |
| DISCORD_WEBHOOK_URL | (unset) | Discord webhook URL for alerts (optional) |
git β for workspace rollback and daily snapshotsLanguages: English Β· δΈζ Β· FranΓ§ais Β· Deutsch Β· Π ΡΡΡΠΊΠΈΠΉ Β· ζ₯ζ¬θͺ Β· Italiano Β· EspaΓ±ol
</div>MyClaw.ai is an AI personal assistant platform that gives every user a fully-featured AI agent running on a dedicated server β with complete code control, internet access, and tool integrations. Think of it as your own private AI that can actually do things, not just answer questions.
OpenClaw Guardian is an open-source project born from MyClaw.ai's production infrastructure. We run thousands of AI agent instances 24/7, and Guardian is the hardening layer that keeps them alive. We're open-sourcing it so everyone can benefit.
π Try MyClaw.ai: https://myclaw.ai
openclaw doctor --fix on failure (up to 3 attempts)git commit of your workspaceNo comments yet. Be the first to share your thoughts!
pgrep / pkill β for process detectioncurl β for Discord webhook alerts (only if DISCORD_WEBHOOK_URL is set)openclaw β the OpenClaw CLITell your OpenClaw agent:
"Help me install openclaw-guardian to harden my gateway"
Or manually:
# 1. Init git in workspace (required for rollback)
cd ~/.openclaw/workspace
git init && git add -A && git commit -m "initial"
# 2. Install
cp scripts/guardian.sh ~/.openclaw/guardian.sh
chmod +x ~/.openclaw/guardian.sh
# 3. Start
nohup ~/.openclaw/guardian.sh >> /tmp/openclaw-guardian.log 2>&1 &
Note: Use repository-level git config, not --global:
git -C ~/.openclaw/workspace config user.email "guardian@example.com"
git -C ~/.openclaw/workspace config user.name "Guardian"
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 &
Full docs: https://github.com/LeoYeAI/openclaw-guardian
Gateway down detected
β
βΌ
doctor --fix βββ success? βββ β
Done
(up to 3x)
β all failed
βΌ
git rollback βββ success? βββ β
Done
β failed
βΌ
cooldown 300s β resume monitoring
Already using OpenClaw? Just tell your AI agent:
"Help me install openclaw-guardian to harden my gateway"
Your agent will handle everything automatically β git init, script install, and auto-start. No terminal needed.
# 1. Initialize git in workspace
cd ~/.openclaw/workspace
git init && git add -A && git commit -m "initial"
# 2. Install
cp scripts/guardian.sh ~/.openclaw/guardian.sh
chmod +x ~/.openclaw/guardian.sh
# 3. Start
nohup ~/.openclaw/guardian.sh >> /tmp/openclaw-guardian.log 2>&1 &
| Variable | Default | Description |
|---|---|---|
| GUARDIAN_WORKSPACE | $HOME/.openclaw/workspace | Workspace git repo path |
| GUARDIAN_CHECK_INTERVAL | 30 | Health check interval (seconds) |
| GUARDIAN_MAX_REPAIR | 3 | Max repair attempts before rollback |
| GUARDIAN_COOLDOWN | 300 | Cooldown after all repairs fail (seconds) |
| DISCORD_WEBHOOK_URL | (unset) | Discord webhook for alerts (optional) |
| | gw-watchdog | Guardian | |---|---|---| | Check interval | 15s | 30s | | Action | Fast restart | doctor --fix β rollback | | Git rollback | β | β | | Discord alerts | β | β | | Daily backup |...