feat: capture normalised bash command heads for the favorite-tools stat

This commit is contained in:
damocles 2026-06-06 00:18:55 +02:00 committed by mara
commit 1569d55f78
7 changed files with 252 additions and 17 deletions

View file

@ -101,6 +101,16 @@ Bin-loop helpers `build_row` + `record` land each row at
`turn_end`; writes are best-effort, a sqlite hiccup logs + lets
the turn loop continue.
A sibling `bash_commands(ts INTEGER, head TEXT)` table in the same
file is written by the `hive-bash-mcp` daemon (not the harness): one
row per executed bash task recording the normalised command head -
the basename of the first real command, looking past `cd repo &&`
prefixes, env-assignments, and prefix-runners like `sudo`/`env`. It
backs the "favorite tools" view on the /stats page (aggregated
host-side). Best-effort and created on first write
(`CREATE TABLE IF NOT EXISTS`), so it's simply absent until a bash
task runs.
`hive-c0re::stats_vacuum` runs hourly and deletes rows older than 90 days
(`started_at < cutoff`). Age-only sweep, same pattern as `events_vacuum`.