Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Two surfaces

TermHerd exposes itself to Claude sessions over MCP, so a session can read and drive the workspace it is running in. There are two servers, and which one you get depends on how the session started.

          ┌──────────────────────────────┐
          │        TermHerd (GUI)        │
          │  ┌────────────────────────┐  │
 in-proc  │  │   core::App (state)    │  │
 loopback │  └───────────▲────────────┘  │
   ┌──────┼──────────────┘               │
   │      │   the LIVE BRIDGE            │
   │      │   20 tools · the running     │
   │      │   workspace + settings.json  │
   │      └──────────────────────────────┘
   │
   │  wired in at spawn, per-session token
   ▼
┌─────────────────────┐        ┌──────────────────────────┐
│ a Claude session    │        │  any Claude session      │
│ LAUNCHED BY termherd│        │  anywhere                │
└─────────────────────┘        └────────────┬─────────────┘
                                            │ you register it
                                            ▼
                               ┌──────────────────────────┐
                               │  termherd-mcp (stdio)    │
                               │  2 tools · settings.json │
                               └──────────────────────────┘
The live bridgeThe stdio server
Reachesthe running workspace and the settings filethe settings file
Setupnone — wired in at spawnyou register termherd-mcp yourself
Available tosessions launched from TermHerd, plus any client that attachesany Claude session
Transportin-process, loopback, per-session bearer tokenJSON-RPC over stdio
Surface20 tools2 tools + 2 resources
Needs the app running✅ yes❌ no

The gap between them, and the bridge across it

Two servers, but three ways in. The live bridge holds the running workspace and hands its endpoint only to sessions it spawned; the stdio server is reachable from anywhere and sees only the settings file. Between those sat a hole: the terminal that launched TermHerd could not ask it for a screenshot the app already knows how to take.

Attaching from outside closes it — the same live bridge and the same twenty tools, reached by a client TermHerd did not spawn. What was missing was discovery, not capability, so nothing new was added to the surface. It is opt-in (mcp.attach), because publishing an endpoint that can type into a terminal is a decision, not a default.

Which one you want

  • “Split this pane and run the tests” → live bridge. It only exists inside a session TermHerd started. One session driving others through it: Orchestrating sessions.
  • “Switch me to a light theme” → either. Both carry list_options and set_option, over one shared catalogue; the write lands in settings.json and a running TermHerd applies it at once. From a session TermHerd started, the bridge already has them — register the stdio server only for a session started elsewhere.

Design notes

Sessions are addressed by a stable handle — the runtime session id — never by the Claude resume_id, which re-keys on a fork or a plan-accept.

Every call is timeout-bounded. A wedged shell surfaces as a tool error, never a hang. Waits have a default and a hard cap, so no call, however parameterised, can park a caller indefinitely.

The domain core has no MCP awareness at all. Every mutation goes through an Event that already existed for the keyboard. That is the invariant behind the whole surface: an MCP caller cannot reach a state the keyboard cannot.