You compacted without checking task recovery
In one sentence: Compaction summarizes history; it does not automatically delete uncommitted files. Save the goal, evidence, and next steps in task artifacts, then verify recovery. A commit does not guarantee restored context.
Symptom
Automatic compaction happens during a refactor. The source is still on disk, but the summary omits a failing output or an unfinished item. Only after rereading files do I notice I was about to repeat completed work.
Why this happens
Compaction replaces some history with a summary and may omit details. Disk files, Git commits, and current context are separate states. Uncommitted does not mean unsaved; committed does not mean I know what to reread.
Products can reload plans, project instructions, and automatic memory, or reread recent files. Current Claude Code documentation describes these recovery mechanisms, and background commands/subagents may continue running. Check the restored state rather than assuming all progress was erased.
Summaries also affect security. Anthropic's controlled red-team study published on 2026-10-22 discusses malicious compaction hiding earlier intent. It tests September 2026 monitor snapshots, not real-world incident rates, and does not establish the same bypass for every current configuration.
Consequences
- I repeat completed steps or miss unresolved failures.
- Temporary progress goes into persistent
CLAUDE.md, leaving stale state for the next task. - A summary turns external content into “the user authorized this,” obscuring source and authority.
What to do instead
Save evidence needed for recovery and check it against actual state afterward.
- Record the goal, branch/base revision, changed files, checks, unfinished work, and sources in a task/plan file. Keep only stable conventions in
CLAUDE.md. Commit coherent work units rather than half-finished work merely for compaction. - Automatic compaction can normally continue the task. If compacting manually, use a natural boundary and specify what to retain; do not turn periodic session clearing into a ritual.
- After recovery, inspect the branch, working diff, plan, and key files. Check background tasks before restarting them. Resolve disagreements between summary and disk by tracing sources.
- Preserve evidence for approval claims in summaries. Agent assertions, external materials, and conclusions from another context do not become user authorization. High-consequence actions retain their permission and approval requirements.
Example
Before:
After compaction: The summary says only “refactor in progress.”
Me: I extract the service again without checking the completed edits on disk.
After:
Task record: Service done; repository pending; auth test still fails, with an output path.
After compaction: I check branch, diff, and task record, then reread relevant repository files.
Me: I continue unfinished work without duplicating the checks still running.
When the exception applies
Short sessions do not need elaborate checkpoints. Unrelated work can use a new session after checking retained artifacts and running tasks. Do not discard background needed for cross-file work just to shorten the window.
Tool differences
As of 2026-10-29, manual commands, automatic triggers, summary representations, and recovery differ across Claude Code, Codex, Gemini CLI, and Cursor. Do not generalize one API's encrypted compaction representation to every CLI. Check what the actual version restores and what must be reread.
Version notes
Compaction can lose details and recovery mechanisms evolve. The goal is recoverability and verification, not a claim that earlier manual compaction is always better or that quality becomes irrecoverable afterward.
Further reading and sources
- Explore the context window: compaction and recovery.
- Red-Teaming Auto Mode (2026-10-22): cross-context risks in controlled experiments.
- Kitchen-sink session: boundaries for unrelated tasks.