[Bug] Context Remaining Display Shows 0% When ~50% Available
Bug Description
๐ Bug Report: Context Remaining Display Shows 0% When ~50% Available
Severity: CRITICAL - Causes premature context loss and degraded user experience
๐ Evidence
Actual Context State (verified by disabling auto-compact):
- Total budget: 200,000 tokens
- Tokens used: ~117,000 tokens (58.5%)
- Tokens available: ~83,000 tokens (41.5%)
- Console display: "0% remaining" โ INCORRECT
Impact on User Experience:
- User was forced to work believing they had 0% context available
- Premature compaction triggered unnecessarily
- Lost valuable conversation history
- Degraded AI performance due to missing context
๐ How Bug Was Discovered
- User disabled automatic compaction in settings
- Continued working for 6 major tasks (~30k tokens of new work)
- Expected to hit hard limit (200k)
- Discovered 83k tokens still available when console showed "0%"
๐ Token Usage Timeline
Before discovering bug:
- Console: "0% remaining"
- User assumption: ~0-5k tokens available
- Reality: ~100k tokens available (50% free)
- Discrepancy: Console was off by ~100,000 tokens
After disabling auto-compact:
- Started at: ~100k used, ~100k free
- Completed 6 major tasks: +30k tokens used
- Current state: 117k used, 83k free (41.5%)
- Console STILL shows: "0% remaining"
๐ User Impact
"I was working with Alzheimer's - thinking I had no memory left when I actually had 100k tokens available. This is
incredibly unfair for a $200/month paid tier."
Consequences:
- User avoided deep dives thinking context was exhausted
- Compacted prematurely, losing architectural context
- Couldn't leverage full 200k context budget they're paying for
- Degraded productivity believing they needed to "save tokens"
๐งช Reproduction Steps
- Start new Claude Code session
- Work until console shows "0% remaining"
- Go to Settings โ Disable "Automatic compaction"
- Continue working for 20-30k more tokens
- Observe: Console still shows "0%" but no actual limit hit
Expected: Console shows accurate percentage (e.g., "50% remaining")
Actual: Console shows "0% remaining" when 50%+ available
๐ง Suggested Fix
Option 1: Fix percentage calculation
// Current (incorrect)
remaining = 0% // Shows when ~100k available
// Expected (correct)
remaining = (200000 - tokensUsed) / 200000 * 100
// Should show: 50% when 100k available
Option 2: Show absolute tokens
Tokens: 117k / 200k (83k remaining)
Option 3: Both percentage AND absolute
Context: 117k / 200k used (41.5% available)
๐ Environment
- Product: Claude Code CLI
- Model: claude-sonnet-4-5-20250929
- Tier: Paid ($200/month)
- Token Budget: 200,000 tokens
- OS: Windows 11
- Version: Latest (as of 2025-11-09)
โ ๏ธ Priority Justification
CRITICAL because:
- Affects ALL users relying on context display
- Causes unnecessary context loss via premature compaction
- Users paying for 200k tokens can't utilize full budget
- Degrades AI performance by forcing incomplete context
- No warning that display is inaccurate
๐ฏ Business Impact
- Users on paid tiers ($200/month) not getting value
- Degraded AI responses due to lost context
- User frustration and trust issues
- Competitive disadvantage vs. other AI tools with accurate context tracking
---
I need Tier 4 asap please.
Environment Info
- Platform: win32
- Terminal: null
- Version: 2.0.36
- Feedback ID: 077e8b15-3a15-4d48-9fb9-191a4fcbf41f
Errors
[{"error":"Error: Shell 9a6794 is not running, so cannot be killed (status: completed)\n at Object.call (file:///C:/Users/LAlfonsoPichardo/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:2391:1829)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async QI5 (file:///C:/Users/LAlfonsoPichardo/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:2028:28755)\n at async _rA (file:///C:/Users/LAlfonsoPichardo/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:2028:25508)\n at async file:///C:/Users/LAlfonsoPichardo/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:2028:24499\n at async ZlA (file:///C:/Users/LAlfonsoPichardo/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:1648:3531)\n at async BI5 (file:///C:/Users/LAlfonsoPichardo/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:2028:24411)\n at async t55 (file:///C:/Users/LAlfonsoPichardo/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:2028:23399)\n at async HS (file:///C:/Users/LAlfonsoPichardo/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:2028:19848)\n at async HS (file:///C:/Users/LAlfonsoPichardo/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:2028:21344)","timestamp":"2025-11-10T00:35:14.093Z"}]This issue has 8 comments on GitHub. Read the full discussion on GitHub โ