claude-code - 💡(How to fix) Fix Autocompact silently destroys active session work without user consent [3 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#47145Fetched 2026-04-13 05:40:16
View on GitHub
Comments
3
Participants
2
Timeline
7
Reactions
0
Timeline (top)
commented ×3labeled ×3cross-referenced ×1

The automatic context compaction feature silently destroys active session work without user consent, warning, or checkpoint. The 10-second notification is insufficient and non-interactive — there is no opt-out, no confirmation dialog, and no ability to select what is preserved.

Root Cause

The automatic context compaction feature silently destroys active session work without user consent, warning, or checkpoint. The 10-second notification is insufficient and non-interactive — there is no opt-out, no confirmation dialog, and no ability to select what is preserved.

RAW_BUFFERClick to expand / collapse

Bug Report

Summary

The automatic context compaction feature silently destroys active session work without user consent, warning, or checkpoint. The 10-second notification is insufficient and non-interactive — there is no opt-out, no confirmation dialog, and no ability to select what is preserved.

What happened

During an active Claude Code session (Opus 4.6), autocompact triggered and erased a fully discussed pricing/tier system from context. The "summary" that replaced the compacted context did not include the most critical work from the session — a complete subscription tier model with copyright check logic, strike system, and API endpoint designs.

Post-compact, the model:

  1. Could not recall the work it had just produced
  2. Spent 30+ minutes searching for information it had written itself
  3. Only recovered the information when the user manually directed it to search the raw session transcript (.jsonl)
  4. The transcript confirmed the work existed — the compact simply dropped it

Expected behavior

  • Autocompact should ask permission before compacting — not a 10-second passive notification
  • The user should be able to see what will be removed and approve/reject
  • Critical session state (code, architectural decisions, pricing models, feature designs) should be automatically saved to persistent memory before compacting
  • At minimum: compaction should be a manual action, not automatic

Actual behavior

  • Compact triggers automatically with ~10 seconds of non-interactive notification
  • No opt-out mechanism exists
  • The summary omits critical technical decisions and designs
  • The model post-compact cannot access its own prior output
  • The raw transcript (.jsonl) retains everything — proving the data existed and was selectively dropped by the summarizer

Impact

  • User time wasted re-explaining work the model already produced
  • Trust erosion — if the model can lose its own work silently, it cannot be relied on for multi-hour sessions
  • For solo developers running long sessions, this is a data loss event with no recovery path except manual transcript search

Environment

  • Claude Code CLI, Windows 11
  • Model: Opus 4.6
  • Session length: ~6+ hours before compact triggered
  • Date: 2026-04-13

Suggested fix

  1. Make compaction opt-in or manually triggered
  2. Show the user what will be compacted before executing
  3. Auto-save critical state to persistent memory (.claude/memory/) before any compaction
  4. Never compact automatically without explicit user consent

This is not a feature request — this is a bug. A system that silently destroys user work product is broken.

extent analysis

TL;DR

The most likely fix is to modify the autocompact feature to require explicit user consent before compacting, allowing users to review and approve what will be removed.

Guidance

  • Modify the autocompact feature to be opt-in or manually triggered, rather than automatic, to prevent silent data loss.
  • Implement a confirmation dialog that shows the user what will be compacted before executing, allowing them to approve or reject the changes.
  • Auto-save critical session state to persistent memory (e.g., .claude/memory/) before any compaction to ensure that important work is not lost.
  • Consider adding a warning or notification system that alerts the user when compaction is about to occur, giving them time to review and save their work.

Example

No code snippet is provided as the issue does not include specific code details.

Notes

The suggested fix is focused on addressing the silent data loss issue and providing more control to the user. However, the implementation details may vary depending on the specific requirements and constraints of the Claude Code system.

Recommendation

Apply workaround: Modify the autocompact feature to require explicit user consent before compacting, as this will prevent silent data loss and give users more control over their work. This is a necessary fix to address the bug and prevent trust erosion.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

  • Autocompact should ask permission before compacting — not a 10-second passive notification
  • The user should be able to see what will be removed and approve/reject
  • Critical session state (code, architectural decisions, pricing models, feature designs) should be automatically saved to persistent memory before compacting
  • At minimum: compaction should be a manual action, not automatic

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Autocompact silently destroys active session work without user consent [3 comments, 2 participants]