Skip to content

Measure the status bar's context gauge against the auto-compact point - #11

Merged
evanwon merged 1 commit into
mainfrom
status-bar-autocompact
Dec 3, 2026
Merged

evanwon merged 1 commit into
mainfrom
status-bar-autocompact

Conversation

@evanwon

@evanwon evanwon commented Dec 3, 2026

Copy link
Copy Markdown
Owner

What changed

Both context gauges, in the desktop status bar and the terminal status line, now run to the point where Claude Code auto-compacts instead of to the end of the window. The amber and red thresholds (50% and 80%) now mean "halfway to compaction" and "nearly there".

  • Desktop mod (.claude/mods/status-bar): uses autoCompactThreshold from $.session.usage({ breakdown: 'summary' }), which the mod already fetched. With auto-compact off, the gauge runs to the end of the window as before. Clicking "ctx" now shows how far along to compaction the context is, for example "auto-compacts at 400,000, 60% of the way there". Added a test for a 1M window that compacts at 400k.
  • Terminal script (.claude/statusline-command.sh): the status line input has no auto-compact field (the docs say used_percentage is always against the full window). The script uses CLAUDE_CODE_AUTO_COMPACT_WINDOW, then autoCompactWindow in ~/.claude/settings.json (the model's modelSettings entry, which /autocompact writes, then the top-level key), and otherwise assumes the auto default of 400k, capped at the window. The label shows that point, for example 60%/400k.
  • README updated to match.

Why

Claude Code now auto-compacts near 400k on 1M models. Against the whole window, compaction runs at about 40%, so the gauges never reached amber or red before compacting.

For the reviewer

  • The terminal script reads the settings file in the jq call it already makes, so it starts no extra process. Timed over 20 runs, the old and new scripts both take about 200 ms.
  • The terminal script doesn't read project or managed settings, the --autocompact flag, or CLAUDE_AUTOCOMPACT_PCT_OVERRIDE. With auto, compaction actually runs near 367k, so the terminal gauge reads about 92% at that moment. The desktop gauge uses the exact threshold.
  • Tested: the pre-push checks pass (plugin validate, plugin test and tsc for both mods, bash -n). The script was run with sample inputs for the default, a per-model setting, a top-level setting, the environment variable, a 200k window, no settings file, and the real settings. The desktop band hasn't been seen live: it updates after merge and claude plugin update status-bar.

🤖 Generated with Claude Code

Claude Code now auto-compacts near 400k on 1M models, so a gauge against the
whole window never reached its 50/80% colors before compaction. The desktop
mod uses the threshold Claude Code reports; the terminal script, whose payload
carries none, reads CLAUDE_CODE_AUTO_COMPACT_WINDOW, then autoCompactWindow in
~/.claude/settings.json, else assumes the 400k auto default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@evanwon
evanwon merged commit f8e863a into main Dec 3, 2026
2 checks passed
@evanwon
evanwon deleted the status-bar-autocompact branch December 3, 2026 15:41
evanwon added a commit that referenced this pull request Dec 3, 2026
…ersion bump (#12)

* Bump status-bar to 0.2.0, and refuse a push that changes a mod without a bump

claude plugin update compares versions, so the auto-compact gauge from #11
never reached an installed copy: status-bar was still 0.1.0. The pre-push hook
now fails when a mod differs from origin/main (tests aside) with the same version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* pre-push: keep Git Bash from rewriting origin/main:<path>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant