Inhalt Context as a budget, not a memory

Why agents fail

Context as a budget, not a memory

The context window is a budget you spend, not a memory the agent keeps. Every part of a request draws it down: the system prompt, the tool definitions, every message in the history including tool results and attached documents, and the output the model produces for the turn, extended thinking included.1 Before compaction or other context management steps in, earlier turns are preserved whole and accumulate, so each turn's input carries all of the conversation before it.1

Two documented facts turn that accumulation into a budget rather than an archive. First, caching changes what you pay for a repeated prefix, not whether it occupies the window; cached reads still count against the limit.1 Second, capacity is not quality. Anthropic frames context as a finite resource with diminishing returns and gives two architectural reasons: attention forms a relationship for every pair of tokens, and training data holds far more short sequences than long ones, so fewer parameters are specialised for context-wide dependencies.2 The documented result is a gradient, reduced precision for retrieval and long-range reasoning, not a sudden cliff.2 Liu and colleagues measured the shape of it: accuracy is highest when the needed information sits at the start or the end of the input and degrades when the model has to use something from the middle, on models built for extended context too.3 The platform documentation says it directly: "more context isn't automatically better".1

The diagram models one turn as a shared context budget, showing how each input component reduces the headroom left for the model's output.

<svg viewBox="0 0 700 215" xmlns="http://www.w3.org/2000/svg" font-family="system-ui, sans-serif">
  <title>One context window as an occupancy bar, with illustrative segment widths</title>
  <text x="20" y="28" fill="currentColor" font-size="16" font-weight="600">One context window, one turn</text>
  <text x="20" y="50" fill="currentColor" font-size="14" opacity="0.8">Equal widths on purpose: illustrative, because the real split is not published.</text>
  <g fill="currentColor">
    <rect x="20" y="66" width="132" height="44" opacity="0.85" />
    <rect x="152" y="66" width="132" height="44" opacity="0.68" />
    <rect x="284" y="66" width="132" height="44" opacity="0.5" />
    <rect x="416" y="66" width="132" height="44" opacity="0.32" />
    <rect x="548" y="66" width="132" height="44" opacity="0.08" />
  </g>
  <g stroke="currentColor" fill="none" stroke-width="1.4">
    <rect x="20" y="66" width="660" height="44" rx="3" />
    <line x1="548" y1="60" x2="548" y2="118" stroke-dasharray="5 4" />
  </g>
  <g fill="currentColor" font-size="14" text-anchor="middle">
    <text x="86" y="132">System</text>
    <text x="218" y="132">CLAUDE.md</text>
    <text x="350" y="132">History</text>
    <text x="482" y="132">Tool output</text>
    <text x="614" y="132">Headroom</text>
  </g>
  <g fill="currentColor" font-size="14" text-anchor="middle" opacity="0.8">
    <text x="86" y="152">prompt, tools</text>
    <text x="218" y="152">reloaded after compact</text>
    <text x="350" y="152">past turns</text>
    <text x="482" y="152">reads, results</text>
    <text x="614" y="152">what is left</text>
  </g>
  <text x="20" y="182" fill="currentColor" font-size="14" opacity="0.8">Everything left of the dashed line is spent before the model writes a word.</text>
  <text x="20" y="204" fill="currentColor" font-size="14" opacity="0.8">Cached segments cost less and occupy the same space. Compaction shrinks History, not for free.</text>
</svg>

Figure: Every input segment spends the same finite window, while the illustrative widths provide no safe target for filling it. The budget gets spent whether or not you spend it deliberately. When Claude Code compacts, what comes back is re-injected selectively: project-root CLAUDE.md and the plan are reloaded from disk, a handful of recently read or edited files are read again, and a file over five thousand tokens returns as a path reference with no content behind it.4 Compaction is not free either. It reads the conversation it summarises and is reported as an extra sampling iteration whose tokens sit outside the top-level counts.5

Where the framing stops helping: a budget implies you can read the remaining balance and stay under it. No vendor publishes per-category occupancy for a real repository, and the degradation is gradual rather than stepped, so there is no fill level anyone can point to as safe. The scarcity is documented; the safety line is not.

Quellen

Quizze
  1. Prompt caching is on and a prefix is read from the cache. Which of these does that change?

    • What those tokens cost
    • How much of the window those tokens occupy
    • Whether those tokens count toward the context limit

    Caching changes the price of a repeated prefix, not its footprint. Cache reads still count toward the window, so a cached brief spends the budget exactly like an uncached one.

  2. Anthropic characterises the loss of accuracy that comes with context length as a ____.

    • gradient
    • cliff
    • hard ceiling

    Precision for retrieval and long-range reasoning falls off as length grows rather than failing at once, which is why the page can point to no safe fill level.

  3. One turn draws down one budget: the tool definitions and the output the model writes for that turn come out of the same window as the history.

    • True
    • False

    System prompt, tool definitions, the retained history and the turn output including extended thinking all occupy one window before compaction consolidates it, which is what makes it a budget rather than a memory.

Kommentare

Noch keine Kommentare. Fang das Gespräch an.