[BUG] Conversation compaction loses entire history, ctrl+e unresponsive

Status Closed — not planned
Maintainer reply None cached
Activity 15 comments · opened Jan 21, 2026 · closed Mar 26, 2026

Description

After conversation compaction, the entire conversation history is lost. Only the compact summary notes remain visible.

Steps to Reproduce

  1. Work on a task until compaction triggers
  2. After compaction completes, conversation shows only compact notes
  3. Previous messages/task context completely gone

Expected Behavior

  • Compacted conversation should preserve context
  • Ctrl+O should restore previous messages
  • Ctrl+E should show full transcript

Actual Behavior

  • Entire last task forgotten after compaction
  • Ctrl+O only shows compact notes (not full history)
  • Ctrl+E does not respond / no full transcript available
  • Conversation effectively lost

Impact

Task progress lost, must restart work from scratch.

Environment

  • Platform: Windows
  • Application: Claude Code CLI

View original on GitHub ↗

15 Comments

github-actions[bot] · 7 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/7424
  2. https://github.com/anthropics/claude-code/issues/13446
  3. https://github.com/anthropics/claude-code/issues/18204

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

ThatDragonOverThere · 7 months ago

This is NOT a duplicate of the scroll buffer issues.

Key difference: The suggested duplicates (#7424, #13446, #18204) describe losing the ability to scroll up in the terminal after compaction.

This issue describes: After compaction, ctrl+e (conversation history) shows nothing at all - the entire conversation history appears to be deleted, not just the terminal scroll buffer. The data itself is gone from the session, not just hidden from view.

This is a more severe bug - complete data loss vs. visual scroll buffer clearing.

ThatDragonOverThere · 7 months ago

Reproduction - Jan 23, 2026:

After compaction, Claude Desktop stopped responding again. Was in the middle of:

  • Verifying script relationships (overnight_analysis_pipeline.py calling unsupervised_pattern_discovery.py)
  • Validating IQFeed symbol references

Session showed "14 steps" and "Verifying script relationships and validating symbol references" then froze with just "F read_file" visible.

Same pattern as original report:

  • Compaction triggers
  • UI becomes unresponsive
  • Work in progress is lost
  • Must restart session
ThatDragonOverThere · 7 months ago

Additional symptom from same incident:

After the freeze/compaction, Claude Desktop responded with:

  • "Yes, I'm here! Sorry about that - I was trying to access files but ran into path issues."
  • "Based on the compacted summary, we were discussing corrections to the CLAUDE.md documentation"

This shows Claude:

  1. Lost the actual conversation context
  2. Is reconstructing from compacted notes (incorrectly)
  3. Gives generic "I'm here" responses instead of continuing work

The compaction is not just freezing - it's corrupting/losing the conversation state, forcing Claude to guess what was being discussed.

ThatDragonOverThere · 7 months ago

Additional impact discovered:

The compaction bug also caused file truncation. CLAUDE.md was truncated from ~860 lines to 424 lines - losing the entire bug tracker section and other critical documentation.

This suggests the compaction issue isn't just losing conversation context - it may be corrupting file operations in progress, resulting in partial writes or truncated files.

ThatDragonOverThere · 7 months ago

New error observed: "max compactions exceeded" flashed briefly before the compaction failure.

This suggests there may be a hard limit on compaction attempts that's being hit, causing the cascading failures (history loss, ctrl+e unresponsive, etc.).

ThatDragonOverThere · 7 months ago

Another compaction error observed: "NO compactable messages available"

This appeared in the same session where "max compactions exceeded" was seen. Suggests the compaction system is hitting multiple failure modes.

junaidtitan · 6 months ago

We've been working on this problem — built Cozempic as an open-source tool to mitigate context loss during compaction.

Cozempic works on two fronts:

Prevention — Reduce what gets lost:

  • System-reminder deduplication (removes redundant copies that bloat context)
  • Tool-output trimming (caps oversized results eating context budget)
  • Guard daemon that proactively prunes before compaction triggers

Recovery — Restore what was lost:

  • Pre-compaction checkpointing saves working state to .memory/WORKING.md
  • For agent teams: config merging + recovery injection restores team roster and task states
  • PostToolUse hooks checkpoint after significant operations
pip install cozempic
cozempic init

One command, then it auto-starts a background guard on every Claude Code session.

It won't make compaction perfect — some conversational nuance will still be lost — but in our testing it significantly reduces the "entire history wiped" problem by ensuring the compactor has cleaner, less redundant input to work with.

Would appreciate if you could test it and let us know if it helps. If specific context is still getting dropped, we can investigate what patterns need additional protection.

scapeshift-ojones · 6 months ago

This issue is tracked in the consolidated report at #26125, which covers the broken transcript mode (hidePastThinking hardcoded to true), mislabeled Ctrl+O help text, and post-compaction history inaccessibility — with source-level root cause analysis and a community patch. Please add your thumbs-up there to help it reach the oncall triage threshold.

zzkevin2019 · 6 months ago

+1 on this. Related note: /export also doesn't include the compaction summary, even though it's stored in the raw transcript .jsonl file (as an isCompactSummary message). So even if you try to export after compaction, the summary is silently dropped.

Currently the only way to retrieve it is to dig into the .jsonl file manually with jq, or set up a PreCompact hook to auto-save the transcript before compaction.

scapeshift-ojones · 6 months ago

The history loss and Ctrl+E unresponsiveness reported here are confirmed on v2.1.47. Ctrl+E now toggles the status bar text and timing badges, but does not reveal any hidden pre-compaction content — same effective result as "unresponsive" from the user's perspective.

Consolidated into #27242 with JSONL evidence that all conversation data is preserved on disk. The fix is a UI viewer, not a data layer change. If you've been affected by this, please 👍 and comment on #27242 to help get it triaged.

ThatDragonOverThere · 6 months ago

Still Occurring — Now Compounded by Crash Crisis

Compaction history loss is still occurring on v2.1.55. Combined with #21576 (26+ Bun crashes forcing constant restarts), #9796 (instructions lost post-compact), and #28577 (resume loads blank), the full session lifecycle on Windows is broken: sessions crash → can't find them by name → can't resume them → when you do resume, compaction wipes the history anyway.

junaidtitan · 6 months ago

Can you please share the logs, this shouldn’t be the case with cozempic
guard Installed

Regards,
Junaid Ali Qureshi

On Wed, 25 Feb 2026 at 10:20 PM ThatDragonOverThere <
@.***> wrote:

ThatDragonOverThere left a comment (anthropics/claude-code#19888) <https://github.com/anthropics/claude-code/issues/19888#issuecomment-3961133579> Still Occurring — Now Compounded by Crash Crisis Compaction history loss is still occurring on v2.1.55. Combined with #21576 <https://github.com/anthropics/claude-code/issues/21576> (26+ Bun crashes forcing constant restarts), #9796 <https://github.com/anthropics/claude-code/issues/9796> (instructions lost post-compact), and #28577 <https://github.com/anthropics/claude-code/issues/28577> (resume loads blank), the full session lifecycle on Windows is broken: sessions crash → can't find them by name → can't resume them → when you do resume, compaction wipes the history anyway. — Reply to this email directly, view it on GitHub <https://github.com/anthropics/claude-code/issues/19888#issuecomment-3961133579>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AFVALNOAO52D6B4P4XAH3LL4NXRVFAVCNFSM6AAAAACSOPWHQKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTSNRRGEZTGNJXHE> . You are receiving this because you commented.Message ID: @.***>
github-actions[bot] · 5 months ago

Closing for now — inactive for too long. Please open a new issue if this is still relevant.

github-actions[bot] · 4 months 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.