[Bug] Infinite Context Loop: Repeated File Reading & Premature Compaction
Bug Description
Critical Bug - Infinite Context Loop & Premature Context Exhaustion on Max Plan
Issue Summary: I'm experiencing a severe bug where Claude Code enters an infinite file-reading loop, never executes tasks, and repeatedly compacts conversation despite starting with minimal context. This makes the product essentially unusable for development work.
My Plan: Claude Max Plan (Pro/Team)
Bug Details:
Infinite Reading Loop
Claude reads the same 5-6 files repeatedly (10-15+ times)
Files are marked as "Referenced" but Claude re-reads them anyway
Each read cycle adds the same files back to context
Never transitions from "analysis mode" to actually writing code
Premature Context Compaction
New conversation windows start at only 10-12% context used, NOT 100%
Despite low context usage, Claude triggers "Compacting conversation..."
After compaction, Claude loses memory of what it already read
This triggers another read cycle, creating an infinite loop
No Task Completion
Claude continuously says "I'll continue with..." or "Next: Create plan"
Never actually writes code or delivers results
Stuck in eternal preparation phase
Makes promises to deliver but only reads files again
Example Pattern Observed:
⏺ Read(file1.tsx) - 428 lines
⏺ Read(file2.ts) - 435 lines
⏺ Read(file3.ts) - 373 lines
⎿ "I'll continue with the analysis..."
⎿ [Reads same 3 files again]
⎿ [Reads same 3 files again]
⎿ [Reads same 3 files again]
· Compacting conversation...
⎿ Next: Create comprehensive plan
⎿ [Reads same 3 files AGAIN]
[INFINITE LOOP CONTINUES]
Impact:
Unable to complete ANY development tasks
Wasted hours watching Claude read files in loops
Even with explicit instructions "DO NOT READ FILES," behavior persists
Starting fresh conversations doesn't help - same pattern repeats
Makes Max plan effectively worthless for coding work
Expected Behavior:
Read files ONCE and keep them in context
Use 100% of available context window in new conversations
Execute tasks after reading, not endless re-reading
Compaction should preserve file state, not trigger re-reads
System Information:
Product: Claude Code / Claude.ai with computer use
Model: Claude Sonnet 4.5
Task Type: Full-stack development (React frontend + Node backend)
Typical file sizes: 300-500 lines per file
Reproducibility: 100% reproducible on:
Any multi-file analysis request
Any "review" or "analyze" task
Persists across new conversation windows
Happens even with explicit "don't read files" instructions
Why This is Critical for Max Plan Users: I'm paying for the highest tier specifically for:
Extended context windows
Better reasoning for complex coding tasks
Reliable multi-file development support
Instead, I'm getting:
Context that starts at 10-12% (not 100% as it should)
Infinite loops that waste the limited context available
Zero task completion
Behavior worse than basic tier due to the looping bug
Request:
Investigate the context compaction trigger logic - why is it activating at 10-12% usage?
Fix the file re-reading loop - files marked as "Referenced" should not be read again
Implement state persistence across compaction events
Add safeguards to prevent infinite read cycles
Ensure new conversations actually start with full context window (100%, not 10-12%)
This bug makes Claude Code unusable for professional development work. As a paying Max plan customer, I expect this to be treated as a P0 critical bug.
Here is attached screenshot - '/Users/divyanshusingh/Desktop/Screenshot 2025-11-12 at 7.00.50 PM.png'
Environment Info
- Platform: darwin
- Terminal: vscode
- Version: 1.0.96
- Feedback ID: 8bafd77d-38f1-4c85-ad64-b1142bbc080f
<img width="1440" height="900" alt="Image" src="https://github.com/user-attachments/assets/1149bb50-2179-4879-8155-7e5e143994e6" />
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗