Files
SynthesisAgent/STATUS.md
zhi 0fb46e318e chore: initial scaffolding for SynthesisAgent
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.
2026-05-14 09:39:02 +00:00

69 lines
4.2 KiB
Markdown

# SynthesisAgent — Status (paused 2026-05-14)
## Where we left off
Scaffolding complete. Two submodules wired up with their core skeletons:
- `SynthesisAgent.ClaudePlugin/server.ts` — stdio MCP server + bridge WebSocket client. Reads 4 env vars, forwards `tool_call` / `permission_request` to OpenClaw side, translates `inbound_message` frames to `notifications/claude/channel`.
- `SynthesisAgent.OpenclawPlugin` — process manager (spawn/resume/idle-GC), session mapping (JSON persist), bridge WS server, OpenClaw plugin entry. Tool-dispatch and inbound-event-subscription are stubbed.
Wire protocol fully specified in `docs/wire-protocol.md`.
## Open blockers (in priority order)
### Done / validated 2026-05-14 on laptop (SSH via T2)
-`--channels` flag exists in Claude Code 2.1.140/141 (hidden from `--help`)
- ✅ Syntax: `plugin:<name>@<marketplace>` or `server:<name>`
-`--plugin-dir <path>` IS documented and works for local plugin loading
- ✅ Capability declaration must be `experimental.claude/channel` not top-level — **scaffolding patched**
-`-p` mode does NOT trigger turns from channel notifications — interactive only
- ✅ Full gating chain decoded from binary (see `memory/claude_channels_protocol.md`)
- ❌ Did NOT capture an end-to-end "claude responds to channel notification" trace — got stuck at `--dangerously-load-development-channels` allowlist gate in script-PTY runs (interactive confirm may not have flowed through). Indirect evidence is overwhelming via the Discord plugin's working production pattern; remaining doubt is small.
### Remaining
1. **`.mcp.json` not written** — sandbox flagged it as sensitive on Write. Five-line file, need to drop in by hand or approve the write.
2. **Confirm channel notification → new turn empirically** — Have user run interactively (no PTY tricks):
```
claude --mcp-config /tmp/synthesis-mcp.json \
--channels server:synthesis-stub \
--dangerously-load-development-channels server:synthesis-stub
```
(in a trusted dir), confirm dev mode at the prompt, watch for the stub's 1.5s-delayed channel-test ping triggering a turn.
3. **Decide deployment path**:
- `server:` channels are flagged "dangerous dev only" — fine for our own use, awkward for shipping
- `plugin:` channels need to be in marketplace allowlist (org `allowedChannelPlugins`) — requires distribution mechanism
- Easiest dev path: local marketplace pointing at our repo
4. **OpenClaw plugin-sdk inbound subscription API** — `index.ts` has a TODO where `api.channels.onInbound(...)` should live. Need to read `contractor-agent/index.ts` carefully and copy the actual pattern.
5. **Tool catalog source** — `web/bridge-server.ts` sends an empty `tools: []` in `hello_ack`. Must enumerate OpenClaw's real tool surface and forward.
6. **`tool_call` dispatch** — currently returns `not implemented`. Need to wire to OpenClaw's tool execution path.
7. **Permission routing back to source channel** — bridge auto-denies any `permission_request` today.
## Quick-start tests to run when resuming
```bash
# 0. write .mcp.json (blocked last time)
# 1. verify --channels accepts local path or local marketplace
claude --channels plugin:synthesis-claude@/root/.openclaw/workspace/workspace-developer/SynthesisAgent/SynthesisAgent.ClaudePlugin 2>&1 | head -20
# 2. once #1 works: smoke-test notifications/claude/channel from a stub server
# (build a 30-line MCP server that fakes inbound_message after 5s)
```
## Files to start from when picking up
- `README.md` — context refresher
- `docs/wire-protocol.md` — protocol contract
- `SynthesisAgent.OpenclawPlugin/README.md` — TODO list for that side
- `SynthesisAgent.ClaudePlugin/README.md` — TODO list for that side
Reference implementations to crib from:
- `~/.claude/plugins/marketplaces/claude-plugins-official/external_plugins/discord/server.ts` — channel protocol model
- `/root/.openclaw/plugins/contractor-agent/index.ts` — OpenClaw plugin lifecycle model
## Why paused
User pivoted to investigate a recurrence of the Discord duplicate-messages bug ([[discord_duplicate_messages]]). SynthesisAgent is the longer-term fix for that whole class of problem; the duplicate-messages bug is the short-term hotfix path.