/branch causes massive context inflation — 6% to 73% after single message
Preflight Checklist
- [x] I searched existing issues and found no duplicates
- [x] I am using the latest version of Claude Code
What's Wrong?
After using /branch to create a branch from a conversation at 6% context (59.7k/1M tokens), the new branch shows 73% context (735k/1M tokens) after sending a single short message.
The system/tools/memory/skills categories remain identical between parent and branch — the entire inflation is in the Messages category:
- Before branch: Messages = 40.5k tokens (4.0%)
- After branch + 1 message: Messages = 715.6k tokens (71.6%)
That's ~675k tokens appearing from nowhere. One short message cannot account for this.
Steps to Reproduce
- Have a conversation at ~6% context usage (59.7k tokens)
- Run
/contextto confirm usage - Run
/branch - Send one short message in the new branch
- Run
/contextagain
Expected Behavior
Context usage in the branch should be roughly the same as the parent session plus the new message/response — maybe 7-8%, not 73%.
Actual Behavior
Context jumps from 6% (59.7k) to 73% (735k). The Messages category inflates from 40.5k to 715.6k tokens.
All non-message categories are identical between parent and branch:
- System prompt: 6.5k (0.6%)
- System tools: 7.9k (0.8%)
- MCP tools: ~2.2k (0.2%)
- Memory files: 2.9k (0.3%)
- Skills: 1.2k (0.1%)
- Autocompact buffer: 21k (2.1%)
Only Messages inflates: 40.5k → 715.6k. This suggests /branch is either duplicating/expanding message history without compaction, or the token counter is miscalculating after a branch.
Screenshots
Will attach /context screenshots (before and after) in comments.
Claude Model
Opus 4.6 (1M context)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.96
Platform
Anthropic API
Operating System
macOS (Darwin 24.6.0)
Terminal/Shell
zsh
Additional Information
This is distinct from the general token consumption issues (#41930, #40524, #41607) — those are about cache invalidation and compaction bugs. This is specifically about /branch inflating the Messages token count by ~18x immediately.
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗