A new technical deep-dive into Claude Code’s context management reveals a stark asymmetry in what survives session compaction. While high-level reasoning and decisions are largely preserved, the granular details that actually make code work—shell commands, specific file paths, and exact error messages—are almost entirely discarded. The analysis, published by developer vshulcz, suggests that for AI coding agents, the loss of operational data is the primary bottleneck to long-term session continuity.
The 77/0.2 Split
The study analyzed 58 real transcripts and 43 compaction events, compressing 2.59 GB of raw conversation into 0.72 MB of summaries. The results were lopsided: approximately 77% of 'decision sentences'—the conclusions and rationale behind choices—survived the compaction process. However, only 9.8% of file paths and 1.9% of measured numbers remained. Most critically, a mere 0.2% of the shell commands actually executed during the session persisted in the summary. This means the agent remembers *why* it chose a library, but forgets *how* it configured it.
Intent vs. Implementation
The core issue is that summaries are written in the language of intent, while debugging happens in the language of implementation. The article illustrates this with a concrete example: a summary might retain the line 'Switched connection pool from pgx 5.4.3 to pgbouncer transaction mode,' but it drops the specific go test invocation that validated the change, the exact pq: sorry, too many clients already error text, and the line number in internal/db/pool.go where the max connections were adjusted. When the agent asks for the specific command later, it receives a confident paraphrase of the plan rather than the executable reality.
Retrieval, Not Data Loss
Importantly, this is a retrieval problem, not a data-loss problem. The raw transcripts remain on disk in the harness's log directory, untouched by compaction. The tool deja-vu demonstrates that these logs can be indexed locally to recover the 'lost' context. By using a pre-compaction hook, the system can capture the active transcript, marking commands with their exit status ([passed] or [failed]) and injecting a 4KB packet of critical operational data back into the context window. This ensures that when compaction occurs, the agent retains the specific invocations and error states that cost the developer time.
Key Takeaways
- Compaction preserves 77% of reasoning but loses 99.8% of shell commands.
- The raw logs are still on disk; the problem is that the model doesn't read them back.
- Tools like
deja-vuuse pre-compaction hooks to inject critical operational details (commands, errors, file paths) back into the context. - Default Claude Code settings delete transcripts older than 30 days, requiring configuration changes to retain long-term history.
The Bottom Line
LLM context windows are finite, but our tolerance for repeating the same debugging cycles should be zero. Until models can natively prioritize operational syntax over narrative prose, external memory layers that index raw transcripts are essential for serious agentic coding.