Engineering brief

Context compaction is a trap when caching is cheap

This engineering brief covers Context compaction is a trap when caching is cheap, with practical context for AI and developer-tool decisions.

AI Engineer

The Brief

Most AI agents compact context to save tokens. But new experiments show full history beats compaction on cost, recall, and latency—thanks to 50x caching discounts.

Decision relevance

Read this for workflow impact, implementation trade-offs, and the claims that need technical scrutiny before they reach team planning.

Summary

Towards AI's experiments on their AI tutor reveal a counterintuitive finding: not compacting context often outperforms compaction. The team tested sliding windows, summarization, selective retention, and full history across Gemini and DeepSeek models. Full history consistently achieved higher recall (95% vs 32% for compacted) and lower cost per turn due to aggressive prompt caching.

Caching discounts of up to 50x mean that resending the same context is far cheaper than regenerating summaries. Compaction destroys cache locality, forcing the model to re-process new tokens at full price. The result is higher latency, more tool calls, and worse memory recall.

The tradeoff shifts when context exceeds local hardware limits. On a MacBook, the 32K window forced compaction, lowering recall to 33%. For documents, hybrid retrieval (dense + BM25) maintained 100% accuracy, outperforming pure semantic search at scale.

Teams should not default to compaction. Instead, measure cache hit rates, use cheaper models with generous caching, and only compact when context windows are genuinely constrained by hardware or API limits. The real bottleneck is workflow design, not model quality.

Why It Matters

Default compaction strategies can waste money and degrade quality; caching changes the economics.

Editorial analysis

Key claims

  • Don't compact by default. Let caching do the heavy lifting.

Practical use cases

  • Use this as input for tooling evaluation, workflow planning, and technical due diligence.

Risks / caveats

  • Claims that summarization always saves cost without measuring cache impact.

Who should care

  • Engineering managers, tech leads, and CTOs evaluating AI or developer tooling decisions.

Related topics

Bottom Line

Don't compact by default. Let caching do the heavy lifting.

Watch

This video is blocked due to your privacy settings. To watch this video, please accept YouTube marketing cookies.

Related breakdowns

Get TL;DW

Too Long; Didn't Watch.

A concise breakdowns of the AI and devtools videos that actually matter for engineering leaders.

Free. Weekly. No hype.

Video and thumbnails remain the property of their respective creators. tldw.news provides editorial analysis, commentary, and discovery links to original content.