← 返回 Skills 市场
mupengi-bot

Gateway Self-Heal Watchdog

作者 mupengi-bot · GitHub ↗ · v1.0.0
cross-platform ⚠ suspicious
384
总下载
0
收藏
1
当前安装
1
版本数
在 OpenClaw 中安装
/install gw-self-heal
功能描述
Self-healing watchdog for OpenClaw gateway. Auto-backup openclaw.json before changes, health-check the gateway process, and auto-rollback to last known good...
使用说明 (SKILL.md)

Gateway Watchdog

Automated self-healing system for OpenClaw gateway failures including config corruption, process crashes, and auth failures.

How It Works

Three-layer protection:

  1. Config Guard — Auto-backup openclaw.json on every successful health check
  2. Process Watchdog — Detect gateway process death → auto-restart
  3. Auth Health Check — Detect running-but-broken state → rollback config → restart

Setup

Run the setup script to install the watchdog:

bash scripts/setup-watchdog.sh

This will:

  • Create the watchdog script at ~/.openclaw/watchdog.sh
  • Register it as a cron job (every minute)
  • Take an initial config backup

Manual Commands

# Check watchdog status
bash scripts/watchdog-status.sh

# Force backup current config
cp ~/.openclaw/openclaw.json ~/.openclaw/openclaw.json.bak

# View watchdog logs
cat ~/.openclaw/watchdog.log | tail -20

# Disable watchdog
crontab -l | grep -v watchdog | crontab -

Recovery Levels

Level Condition Action Auto?
1 Process dead, config OK Restart gateway
2 Process alive, health check fail Rollback config + restart
3 No valid backup exists Log alert, notify if possible ⚠️ Manual

Config Backup Strategy

  • Auto-backup: On every successful health check, current config overwrites .bak
  • Pre-change backup: Before any openclaw.json edit, copy to .bak.prev
  • Broken config preserved: Failed configs saved as .broken.\x3Ctimestamp> for debugging

Logs

All watchdog activity logged to ~/.openclaw/watchdog.log with timestamps.

Platform Support

  • macOS: cron-based (launchd alternative in references/launchd.md)
  • Linux: cron or systemd (see references/systemd.md)
  • Docker: Use HEALTHCHECK directive (see references/docker.md)
安全使用建议
What to check before installing or running this skill: - Inspect the scripts yourself. The setup script writes and runs ~/.openclaw/watchdog.sh and registers a cron job — review the watchdog.sh contents (they are included) to ensure the restart/rollback logic matches your expectations. - Backup your existing crontab before running setup, because the removal step (crontab -l | grep -v "watchdog.sh" | crontab -) can clear other jobs if crontab -l returns nothing. Run: crontab -l > ~/crontab.before.install - Confirm openclaw binary is installed and in the PATH for the same user that will run the cron job; otherwise the script will fail to restart the service. - Be aware of the undeclared environment variable OPENCLAW_HEALTH_PORT used by the watchdog; if your gateway uses a different port, export OPENCLAW_HEALTH_PORT before installing or edit the script. - The included references (systemd/launchd/docker) assume different locations and privileges: systemd example runs as root with /root/.openclaw — prefer running under the least privilege user and adjust paths accordingly. - If you operate critical systems, test the watchdog in a non-production environment first to confirm it doesn't accidentally overwrite valid configs or remove needed cron jobs. - If you want safer behavior, modify setup-watchdog.sh to (a) prompt before altering crontab, (b) preserve/merge existing crontab more robustly, and (c) avoid running any privileged commands or root paths unless intentionally chosen.
功能分析
Type: OpenClaw Skill Name: gw-self-heal Version: 1.0.0 The skill implements a self-healing watchdog that establishes persistence via a per-minute cron job and performs automated process restarts and configuration rollbacks. While the logic in `scripts/setup-watchdog.sh` and the generated `watchdog.sh` is consistent with the stated purpose of gateway resilience, the use of automated persistence and shell-based system management are high-risk capabilities. No evidence of malicious intent, data exfiltration, or unauthorized remote communication was found.
能力评估
Purpose & Capability
Name/description align with the files and scripts: scripts check gateway process, perform health-checks, backup openclaw.json, and perform rollback. The files included (setup and watchdog scripts plus systemd/launchd/docker references) are consistent with a watchdog purpose.
Instruction Scope
The runtime instructions and setup script perform system-level actions: create ~/.openclaw/watchdog.sh, write logs, and register a cron job that runs every minute. The setup script will modify the user's crontab and run the watchdog immediately. The scripts access and overwrite configuration files under ~/.openclaw, call openclaw start/stop, and curl the local health endpoint. The crontab manipulation pattern used can erase unrelated existing cron entries (see details below). A watchdog script that restarts services and overwrites configs is expected, but the crontab/sysadmin actions are potentially destructive and should be highlighted to users before install.
Install Mechanism
This is an instruction-only skill with no install spec; it writes scripts into the user's home directory and registers a cron job. No external downloads or package installs are performed by the skill itself. That reduces supply-chain risk, but the script's behavior still modifies system state.
Credentials
No credentials are requested (good). However, the watchdog script references an environment variable OPENCLAW_HEALTH_PORT (defaulting to 3377) but this env var is not declared anywhere in the skill metadata or SKILL.md. The systemd and docker reference files also assume root paths (/root/.openclaw) and global npm-installed openclaw in Docker, which are not declared requirements. These undeclared environment/path assumptions could cause surprises or require elevated privileges.
Persistence & Privilege
The setup script registers a cron job to run every minute (persistent/automated invocation). While the skill is not marked always:true, the cron job is permanent until removed. The included systemd reference file runs the watchdog as root (User=root) and uses /root paths — that suggests a privileged deployment option which elevates impact if used. The cron-registration approach in the script can unintentionally wipe other cron entries (risk of losing unrelated scheduled jobs).
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install gw-self-heal
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /gw-self-heal 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release: auto-backup openclaw.json, health check, config rollback on failure, process auto-restart. Supports cron, systemd, launchd, Docker. Author: 김여명 (dawnkim_master)
元数据
Slug gw-self-heal
版本 1.0.0
许可证
累计安装 1
当前安装数 1
历史版本数 1
常见问题

Gateway Self-Heal Watchdog 是什么?

Self-healing watchdog for OpenClaw gateway. Auto-backup openclaw.json before changes, health-check the gateway process, and auto-rollback to last known good... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 384 次。

如何安装 Gateway Self-Heal Watchdog?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install gw-self-heal」即可一键安装,无需额外配置。

Gateway Self-Heal Watchdog 是免费的吗?

是的,Gateway Self-Heal Watchdog 完全免费(开源免费),可自由下载、安装和使用。

Gateway Self-Heal Watchdog 支持哪些平台?

Gateway Self-Heal Watchdog 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Gateway Self-Heal Watchdog?

由 mupengi-bot(@mupengi-bot)开发并维护,当前版本 v1.0.0。

💬 留言讨论