Deploy and manage a Guardian watchdog for OpenClaw Gateway. Auto-monitor every 30s, self-repair via doctor --fix, git-based workspace rollback, daily snapshots, and optional Discord alerts. Built by MyClaw.ai (https://myclaw.ai) — the AI personal assistant platform running thousands of agents 24/7.
$npx -y skills add leoyeai/openclaw-guardian --skill openclaw-guardianInstalls into the current project.
Run `npx skills use "https://github.com/leoyeai/openclaw-guardian" --skill "leoyeai/openclaw-guardian"` and follow the generated skill instructions now. Read its complete output, redirecting it to a temporary file first if necessary. Resolve relative paths from the supporting-files directory it provides.
Use the skills in "https://github.com/leoyeai/openclaw-guardian" that are relevant to the current task. Run `npx skills add "https://github.com/leoyeai/openclaw-guardian"` and select the relevant skills, then follow their instructions.
| 1 | # 🛡️ OpenClaw Guardian |
| 2 | |
| 3 | <div align="center"> |
| 4 | |
| 5 | <a href="https://myclaw.ai"> |
| 6 | <img src="https://img.shields.io/badge/Powered%20by-MyClaw.ai-blue?style=for-the-badge" alt="Powered by MyClaw.ai" /> |
| 7 | </a> |
| 8 | |
| 9 | **Languages:** |
| 10 | [English](README.md) · [中文](README.zh-CN.md) · [Français](README.fr.md) · [Deutsch](README.de.md) · [Русский](README.ru.md) · [日本語](README.ja.md) · [Italiano](README.it.md) · [Español](README.es.md) |
| 11 | |
| 12 | </div> |
| 13 | |
| 14 | --- |
| 15 | |
| 16 | ## 🤖 Powered by [MyClaw.ai](https://myclaw.ai) |
| 17 | |
| 18 | **[MyClaw.ai](https://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. |
| 19 | |
| 20 | 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. |
| 21 | |
| 22 | > 🌐 **Try MyClaw.ai**: [https://myclaw.ai](https://myclaw.ai) |
| 23 | |
| 24 | --- |
| 25 | |
| 26 | ## Features |
| 27 | |
| 28 | - **Auto-monitor** — checks Gateway health every 30 seconds |
| 29 | - **Auto-repair** — runs `openclaw doctor --fix` on failure (up to 3 attempts) |
| 30 | - **Auto-rollback** — resets workspace to last stable git commit if repair fails |
| 31 | - **Daily snapshots** — automatic daily `git commit` of your workspace |
| 32 | - **Discord alerts** — optional webhook notifications on failures and recovery |
| 33 | |
| 34 | ## How It Works |
| 35 | |
| 36 | ``` |
| 37 | Gateway down detected |
| 38 | │ |
| 39 | ▼ |
| 40 | doctor --fix ──→ success? ──→ ✅ Done |
| 41 | (up to 3x) |
| 42 | │ all failed |
| 43 | ▼ |
| 44 | git rollback ──→ success? ──→ ✅ Done |
| 45 | │ failed |
| 46 | ▼ |
| 47 | cooldown 300s → resume monitoring |
| 48 | ``` |
| 49 | |
| 50 | ## ⚡ One-Line Deploy (OpenClaw Users) |
| 51 | |
| 52 | Already using OpenClaw? Just tell your AI agent: |
| 53 | |
| 54 | > **"Help me install openclaw-guardian to harden my gateway"** |
| 55 | |
| 56 | Your agent will handle everything automatically — git init, script install, and auto-start. No terminal needed. |
| 57 | |
| 58 | --- |
| 59 | |
| 60 | ## Quick Start |
| 61 | |
| 62 | ```bash |
| 63 | # 1. Initialize git in workspace |
| 64 | cd ~/.openclaw/workspace |
| 65 | git init && git add -A && git commit -m "initial" |
| 66 | |
| 67 | # 2. Install |
| 68 | cp scripts/guardian.sh ~/.openclaw/guardian.sh |
| 69 | chmod +x ~/.openclaw/guardian.sh |
| 70 | |
| 71 | # 3. Start |
| 72 | nohup ~/.openclaw/guardian.sh >> /tmp/openclaw-guardian.log 2>&1 & |
| 73 | ``` |
| 74 | |
| 75 | ## Configuration |
| 76 | |
| 77 | | Variable | Default | Description | |
| 78 | |---|---|---| |
| 79 | | `GUARDIAN_WORKSPACE` | `$HOME/.openclaw/workspace` | Workspace git repo path | |
| 80 | | `GUARDIAN_CHECK_INTERVAL` | `30` | Health check interval (seconds) | |
| 81 | | `GUARDIAN_MAX_REPAIR` | `3` | Max repair attempts before rollback | |
| 82 | | `GUARDIAN_COOLDOWN` | `300` | Cooldown after all repairs fail (seconds) | |
| 83 | | `DISCORD_WEBHOOK_URL` | _(unset)_ | Discord webhook for alerts (optional) | |
| 84 | |
| 85 | ## Works Alongside gw-watchdog |
| 86 | |
| 87 | | | gw-watchdog | Guardian | |
| 88 | |---|---|---| |
| 89 | | Check interval | 15s | 30s | |
| 90 | | Action | Fast restart | doctor --fix → rollback | |
| 91 | | Git rollback | ❌ | ✅ | |
| 92 | | Discord alerts | ❌ | ✅ | |
| 93 | | Daily backup | ❌ | ✅ | |
| 94 | |
| 95 | ## Install as OpenClaw Skill |
| 96 | |
| 97 | ```bash |
| 98 | clawhub install myclaw-guardian |
| 99 | ``` |
| 100 | |
| 101 | ## License |
| 102 | |
| 103 | MIT © [MyClaw.ai](https://myclaw.ai) |