diff --git a/README.md b/README.md index 0f6568a..37a7ad0 100644 --- a/README.md +++ b/README.md @@ -13,11 +13,12 @@ cheaper/local model. A small always-on message server, **`bridged`**, controls [herdr](https://herdr.dev) (an agent multiplexer) over its Unix-socket API and exposes a -clean 2-way messaging API (HTTP/SSE + optional broker). herdr owns the PTYs, multiplexing, -persistence, and **agent-status events**; `bridged` owns policy (subscription boundary, -session lifecycle, status-gated delivery) and the client contract. The worker `claude` -launches with `ANTHROPIC_BASE_URL=https://ollama.ltms.dev` + a bearer token; the primary -Opus stays env-clean and talks to `bridged` over HTTP. +clean 2-way messaging API as an **MCP server that both the primary and the workers mount** — +one unified Claude setup (REST/SSE stays for non-Claude clients, plus an optional broker). +herdr owns the PTYs, multiplexing, persistence, and **agent-status events**; `bridged` owns +policy (subscription boundary, session lifecycle, status-gated delivery) and the client +contract. The worker `claude` launches with `ANTHROPIC_BASE_URL=https://ollama.ltms.dev` + a +bearer token; the primary Opus stays env-clean and calls `bridged`'s MCP tools. ```mermaid flowchart LR @@ -27,7 +28,8 @@ flowchart LR W["worker claude
ANTHROPIC_BASE_URL set"] M["ollama.ltms.dev
(worker model)"] - OPUS -->|"blocking POST /message"| BD + OPUS -->|"MCP bridge_send (blocks)"| BD + W -.->|"MCP bridge_reply"| BD BD -->|"Unix socket
send_text · events.subscribe"| HERDR HERDR -->|"drives PTY"| W W -->|"inference"| M @@ -41,15 +43,21 @@ flowchart LR - **Subscription boundary:** the *primary* never sets `ANTHROPIC_BASE_URL` (stays on Pro/Max). Only the *secondary* process is off-subscription — and `bridged` itself is a plain daemon (no Anthropic quota), so it may poll/subscribe freely. -- **How the primary consumes a reply:** a single **blocking request** (`bridged` holds the - HTTP call open until the worker's turn completes, then returns the reply as the body). No - cross-turn busy-poll, so no quota burn. SSE is an optional side-channel for humans/dashboards - watching status, not how the primary gets its answer. Long/detached work uses the async - broker path instead. -- **Worker → primary:** *single-host only*, herdr can also type into the primary pane (typing - keystrokes is subscription-safe). When the primary runs off-herdr (e.g. on a Mac, - split-host), that direction goes via the **broker + the primary's own `Stop`-hook** — - `bridged` cannot inject into a primary it doesn't host. See the wiki for the two topologies. +- **Unified MCP setup:** both the primary and the workers mount `bridged` as an MCP server + (one `claude mcp add` line, same on each side). Claude ↔ Claude runs over MCP tools — + `bridge_send` / `bridge_reply` / `bridge_ask` / `bridge_status` — with no `curl` or bespoke + client. MCP tool I/O never sets `ANTHROPIC_BASE_URL`, so mounting the bridge is + subscription-safe by construction. +- **How the primary consumes a reply:** a single **blocking MCP call** (`bridge_send`); + `bridged` holds it open until the worker calls `bridge_reply` or its turn hits + `agent_status=done`, then returns the reply as the tool result. No cross-turn busy-poll, so + no quota burn. SSE is an optional side-channel for humans/dashboards watching status. + Long/detached work uses the async broker path instead. +- **Worker → primary** rides `bridged`'s **MCP rendezvous** — the reply resolves the primary's + blocking call, so *no keystroke into the primary pane is needed, even single-host*. + Fallbacks: a single-host non-MCP primary can be typed into by herdr (subscription-safe + simulated typing); a split-host primary gets it via the **broker + its own `Stop`-hook**. + See the wiki for the two topologies. - **Different model per process** sidesteps Claude Code's lack of per-subagent provider routing — the worker isn't a subagent, it's its own configured process. - **AgentAPI** ([`coder/agentapi`](https://github.com/coder/agentapi)) is retained only as a diff --git a/wiki b/wiki index 0b73fac..b824a28 160000 --- a/wiki +++ b/wiki @@ -1 +1 @@ -Subproject commit 0b73facb66a49114f324b974665c56fc63c88bb7 +Subproject commit b824a28d0494c6b2a056e0e9aea0371fe6479ce4