hermes-agent/scripts
Michael Jordan ac48add3a7 feat(agent): report context occupancy, not just tokens saved
Tokens saved is the wrong headline for this feature. Micro-compaction is
not an efficiency optimisation — the same summarization work happens either
way. What it buys is (a) that work amortized across turns instead of one
stall, and (b) a window kept low enough that a session runs much further
before needing a hard compaction at all.

Neither shows up in "net tokens saved". A session can save nothing on paper
and still be a clear win on both counts.

So the telemetry now carries occupancy: tokens_after as a share of the
compaction threshold, plus the threshold and resolved window it was
computed from. That is the number that says whether a session has headroom
left. The report leads with it, and cross-references the batch
`compression_attempt` lines already in the log so it can show how often the
long pause actually fired — ideally never.

Occupancy is read from the cached threshold only. The public
`threshold_tokens` property resolves lazily and can issue a synchronous
/models probe (#32221); telemetry must never be the thing that blocks a
turn, so an unresolved window reports null. In practice a pass has already
resolved it via the tail calculation, so the field is populated. A test
pins the no-forcing behaviour directly against the emitter.

The report is pure ASCII: `scripts/check_subprocess_stdin.py` currently
dies on a cp1252 console before printing its results, and a diagnostic tool
that crashes on the platform it is diagnosing is worse than no tool.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-31 17:44:19 +05:30
..
ci
…
lib
…
observability
…
tests
…
whatsapp-bridge
…
LIVETEST_README.md
…
add_contributor.py
…
analyze_livetest.py
…
benchmark_browser_eval.py
…
build_model_catalog.py
…
build_skills_index.py
…
capture-cage-terminal.sh
…
check-windows-footguns.py
…
check_subprocess_stdin.py
…
contributor_audit.py
…
dev-sandbox.sh
…
discord-voice-doctor.py
…
docker_config_migrate.py
…
docker_rebootstrap_nous_session.py
…
generate_conformance_vectors.py
…
hermes-gateway
…
install.cmd
…
install.ps1
…
install.sh
…
install_psutil_android.py
…
iso-certify.py
…
keystroke_diagnostic.py
…
kill_modal.sh
…
lint_diff.py
…
micro_compaction_report.py feat(agent): report context occupancy, not just tokens saved 2026-07-31 17:44:19 +05:30
profile-tui.py
…
release.py chore: add contato@webtecnica.com.br → webtecnica to AUTHOR_MAP 2026-07-30 20:52:19 +05:00
run_tests.sh
…
run_tests_parallel.py
…
sample_and_compress.py
…
smoke_nemo_relay_shared_metrics.py
…
tool_search_livetest.py
…
tool_search_livetest2.py
…
tool_search_livetest_ue.py
…
tool_search_livetest_ue_disc.py
…
tool_search_livetest_ue_hard.py
…