| 1 | # Darwin Deck - Agent Command Center (contract) |
| 2 | |
| 3 | "See every agent, and their sub-agents, and theirs - recursively - live, and drive them." |
| 4 | One event bus → one live force-directed tree → attach-to-terminal. Reuse the Odysseus Cockpit's |
| 5 | in-SPA SSH pane infra (CT245 `cockpit` project) for the terminal layer; build the bus + tree new. |
| 6 | |
| 7 | **Runtime:** Node/TypeScript event collector + WebSocket fan-out, or Python FastAPI + WS. Lives on |
| 8 | the Darwin CT. Port: WS `:9892`, HTTP `:9893`. |
| 9 | |
| 10 | ## 1. Event schema (every agent emits these) |
| 11 | ```jsonc |
| 12 | { |
| 13 | "ts": "2026-06-24T00:30:00Z", |
| 14 | "agent_id": "a5160ed9...", // stable per agent run |
| 15 | "parent_id": "f0e93741..." | null, // the spawner → builds the recursive tree |
| 16 | "type": "spawned|tool_call|child_spawned|returned|error|token_tick", |
| 17 | "label": "Build Cortex gateway", |
| 18 | "model": "sonnet|opus|haiku|glm-5.2|codex|...", |
| 19 | "status": "running|done|error|paused", |
| 20 | "tool": "Bash|Write|...", // for tool_call |
| 21 | "tokens": 53542, // cumulative for token_tick |
| 22 | "host": "ct215|ct241|ct247|...", |
| 23 | "session": "..." |
| 24 | } |
| 25 | ``` |
| 26 | |
| 27 | ## 2. Sources of events (where the bus listens) |
| 28 | - **Claude Code agents** (this harness): the Task/Agent transcripts under the session task dir emit |
| 29 | spawn/return; tail + normalize. Recursive `parent_id` chains nest the tree to any depth. |
| 30 | - **GLM/OpenCode (CT247), Codex (CT241):** their session logs/SSE - normalize into the same schema. |
| 31 | - **Schedulers/loops** (Hermes-style cron, JobForge): heartbeat events. |
| 32 | - A thin `darwin-emit` helper any process can `POST /event` to, so future agents self-report. |
| 33 | |
| 34 | ## 3. The tree (the organism's nervous system) |
| 35 | - Live **force-directed graph**: you → your agents → their agents → theirs. Each node = model badge, |
| 36 | status color, token spend, current tool. Edges = parent→child spawns. |
| 37 | - This IS the Face's "nervous system" view (blueprint §6) - same data, rendered as living synapses; |
| 38 | active tool_call = a firing synapse. Idle/done agents dim; errored agents flash red. |
| 39 | - Click a node → **attach to its terminal** via the Cockpit SSH pane (reuse, don't rebuild). |
| 40 | |
| 41 | ## 4. Health feed |
| 42 | Deck also exposes `/health` rollups (active agents, total token spend, stuck-waiting-on-Zion count) |
| 43 | that feed (a) the organism's vitality and (b) the 24h dead-man check-in brief. |
| 44 | |
| 45 | ## 5. Acceptance |
| 46 | - A real spawned subagent appears in the tree within ~1s, nests under its parent, shows live token |
| 47 | growth, and goes dim on return. |
| 48 | - Attach-to-terminal opens the agent's live pane. |
| 49 | - Survives an engine/agent dying without crashing the bus (graceful, like the Cortex). |