[Bug] Auto-Compact Erases Entire Chat History Without Warning
Open 💬 30 comments Opened Sep 12, 2025 by DougJoseph
💡 Likely answer: A maintainer (sid374, contributor)
responded on this thread — see the highlighted reply below.
Bug Description
In Claude Code, every time the chat gets auto-compacted, it erases ALL my chat history with no way to get it back. This is wrong, and is a terrible thing to do. It does this without any warning. This must stop!
Environment Info
- Platform: darwin
- Terminal: Apple_Terminal
- Version: 1.0.112
- Feedback ID: 25d30069-c450-48c1-a7de-55140f229ee2
Errors
[{"error":"Error: Request was aborted.\n at e61._createMessage (file:///Users/dougjoseph/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1001:7955)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-09-12T03:58:21.790Z"},{"error":"Error: Request was aborted.\n at gT.makeRequest (file:///Users/dougjoseph/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1010:3864)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-09-12T04:24:56.244Z"},{"error":"Error: EISDIR: illegal operation on a directory, read\n at Module.readFileSync (node:fs:442:20)\n at Object.readFileSync (file:///Users/dougjoseph/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:719:6735)\n at s9B (file:///Users/dougjoseph/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:3507:9370)\n at Object.call (file:///Users/dougjoseph/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1778:936)\n at call.next (<anonymous>)\n at iM (file:///Users/dougjoseph/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1783:2968)\n at file:///Users/dougjoseph/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1797:1186\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-09-12T04:27:53.005Z"},{"error":"Error: Request was aborted.\n at e61._createMessage (file:///Users/dougjoseph/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1001:7955)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-09-12T04:29:42.805Z"},{"error":"Error: Request was aborted.\n at e61._createMessage (file:///Users/dougjoseph/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1001:7955)\n at processTicksAndRejections (node:internal/process/task_queues:105:5)\n at runNextTicks (node:internal/process/task_queues:69:3)\n at process.processTimers (node:internal/timers:520:9)","timestamp":"2025-09-12T04:33:49.357Z"},{"error":"Error: Request was aborted.\n at e61._createMessage (file:///Users/dougjoseph/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1001:7955)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-09-12T04:39:35.605Z"},{"error":"Error: Request was aborted.\n at e61._createMessage (file:///Users/dougjoseph/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1001:7955)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-09-12T04:57:54.112Z"},{"error":"Error: Request was aborted.\n at gT.makeRequest (file:///Users/dougjoseph/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1010:3864)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-09-12T06:28:49.698Z"},{"error":"Error: Request was aborted.\n at gT.makeRequest (file:///Users/dougjoseph/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1010:3864)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-09-12T06:47:37.918Z"}]
30 Comments
Found 2 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
My issue is NOT a duplicate of those other two issues. This has nothing to do with how much Claude Code remembers after an auto-compact. This issue is that all my chat history, the text in MY terminal shell, all of it ABOVE the chat auto-compact lines, DISAPPEARS COMPLETELY and cannot be gotten back, and it never used to be this way. I have many things in that chat conversation history that are extremely valuable, and at certain points I will export the text of the whole conversation to save for later reference. That saving of a whole session is impossible now because after each auto-compact, all the text of the chat history disappears. This is a HORRIBLE thing to do to us. PLEASE MAKE IT STOP. Make it like it was before!
You can still see the previous history by going into transcript mode with Ctrl + R
@sid374
Nope. Tried that over and over. NO chat history from prior to auto-compact, after the auto-compact happens!!!
yeah this is very frustrating - Why can't we scroll up to see previous history. Auto-compact now feels destructive. I rely on being able to scroll up.
Frequent auto-compacting and erasing the chat history has succeeded in reducing my productivity and increasing my frustration with Claude Code. Erasing the chat/shell history is likely an attempt to prevent the well-documented shell history buffer from building up to the point where the screenful of text scrolls quickly and doesn't stop.
Please fix this!
Just a quick update: the problem went away for me. I'm in coding with Claude Code very often, and after the problem persisting for quite some time, it did finally start working right, at least of now.
Yeah agreed that's probably why, but like I don't care I'd rather deal with that every now and again then just nuking it.
I regret to inform that although I previously reported the issue was not longer happening, I just had it happen AGAIN. This is not fixed!
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.
This is still happening and is my #1 issue with Claude Code. I'm still a noob with AI coding so had presumed it was for some unknown reason supposed to work this way. I hadn't considered it might be a bug.
Please please please please please fix it.
Yeah, this is really annoying. Just don't clear the terminal when it compacts, let my terminal keep its buffer of past output so that I can scroll up as far as my terminal will let me.
I was upset about this as well, but I discovered that /rewind can recover history from before the auto compact
You can also turn off auto compact with /config and then manually compact with /compact [what to remember]
the same
It is extremely annoying. In my case I managed to recover the conversations by parsing the sessions files in
~/.claude/projects/This bug seriously reduces productivity. You should not be messing with the terminal history.
Whoever thought this was a good idea? You can't even view the last thing you were working on. It's very frustrating when you have to go and dig around in JSON files to find something you literally were just working on. When compaction happens, you can't view any of your old history. Why can't this be fixed?
Is it me, or it was possible to rewind before compaction at some point, but now it is again impossible?
This used to work fine, but has started happening recently.
After an auto-compact, the entire history that led up to the auto-compact is wiped!! There is no way to recover it with
/rewind. It literally shows no history before the auto-compact.This is quite a serious bug...
<img width="1125" height="192" alt="Image" src="https://github.com/user-attachments/assets/f4cf1720-1c3c-4c05-b124-5eac3497fdfd" />
I use a script to get the conversation:
view-claude-history.sh:Then
You can get the ID of the current session with
/status.It can be useful as a claude skill:
where
~/.claude/skills/view-claude-history/SKILL.md:~~~
---
name: view-claude-history
description: View the history of a claude conversation. Use when you need information that was before a compaction.
---
Command
Run the command:
~~~
This issue was present in the latest version. Downgrading to the stable version fixed it for me (for now).
I also noticed that if you have written a prompt to Claude that you have not yet submitted or stashed, compaction seems to clear that as well.
Claude Code should use compacted content in a new session, so that I can still continue previous old session in case I want to fork.
Yeah, really frustrating. I have to completely redo a bunch of heavy work because I cannot rewind code changes to somewhere in the middle after auto-compact. What a waste of gigawatts!
same issue
Auto-compact erasing history happens because the compaction prompt has to summarize too much content at once. If the session is bloated with progress ticks, stale reads, and duplicate content, the summary loses important details.
Cozempic v1.4.1 pre-prunes via PreCompact hook so compaction operates on a much smaller, cleaner input. The guard daemon also runs proactively so sessions rarely reach the compaction threshold at all.
pip install cozempic && cozempic initThe
is_protected()system also prevents the pruner from ever touching compact summaries, compact boundaries, or other critical session state.@junaidtitan This has nothing to do with compaction summary quality. The issue is that the terminal scrollback buffer gets wiped on auto-compact. No amount of "pre-pruning" or "guard daemons" fixes that — you're solving a problem that doesn't exist here. Please don't use bug reports as advertising space.
The irony of it all is that we should still be able to view such a thing locally as this cli/extension should be smart enough to know the difference between compaction and just being able to keep the text locally, I mean for all intents and purpose just put it all in a text file if anything then we can at least see it.
My guess is that the TypeScript-based CLI gets sluggish when the scrollback buffer becomes too large. I have seen it clear the scrollback even without compaction.