[BUG] Compact Conversation Infinite Loop
Environment
Platform (select one): Claude Code (CLI tool) Claude CLI version: 1.0.31 (Claude Code) Operating System: macOS Sequoia 15.4.1 Terminal & VSCode
Bug Description Claude Code is retaining context from previous projects even when starting a new project. The tool appears to be "stuck" with old context that should have been cleared.
/clear does not change the 0% until auto-compact function
Expected Behavior When starting a new project, Claude Code should begin with a fresh context without any information from previous projects. Actual Behavior Claude Code continues to reference or use context from previous projects even when starting fresh & auto-compact is stuck on a loop
Additional Context
MacBook Pro 16-inch, 2019 2.3 GHz 8-Core Intel Core i9 16 GB RAM Using VSCode with Claude Code integration Issue occurs in the terminal
Auto-compact stores context that persists across sessions No command to clear this compacted memory Deleting ~/.claude directory doesn't reset it Only workaround is disabling auto-compact entirely Feature request: Add /reset-context command or --fresh flag
This Issue is related to Issue: https://github.com/anthropics/claude-code/issues/2283, https://github.com/anthropics/claude-code/issues/2387, and https://github.com/anthropics/claude-code/issues/2222
[!TIP] WORK AROUND: Disable auto-compact via
claude config set -g autoCompactEnabled falseand/compactmanually.
It's not great but at least it works (for me).
Tip
WORK AROUND: Disable auto-compact via
claude config set -g autoCompactEnabled falseand/compactmanually.It's not great but at least it works (for me).
It didn't work for me :/
It didn't work for me :/
Sad :(
- Did you restart Claude Code afterwards?
- Other possible things to check is
/statusor directly the localCLAUDE.md& the userCLAUDE.mdat~/.claude/CLAUDE.mdif they would be huge that may be the trigger.
Could you share more about your experience, @fabiobroldao, so that we can get closer to identifying the root cause and enable the Claude team to resolve this issue for everyone.
I just updated to the latest version of Claude Code, and restarted a conversation. It seemed to not respect the global config. Try:
[!TIP]
/configand then disableAuto-compactdirectly in Claude Code.
I just updated to the latest version of Claude Code, and restarted a conversation. It seemed to not respect the global config. Try:
Tip
/configand then disableAuto-compactdirectly in Claude Code.
I restarted the mac and it worked!!! No problems! I believe that some environment variable or even with node, was stuck!
uhhh so I made a different account on my computer downloaded claude code again and I'm not having ANY issues at all anymore.
this was seriously unusable & I was getting API errors which are fixed now too.
I can't keep making a new user account on my computer just to work with claude but I do find it interesting
I am on a Mac, running VS Code/Cursor as IDE for hosting terminal, and I recently installed Serena. That match anyone else's patterns for this?
I am on a Mac, running VS Code/Cursor as IDE for hosting terminal, and I recently installed Serena. That match anyone else's patterns for this?
I don't know what Serena is. Any way I, I am on MacOS 15.5 (24F74) and run Claude Code from JetBrains IDEs Terminals and Item2.
These API errors are driving me nuts also.
https://imgur.com/a/1oedVFy
This is a showstopper. What am I paying 200 bucks a month for? Get it together, Anthropic.
I had to create a new user profile on my computer re install everything and then it worked... not an ideal workaround but it does work. ZERO issues in 12h!
I know it sucks but it starts working again like a charm. Then I just /clear after I'm done working on a certain task
I had to create a new user profile on my computer re install everything and then it worked... not an ideal workaround but it does work. ZERO issues in 12h!
I know it sucks but it starts working again like a charm. Then I just /clear after I'm done working on a certain task
I tried this and it kinda worked for a while, but then the same problem came back again. This is awful. I was so productive all month and now I'm screwed.
This is happening to me often, it just compacts for >10m and never stops
I experienced the same infinite auto-compact loop making Claude Code unusable. After extensive debugging, I identified Zen MCP Server as the trigger in my setup. Solution: claude mcp remove zen The auto-compact bug disappeared immediately after removing Zen MCP. @NellInc mentioned issues after installing Serena MCP. Both are Python-based MCP servers with extensive tool sets. This suggests the bug isn't specific to one MCP server but rather how Claude Code handles certain MCP implementations. Workaround: Remove problematic MCP servers until Claude Code implements better MCP metadata handling.
This infinite autocompact loop is happening to me too, and also all my mcp servers just dissappeared from my Claude Code - aaaaaaagh - I'm using Warp terminal
I'm experiencing the same situation.
I have tried restarting my Mac, uninstalling Claude Code, clearing caches, and deleting all related files, but nothing has changed. Even when I start a new session, it always begins with Context low (100% remaining).
I'm not using MCP.
I'm using Ghostty
Same situation here. Ubuntu 24.02. Tried everything I can think of -- including make an entire new user on the machine and completely removing and re-installing Claude Code. Nothing seems to fix it.
@LarsArtmann Did you ever happen to make any progress on fixing this? Looking at all the open issues it seems like you've been experiencing this issue the longest.
@christabone
[!TIP] What I can recommend trying:
- Update to the latest version of Claude Code
- Check your ~/.claude/CLAUDE.md and make sure it's less then 20k chars
- Check your CLAUDE.md in the project your working on and make sure it's less than 50k chars
- Use the latest version of node
- Restart you computer
- If it still persists just disable autoCompact via /config on every claude startup. And use manual /compact [Message] <-- Works better anyway if you instruct it what to follow
- Backup the ~/.claude/ folder and start fresh
I hope that helps!
@LarsArtmann Thanks so much for taking the time to reply! Interestingly, it started working about a week after I last posted. Not sure why? I tried most of the things from your list initially and even went so far as to make a new user on the Linux machine I was using (still didn't fix it). Super confused, but at least it's back now and working.
infinite auto-compac
That was it for me too.
How to disable this shit, this breaks the task context!
https://streamable.com/6g1u7w My experience
opencode is working hooked up to my claude pro max plan! https://opencode.ai/
Found a workaround. Not sure how detrimental it is to context awareness, but deleting/renaming the settings.local file in the .claude folder fixed the context issues for me. I am guessing the file just got too large for Claude to be able to effectively read because of all the bash commands it stored away that weren't reusable in most cases.
if you want to YOLO it, you can use "claude --dangerously-skip-permissions" to bypass permission prompts (the ones that when saved to the project, fill up the setting.local.json file and ultimately cause the context issue)
But that is absolute last resort and very dangerous to do. Hence the flag name....
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.