Because the API is stateless (Lesson 1.1), all session memory is something your application manages: the growing message list you resend in full on every call. For a long agent session, that list needs active management - not just accumulation - or it eventually runs into cost, latency, and the model's context window limits. Every user/assistant turn adds two messages; every tool round trip adds a tool_use block and a tool_result block on top of that. Tool results, especially raw JSON dumps, log excerpts, or full file contents, are very often the largest single contributor to history size - much larger than the actual conversational turns around them.
Pruning tool results deliberately
Once a tool result has been read and acted on, later turns often don't need the full raw payload still sitting in history - they need whatever conclusion was drawn from it. Replacing an old, superseded tool_result block's content with a short placeholder ("[full file contents omitted after use]") while leaving the rest of the conversation intact is a deliberate, targeted form of pruning: it's not the same as blindly truncating the oldest N messages, which risks cutting something that's still relevant regardless of age. The Claude Developer Platform also offers this as a built-in feature - context editing that can automatically clear aging tool interactions, and a memory tool for persisting durable facts to storage outside the conversation so they survive even when the message history itself is trimmed. The underlying principle is the same whether you hand-roll it or configure the platform feature: decide deliberately what's still relevant, rather than letting everything accumulate by default.
Fresh start, full carry-forward, or a compact summary
There are three legitimate options, not two. Full carry-forward - keep appending to the same history - is correct for a task that's genuinely continuing. A fresh session is usually better than carefully pruning an old one down when the new request is unrelated to what came before: it avoids paying token cost for irrelevant history and avoids the model being distracted by stale context that has nothing to do with the current ask. A deliberately-written compact summary injected into a fresh session is the middle option - when some continuity genuinely matters (the agent needs to remember what it already tried, what conclusions were reached, what's still open) but the full raw transcript doesn't need to survive. Writing that summary is an active step, not a shortcut to skip: a good one states outcomes and open items in a few sentences, not a compressed retelling of the whole transcript.
Common exam distractor
Blind truncation - keeping only the last N messages, or the last K tokens' worth - is not the same thing as a deliberate summary, and the exam treats it as a lesser, riskier substitute. Truncation can cut something upstream that's still load-bearing (an early instruction, a fact established turns ago) with no judgment applied to what's kept. A summary is a judgment call about what still matters; truncation is a judgment-free cut by position.
Isolation applies across sessions too
The isolation principle from Lesson 3.2 isn't just about subagents - it applies to any fresh session too. A brand-new session has no memory of a prior one unless something is explicitly reinjected into it. If a follow-up task depends on the agent remembering a prior decision, that fact has to be written into the new session's opening context (via a summary, a stored memory-tool entry, or an explicit user-supplied recap) - it will not simply be recalled from thin air just because the same user is continuing the same overall workflow.
Practical example: a long-running incident-response agent
An on-call agent investigates a production incident over 40 tool calls across two hours - querying logs, checking dashboards, reading recent deploys, running diagnostic commands. Each of those tool results might run to several hundred or a few thousand tokens. Left unmanaged, the history for that single incident balloons into tens of thousands of tokens, most of it diagnostic output that was relevant for the two or three turns immediately after it arrived and irrelevant afterward - nobody needs the full raw output of a log query from 90 minutes ago once its conclusion ("no errors in that window") has already been drawn and acted on.
Every one of those input tokens is resent, and billed, on every subsequent call in the session - prompt caching can reduce the marginal cost of resending an unchanged prefix, but it doesn't make an ever-growing prefix free, and it does nothing about the model having to read past a wall of stale diagnostic output to find what's currently relevant. Pruning superseded tool results as the investigation moves on, and eventually writing a compact incident summary once the issue is resolved (what broke, what fixed it, what to watch for) rather than preserving the full 40-call transcript indefinitely, keeps both the cost and the model's effective attention where they belong.
Key concept
The choice isn't just "keep everything" vs. "lose everything." A compact, deliberately-written summary injected into a fresh session is a third option that preserves what matters without the token cost of the full history - and it's different in kind from blind truncation, which applies no judgment at all.