zhi 959e635bb5 fix: 800ms delay before first inbound notification
Race observed on first turn: ClaudePlugin emits
notifications/claude/channel before Claude Code finishes registering
the channel handler internally. Claude logs
"MCP server synthesis: Channel notifications registered" ~25ms AFTER
hello_ack arrives. Notifications that arrive earlier are silently
dropped — observed empty session, no turn, curl hangs until timeout.

Fix: on first `inbound` frame after WS hello, wait 800ms before
emitting the MCP notification. Subsequent inbounds skip the wait.

End-to-end verified twice on laptop. Cold-start ~10s, hot path 2-3s.
2026-05-14 14:00:36 +00:00

SynthesisAgent.ClaudePlugin

Stdio MCP server registered as a Claude Code --channels server:<name> source. Lives inside every long-lived Claude process spawned by SynthesisAgent.OpenclawPlugin.

What it does

  • Connects out (WebSocket) to OpenclawPlugin's bridge on startup, sends hello
  • Listens for inbound frames → emits notifications/claude/channel so Claude opens a new turn
  • Exposes a single reply(text, final?) MCP tool — the model calls it to send its answer back to the OpenClaw side

Capability declaration (important detail)

new Server({...}, {
  capabilities: {
    tools: {},
    experimental: {
      'claude/channel': {},
    },
  },
})

Top-level placement of 'claude/channel' is silently ignored — Claude Code logs "server did not declare claude/channel capability". Verified 2026-05-14 against the official Anthropic discord plugin source.

Required env vars

Set by OpenclawPlugin's process-manager when spawning claude:

Var Example
SYNTHESIS_WS_URL ws://127.0.0.1:18901/bridge
SYNTHESIS_OPENCLAW_SESSION developer::discord:channel:123
SYNTHESIS_CLAUDE_SESSION <uuid>

Manual registration (laptop smoke test)

To use this MCP server with claude --channels server:synthesis, register it once globally:

claude mcp add --scope user synthesis -- bun run /absolute/path/to/server.ts

Then OpenclawPlugin can spawn:

claude --channels server:synthesis \
       --dangerously-load-development-channels server:synthesis \
       --resume <uuid> \
       --permission-mode bypassPermissions

(The --dangerously-load-development-channels flag triggers a one-time interactive dev-mode confirmation. OpenclawPlugin's process-manager pipes "1\n" to stdin shortly after spawn to dismiss it automatically.)

Tool surface (v1)

Just reply. The model uses Claude Code's built-in tools (Read, Edit, Bash, etc.) for any actual work; reply is purely the output channel.

reply(text, final=true) sends a complete answer. reply(text, final=false) queues a progress chunk; OpenclawPlugin buffers chunks until a final call arrives.

License

Apache-2.0 (modeled after Anthropic's official discord@claude-plugins-official plugin).

Description
No description provided
Readme 38 KiB
Languages
TypeScript 100%