JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 32
  • Score
    100M100P100Q88848F
  • License MIT

AI assistant gateway watchdog — alias for openclaw-cli. Visit https://openclaw-cli.app

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (openclaw-watch) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    OpenClaw watch

    OpenClaw watch

    Keep your OpenClaw service alive. Automatically.

    中文文档

    Get Started

    npm install -g openclaw-watch
    openclaw-watch watch -d

    That's it. Doctor monitors your OpenClaw gateway in the background, restarts it when it goes down, and tells you what happened. Zero configuration needed -- it reads everything from your existing OpenClaw setup.

    Core Commands

    openclaw-watch watch            # Start monitoring (foreground)
    openclaw-watch watch -d         # Start monitoring (background)
    openclaw-watch unwatch          # Stop monitoring
    
    openclaw-watch status           # Quick health check

    These four commands cover 90% of daily use.

    Gateway Management

    openclaw-watch gateway start    # Start the OpenClaw gateway
    openclaw-watch gateway stop     # Stop the gateway
    openclaw-watch gateway restart  # Restart the gateway

    Diagnostics & Logs

    openclaw-watch doctor           # Full diagnostics (binary, gateway, channels)
    openclaw-watch logs             # View gateway logs
    openclaw-watch logs --error     # View error logs only
    openclaw-watch logs --doctor    # View Doctor's own event logs
    openclaw-watch dashboard        # Web management UI (http://localhost:9090)

    Install

    # npm (recommended)
    npm install -g openclaw-watch
    
    # or run without installing
    npx openclaw-watch status

    Requires Node >= 22 (same as OpenClaw).

    How It Works

    Doctor auto-detects your OpenClaw installation:

    • Reads ~/.openclaw/openclaw.json for gateway port, channels, agents
    • Finds the launchd service from ~/Library/LaunchAgents/
    • Checks health via openclaw health --json (real gateway RPC, not HTTP)
    • Restarts via launchctl kickstart when needed

    You don't configure OpenClaw details. Doctor figures them out.

    All Commands

    Command Description
    Monitoring
    watch Start health monitoring (foreground)
    watch -d Start health monitoring (background)
    watch -d --dashboard Background monitoring + web dashboard
    unwatch Stop monitoring
    Gateway
    gateway start Start the OpenClaw gateway
    gateway stop Stop the gateway
    gateway restart Restart the gateway
    Info
    status Show gateway and channel health
    status --json Machine-readable JSON output
    doctor Run full diagnostics
    dashboard Start web management UI
    logs Show gateway logs
    logs --error Show error logs only
    logs --doctor Show Doctor event logs

    Configuration

    Config is stored at ~/.openclaw-doctor/config.json. Created automatically on first run. Only Doctor's own preferences -- no OpenClaw settings needed.

    {
      "checkInterval": 30,
      "failThreshold": 3,
      "dashboardPort": 9090,
      "maxRestartsPerHour": 5,
      "openclawProfile": "default",
      "notify": {
        "webhook": {
          "enabled": false,
          "url": "",
          "bodyTemplate": "{\"msgtype\":\"text\",\"text\":{\"content\":\"{{message}}\"}}"
        },
        "system": {
          "enabled": true
        }
      }
    }
    Field Description Default
    checkInterval Seconds between health checks 30
    failThreshold Consecutive failures before restart 3
    dashboardPort Web dashboard port 9090
    maxRestartsPerHour Restart throttle 5
    openclawProfile OpenClaw profile to monitor (default, dev, ...) default
    notify.webhook.url Webhook for notifications --
    notify.system.enabled macOS native notifications true

    Notifications

    Doctor notifies you across the full lifecycle:

    Event Example
    Monitoring started "Doctor is watching your OpenClaw service"
    Health degraded "Service unhealthy (attempt 2/3)"
    Restarting "Restarting gateway..."
    Restart succeeded "Gateway back online"
    Restart failed "Restart failed: [error]"
    Throttled "Too many restarts, manual intervention needed"
    Recovered "Service recovered on its own"
    Monitoring stopped "Doctor stopped"

    Channels: Webhook (DingTalk, Feishu, Slack, etc.) + macOS system notifications.

    Skills Integration

    Doctor runs as a standalone daemon, callable by OpenClaw or other tools:

    openclaw-watch status --json    # Machine-readable output
    openclaw-watch watch -d         # Idempotent -- safe to call repeatedly

    If the caller crashes, Doctor keeps running.

    Architecture

                              +-----------------+
                              |  Notification   |
                              |  (Webhook/OS)   |
                              +--------^--------+
                                       |
    +-------------+    CLI    +--------+--------+    RPC      +-----------+
    |  OpenClaw   | --------> |                 | ---------> |  OpenClaw |
    |  / Scripts  |           | openclaw-doctor |            |  Gateway  |
    |  / Skills   | <-------- |  (daemon)       | <--------- | :18789    |
    +-------------+  stdout   +--------+--------+  health    +-----------+
                                       |
                              +--------v--------+
                              | ~/.openclaw/logs |
                              | (read & analyze) |
                              +-----------------+

    Development

    git clone https://github.com/openclaw/openclaw-doctor.git
    cd openclaw-doctor
    npm install
    
    npm run dev -- status          # Quick test
    npm run dev -- watch           # Foreground monitoring
    npm run dev -- watch -d        # Background daemon
    npm run dev -- unwatch         # Stop daemon
    
    npm run build                  # Build for distribution

    Roadmap

    • Health check via openclaw health --json + auto-restart with throttling
    • Auto-detect OpenClaw config (gateway port, channels, agents, launchd)
    • Background daemon mode (watch -d / unwatch)
    • Gateway management (gateway start/stop/restart)
    • Read and display OpenClaw gateway logs
    • Web status dashboard
    • --json output for status
    • Notification system (Webhook + macOS)
    • logs --tail (real-time follow)
    • config command (get/set)
    • Multiple service monitoring
    • Linux systemd support

    License

    MIT

    Publishing

    This repo publishes two npm packages from the same codebase:

    • openclaw-watch — the main package (package.json)
    • openclaw-watch — alias package (package.openclaw-watch.json)

    Both packages share the same version number and dist output.

    Release a new version

    # 1. Bump version (patch / minor / major)
    npm version patch
    
    # 2. Build + publish both packages
    npm run release

    npm run release calls scripts/publish.sh, which:

    1. Builds once (npm run build)
    2. Publishes openclaw-watch with the default package.json
    3. Temporarily swaps in package.openclaw-watch.json, publishes openclaw-watch, then restores

    To update the openclaw-watch package metadata (description, keywords, bin name, etc.), edit package.openclaw-watch.json. Keep version in sync — it's automatically picked up from whichever package.json is active during publish.