# SynthesisAgent.ClaudePlugin The **Claude Code side** of SynthesisAgent. A stdio MCP server that registers as a `--channels` plugin and bridges to `SynthesisAgent.OpenclawPlugin`. ## What it does - Receives inbound messages from OpenClaw and emits `notifications/claude/channel` so Claude Code starts a new turn. - Receives the OpenClaw tool catalog at `hello_ack` time and exposes them as MCP tools. - Forwards every `tools/call` over the bridge for OpenClaw to execute. - Forwards Claude's `permission_request` notifications to OpenClaw, and surfaces the user's reply back. ## Required env vars Set by OpenclawPlugin when it spawns Claude: | Var | Example | Meaning | |-----|---------|---------| | `SYNTHESIS_BRIDGE_URL` | `ws://127.0.0.1:18801/bridge` | Where to connect | | `SYNTHESIS_BRIDGE_TOKEN` | `...` | Shared secret | | `SYNTHESIS_OPENCLAW_SESSION` | `discord:alice` | This Claude process serves *this* session | | `SYNTHESIS_CLAUDE_SESSION` | `` | The Claude session UUID, for traceability | ## Spawn shape (done by OpenclawPlugin) ```bash claude \ --channels plugin:synthesis-claude@local \ --resume "$SYNTHESIS_CLAUDE_SESSION" \ --allowed-tools "Read Edit Bash mcp__synthesis__*" \ --append-system-prompt-file ./session-context.md ``` ## TODO - [ ] Verify exact semantics of `--channels plugin:foo@bar` against the running Claude Code build. - [ ] Verify `mcp.notification('notifications/claude/channel', ...)` triggers a new turn (vs being silently accepted). May need to first land on `claude/channel` capability declaration. - [ ] Implement attachment download flow (`download_attachment` style) — currently passthrough. - [ ] Implement `fetch_messages` to query OpenClaw history. - [ ] Wire `bun-types` install in `package.json`. ## Manual test (once OpenclawPlugin is wired up) ```bash # Terminal 1: start OpenclawPlugin bridge server openclaw # with SynthesisAgent.OpenclawPlugin loaded # Terminal 2: simulate the spawn manually SYNTHESIS_BRIDGE_URL=ws://127.0.0.1:18801/bridge \ SYNTHESIS_BRIDGE_TOKEN=local-dev \ SYNTHESIS_OPENCLAW_SESSION=test:1 \ SYNTHESIS_CLAUDE_SESSION=$(uuidgen) \ claude --channels plugin:synthesis-claude@local # Terminal 3: push a fake inbound message via OpenclawPlugin admin CLI openclaw synthesis push --session test:1 --content "hello" ``` A successful run: Claude Code visibly starts a new turn in Terminal 2 reacting to "hello".