Repeated context compaction drains weekly token budget — 9 consecutive compactions in a single session
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?
During a debugging session on an ESP32 firmware project (single .ino file, ~1470 lines), context compaction triggered 9 times consecutively — once per user message. This consumed approximately 13% of my weekly Pro token budget, while the actual useful work performed was minimal (a few grep searches, two file reads, one git comparison, one small edit).
Steps to reproduce:
Continue a session from a previous conversation (using context summary/continuation)
Work on a project with a large CLAUDE.md and verbose git status (many deleted files from a project rename)
Exchange several short messages with the assistant
Observe compaction triggering on every single message
Expected behavior:
Compaction should trigger sparingly and not re-run on every message. The token cost of a session should be proportional to the actual work performed.
Actual behavior:
Compaction ran 9 times in succession. Each compaction re-processes the entire accumulated context at Opus input token rates. The resulting token consumption was wildly disproportionate to the work done.
Impact:
13% of weekly Pro budget consumed in one short session
Most of the cost was compaction overhead, not useful work
Makes Opus practically unusable for multi-turn debugging sessions
Users have no visibility or control over when compaction triggers
Environment:
Claude Code CLI on Windows
Model: Opus
Session continued from a previous conversation
Project has large git status output (hundreds of deleted files from a rename)
Suggestion:
Add a compaction cooldown (don't re-compact every message)
Show token cost of compaction to the user before it runs
Allow users to opt out or control compaction frequency
Exclude verbose git status from context when it's mostly noise (e.g., hundreds of deleted build artifacts)
What Should Happen?
Compaction ran 9 times in succession. Each compaction re-processes the entire accumulated context at Opus input token rates. The resulting token consumption was wildly disproportionate to the work done.
Impact:
13% of weekly Pro budget consumed in one short session
Most of the cost was compaction overhead, not useful work
Makes Opus practically unusable for multi-turn debugging sessions
Users have no visibility or control over when compaction triggers
Environment:
Claude Code CLI on Windows
Model: Opus
Session continued from a previous conversation
Project has large git status output (hundreds of deleted files from a rename)
Suggestion:
Add a compaction cooldown (don't re-compact every message)
Show token cost of compaction to the user before it runs
Allow users to opt out or control compaction frequency
Exclude verbose git status from context when it's mostly noise (e.g., hundreds of deleted build artifacts)
Error Messages/Logs
Steps to Reproduce
It's a joke ?
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
1.1.2321
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Other
Additional Information
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗