readme: richer architecture sketch + per-turn / approval flow

This commit is contained in:
müde 2026-05-15 16:45:54 +02:00
parent 2e8597b9db
commit 8dc9b24934

View file

@ -8,20 +8,43 @@ coordinates the swarm and gates lifecycle changes on user approval via git
commits, surfaced through a vibec0re-styled HTTP dashboard. commits, surfaced through a vibec0re-styled HTTP dashboard.
``` ```
┌────────────────────────┐ host (NixOS, runs hive-c0re.service)
│ hive-c0re (Rust) │
operator ──▶ │ • lifecycle │ ─▶ nixos-containers ├── operator
│ • broker (sqlite) │ ├── hm1nd (manager) │ ├── browser → :7000 hive-c0re dashboard (containers, approvals)
│ • approvals (sqlite) │ ├── h-alice (sub-agent) │ ├── browser → :8000 / :8100-8999 per-agent web UIs (live SSE, send, login)
│ • dashboard :7000 │ └── h-bob ... │ └── CLI → /run/hyperhive/host.sock JSON-line admin protocol
│ • per-agent sockets │
└────────────────────────┘ ├── hive-c0re (Rust daemon)
│ ├── lifecycle nixos-container CRUD + per-agent flake generation
│ ├── broker sqlite messages + tokio broadcast (powers SSE + wake-ups)
│ ├── approvals sqlite queue, two kinds: ApplyCommit (config) + Spawn
│ ├── auto_update rebuilds any container whose recorded flake rev is stale
│ ├── dashboard axum HTTP + async-form actions + SSE message flow
│ └── sockets /run/hyperhive/{host,manager,agents/<n>}/mcp.sock
└── nixos-containers (each bind-mounts its socket dir → /run/hive,
│ its credentials dir → /root/.claude;
│ manager additionally gets /agents RW)
├── hm1nd hive-m1nd serve : claude turn loop +
│ MCP (send / recv / request_spawn / kill /
│ request_apply_commit) + web UI on :8000
└── h-<name> hive-ag3nt serve : claude turn loop +
MCP (send / recv) + web UI on a hashed :8100-8999
``` ```
Each container runs a harness binary that drives `claude --print --continue` Each turn: harness pops one inbox message (Recv long-polls server-side and
in a turn loop, exposes a per-agent web UI with a live event stream, and wakes on a broker Sent event) → builds a wake prompt → spawns
talks to the broker over a bind-mounted unix socket via an embedded MCP `claude --print --continue --output-format stream-json --mcp-config …`
server claude calls into. streams JSON events into the per-agent SSE bus → claude drives any further
`recv`/`send` itself via the embedded MCP server.
Config changes flow the other way: manager edits `/agents/<name>/config/agent.nix`
(bind-mounted from the host's proposed repo) → commits → submits the sha as
an approval → operator clicks ◆ APPR0VE on the dashboard → hive-c0re copies
the file into the applied repo and `nixos-container update`s the agent.
## Host config ## Host config