Skip to content

[Bug] Auto-Compact Erases Entire Chat History Without Warning #7502

Open

Description

@DougJoseph

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"}]

Activity

  1. github-actions commented on Sep 12, 2025

    @github-actions

    Found 2 possible duplicate issues:

    1. Context Memory Loss After Auto Compact Summary #3841
    2. [BUG] Claude forgets everything in CLAUDE.md after compaction #6354

    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

  2. DougJoseph commented on Sep 12, 2025

    @DougJoseph
    Author

    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!

  3. sid374 commented on Sep 13, 2025

    @sid374
    Contributor

    You can still see the previous history by going into transcript mode with Ctrl + R

  4. DougJoseph commented on Sep 13, 2025

    @DougJoseph
    Author
  5. zshawauxlol commented on Sep 17, 2025

    @zshawauxlol

    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.

  6. thomastthai commented on Sep 19, 2025

    @thomastthai

    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.

  7. colivetree commented on Sep 20, 2025

    @colivetree

    Please fix this!

  8. DougJoseph commented on Sep 20, 2025

    @DougJoseph
    Author

    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.

  9. zshawauxlol commented on Sep 21, 2025

    @zshawauxlol

    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.

    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.

  10. DougJoseph commented on Sep 22, 2025

    @DougJoseph
    Author

    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!

  11. 8 remaining items

  12. brian-ketos commented on Jan 28, 2026

    @brian-ketos

    This bug seriously reduces productivity. You should not be messing with the terminal history.

  13. jleppert commented on Feb 8, 2026

    @jleppert

    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?

  14. leon0399 commented on Feb 9, 2026

    @leon0399

    Is it me, or it was possible to rewind before compaction at some point, but now it is again impossible?

  15. apetta commented on Feb 9, 2026

    @apetta

    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...

    Image
  16. segeljakt commented on Feb 9, 2026

    @segeljakt

    I use a script to get the conversation:

    view-claude-history.sh:

    #!/bin/bash
    jq -r '
      .message // empty |
      .role as $role |
      (.content |
        if type == "string" then .
        elif type == "array" then
          [.[] | select(.type == "text") | .text] | join("\n")
        else ""
        end
      ) |
      select(test("\\S")) |
      "────────────────────────────────────────────────────────────\n\($role | ascii_upcase)\n────────────────────────────────────────────────────────────\n\(.)\n"
    ' "$1"
    

    Then

    chmod +x view-claude-history.sh
    ./view-claude-history.sh ~/.claude/projects/<project-id>/<session-id>.jsonl
    

    You can get the ID of the current session with /status.

    It can be useful as a claude skill:

    ~/.claude/skills/view-claude-history/
      SKILL.md
      scripts/
        view-claude-history.sh
    

    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:
    ```
    ./scripts/view-claude-history.sh ~/.claude/projects/<project-id>/<session-id>.jsonl
    ```
    
  17. zahiriddin-rustamov commented on Feb 9, 2026

    @zahiriddin-rustamov

    This issue was present in the latest version. Downgrading to the stable version fixed it for me (for now).

  18. segeljakt commented on Feb 23, 2026

    @segeljakt

    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.

  19. dc3671 commented on Mar 2, 2026

    @dc3671

    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.

  20. leoauri commented on Mar 17, 2026

    @leoauri

    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!

  21. MarcusDelvecchio commented on Apr 3, 2026

    @MarcusDelvecchio

    same issue

  22. junaidtitan commented on Apr 3, 2026

    @junaidtitan

    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 init

    The is_protected() system also prevents the pruner from ever touching compact summaries, compact boundaries, or other critical session state.

  23. segeljakt commented on Apr 4, 2026

    @segeljakt

    @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.

  24. fangmaster35 commented on Apr 6, 2026

    @fangmaster35

    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.

    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.

  25. segeljakt commented on Apr 7, 2026

    @segeljakt

    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.

  26. chevovish commented on Oct 6, 2026

    @chevovish

    Still experience the same issue. Please fix this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:corebugSomething isn't workinghas reproHas detailed reproduction stepsmemoryplatform:macosIssue specifically occurs on macOS

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions