From fc8ec13620e98823db6e5eec9ba4e2751d2a1a05 Mon Sep 17 00:00:00 2001 From: damocles Date: Wed, 18 Nov 2026 20:08:22 +0100 Subject: [PATCH] docs: drop the turn-stats sqlite section and stale mentions, point the grafana check at the daemon --- .../agent-state/persistence.md | 10 ---------- docs/5-project/process/gotchas.md | 4 ++-- hive-agent/src/paths.rs | 5 ++--- hive-c0re/src/coordinator.rs | 3 +-- hive-c0re/src/main.rs | 3 --- nix/module-eval/grafana.nix | 18 +++++++++++------- 6 files changed, 16 insertions(+), 27 deletions(-) diff --git a/docs/4-implementation/agent-state/persistence.md b/docs/4-implementation/agent-state/persistence.md index 854727d16..00a5eeed7 100644 --- a/docs/4-implementation/agent-state/persistence.md +++ b/docs/4-implementation/agent-state/persistence.md @@ -41,16 +41,6 @@ Retention: successful turn, so `requeue_inflight` can still requeue an unacked row on a crash. -### `/harness/hyperhive-turn-stats.sqlite` (per agent) - -Nothing writes or reads this file now. Older harnesses wrote per-turn -`turn_stats` and `sessions` tables there, and an older `hive-bash-daemon` a -`bash_commands` table; they stay in existing files, which are safe to delete -by hand. The bash daemon counts executed commands itself and exports them -over OTEL (see -[`observability.md`](../scheduler/observability.md)), and the one value the -harness reads back between runs lives in `hyperhive-harness.json`, below. - ### `/state/hyperhive-harness.json` (per agent) Consolidated harness state file written atomically (`.tmp` + rename) by diff --git a/docs/5-project/process/gotchas.md b/docs/5-project/process/gotchas.md index d7af54e9b..342e4fdad 100644 --- a/docs/5-project/process/gotchas.md +++ b/docs/5-project/process/gotchas.md @@ -202,8 +202,8 @@ across `destroy`/recreate (`--purge` wipes them). The harness exposes the same path via `$HYPERHIVE_STATE_DIR`. System prompts tell agents to keep durable knowledge here (`notes.md`, anything else) — the harness's own -internal files (`hyperhive-turn-stats.sqlite`, -`hyperhive-model`) live in the separate `harness` dir instead, so they +internal files (`hyperhive-model`, +`hyperhive-effort`) live in the separate `harness` dir instead, so they don't clutter what claude sees as "my notes dir" (see [`docs/4-implementation/agent-state/persistence.md`](../../4-implementation/agent-state/persistence.md)). Survives `destroy`/recreate alongside the claude dir. diff --git a/hive-agent/src/paths.rs b/hive-agent/src/paths.rs index 3e4c5c3af..28f8e18b0 100644 --- a/hive-agent/src/paths.rs +++ b/hive-agent/src/paths.rs @@ -2,7 +2,7 @@ //! //! All agents (including the manager `root`) use `/agents/{label}/state` //! for agent-owned durable notes, and `/agents/{label}/harness` for -//! harness-internal files (`hyperhive-turn-stats.sqlite`, `hyperhive-model`, etc.) +//! harness-internal files (`hyperhive-model`, etc.) //! that should not clutter what claude sees as "my notes dir". //! Claude credentials live at `$HOME/.claude` (resolves to //! `/home//.claude` because the harness service runs as a @@ -28,8 +28,7 @@ pub fn state_dir() -> PathBuf { } /// Harness-internal state directory. Holds files the harness owns -/// (`hyperhive-turn-stats.sqlite`, -/// `hyperhive-model`) so they do not appear inside the agent-visible +/// (`hyperhive-model`, ...) so they do not appear inside the agent-visible /// `/agents/{label}/state` tree. Delegates to the shared canonical /// resolver in `hive_agent_sock::paths` so the harness + every /// out-of-process MCP daemon resolve this identically (reads diff --git a/hive-c0re/src/coordinator.rs b/hive-c0re/src/coordinator.rs index 7ae234f3b..8229010cf 100644 --- a/hive-c0re/src/coordinator.rs +++ b/hive-c0re/src/coordinator.rs @@ -750,8 +750,7 @@ impl Coordinator { /// Per-agent harness-internal state dir. Bind-mounted RW into the /// agent container at `/agents/{name}/harness`. Holds sqlite dbs - /// and config files owned by the harness (`hyperhive-turn-stats.sqlite`, - /// `hyperhive-model`) — kept separate + /// and config files owned by the harness (`hyperhive-model`, ...) — kept separate /// from the agent-visible `state/` so claude's "my notes" view is /// uncluttered and the host vacuum has a clean sweep root. pub fn agent_harness_dir(name: &hive_types::Ident) -> PathBuf { diff --git a/hive-c0re/src/main.rs b/hive-c0re/src/main.rs index 63341f285..67e8acfab 100644 --- a/hive-c0re/src/main.rs +++ b/hive-c0re/src/main.rs @@ -325,9 +325,6 @@ async fn cmd_serve( // now run agent-side in the harness (`hive_agent::vacuum`): the files are // agent-owned, so host-side deletes hit PermissionDenied / readonly-db // under privsep. See issue tracker "perms borked". - // (hyperhive-turn-stats.sqlite has no vacuum: it holds only the bash - // command heads now, small, and the legacy stats viewer reads what older - // harnesses left in it.) // Slow per-container disk sampler: hive-priv measures each agent's state/ // + work/ + writable rootfs every 30 min, cached so a sample only reads // cgroup files. Feeds `disk_bytes` to the OTEL exporter. See diff --git a/nix/module-eval/grafana.nix b/nix/module-eval/grafana.nix index 025c5b1e6..508e77542 100644 --- a/nix/module-eval/grafana.nix +++ b/nix/module-eval/grafana.nix @@ -567,11 +567,12 @@ let && lib.any (e: lib.hasInfix "hyperhive.container.memory.oom_kills" e) exprs; } { - # The agents board's turns tab reads the turn, tool, bash command, reminder - # and session metrics the harness records, grouped by the labels it sets on them. A renamed instrument or - # label there is a tab of empty panels, so each must still be spelled in the - # harness; and the duration percentiles are only right while the histogram - # has bounds past the SDK's 10 s default ceiling. + # The agents board's turns tab reads the turn, tool, reminder and session + # metrics the harness records, and the bash command counter the bash + # daemon records, grouped by the labels they set. A renamed instrument or + # label there is a tab of empty panels, so each must still be spelled in + # the harness or the daemon; and the duration percentiles are only right + # while the histogram has bounds past the SDK's 10 s default ceiling. name = "the agents dashboard's turns tab reads the turn metrics and labels the harness records"; ok = let @@ -582,6 +583,7 @@ let n: map (q: q.spec.query.spec.expr) board.spec.elements.${n}.spec.data.spec.queries ) names; recorded = builtins.readFile ../../hive-agent/src/otel_turn_metrics.rs; + bashRecorded = builtins.readFile ../../hive-bash-mcp/src/stats.rs; in tab != null && lib.length names == 14 @@ -590,16 +592,18 @@ let "hyperhive.agent.turn.duration" "hyperhive.agent.session.count" "hyperhive.agent.tool.calls" - "hyperhive.agent.bash.commands" "hyperhive.agent.reminders" "hyperhive.agent.first_turn.context" "wake_from" "result_kind" "model" "tool" - "command" "event" ] + && lib.all (m: lib.hasInfix "\"${m}\"" bashRecorded) [ + "hyperhive.agent.bash.commands" + "command" + ] && lib.all (l: lib.any (e: lib.hasInfix l e) exprs) [ "wake_from" "result_kind"