diff --git a/docs/4-implementation/agent-state/persistence.md b/docs/4-implementation/agent-state/persistence.md index 59af116c3..0f7b1f3e5 100644 --- a/docs/4-implementation/agent-state/persistence.md +++ b/docs/4-implementation/agent-state/persistence.md @@ -152,13 +152,12 @@ Capturing the full stream (rather than a short tail buffer) matters because real eval errors routinely run long — "tried alternatives" blocks alone are often 30+ lines — so a truncated tail would cut off the actual failure and leave only the host journal holding the -complete output. With this table the dashboard can surface the entire -log. +complete output. This table holds the entire log; no HTTP route serves +it. Three indices: -- `(agent, started_at)` — backs the per-agent latest-N lookup used - by the agent card chip. +- `(agent, started_at)` — per-agent lookup by recency. - `(status, finished_at)` — backs the retention sweep that runs as part of the existing hourly vacuum. - `(node_id)` — added by a later migration so a build log row can be diff --git a/docs/4-implementation/agent-state/roster.md b/docs/4-implementation/agent-state/roster.md index 347ed0e8e..1329b4b97 100644 --- a/docs/4-implementation/agent-state/roster.md +++ b/docs/4-implementation/agent-state/roster.md @@ -101,10 +101,8 @@ state dirs work as for every other agent. - **Wire-protocol** — `hive-core-agent-sock`'s unified `Request` enum is the same on both socket flavours. Container lifecycle ops (kill/start/restart/rebuild) go through the separate host-admin - socket `hivectl` speaks. `Wake` (inject a `from: ` message straight - into the caller's own inbox) is on this socket too, unprivileged on - both flavours; matrix, bash and forge don't call it — their - notifications push a todo on the harness's in-agent socket (see + socket `hivectl` speaks. Matrix, bash and forge wake the agent by pushing a todo on the + harness's in-agent socket (see [`docs/4-implementation/turn-loop/mcp.md`](../turn-loop/mcp.md#waking-the-agent-from-inside-the-container)). - **Storage/mounts** — the `manage_root_agent` permission, which the [`ruth` archetype](../../2-handbook/swarm/archetypes.md#the-built-in-archetypes) grants, gets a container diff --git a/docs/4-implementation/agent-tools/forge-notify.md b/docs/4-implementation/agent-tools/forge-notify.md index b428cfce6..a0ec0d323 100644 --- a/docs/4-implementation/agent-tools/forge-notify.md +++ b/docs/4-implementation/agent-tools/forge-notify.md @@ -8,9 +8,8 @@ Its own long-running per-agent daemon (`hive-forge-notify`, a sibling of `hive-bash-daemon` / `hive-matrix-daemon`) — it used to be a background task inside the `hive-agent` serve loop. Polls `GET /api/v1/notifications?all=false` every 30 seconds (Forgejo's -unread-only filter), formats each notification as a broker -`Wake { from: "forge" }` message, and delivers it to the agent's own -inbox so claude's normal turn loop picks it up. +unread-only filter), formats each notification as a todo and pushes it to the agent's own +in-agent socket so claude's normal turn loop picks it up. The daemon waits about ten minutes for the agent's forge token, then exits 0, which its `Restart=on-failure` doesn't restart. A path unit diff --git a/docs/4-implementation/networking/gateway.md b/docs/4-implementation/networking/gateway.md index 5d6554260..9601a10e0 100644 --- a/docs/4-implementation/networking/gateway.md +++ b/docs/4-implementation/networking/gateway.md @@ -276,7 +276,7 @@ Solution: an `nginx http`-context `map $http_accept $matrix_spa_target { ... }` hive-c0re serves exactly two prefixes, so the dashboard routes by **path** — deterministic, where a content-type split would let one URL resolve differently by the caller's `Accept` header: -- `location /api/` → hive-c0re (`7000`): all dashboard data, actions, and the two SSE streams (`/api/dashboard/stream`, `/api/build-logs/id/{id}/stream`). `proxy_buffering off` and a 1d read timeout keep the streams live. +- `location /api/` → hive-c0re (`7000`): all dashboard data, actions, and the SSE stream (`/api/dashboard/stream`). `proxy_buffering off` and a 1d read timeout keep the stream live. - `location /health/` → hive-c0re: liveness and readiness. - `location /` → the dashboard dist (from the `servedFrontend` nix-store path) with `try_files $uri /index.html`. diff --git a/docs/4-implementation/turn-loop/claude-invocation.md b/docs/4-implementation/turn-loop/claude-invocation.md index e27ae53ff..231968fc9 100644 --- a/docs/4-implementation/turn-loop/claude-invocation.md +++ b/docs/4-implementation/turn-loop/claude-invocation.md @@ -172,12 +172,12 @@ best-effort — a failed checkpoint or `/compact` never fails the turn that already succeeded. An ACP agent gets the same policy; how it compacts is in [`hive-runtime/README.md`](../../../hive-runtime/README.md#acp-backend-compaction). -The operator can force a compaction any time via `POST /api/compact`. It's -**deferred**: the handler sets `Bus::request_compact()` and returns +The agent can force a compaction via its `compact` MCP tool. It's +**deferred**: the tool sets `Bus::request_compact()` and returns immediately; the harness runs the `/compact` at the next turn boundary (end of the in-flight turn in `drive_turn`, or — when the agent is idle — in `turn::run_pending_compact` on the serve loop's next empty poll). This -lets `/api/compact` work mid-turn instead of only when idle, without racing +lets the request work mid-turn instead of only when idle, without racing a live claude process. To disable proactive compaction for a specific agent, use the nix option: diff --git a/docs/4-implementation/turn-loop/mcp.md b/docs/4-implementation/turn-loop/mcp.md index 97f578a3f..ded65a9db 100644 --- a/docs/4-implementation/turn-loop/mcp.md +++ b/docs/4-implementation/turn-loop/mcp.md @@ -102,12 +102,12 @@ hive_name?, swarm_name?, matrix_accounts? }`. `matrix_accounts` is a `{state_dir}/hyperhive-status`. Pass `""` to clear. Not gated by the `meta` group — every agent needs to keep its dashboard status chip current regardless of which optional groups it holds. -- `compact` — agent self-service equivalent of the operator dashboard's - `/compact` button. No args. Gated server-side on the last completed +- `compact` — queues a compaction of the current session; the only way to + request one. No args. Gated server-side on the last completed turn's context usage: refused (with an explanation, no side effect) unless usage is above 66% of the effective context window. On a - pass, queues the same deferred `compact_pending` flag the dashboard - button sets — consumed at the end of the current turn, so it never + pass, queues the deferred `compact_pending` flag — consumed at the end + of the current turn, so it never races a live claude process, and the usual pre-compaction notes-checkpoint turn still fires first. Dispatched through the in-agent socket (`hive-agent-sock::Request::Compact`), not the @@ -159,15 +159,6 @@ makes the harness signal its own turn loop, with no hive-c0re round-trip. An external MCP server (or any other in-container process) can push its own todo the same way — `subsystem` is any string. -The host-served per-agent socket at `/run/hive/mcp.sock` carries a -lower-level `Wake` request (`hive_core_agent_sock::Request::Wake { -from, body }` — JSON-line, `{"cmd":"wake","from":"matrix","body":"new dm -from @alice"}\n`) that drops the body straight into the broker inbox as -`{from: