Bridge between OpenClaw (multi-channel hub) and interactive Claude Code, keeping autonomous agent usage on the subscription quota after the 2026-06-15 Agent SDK credit split. Initial scaffolding only — two submodules with skeletons: - SynthesisAgent.ClaudePlugin: stdio MCP server registered as a --channels source. Declares experimental.claude/channel capability (verified 2026-05-14 against the official Anthropic discord plugin) and emits notifications/claude/channel to push OpenClaw inbound messages into the Claude turn loop. - SynthesisAgent.OpenclawPlugin: process manager + session mapping + bridge WebSocket. Currently shaped around a custom ws protocol; will be rewritten as a model-provider HTTP server (contractor-agent pattern) so OpenClaw routes inbound channel messages through it via /v1/chat/completions. See STATUS.md for the open punch list and docs/wire-protocol.md for the (soon-to-change) inter-plugin frame schema.
62 lines
3.4 KiB
Markdown
62 lines
3.4 KiB
Markdown
# SynthesisAgent
|
|
|
|
Bridge between **OpenClaw** (multi-channel hub) and **Claude Code** (interactive Claude session), letting OpenClaw drive Claude Code as an autonomous worker **without using `claude -p` or the Agent SDK** — so all usage stays on the interactive subscription quota.
|
|
|
|
## Motivation
|
|
|
|
Starting 2026-06-15, Claude Agent SDK and `claude -p` usage on Max plans draws from a separate `$100` monthly credit pool. Interactive Claude Code usage continues to draw from the subscription. Today OpenClaw's contractor agents spawn a fresh `claude -p` per external event, which after the cutover will consume credit instead of subscription.
|
|
|
|
SynthesisAgent moves contractor agents to a model where:
|
|
|
|
- A **long-lived interactive `claude` process** serves each OpenClaw session.
|
|
- External events (Discord, Telegram, Slack…) flow into that process via the official `notifications/claude/channel` MCP notification protocol, the same one Anthropic's own `discord@claude-plugins-official` plugin uses.
|
|
- The process exposes OpenClaw's tool surface (pcexec, sessions_*, memory_*, wiki_*, canvas, …) back to the model.
|
|
|
|
## Architecture
|
|
|
|
```
|
|
Discord / Telegram / Slack / ...
|
|
│
|
|
▼
|
|
OpenClaw Gateway (existing)
|
|
│
|
|
▼
|
|
┌──────────────────────────────────────┐
|
|
│ SynthesisAgent.OpenclawPlugin │
|
|
│ - Process Manager (spawn / resume) │
|
|
│ - Session Mapping DB │
|
|
│ - Bridge WebSocket Server │
|
|
└──────────────────────────────────────┘
|
|
│ ▲
|
|
│ spawn │ WebSocket
|
|
▼ │
|
|
┌──────────────────────────────────────┐
|
|
│ claude --channels plugin:synthesis │ (one per OpenClaw session)
|
|
│ ├─ Claude Code (interactive) │
|
|
│ └─ SynthesisAgent.ClaudePlugin │
|
|
│ (MCP stdio server) │
|
|
│ - notifications/claude/channel │
|
|
│ - tool proxy → OpenClaw │
|
|
│ - permission bridge │
|
|
└──────────────────────────────────────┘
|
|
```
|
|
|
|
## Submodules
|
|
|
|
| Module | Lives in | Role |
|
|
|-------------------------------------|-----------------------|------|
|
|
| [`SynthesisAgent.OpenclawPlugin`](./SynthesisAgent.OpenclawPlugin/) | OpenClaw process | Spawns/manages Claude processes per session; bridges Claude `↔` OpenClaw event bus |
|
|
| [`SynthesisAgent.ClaudePlugin`](./SynthesisAgent.ClaudePlugin/) | Each Claude process | MCP stdio server registered as a `--channels` plugin; receives events from OpenclawPlugin bridge, proxies tool calls back |
|
|
|
|
## Wire protocol
|
|
|
|
See [`docs/wire-protocol.md`](./docs/wire-protocol.md) for the message schema between the two plugins.
|
|
|
|
## Status
|
|
|
|
Scaffolding only. Nothing wired up. See each submodule's TODO list.
|
|
|
|
## License
|
|
|
|
Apache-2.0 (matches the upstream Anthropic Discord channel plugin this work is modeled after).
|