[BUG] Random context usage at start of new sessions and on "/clear"
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Hi Team,
From the recent versions and updates, I have been noticing the following issues in Claude Code:
Even after using /clear, the context always starts at around 22%. When I start new sessions, sometimes it begins at 5%, sometimes at 13%. It feels quite random. I tested this by opening multiple sessions without making any changes, and I still observed the same behaviour. Initially it doesn't show 0 or any level, as soon as I start the first message, it jumps to 22 or higher.
Ideally, when the context is cleared or a new session is started, it should begin close to 0%. But currently, it seems like some previous state or overhead is still being counted.
Because of context limits, I am forced to clear the context frequently while coding. At the same time, due to hourly rate limits, this repeated usage may be increasing the overall cost unnecessarily for the organisation.
It would be really helpful if you could look into this issue and fix it.
What Should Happen?
Claude Code should properly reset the context when using /clear or when starting a new session. The context usage should start close to 0% consistently, instead of showing random values like 5%, 13%, or 22%.
The system should not carry over any previous state or hidden usage after clearing. This will help ensure accurate context tracking and avoid unnecessary usage affecting rate limits and cost.
Error Messages/Logs
Steps to Reproduce
- Open Claude Code
- Start a new session
- Check the initial context usage percentage
- Use /clear to reset the context after reaching 100% or wait for 1-2 compact sessions to get over. That will give the accurate results. Then use "/clear" or start new sessions. Observe no percent is being shown now. Now enter any first message and click "Enter".
- Check the context usage again
- Repeat by opening multiple new sessions without making any changes
Observed:
The context usage starts at different values like 5%, 13%, or 22%, even after clearing or starting a new session.
Claude Model
Not sure / Multiple models
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.114
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Warp
Additional Information
_No response_
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗