Correct totals. One API response split across several JSONL lines is now counted once (it was over-counted 2.4x to 3.4x, with Tools and Retrieved inflated most). Resume replays are deduplicated by uuid, and phantom system records no longer count as messages.
Correct window size. fable-5 and opus-5 sessions, the [1m] model in settings.json, the statusline payload's context_window_size, and pasted /context output all feed context-limit detection. A fresh 1M session no longer reads as 81% hot.
Correct compaction math. Auto-compaction is modelled as a 33K-token headroom buffer (83.5% of a 200K window, 96.7% of 1M) instead of a flat 80%; the window total includes the last response; compaction events use Claude Code's own postTokens and trigger (auto/manual).
System bucket restored. The fixed Claude Code context (system prompt, core tool schemas, memory, skills, hooks) is derived again instead of being discarded above 15K.
New record types. Attachment records (hook output, skill and tool listings, task reminders, nested CLAUDE.md, memory files) are classified; non-human user records (task notifications, slash-command wrappers, skill bodies) no longer masquerade as your prompt.
Tool catalogue rebuilt. Placeholder tool names removed; PowerShell, Workflow, ScheduleWakeup and ToolSearch-loaded deferred tools recognised; MCP servers discovered from ~/.claude.json, plugins, and the session itself.
Plus:
calibrateparses the current/contexttable format.- Buckets now reconcile to the API window total and expose raw
contentTokens; trend records carrybucketBasis. - Auto-inject advisory: same prefix, headroom-based default gate, corrected explanation of when Claude Code compacts.
Fully offline, zero API calls, as always.
Upgrade notes
- JSON consumers: bucket
tokensnow sum tototal_tokensexactly; the raw classifier estimates moved tocontentTokensper bucket.reconciliation.basissays which basis a view is on. COMPACTION_THRESHOLDis gone; the trigger iscontext_limit - 33,000(override viaautocompactBufferTokensin~/.claude-crusts/config.json).- Auto-inject without an explicit
thresholdin config now fires near the real auto-compaction trigger instead of at 70% usage. Setthresholdexplicitly to keep the old behaviour.