Stop Compacting Your Context: Why Keeping Everything Often Costs Less and Works Better
Prompt caching has inverted the economics of context management: aggressive compaction breaks the cache and costs more than keeping the full conversation, while delivering worse recall. The default for long agent sessions should shift to cache-friendly full-context preserving.
AngleArgue from the 50x discount and 92%-vs-38% recall result that most compaction playbooks are obsolete unless compression exceeds 50x.
Source video ↗Context Rot Is Not a Model Problem: Why Agents Forget Their Instructions
Long-agent failures are a consequence of attention-budget dilution—non-instruction tokens crowding out the system prompt—not a decline in model intelligence. Active context hygiene is required to maintain instruction adherence.
AngleUse the 'git push to main after 45 turns' anecdote to show that even explicit instructions erode as logs and diffs accumulate, and argue for monitoring context composition as a reliability practice.
Source video ↗Context Management Is Not Memory: The Architectural Separation Agents Need
Conflating within-session context allocation with cross-session persistence creates agents that are either stateless or infinitely bloated. Architecturally separating a session-scoped context manager from a persistent memory service enables independent optimization of caching and retrieval.
AnglePresent the distinction as a required module boundary for long-lived agents, with file-based wikis and hybrid retrieval as the memory side and cache-aware context framing as the session side.
Source video ↗The 50x Rule: A Heuristic for When Compaction Pays Off
Compaction is only economically justified when it achieves more than the cache discount ratio (e.g., 50x on DeepSeek) in compression, otherwise it destroys value and recall. This simple heuristic should guide context-engineering decisions.
AngleDerive a decision rule from the cost model: compute effective compression ratio vs cache discount; if below threshold, revert to full-context with caching.
Source video ↗Cache-Aware Compaction Harness
gatehouseIn an agent with prompt caching, enabling naive summarization-based compaction will increase total cost and reduce session-recall accuracy compared to full-context, when the cache discount is 50x and compression is below 50x.
Proof of conceptBuild a minimal agent loop (e.g., a coding tutor) using Gemini and DeepSeek APIs. Run three conditions: full-context with caching, sliding-window compaction, and LM-summarization compaction. Run multi-turn recall and cost measurement on a fixed task set.
MeasurementPer-turn token cost, cache hit ratio, session-recall accuracy (exact/semantic match), and tool-call counts.
Source video ↗Context Rot Monitor
beyond-evalsInstruction-adherence accuracy in a multi-turn coding agent will degrade monotonically as the ratio of non-instruction tokens (logs, diffs, tool output) to instruction tokens increases, and this degradation can be predicted by a simple context-composition metric.
Proof of conceptCreate a small coding-agent environment with an explicit 'NEVER push to main' instruction. Run extended sessions with varied log/diff padding, recording adherence per turn. Compute a context-pollution score (e.g., non-instruction token fraction) and correlate with violation likelihood.
MeasurementInstruction-following accuracy per turn, context-pollution score, and ROC/AUC for predicting the first violation.
Source video ↗Cache-Preserving Two-Tier Context
newA two-tier context format—a stable instruction prefix followed by a compacted tail of older turns—will preserve cache hits on the prefix while reducing total token count and maintaining session-recall accuracy comparable to full-context, unlike naive compaction which breaks the cache.
Proof of conceptImplement a context manager that keeps the system prompt and first N turns untouched, then appends a 'compaction summary' of later turns after a stable delimiter. Compare against full-context and summarization-compaction on recall and cache hit rate.
MeasurementCache hit ratio, tokens-per-turn, session-recall score, and end-to-end latency.
Source video ↗Agent Wiki Hybrid Retrieval Benchmark
movement-labFor an agent-maintained file-based LLM wiki (with an index.md map), hybrid retrieval (dense embeddings + BM25 + reranking) will achieve higher recall@5 and MRR than pure semantic vector search on the same corpus, across factual and procedural queries.
Proof of conceptBuild a small agent-maintained wiki with ~1,000 entries. Enable two retrieval modes: embeddings-only and hybrid. Run a set of 100 query-answer pairs generated from wiki content, measuring retrieval quality end-to-end.
MeasurementRecall@5, MRR, and final answer accuracy.
Source video ↗