Context hit 1M token limit with no auto-compaction and no recovery path
Bug description
During a normal coding session, the conversation context grew to the 1M token limit without auto-compaction triggering. When the limit was hit, the error message was about requiring more credits to use 1M context — misleading, since the user never opted into extended context. Manual /compact was also unavailable or broken at that point, leaving the user stranded with no way to continue the session.
Expected behavior
- Auto-compaction should trigger before hitting the 1M limit
- If auto-compaction fails,
/compactshould still be available as a fallback - If the limit is hit, the error should offer a recovery path (e.g., "run /compact"), not a billing/credits message
Actual behavior
- Context grew to 1M without auto-compaction firing
/compactwas not usable when needed- Error message referenced credits/billing for 1M context, which is confusing and unhelpful
- User was forced to start a new conversation, losing session context
Environment
- Claude Code version: 2.1.158
- OS: Linux (WSL2)
- Model: claude-sonnet-4-6
Impact
High — basic session continuity broken, user loses all conversation context mid-task with no recovery option.
Found 3 possible duplicate issues:
- https://github.com/anthropics/claude-code/issues/63976
- https://github.com/anthropics/claude-code/issues/42084
- https://github.com/anthropics/claude-code/issues/63718
This issue will be automatically closed as a duplicate in 3 days.
- If your issue is a duplicate, please close it and 👍 the existing issue instead
- To prevent auto-closure, add a comment or 👎 this comment
🤖 Generated with Claude Code
now you owe them an apology for cursing
This is exactly the failure mode we built cozempic for — context creeping toward the hard limit without auto-compaction firing, and then no recovery path once you're already there.
It runs a small guard daemon that watches the session's token count and prunes proactively before you hit the wall (collapsing progress noise, de-duping repeated file reads, trimming stale tool output), so you get noticeably longer sessions before compaction is even needed. And for the "already stranded" case you describe, cozempic treat <session-id> -rx aggressive prunes the on-disk transcript so a session that won't load becomes resumable again — that's the recovery path you're asking for.
Zero-dependency, pip install cozempic (or pipx install cozempic), auto-runs: github.com/Ruya-AI/cozempic
Would genuinely love your feedback if you try it — especially on the stranded-session recovery, since that's the precise scenario you hit here.