Keep the goal and the live plan; evict consumed tool results, dead-end branches, stale reasoning tokens, and resolved error messages from the agent's context.
Imagine a detective solving a case across many days. The whiteboard at the front of the room has the central question and the next move to investigate. The detective does not need to keep every dead-end interview transcript pinned up; once a lead is followed and concluded, the conclusion moves to the whiteboard and the transcript goes into a drawer. Without that discipline, the room fills with paper and the detective wastes hours rereading old leads. The same is true for an agent. The whiteboard is the live plan plus the user's question. Everything else is reference material that should be filed once its conclusion is on the board.
Detailed answer & concept explanation~4 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
3 min: name the four prune-safe categories, separate them from the two keep categories, explain the slot-lifecycle framing, connect pruning to lost-in-the-middle and prompt-cache discipline.
Real products, models, and research that use this idea.
- LangGraph's typed state lets you declare which fields persist across nodes and which are scratch, making pruning a schema-level decision rather than a per-call cleanup.
- OpenAI's reasoning-summary mode for o-series models in 2026 stores intermediate reasoning server-side and exposes only summaries to subsequent turns.
- Anthropic's Claude Opus 4.7 agent patterns recommend evicting consumed tool results once their conclusions are in the plan, paired with prompt caching on the stable prefix.
- Letta exposes explicit `archive_search` and `core_memory` tools so the model can choose what gets recalled rather than auto-including history.
What an interviewer would ask next. Try answering before peeking at the approach.
QHow would you decide programmatically when a tool result is consumed and safe to evict?
QWhat changes if the agent backtracks and needs information from an abandoned branch?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Treating the agent's prior reasoning tokens as load-bearing context. The plan is load-bearing; the reasoning that produced it has done its job and can leave.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.