ClawGuard Task & Gateway Watchdog for Openclaw

A lightweight system-level watchdog designed to monitor sub-agent processes and automate configuration recovery for the OpenClaw gateway.

camopel
v1.1.0
Mar 2, 2026
0
1.3k
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install openclaw-claw-guard

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install openclaw-claw-guard using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is ClawGuard Task & Gateway Watchdog?

ClawGuard provides a robust safety net for developers building with Openclaw Skills. It functions as a lightweight daemon that monitors explicitly registered process IDs (PIDs) and file system events, ensuring that long-running background tasks don't fail silently. By integrating directly with system services like systemd or launchd, it offers a reliable way to maintain uptime and visibility across complex AI agent workflows.

Beyond simple monitoring, this tool acts as a critical recovery layer for the OpenClaw gateway. In the event of a failed restart—whether due to a configuration error or a system crash—it automatically reverts to previous configuration backups, ensuring the gateway returns to a functional state without manual intervention. This makes it an essential component for any production-grade deployment of Openclaw Skills where high availability is required.

ClawGuard Task & Gateway Watchdog Use Cases

  • Monitoring long-running sub-agent tasks to ensure they haven't crashed or stalled during execution.
  • Automatically reverting gateway configurations if a new update causes a boot failure.
  • Receiving real-time notifications via Matrix, Discord, or Slack when a background process terminates.
  • Watching specific directories or log files for freshness to detect stalled data processing jobs.
  • Managing background process lifecycles in resource-constrained environments.

How ClawGuard Task & Gateway Watchdog Works

  1. Registration: The user or agent explicitly registers a PID or a gateway restart event with the watchdog using the CLI.
  2. Snapshotting: For gateway restarts, ClawGuard automatically takes a snapshot of the current configuration, rotating up to five previous backups.
  3. Periodic Polling: Every 15 seconds, the service checks the status of all registered PIDs and the health of the gateway service.
  4. Stale Detection: The watchdog evaluates log file or directory timestamps against a defined timeout to detect stale or "zombie" processes.
  5. Trigger & Notify: If a failure is detected (PID gone or timeout reached), it executes recovery logic, such as config reversion, and sends a notification to the designated target channel.
  6. Cleanup: Once a notification is sent or a task completes, the entry is removed from the registry to prevent duplicate alerts.

ClawGuard Task & Gateway Watchdog Setup

To install the watchdog for your Openclaw Skills environment, run the following commands:

cd <skill-dir>
bash scripts/install.sh

To automate gateway recovery, add the register-restart command to your systemd service file:

# ~/.config/systemd/user/openclaw-gateway.service
[Service]
ExecStartPre=/home/<user>/.local/bin/claw-guard register-restart
ExecStart=...

Then reload the daemon:

systemctl --user daemon-reload

ClawGuard Task & Gateway Watchdog Data Schema & Taxonomy

ClawGuard manages its state with a focus on minimal persistence to ensure a clean slate upon reboot, while keeping critical backups on disk.

Component Location / Structure Persistence
Registry In-memory state of active PIDs and watches Cleared on Restart
CLI Binary ~/.local/bin/claw-guard Permanent
Workspace ~/.openclaw/workspace/tools/claw-guard/ Permanent
Config Backups Rotating .bak files (up to 5 versions) Persistent

ClawGuard Task & Gateway Watchdog Advanced Features

  • Automatic configuration rotation: Maintains a history of the last 5 known-working gateway configurations for safe rollbacks.
  • Directory Heartbeats: Monitors file creation within a specific folder to ensure export or generation tasks are progressing.
  • Cross-platform support: Native integration with systemd for Linux and launchd for macOS users.
  • Multi-target Notifications: Supports routing alerts to Matrix, Telegram, Discord, and Slack via the OpenClaw message bus.
  • Resource Efficiency: Designed with a minimal footprint, consuming roughly 7MB of RAM with negligible CPU overhead.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*