Files
hermes-agent/persistence/sqlite/conversation/_store
Teknium ebbaa5288e fix(compression): archive every pruned tool result to disk; never prune the running turn
Salvage of #136488 (kshitijk4poor), review findings from 100yenadmin and kvnloo.

- No information loss: before the proactive prune shortens a tool result, its
  full original is written byte-verified to
  $HERMES_HOME/cache/pruned/<session>_<UTC>_<tool>_<id>.<json|txt> and the stub
  ends with " — full result: <path>", so read_file returns the exact output.
  A result whose write fails stays whole and the reclaim gate is re-checked on
  what is left (no commit -> the written files are removed).
- This also closes kvnloo's unflushed-original case without deferring the
  prune: the original no longer depends on the store having seen the row.
- The running turn is never shortened: the post-tool site passes the turn's
  user-row index (turn_start), and every row from it on is kept whole. Before,
  the count-only tail let a long tool loop stub its own earlier calls.
- One sweeper: the spillover reference/retention machinery now covers
  cache/pruned too (archive_refs_in_text / referenced_archive_refs; session
  delete retires both). Pruned files follow sessions.retention_days and are
  never deleted while state.db references them. cache/pruned is mounted for
  sandboxed backends like cache/spillover, and the stub names the path the
  backend sees.
- Cold-cache reading isolated in turn_proactive_prune.prompt_cache_is_cold so
  the shared cache clock can replace it in one line.
- Two skill-safety fixtures pin the old 4096 reclaim gate (the shipped 64K
  default made their ~7K-token transcripts no-ops).
2026-11-18 03:40:34 -08:00
..
…
…
…
…