You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Context display should use autocompactWindow as denominator instead of full context window #540
Thanks for the detailed report. There is no config option today for changing the context denominator. I am keeping this open as an enhancement.
The main design decision is the source of truth: prefer an official stdin field for the effective auto-compact window if Claude Code exposes one; otherwise this needs an explicit HUD config instead of broad implicit reads from Claude settings. The display should preserve current defaults.
Re the stdin path: Claude Code's statusline schema doesn't expose an autoCompactWindow field. The context_window block carries context_window_size, current_usage, used_percentage, and remaining_percentage (src/types.ts:17-30) — no analog of the user's autoCompactWindow setting from ~/.claude/settings.json.
That puts this on the "otherwise this needs an explicit HUD config" branch. Concrete shape that preserves current defaults:
display.autoCompactWindow: number | null (default null)
When null → today's behavior unchanged: prefer used_percentage from stdin, fall back to context_window_size
When set → ignore used_percentage (computed against the full window upstream) and use min(100, round(totalTokens / autoCompactWindow * 100)) in both getContextPercent and getBufferedPercent
Both getters in src/stdin.ts prefer the native field today (src/stdin.ts:163-165, 181-183), so the override has to short-circuit them rather than feed through the existing fallback. Happy to ship if the shape lands right.
Implemented in #589. Adds an opt-in display.autoCompactWindow so the context bar, percent, and token display all use the auto-compact window as the denominator (matching /context), with default behavior unchanged when unset.
Activity
jarrodwatts commentedon May 13, 2026
Thanks for the detailed report. There is no config option today for changing the context denominator. I am keeping this open as an enhancement.
The main design decision is the source of truth: prefer an official stdin field for the effective auto-compact window if Claude Code exposes one; otherwise this needs an explicit HUD config instead of broad implicit reads from Claude settings. The display should preserve current defaults.
truffle-dev commentedon May 13, 2026
Re the stdin path: Claude Code's statusline schema doesn't expose an autoCompactWindow field. The
context_windowblock carriescontext_window_size,current_usage,used_percentage, andremaining_percentage(src/types.ts:17-30) — no analog of the user's autoCompactWindow setting from~/.claude/settings.json.That puts this on the "otherwise this needs an explicit HUD config" branch. Concrete shape that preserves current defaults:
display.autoCompactWindow: number | null(defaultnull)null→ today's behavior unchanged: preferused_percentagefrom stdin, fall back tocontext_window_sizeused_percentage(computed against the full window upstream) and usemin(100, round(totalTokens / autoCompactWindow * 100))in bothgetContextPercentandgetBufferedPercentBoth getters in src/stdin.ts prefer the native field today (src/stdin.ts:163-165, 181-183), so the override has to short-circuit them rather than feed through the existing fallback. Happy to ship if the shape lands right.
mvanhorn commentedon Jun 3, 2026
Implemented in #589. Adds an opt-in
display.autoCompactWindowso the context bar, percent, and token display all use the auto-compact window as the denominator (matching/context), with default behavior unchanged when unset.Merge pull request #589 from mvanhorn/feat/540-autocompact-window-den…