โ† Back to Roadmap

Task 6: OpenClaw Integration

3-4 days Platform / DX

Current Issue / Scenario

The integration works. The setup doesn't. The notifier-openclaw plugin is functional โ€” once configured, AO and OpenClaw talk to each other fine. But getting to that point is painful. Users struggle through manual dependency checks, hand-editing config files, guessing gateway URLs, and configuring API keys one by one.

What Works vs. What Doesn't

AspectStatusProblem
notifier-openclaw pluginโœ“ WorksSends notifications, session events โ€” functional once wired up
System dependency detectionโœ— MissingAO assumes git, node, npm, tmux are installed. Fails with cryptic errors if they're not.
Plugin installation~ ManualRequires multiple manual steps โ€” no one-command setup
API key configuration~ ManualUsers hand-edit config files. No validation, no guided flow.
OpenClaw discoveryโœ— MissingAO doesn't auto-detect if OpenClaw is running on the same machine. User must manually enter gateway URL and port.
Connection validationโœ— MissingNo way to verify the connection works until you trigger a real event and check if it arrived.
Error messagesโœ— PoorMissing dependencies produce stack traces, not actionable guidance.
The user experience today: Install AO โ†’ run ao start โ†’ "Error: tmux not found" (raw error) โ†’ Google it โ†’ install tmux โ†’ try again โ†’ "Error: OPENCLAW_API_ENDPOINT not set" โ†’ find docs โ†’ hand-edit config โ†’ wrong port โ†’ try 3 times โ†’ finally works. This should be a 30-second wizard.

What To Do

How We Will Do It

References

SourceRelevance
notifier-openclaw plugin
source
~170 lines. Posts to /hooks/agent with per-session key hook:ao:<sessionId>. Needs: url (default localhost:18789), token (env OPENCLAW_HOOKS_TOKEN), name, wakeMode. Has retry with exponential backoff.
OpenClaw hooks configRequires in openclaw.json: hooks.enabled: true, hooks.token, hooks.allowRequestSessionKey: true, hooks.allowedSessionKeyPrefixes: ["hook:"]. Currently not configured on this machine.
OpenClaw gatewayRuns on port 18789 (not 3100). Config at ~/.openclaw/openclaw.json. The /hooks/agent endpoint returns 200 but hooks are not enabled in config.
packages/cli/src/commands/Where ao setup and ao doctor commands will live. 16 commands currently.
Homebrew doctorGood UX reference for dependency checking. Clear โœ“/โœ— output with fix instructions.

What the plugin actually does (from source)

Implementation Plan

Dependency Checker on Startup

Add to ao start (and new ao doctor command). Check for required binaries and versions:

$ ao doctor

System Dependencies:
  โœ“ git 2.43.0         (required โ‰ฅ2.30)
  โœ“ node 22.12.0       (required โ‰ฅ18)
  โœ“ npm 10.9.0
  โœ— tmux โ€” not found
    โ†’ Install: brew install tmux  (macOS)
    โ†’ Install: sudo apt install tmux  (Ubuntu/Debian)

Agent CLIs:
  โœ“ claude 1.0.12
  โœ“ codex 0.1.5
  โœ— aider โ€” not found (optional)

OpenClaw:
  โœ“ Gateway detected on localhost:18789
  โœ— notifier-openclaw not configured
    โ†’ Run: ao setup openclaw

On ao start, only block on required deps. Warn (don't block) on optional ones.

OpenClaw Auto-Detection

Before asking the user anything, try to find OpenClaw automatically:

  1. Check if ~/.openclaw/ directory exists
  2. Read ~/.openclaw/config.json (or equivalent) for gateway URL/port
  3. Probe localhost:18789 (default port) with a health check request
  4. Check if openclaw binary is in PATH

If found: pre-fill all connection details. If not found: ask user if they have OpenClaw installed elsewhere.

ao setup openclaw Wizard

Interactive CLI wizard using prompts (inquirer-style):

$ ao setup openclaw

๐Ÿ” Detecting OpenClaw...
  โœ“ Found OpenClaw gateway at localhost:18789

๐Ÿ“‹ Configuration:
  Gateway URL: http://localhost:18789 (auto-detected)
  ? Change URL? (Y/n) n

๐Ÿ”‘ API Keys:
  โœ“ ANTHROPIC_API_KEY found in OpenClaw config
  โœ“ GITHUB_TOKEN found in environment
  ? OPENAI_API_KEY not found. Enter key (or skip): sk-...

๐Ÿ”” Notification Preferences:
  ? Notify on session complete? (Y/n) Y
  ? Notify on session failure? (Y/n) Y
  ? Notify on PR created? (Y/n) Y

๐Ÿงช Testing connection...
  โœ“ Sent test notification
  โœ“ OpenClaw received it

โœ… Setup complete! AO โ†” OpenClaw connected.

One-Command Plugin Install

Make ao plugin install notifier-openclaw do everything:

  1. Install the npm package
  2. Auto-detect OpenClaw (step 2 logic)
  3. Run the setup wizard if not already configured
  4. Validate connection
  5. Enable the plugin in AO config

One command, zero manual config editing.

Better Error Messages

Replace every raw error with an actionable message. Examples:

Before (current)After
Error: spawn tmux ENOENTtmux is required but not installed.\n Install: brew install tmux (macOS) | sudo apt install tmux (Linux)\n Then retry: ao start
Error: ECONNREFUSED 127.0.0.1:3100Can't reach OpenClaw gateway at localhost:18789.\n Is OpenClaw running? Check: openclaw gateway status\n Different port? Set: ao config set openclaw.url http://localhost:XXXX
TypeError: Cannot read property 'token' of undefinedGitHub token not configured.\n Set it: ao config set github.token YOUR_TOKEN\n Or run: ao setup openclaw (reads from OpenClaw config)

API Key Sharing from OpenClaw

AO should check for API keys in this order:

# Key resolution order:
# 1. Environment variables (ANTHROPIC_API_KEY, GITHUB_TOKEN)
# 2. AO config (~/.agent-orchestrator/config.json)
# 3. OpenClaw config (~/.openclaw/keys.json)  โ† NEW
# 4. ao setup wizard (prompts user)

If OpenClaw already has keys configured, AO just reads them. Zero duplication.

Connection Health Check

Add to ao doctor and run periodically in background:

  • Ping OpenClaw gateway โ€” is it reachable?
  • Check notifier-openclaw plugin status โ€” is it loaded and connected?
  • Verify API keys are still valid (quick auth check)
  • Show last successful notification timestamp

If connection drops during a session, warn in dashboard (not crash).

Acceptance Criteria