Context window token count fluctuates inconsistently (185K vs 165K) within same session
Resolved 💬 3 comments Opened Jan 22, 2026 by costa-marcello Closed Jan 26, 2026
Description
The context window token count display fluctuates significantly within the same session, showing inconsistent values (e.g., 185K tokens vs 165K tokens) without any clear correlation to actual context changes.
Observed Behavior
- Status line shows ~185,000 tokens at one point
- Same session later shows ~165,000 tokens
- No correlation to actual context additions/removals
- Makes it impossible to predict when compaction will trigger
Expected Behavior
Token count should be deterministic and consistent for the same conversation state.
Environment
- Claude Code version: 2.1.15
- OS: macOS (Darwin 25.2.0)
- Configuration:
CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=95autoCompactEnabled: false(manual compaction)ENABLE_TOOL_SEARCH=true- 6 MCP servers configured
- 3 plugins enabled
Related Issues
This appears related to but distinct from:
- #17959 - 19% discrepancy (fixed offset)
- #18178 - Display shows 15% free but reports limit reached
- #18705 - Token limit hard-stop without warning
The difference here is that the count is not just offset by a fixed amount—it fluctuates unpredictably within the same session.
Impact
Users cannot reliably:
- Predict when auto-compact will trigger
- Manually manage context window usage
- Trust the displayed percentage/token count
Possible Root Cause
Speculation: The token calculation may be using different methods at different times (e.g., cached vs recalculated values), or MCP/plugin overhead is being counted inconsistently.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗