Skip to navigation

Claude Code Context Window: Why Capacity Is Not Memory

In short: A large context window does not guarantee recall. Claude Code’s cache incident shows how retained reasoning and task state can fail separately.

Published 17 min read
On this page

Direct answer

A context window is capacity. Memory is the ability to retrieve the right fact, decision or constraint when it is needed. A large window can hold more material, but it does not guarantee that the model will notice the important item, preserve its meaning or use it after a long session.

Claude Code’s historical caching incident makes the distinction concrete. Anthropic says a bug on 2026-03-26 repeatedly cleared older reasoning after an idle condition. That did not erase every conversation message. It shows that retained reasoning can fail separately from the text that remains in the session.

For a developer, the practical response is to store critical task state outside the model’s recall. Keep decisions, constraints and acceptance criteria in files or a short task brief. Test recall at known points. Treat the context window as workspace capacity, not a dependable long-term memory.

Why capacity gets mistaken for memory

A context window is the amount of text a model can consider for a request. When the window is large, a developer can include more code, more history and more instructions. That is useful. It reduces the need to manually trim every task.

The mistake is to assume that inclusion equals recall. A fact can be present in the context and still be overlooked. The model may give more weight to recent text, miss a constraint buried in a long transcript or summarize away the detail that mattered. Capacity answers “can this fit?” Memory answers “will the right information be used?”

The difference becomes obvious in a long coding session. The agent may remember the general goal but forget a naming constraint, a rejected approach or a test that must not run. The conversation still contains those details. The task state is still recoverable by a human. The agent simply did not retrieve or apply them reliably.

The Claude Code context versus memory problem is related but not identical. Compaction replaces part of a session with a summary. The historical cache bug affected retained reasoning. Both are reasons to persist critical state, but they should not be described as the same mechanism.

The April 2026 regression postmortem provides the dated evidence for the cache incident. Use it as a specific case, not as proof that every long session fails.

Three layers that fail differently

A useful model separates context capacity, retained reasoning and task state. Each layer has a different job and a different failure mode.

Layer What it holds Typical failure Best control
Context capacity Text available to the current request Important detail is omitted or crowded out Curate the input and keep the task focused
Retained reasoning Earlier analysis the system can reuse Cache state is cleared or stale Record conclusions and test recall
Task state Goals, decisions, constraints and progress Summary drops a requirement Persist a written task brief and checkpoints

Context capacity is mostly a size and selection problem. If the input is too broad, the important instruction competes with noise. The fix is not always a larger window. Often it is a smaller, better-organized prompt with the relevant files and constraints.

Retained reasoning is a system-state problem. The model may have done useful analysis earlier, but the harness or cache may not preserve it in a usable form. The Fable 5.2 agent-loop pricing math explains why repeated context also affects cost, but cost and recall are separate measurements.

Task state is a workflow problem. A coding task needs a record of what was decided, what remains and what counts as done. That record should survive a new session, a compaction or a model change. The context-portable migration discussion treats this as an engineering task rather than a one-line configuration change.

Three memory layers separating context capacity, retained reasoning and task state
Editorial model for distinguishing three failure modes. It does not assert a measured recall rate for any layer.

Context capacity helps, but it is not a promise

A larger context window lets a developer keep more of the repository and conversation in view. That can reduce manual copying and help the agent connect a change to surrounding code. It is a real advantage for tasks that span several files.

The limit is attention. More text does not ensure that the model will select the relevant sentence. A constraint written once near the start of a long session can be outweighed by a stream of later tool output. The result may be a plausible answer that violates the original requirement.

A practical response is to organize the input around the task. Put the acceptance criteria near the point of use. Link to the relevant files instead of attaching the entire repository. Remove stale transcripts that no longer help. The model selection guide for coding agents can help match capability to a task, but prompt selection remains part of the workflow.

The Claude Code security documentation also matters here. A larger context can include more sensitive material. Capacity is not a reason to send data that the task does not need. The privacy and retention rules should be reviewed before treating the context window as a convenient storage area.

Retained reasoning is separate from visible text

Retained reasoning is the analysis a system keeps from earlier steps so it does not have to start from zero. It can include conclusions about a bug, a rejected approach or a plan for the next edit. When that reasoning is available, the agent can build on it. When it is cleared, the visible conversation may remain while the useful analysis is gone.

The historical cache bug is the clearest example in the frozen record. Official. Anthropic says that on 2026-03-26 a caching bug repeatedly cleared older reasoning after an idle condition. It was fixed on 2026-04-10 and contributed to cache misses and faster usage consumption.

The scope matters. The postmortem does not say that all conversation memory was wiped. It describes a specific failure of retained reasoning under an idle condition. A developer who loses the reasoning but keeps the messages may see the agent repeat work, miss a conclusion or consume more usage.

Historical cache bug clearing older reasoning in April 2026 without erasing all conversation memory
Official: Anthropic’s postmortem describes the cache bug and fix. The incident is historical and did not wipe all memory.

The Claude Code cost documentation explains why cache behavior belongs in a cost review. A cache miss can make the system process more input again. That does not prove a fixed cost increase for every session, but it gives a team a reason to record cache state alongside quality.

A good workflow writes down important conclusions as they happen. If the agent decides that a library cannot be used, put that decision in the task file. If it identifies a failing test caused by environment setup, record the evidence. The written note survives a cache reset better than an unrecorded chain of reasoning.

Task state is the part the team owns

Task state is the structured record of the work: the goal, constraints, decisions, completed steps, open questions and acceptance criteria. It is not the same as the conversation transcript. A transcript records what was said. Task state records what the team currently believes is true and what must happen next.

A coding agent can help maintain task state, but the team should not depend on the model to be the only copy. A short file in the repository or project workspace is easier to review, diff and carry into a new session. It also gives a human a place to correct a mistaken assumption.

The compaction retention test is useful here. Compaction summarizes a session before continuing, and a summary can drop exact constraints or decision rationale. A written task file gives the team something to compare against the summary.

The verification proof packet adds the final piece: evidence that the task is complete. Task state says what was intended. The proof packet shows what changed and how it was checked. Both are needed for a reliable handoff.

A minimal task file can be simple:

Goal: one sentence describing the accepted outcome
Constraints: rules that must not be violated
Decisions: chosen approach and rejected alternatives
Progress: completed steps and remaining work
Evidence: tests, diffs and external-state checks

This is not a demand for bureaucracy. It is a small artifact that prevents the team from relying on recall for information that matters.

The historical cache bug, kept in scope

The April 2026 postmortem is useful because it gives a date, a mechanism and a fix. It is not a general theory of memory. The caching bug cleared older reasoning after an idle condition, was fixed on 2026-04-10 and contributed to cache misses and faster usage consumption.

The same postmortem describes two other changes: a reasoning default moved from high to medium and a verbosity prompt hurt coding quality. Those are separate mechanisms. A team investigating recall should not attribute every failure to the cache bug, especially after the documented fix.

The single points of failure analysis treats model regression as one failure domain. Memory loss can be another. A fallback plan should preserve task state so a new session or provider can continue without reconstructing the entire project from a transcript.

The agent-team token overhead is relevant when several agents work in parallel. Separate contexts can diverge. A shared task file gives the team a common record instead of letting each agent carry a different version of the plan.

Run a recall test with known items

A recall test places known facts, decisions and constraints at known points in a session. It then asks the agent to use them later. The goal is to measure survival, not to trick the model.

Start with a synthetic task. Write three items into the task brief: a fact, a decision and a constraint. For example, the project uses a fictional function name, a particular library was rejected, and a test must not contact the network. These are test items, not claims about a real repository.

Continue the session with unrelated work. At a chosen point, ask the agent to restate the three items and apply them to a small change. Score each item separately. A correct answer about the fact does not compensate for a violated constraint.

Test item Question to ask Pass condition
Fact What name or value did we choose? Exact value is recalled
Decision Which approach did we reject, and why? Decision and rationale are preserved
Constraint What must the change avoid? The change respects the constraint
Progress What remains to be done? Remaining work matches the task file
Evidence How will we know it is done? Acceptance checks are named

The false-success verification pattern explains why a confident answer is not enough. Inspect the actual diff and test output. If the agent violates the constraint, record the failure even if the final summary sounds correct.

Repeat the test after a long session, after compaction and after a client or model change. Do not invent a failure rate from a handful of runs. Report the conditions and the observed result. The proof-of-work packet provides a place to keep that evidence.

Recall test scoring facts, decisions and constraints at known points in a session
Editorial test design. It measures specific items under stated conditions and does not claim a universal recall score.

Practical workflow controls

The best memory control is often a small written artifact. Keep the task brief short, current and easy to diff. Update it when a decision changes. Do not let it become a second transcript that nobody maintains.

Control When to use it What it protects
Task brief At the start of a non-trivial task Goal, constraints and acceptance criteria
Decision log When an approach is chosen or rejected Rationale that may disappear from a summary
Checkpoint Before a long tool run or context reset Progress and next step
Fresh context When the session is noisy or contradictory Separation from stale instructions
Recall test Before accepting a critical change Facts, decisions and constraints
Proof packet At completion Changed files and verification evidence

The five-hour and weekly limits can interrupt a session before the task is complete. A checkpoint makes that interruption less painful because the next session can start from a written state instead of a vague memory.

The Ultra API credits versus Claude Code usage distinction matters for cost planning, but it does not solve recall. Keep usage records and task records separate, then join them when evaluating the workflow.

The exit-plan checklist should include the task file. If the team changes clients, the file is part of the context that must move. The migration inventory helps identify prompts, hooks and context files before cutover.

Workflow controls using written task state, checkpoints, fresh context and recall tests
Editorial workflow controls derived from the distinction between capacity, retained reasoning and task state.

What a larger window cannot fix

A larger context window cannot repair a missing task brief. It cannot guarantee that a constraint will be used. It cannot preserve reasoning that the cache clears. It also cannot make an untrusted tool result trustworthy.

The agent harness security boundaries matter because more context can include more hostile instructions. Capacity is not a security control. The permission layer and sandbox still determine what the agent can do with the text it receives.

A larger window can also make a session harder to audit. When every file and every old message is present, it becomes difficult to know which input influenced a decision. A focused prompt with a clear task file is easier to review than a giant transcript.

The honest loss is that memory requires work outside the model. Someone must write the task state, update it and test recall. The effort is small compared with reconstructing a failed task, but it is still effort. A tool that promises to remember everything should be evaluated against actual recall tests, not window size alone.

Data gap and future update

The frozen evidence does not provide a measured recall rate for Claude Code, a comparison of context sizes or a population-wide memory failure rate. The historical cache incident is documented, but it does not establish how often memory problems occur in current versions.

Future updates should revisit the official postmortem, run a published recall protocol and record the client version, model and task fixture. Until then, treat the workflow controls as recommendations and the incident as a dated case study.

The Claude Code data usage documentation and commercial retention policy describe provider-side handling. They do not answer whether a model recalled a constraint in a particular session. Keep those questions separate.

Recover when memory fails

A memory failure does not always require a full restart. First, identify what was lost. Was the fact absent from the context, present but overlooked, or removed by a cache or summary event? The recovery depends on the answer.

If the information is missing, restore it from the task file or repository. If it is present but overlooked, restate the constraint next to the action it governs. If the session has become contradictory, start a fresh context with a concise brief and the evidence collected so far. Do not keep adding more text to a session that is already confusing the task.

After recovery, verify the result against the original requirement. A restated constraint is not proof that the change complies. Inspect the diff, run the relevant test and check external state. The verification proof packet keeps that evidence with the task.

Record the failure condition. Note whether it followed an idle period, compaction, a model change or a long tool sequence. The record helps separate a repeatable system issue from a one-off mistake. It also gives the team a reason to adjust the workflow instead of blaming the model in general.

Write a checkpoint that can survive a new session

A useful checkpoint is shorter than the conversation and more structured than a final summary. It should tell the next session what to do without requiring it to reconstruct the entire history.

Start with the current goal and the acceptance criteria. Add the decisions that must not be revisited without new evidence. List the files already changed and the tests already run. Name the next action and any known risk.

Keep the checkpoint in a location the team controls, such as a project file or task system. Do not rely on a chat transcript that may be summarized, compacted or unavailable after an account change. The context-portable migration guide explains why these artifacts belong in the migration inventory.

Review the checkpoint before starting a new session. Remove stale steps and confirm that the constraints still apply. A checkpoint is a living record, not a ceremonial document. Its value comes from being current enough to guide the next action.

Verdict that context capacity is not memory and critical state should be persisted and tested
Editorial verdict from the documented cache incident and the memory-layer model. No universal recall rate is claimed.

Measure memory as part of accepted work

Memory problems often show up as rework. The agent repeats an investigation, violates a constraint or forgets a decision, and a human spends time repairing the result. Those costs belong in the same review as tokens and subscription price.

For each task, record whether the agent preserved the key constraints without prompting. Note any repeated work caused by lost reasoning. Add the human time needed to restore context. The cost per verified change framework provides a place to combine those inputs with API or subscription spend.

Do not turn a small sample into a universal score. Report the task type, client version, model and test conditions. A workflow that works well for a short edit may behave differently in a long multi-file task. The useful comparison is between configurations on the same fixture.

The goal is not to prove that one agent has perfect memory. The goal is to find a workflow where critical state is preserved, failures are visible and recovery is cheap. A written task file and a recall test usually provide more value than another increase in context capacity.

Long conversations need a shorter source of truth

A transcript grows in both directions. New tool output arrives, old decisions become harder to find and the agent may give recent text more attention. A short task file gives the important state a stable location outside that flow.

Update the file when the task changes. Do not copy the entire conversation into it. Maintain the current goal, active constraints, settled decisions and next action. When the transcript and the file disagree, resolve the conflict explicitly instead of letting the agent guess.

The same principle applies to handoffs between people. A new developer should be able to read the task file and understand the work without replaying every message. This is a practical test of whether the state is truly persisted.

Store the file close to the code so it is reviewed with the change. A task brief stored in an unrelated chat or private notebook is easier to forget and harder to audit. The repository gives the team a shared history of what the task required. It also makes a changed constraint visible in the same review as the code that must obey it.

Practical response: test a portable route

If you want to compare memory behavior across agents, use the same task brief and recall test on each one. One AI API Key lists 46 live free model IDs for OpenAI-format agents. The quickstart shows the /v1 endpoint, and the prepaid pricing page explains billing.

Those free IDs do not work inside Claude Code. Claude Code’s Anthropic-format route is documented, but all four Claude IDs were unavailable on 2026-11-27, so it is not an active fallback. Use an OpenAI-format agent for the free lane and preserve the task file across the comparison.

The current model catalogue shows availability, while the live status page provides operational context. The monthly API cost worksheet and cost calculator can track spend, but neither measures recall. Score the known items directly.

Use a disposable key with an expiry and a narrow model allowlist from the API reference. Read the privacy and retention policy, then create the evaluation account through the sign-up route. Run the same task brief and recall test with synthetic data on each client.

Leave the task file outside the conversation and unchanged during the comparison. After the run, record which items were recalled, which were applied and how much human repair was needed. Revoke the test key when the evaluation is complete.

FAQ

Is a bigger context window the same as better memory?

No. Capacity determines how much text can be included. Memory determines whether the right information is retrieved and applied. A large window can still overlook a constraint.

Did the April 2026 cache bug erase all conversation memory?

No. Anthropic described older reasoning being cleared after an idle condition. The documented scope is narrower than wiping every message or all task state.

What should a team persist outside the conversation?

Make the goal, constraints, decisions, progress and acceptance criteria in a short task file. Add checkpoints before long operations and a proof packet at completion.

How do you test recall without inventing a benchmark?

Place known facts, decisions and constraints at known points, then ask the agent to restate and apply them. Record the conditions and score each item separately. Do not generalize a few runs into a population-wide rate.

Sources

More in Blog

Try it

One API key for GPT, Grok, DeepSeek, Kimi, GLM, MiniMax, Qwen, Step, Beam, Nemotron, ERNIE, Hunyuan, Gemma, Laguna, LFM, LongCat, Llama, Solar, Jais, Mistral, K2 and Roleplay.

One AI API Key speaks the OpenAI and Anthropic formats, so you change the base URL and the key, not your code. Credit packs start at $10, and every model has a published per-token rate.

New accounts$10 credit on sign-up
  • 100requests
    per day
  • 3Mtokens
    per day
  • 47free
    models
  • $0per
    token
  • No card
  • No end date
Claim $10 credit →