github alexgreensh/token-optimizer v5.11.52

latest release: v5.11.53
9 hours ago

Trustworthy context-fill reporting, and a fix for cross-session attribution.

Context fill now shows its working (#95). The reported percentage names the window it was divided by and where that window came from:

Context at 19% capacity (1M window, source: default 1M)

detect_context_window() always computed that provenance; every call site discarded it. If a stray CLAUDE_CODE_DISABLE_1M_CONTEXT is forcing a 200k window (it is read from settings.json's env block, not just the shell), the message now names it.

Impossible readings are refused. Fill was min(1.0, tokens / window), so a misdetected window produced a confident 100% rather than an error. The contradiction is now detected before the clamp can hide it, and suppresses the percentage instead of reporting it.

Disagreements with the host are recorded. When Claude Code's own fill figure differs from ours by more than 10 points, the gap is captured rather than silently accepted.

No more cross-session attribution. The verbosity nudge could read another session's cache when no transcript path was supplied, so a brand-new session inherited a stale session's fill and quality and was told to conserve. It now refuses to speak for a session it cannot verify.

Hardening. The provenance label is sanitised and length-bounded before it reaches the model's context. A malformed live-fill.json can no longer crash the hook. A suppressed nudge explains itself on stderr instead of failing silently.

Testing. The suite now runs in CI for the first time, across Python 3.11, 3.12 and 3.13, and the new guards are covered by tests that execute the code rather than grep its source.

Don't miss a new token-optimizer release

NewReleases is sending notifications on new releases.