openclaw-xguardian
// Build, configure, and install a 24x7 OpenClaw watchdog on macOS, including scaffolding the Go project, wiring launchd, and tuning health/recovery behavior. Use for requests to create or share the OpenClaw guardian service, deploy it on a Mac, or troubleshoot its recovery/logging behavior.
$ git log --oneline --stat
stars:1,933
forks:367
updated:March 4, 2026
SKILL.mdreadonly
SKILL.md Frontmatter
nameopenclaw-xguardian
descriptionBuild, configure, and install a 24x7 OpenClaw watchdog on macOS, including scaffolding the Go project, wiring launchd, and tuning health/recovery behavior. Use for requests to create or share the OpenClaw guardian service, deploy it on a Mac, or troubleshoot its recovery/logging behavior.
OpenClaw XGuardian
Overview
Create a macOS launchd-backed guardian that keeps OpenClaw running, auto-recovers on failure, and logs minimal operational events.
Workflow
- Scaffold the project from assets.
- Configure paths and OpenClaw CLI location.
- Build the Go binary.
- Install the LaunchAgent and reload.
- Validate via logs and a stop/recovery test.
Steps
1) Scaffold from assets
Copy the template project into the target workspace:
cp -R /Users/xiong/.codex/skills/openclaw-xguardian/assets/guardian/* <TARGET_WORKSPACE>/
This copies:
go.modcmd/openclaw-guardian/main.goconfig.sample.jsonlaunchd/com.openclaw.guardian.plist
2) Configure paths
Edit the user config file at ~/.openclaw-guardian/config.json (create from config.sample.json).
Key fields:
openclaw_bin: absolute path fromwhich openclawconfig_path: usually~/.openclaw/openclaw.jsongateway_plist_path: usually~/Library/LaunchAgents/ai.openclaw.gateway.plistlog_path: e.g.~/.openclaw-guardian/guardian.logverbose_logs:falseby default for concise logslog_health_ok:falseby default to avoid spam
3) Build
go build -o bin/openclaw-guardian ./cmd/openclaw-guardian
4) Install LaunchAgent (guardian)
Edit launchd/com.openclaw.guardian.plist and set:
ProgramArguments: binary path + config pathEnvironmentVariables/PATH: include your Node/OpenClaw pathStandardOutPath/StandardErrorPath: desired log files
Then install and reload:
mkdir -p ~/Library/LaunchAgents
cp launchd/com.openclaw.guardian.plist ~/Library/LaunchAgents/
launchctl unload ~/Library/LaunchAgents/com.openclaw.guardian.plist 2>/dev/null || true
launchctl load ~/Library/LaunchAgents/com.openclaw.guardian.plist
5) Validate
- Check logs:
tail -n 80 ~/.openclaw-guardian/guardian.log - Optional:
openclaw gateway stopand confirm recovery lines appear.
Troubleshooting
env: node: No such file or directory: add Node path to LaunchAgentPATHand setopenclaw_bin.- Repeated
install: ensuregateway_plist_pathpoints to~/Library/LaunchAgents/ai.openclaw.gateway.plist; guardian should bootstrap instead of reinstall. - Too much logging: keep
verbose_logs=falseandlog_health_ok=false.
Resources
assets/
Project template in assets/guardian/.