[BUG] CRITICAL: Context Window Auto-Compact Malfunction - Infinite Loop

Status Fixed / completed
Maintainer reply None cached
Activity 6 comments · opened Aug 25, 2025 · closed Aug 26, 2025

Environment

  • Platform (select one):
  • [ ] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ x] Other: <!-- specify --> Claude Code
  • Claude CLI version: <!-- output of claude --version --> Claude Code v1.0.90
  • Operating System: <!-- e.g. macOS 14.3, Windows 11, Ubuntu 22.04 --> Debian 12
  • Terminal: <!-- e.g. iTerm2, Terminal App --> Putty

Bug Description

<!-- A clear and concise description of the bug -->
When trying to use Claude Code, it is auto-compacting and then IMMEDIATELY showing "Context left until auto-compacting: 2%" or less. It is also burning through my usage window vastly sooner than it used to. Here is Claude's description:

CRITICAL CONTEXT WINDOW MALFUNCTION - IMMEDIATE ACTION REQUIRED

CRITICAL FAILURE DETECTED

  • Date: 2025-08-25 19:37
  • Session: CLC Dashboard Power BI project
  • Status: COMPLETE SYSTEM MALFUNCTION

THE PROBLEM

  1. Impossible Context Behavior: Auto-compacted, then immediately showed 1% until next auto-compact
  2. Usage Limit Hit: Consumed user's usage limit while accomplishing NOTHING
  3. Broken Compression: Context compression is failing catastrophically
  4. Infinite Loop: Stuck in compact-lose-context-compact cycle

REQUIRED FIXES (NOT WORKAROUNDS)

  1. Context Window Algorithm: The auto-compact threshold is broken
  2. Compression Ratio: Context is being lost instead of compressed properly
  3. Usage Tracking: System is charging tokens for failed operations
  4. Loop Detection: Need circuit breaker for compact cycles

Steps to Reproduce

  1. <!-- First step --> Start Claude Code
  2. <!-- Second step -->Try to get it to do something.
  3. <!-- And so on... -->It auto-compacts within minutes.

Expected Behavior

<!-- What you expected to happen -->
Uh, I expected it to do something.

Actual Behavior

<!-- What actually happened -->
It auto-compacted OVER AND OVER.

Additional Context

<!-- Add any other context about the problem here, such as screenshots, logs, etc. -->

View original on GitHub ↗

6 Comments

Codewow · 1 year ago

Workaround: Rename or remove the settings.local.json file from .claude folder.

github-actions[bot] · 1 year ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/6004
  2. https://github.com/anthropics/claude-code/issues/6315
  3. https://github.com/anthropics/claude-code/issues/6461

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

timkjr · 1 year ago
Workaround: Rename or remove the settings.local.json file from .claude folder.

My settings.local.json is only 38 lines. That is not the root cause.

Codewow · 1 year ago
> Workaround: Rename or remove the settings.local.json file from .claude folder. My settings.local.json is only 38 lines. That is not the root cause.

It's a proven workaround for when you're in a compact loop. It's worth a shot in your case.

timkjr · 1 year ago
> > Workaround: Rename or remove the settings.local.json file from .claude folder. > > > My settings.local.json is only 38 lines. That is not the root cause. It's a proven workaround for when you're in a compact loop. It's worth a shot in your case.

Did not help my situation.

github-actions[bot] · 1 year ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.