Documents

Gateway Watchdog Discord

Try it

Monitor OpenClaw gateway health and report incidents to Discord with read-only checks and cooldown dedupe.

What it does

Probes OpenClaw Gateway, Spark, Local API Hub, and Dashboard loopback endpoints each run, persisting per-target state plus an append-only event log under ~/.openclaw/watchdogs/gateway-discord/. The watchdog is read-only: it never rewrites openclaw.json, runs doctor --fix, promotes baselines, or restarts services. Discord delivery prefers a webhook and falls back to bot token + channel ID, with a configurable failure threshold and cooldown to keep alerts low-noise. Optional macOS LaunchAgent or OpenClaw cron scheduling enables recurring runs without modifying core config.

When to use it

  • Run scheduled gateway health checks via LaunchAgent on macOS
  • Send low-noise Discord alerts on OpenClaw gateway incidents
  • Add cron-based watchdog coverage without editing OpenClaw core config
  • Audit downtime and recovery from a local append-only event log

The skill document

Gateway Watchdog (Discord)

Discord-first watchdog for OpenClaw gateway incidents.

🛠️ Installation

Tell OpenClaw: "Install the gateway-watchdog skill." Loading a LaunchAgent or configuring Discord delivery remains an explicit operator action.

2. Manual Installation (CLI)

If you prefer the terminal, run:

openclaw skills install @jonathanjing/openclaw-gateway-watchdog-skill

Isolation model

  • Watchdog data is isolated under ~/.openclaw/watchdogs/gateway-discord/.
  • No edits to openclaw.json are required.
  • The shipped watchdog is read-only: it does not rewrite openclaw.json, run doctor --fix, promote baselines, or restart services.
  • Discord delivery exports a bounded incident summary to a third party; use an allowlisted private channel.
  • A foreground run probes four targets: OpenClaw Gateway, Spark status, Local API Hub health, and Dashboard health. The latter three default to loopback endpoints and may be overridden with the declared environment variables.
  • The script writes per-target state plus an append-only event log under the watchdog data directory. It creates background persistence only when the operator explicitly runs the cron or LaunchAgent installation commands below.
  • config.env is parsed as data using an allowlist; it is never sourced or executed. For Spark only, the script may read the single SPARK_API_TOKEN value from ~/.openclaw/.env when that token is not already configured.

Files in this skill

  • scripts/gateway-watchdog.sh - health checks + state machine + Discord notification.
  • scripts/install-launchd.sh - installs a user LaunchAgent from template.
  • references/com.openclaw.gateway-watchdog.plist.template - launchd template.
  • references/cron-agent-turn.md - isolated cron prompt template.

Health checks

Every run performs these checks:

openclaw gateway status --json
openclaw health --json --timeout 
curl "${SPARK_API_URL:-http://127.0.0.1:17070}/status"
curl "${LOCAL_API_URL:-http://localhost:3456}/health"
curl "http://localhost:${DASHBOARD_PORT:-18793}/health"

Pass criteria:

  • gateway runtime is running
  • RPC probe is healthy (when present)
  • health snapshot returns successfully

Failure classes:

  • runtime_stopped
  • rpc_probe_failed
  • health_unreachable
  • auth_mismatch
  • config_invalid
  • target-specific Spark, Local API Hub, or Dashboard connectivity failure

Quick start (manual run)

bash "{baseDir}/scripts/gateway-watchdog.sh"

Optional env:

export DISCORD_WEBHOOK_URL="https://discord.com/api/webhooks/..."
export DISCORD_BOT_TOKEN="discord_bot_token"
export DISCORD_CHANNEL_ID=""
export GW_WATCHDOG_SOURCE="manual"
export GW_WATCHDOG_FAIL_THRESHOLD=2
export GW_WATCHDOG_COOLDOWN_SECONDS=300

Delivery priority:

  1. DISCORD_WEBHOOK_URL
  2. DISCORD_BOT_TOKEN + DISCORD_CHANNEL_ID

macOS background mode (LaunchAgent)

Install LaunchAgent (does not edit OpenClaw core config):

bash "{baseDir}/scripts/install-launchd.sh" --interval 30 --load

Check status:

launchctl list | rg "com.openclaw.gateway-watchdog"

OpenClaw cron mode (internal path)

Use isolated job and keep messaging in one channel:

openclaw cron add \
  --name "gateway-watchdog-internal" \
  --cron "*/1 * * * *" \
  --session isolated \
  --message "Run bash {baseDir}/scripts/gateway-watchdog.sh and report state changes only." \
  --announce \
  --channel discord \
  --to "channel:" \
  --best-effort-deliver

Backup and audit artifacts

  • state file: ~/.openclaw/watchdogs/gateway-discord/state.json
  • state backups: ~/.openclaw/watchdogs/gateway-discord/backups/state-*.json
  • event log: ~/.openclaw/watchdogs/gateway-discord/events.jsonl

The script rotates old backups and keeps recent history for rollback/debugging.

Questions people ask

Does the watchdog modify OpenClaw configuration?
No. It is read-only and never rewrites openclaw.json, runs doctor --fix, promotes baselines, or restarts services.
Where are state and events stored?
Per-target state, rotated backups, and an append-only event log are kept under ~/.openclaw/watchdogs/gateway-discord/.
Which endpoints are probed and can they be overridden?
OpenClaw Gateway, Spark status, Local API Hub health, and Dashboard health. Spark, Local API Hub, and Dashboard default to loopback URLs and can be overridden via environment variables.

Related skills

Stores durable facts in a categorized, plain-markdown vault on disk, alongside your agent's built-in memory.

by Iván559 installs18 stars

Find why your productivity system keeps failing, then apply the smallest fix — capacity math, bottleneck routing, durable local notes.

by Iván855 installs69 stars

Generate and edit Draw.io, Mermaid, and Excalidraw diagrams from natural language using a structured JSON spec.

by nssa.io1.0k installs47 stars

Join a video meeting as an AI bot with voice, avatar, and screenshare across four operating modes.

by johnpatternai22 installs8 stars

Fetch raw ad creative, app, ranking, and revenue data from AdMapix as structured JSON.

by fly0pants4.3k installs296 stars

More from jonathanjing

Browse all skills

Operate and extend the read-only OpenClaw dashboard backend, frontend tabs, and security model.

by jonathanjing176 installs9 stars

Audit-grade SQLite ledger that records every model call's token usage and cost from OpenClaw sessions.

by jonathanjing28 installs

Multi-stage deep intelligence pipeline (Search → Filter → Fetch → Synthesize). Turns a query into a structured research report with full source citations.

by jonathanjing27 installs

Route user-selected photos from Meta Ray-Ban glasses or another camera through a configured messaging ingress to an approved specialist and destination. Use only for explicit, opt-in photo routing with allowlisted destinations and confirmation before cross-session forwarding or persistent writes.

by jonathanjing39 installs1 stars

Audit a named ClawHub skill or skill URL before installation by combining OpenClaw verification with bounded static analysis. Use when the user explicitly asks whether a skill is safe or requests a pre-install review; report evidence and uncertainty instead of treating a score as proof.

by jonathanjing39 installs

Develop, test, or integrate the OpenClaw Tally Node.js library for task-level cost, complexity, and efficiency analytics. Use when working on Tally's detector, SQLite ledger, analytics engine, or an explicit plugin/hook integration; installing this skill alone does not register hooks or slash commands.

by jonathanjing27 installs