Context limit UX failure: No progressive warnings, misleading error messages, cascade failure in compaction
Summary
Critical UX failure in Claude Code's session management that causes data loss and provides no user feedback about approaching context limits.
Issue Details
1. No Progressive Warnings
- 13-hour intensive session with extensive tool use (2500 lines, 4.5MB session file)
- Zero indication that context limits were being approached
- Users have no opportunity to save work or compact proactively
2. Misleading Error Messages
- Error: "Prompt is too long" when actual issue is cumulative session context size
- Users assume issue is with their current input, not total conversation history
- Leads to confusion and incorrect troubleshooting
3. Cascade Failure in Compaction
- Once context limit is reached,
/compactcommand also fails - Error: "Conversation too long" during compaction attempt
- No recovery path available - user is completely stuck
4. Data Loss
- Extensive work completed but not saved to files before limit hit
- In this case: detailed AI mapping reviews #6-#45 lost (majority of 13-hour session)
- Only work preserved was what had been saved to files earlier (reviews #1-#5)
Reproduction Steps
- Start long-running Claude Code session with extensive tool usage
- Perform complex work involving many file reads, tool calls, detailed analysis
- Continue until session reaches ~2500 lines / 4.5MB
- Attempt any new prompt → "Prompt is too long" error
- Attempt
/compact→ "Conversation too long" error - No recovery possible
Evidence
Test Case: After hitting the error, user edited their message to just one word - same "Prompt is too long" error occurred, proving issue is total context size, not individual prompt length.
Session Metadata:
- Session ID: 6bfb1bd4-1847-49a7-84a3-0295836c27a4
- Duration: 13 hours (07:18:37 - 20:05:20)
- File size: 4.5MB, 2500 lines
- Context: AI mapping review session with detailed Phase-2 verification
Expected Behavior
Progressive Warnings
- 75% context usage: "Context approaching limit - consider /compact soon"
- 90% context usage: "Context nearly full - /compact recommended"
- 95% context usage: "Next large operation may fail - /compact now"
Graceful Degradation
- Automatic compaction at safe thresholds
- Clear separation between prompt size vs. total context errors
- Recovery options when limits approached
Accurate Error Messages
- "Total conversation context too large" instead of "Prompt is too long"
- Guidance on resolution steps
- Context usage statistics
Impact
This affects power users doing extended analysis work and can result in significant data loss. For professional workflows involving complex multi-hour sessions, this is a workflow-breaking issue.
Environment
- Claude Code version: 2.1.111
- Platform: Windows 11
- Model: claude-opus-4-7 → claude-sonnet-4-20250514 (switched mid-session)
- Working directory: Git repository with extensive file operations
Additional Context
User was performing systematic AI mapping reviews following established playbooks, with detailed Phase-2 verification, file sampling, and cross-validation work. The loss of 40+ mapping reviews represents substantial analytical work that cannot be easily recovered.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗