Watch
0
0
Fork
You've already forked hyperhive
0
hyperhive/hive-subagent-mcp/README.md

39 lines
2.1 KiB
Markdown

# hive-subagent-mcp
Per-agent daemon (`hive-subagent-daemon`) that spawns nested headless
`claude` sessions on request and serves the tool surface
(`start`/`continue`/`status`/`interrupt`, plus a separate
subagent-facing `goal_reached`/`need_help` route, one per-session URL)
directly over streamable-http. No stdio bridge, no per-turn respawn — an
agent's claude reconnects to the same stable URL every turn.
Independent of `hive-bash-mcp` — a subagent spawns a full nested
`claude` session, a much heavier capability than a bash command, worth
its own deployable/restartable unit.
## Shape
One bin (`hive-subagent-daemon`, `src/main.rs`) built from the crate's
own lib (`src/lib.rs`):
- **`session.rs` and `session/`** — the actual claude-facing logic. The
entry file has the module doc (the v1 scope: `Claude::spawn` +
`RunningClaude::wait`/`cancel_handle` rather than `InfiniteSession::run`,
which has no cancel handle to reach in), the shared types and a table of
the parts: `session/run.rs` holds `start`, `continue_` and the loop over
a run's turns, `session/goal.rs` the goal prompts and the `goal`
switch, and `session/state.rs` the in-memory maps that are the _only_
state this daemon keeps (no task files — a restart stops whatever's
running; the actual claude session is the durable store, found again by
name via `hive_claude::SessionStore`). `session/config.rs` and
`session/status.rs` hold the run's configuration and what `status` and
`interrupt` say.
- **`mcp.rs`** — the `rmcp` tool routers (the parent's
`start`/`continue`/`status`/`interrupt` on `/mcp`, the subagent's
`goal_reached`/`need_help` on `/signal/mcp/<token>`) + `serve_http`.
Neither signal tool takes a session name: the token in the path is
minted per run and resolved to a session before dispatch, so a subagent
has no way to name — and therefore no way to signal — a sibling. One
route with a path parameter, because the `Router` is built once at
startup and sessions come and go for the daemon's whole life.
- **`paths.rs`** — the in-agent todo-socket path.