Context command shows incorrect remaining context with mixed models
Issue Description
The new /context command does not correctly display remaining context when using mixed models, such as when switching from Opus plan mode to Sonnet.
Current Behavior
When using mixed models (e.g., starting in Opus plan mode then switching to Sonnet), the context display shows:
Context Usage
⛁ ⛀ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ claude-sonnet-4-20250514 • 94k/200k tokens (47%)
...
⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ Free space: 105.8k (52.9%)
But simultaneously shows "2% context window left until autocompact", which is contradictory.
Expected Behavior
The context display should accurately reflect the actual remaining context window, taking into account context usage from previous models in the same session.
Root Cause
It appears the context calculation doesn't account for context used by Opus (or other models) earlier in the session, only showing the current model's usage against its own context window rather than the cumulative session context usage.
Steps to Reproduce
- Start a session in Opus plan mode
- Use significant context in Opus
- Switch to Sonnet
- Run
/contextcommand - Observe contradictory context usage information
Environment
- Platform: Windows (MINGW64_NT-10.0-26100)
- Mixed model usage (Opus plan mode → Sonnet)
- Claude Code CLI
Impact
This makes it difficult to accurately track context usage and plan accordingly when working across different models in the same session.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗