Blog

The context window is not memory

A bigger context window gives an agent more room to think, and none of it survives the session. Memory comes from deciding what to keep, what to update and what to bring back.

Jonathan Bree

Most flagship models now accept around a million tokens, and a few advertise ten million. It is tempting to read that as the end of the memory problem: put the whole history in the prompt and let the model sort it out. That works for a demo. In production, a context window is working space that the model reads on every request and that holds nothing once the request ends, and treating it as memory leaves an agent slower, more expensive and less reliable the longer it is used.

Memory is a set of decisions about what to keep, what to change and what to bring back into the window at the right moment. This piece covers where the long-prompt approach breaks and what those decisions look like in practice. For the basics of why agents lose track between sessions, start with why AI agents forget.

What a context window holds

A context window is the text a model reads to produce one response: the system prompt, tool definitions, retrieved documents and whatever conversation history you choose to send. Models are stateless between calls, so the application rebuilds that window from scratch every time. Anything you leave out of the next request is gone as far as the model is concerned.

That makes the window a good place for reasoning. The model can compare documents, follow instructions and hold a plan while it works. It also means the application, and the team that built it, decides what the model knows on every turn. A larger window raises the limit on that choice without making it for you.

Where stuffing history into the prompt breaks

Cost grows with every turn

When the full history is resent on each request, every new message pays again for all the messages before it. Over a long conversation the total number of input tokens grows roughly with the square of its length. Prompt caching cuts the price of a repeated prefix, but the model still has to read it, and the cache only helps while the prefix stays identical. Our token cost work goes into the numbers.

Accuracy falls as the window fills

Models do not read long inputs evenly. Liu and colleagues showed in their lost in the middle study that accuracy is highest when the relevant passage sits near the start or end of the input and drops when it sits in the middle. Chroma’s 2025 context rot report tested 18 models and found performance became less reliable as input length grew, even on simple tasks. A fact buried 400,000 tokens into a transcript is technically available and often missed.

Old facts and new facts sit side by side

A transcript keeps everything a user has ever said, including the things that are no longer true. If a customer lived in Toronto in March and moved to Berlin in September, both statements are in the history with equal weight. The model has to work out which one wins on every request, and it will sometimes pick the wrong one. Memory systems handle this with contradiction resolution, so the newer fact supersedes the older one before the model ever sees it.

Summaries lose the details

When history outgrows the window, the usual fix is to summarise older turns. Summaries keep the gist and drop the specifics, such as the invoice number, the exact deadline or the name of the colleague who signed off. Those are often the details a user expects an assistant to remember. We look at this failure in how summarisation quietly loses the facts you needed.

Transcripts are hard to govern

A pile of raw conversations is difficult to audit, scope or delete from. If a user asks you to forget their phone number, you have to find every transcript that mentions it. Separating one customer’s history from another’s depends on your own filtering code. A memory store with per-user scoping and timestamps makes those jobs tractable.

Memory is three decisions

What to keep. Most of a conversation is scaffolding: greetings, clarifications, false starts. The parts worth keeping are facts (the customer is on the Scale plan), preferences (they want answers in bullet points) and events (they reported a failed export on 12 November). Extracting those at write time keeps the store small and the signal high.

What to change. Facts go out of date. A memory layer needs to update or supersede entries when new information arrives, record when each fact was learned, and let some things fade. We argue the case for deliberate forgetting in forgetting is a feature.

What to bring back. On each turn, the agent should pull a small, relevant slice of memory into the window: the handful of facts that bear on the current question, favouring recent ones. Retrieval quality matters more here than raw capacity, because a precise 2,000-token slice gives the model less to misread than a 200,000-token history.

The window and the memory store do different jobs. Memory decides what the model should know; the window is where the model uses it. Our glossary entry on memory vs the context window sets the two side by side.

A worked example

Take a support agent for a SaaS product. A customer has been in touch a dozen times over six months. With the full-history approach, each new ticket sends every earlier conversation to the model: tens of thousands of tokens, including an old billing address, a plan they have since upgraded from and a bug that was fixed in June. The agent answers correctly most of the time, takes longer than it should and occasionally quotes the old address.

With a memory layer, the same agent starts each ticket by retrieving what is current: the customer’s plan, their preferred contact channel, the two open issues and the fact that they moved to Berlin. That is a few hundred tokens. The response is faster, cheaper and grounded in facts that have already been reconciled. The older conversations still exist for audit, and they no longer need to be read on every turn.

What to settle before you build

If you are designing an agent that people will use more than once, a few questions shape everything else. Which facts about a user or account should persist, and for how long? What should happen when a new statement contradicts an old one? Who can see a memory, and how is it deleted? How many tokens of memory should reach the model on a typical turn? Teams that answer these early tend to choose simpler infrastructure and ship fewer surprises.

How Exabase approaches memory

Exabase Memory takes conversations or text and extracts facts, preferences and events automatically. When facts change, it resolves the contradiction, so a move to Berlin replaces the old Toronto address. Retrieval uses hybrid semantic and keyword search with a bias towards recent facts, and every memory carries creation and modification timestamps. Memories are scoped to a Base, so each user, project or customer keeps their own.

The result is a small, current set of facts for the window to work with. The agent memory page covers the patterns teams use, and our research pages publish the benchmark results behind the M-1 engine.

FAQs

Is a bigger context window the same as memory?

No. A context window is what the model reads for a single request, and it is rebuilt from scratch each time. Memory is the store your application keeps between requests and the logic that decides what goes back into the window.

Why not send the full conversation history every time?

It works for short conversations, but cost grows with every turn, accuracy falls as the input gets longer, and outdated facts stay in the history alongside current ones. Past a few dozen turns, retrieving the relevant facts is cheaper and more reliable.

Does prompt caching fix the cost problem?

Partly. Caching reduces the price of reading a repeated prefix, but the model still processes it, the cache only helps while the prefix is unchanged, and it does nothing for accuracy on long inputs.

What should an AI agent remember?

Facts, preferences and events that will matter in future conversations, such as a customer’s plan, how they like answers formatted and what issues they have reported. Small talk and resolved back-and-forth can usually be dropped.

How does a memory layer handle facts that change?

A good memory layer records when each fact was learned and supersedes older facts when new information contradicts them. Exabase does this automatically, so retrieval returns the current state instead of every version.

How many tokens of memory should go into each request?

There is no fixed number, but most turns need far less than the full history: the handful of facts that bear on the current question, often a few hundred tokens. Set a budget, then measure answer quality as you raise or lower it. Our context budget template gives a starting point.

What is context rot?

Context rot is the drop in a model’s reliability as its input gets longer, even when the task stays the same. Chroma’s 2025 report found it across all 18 models it tested, which is why a precise slice of memory tends to beat a long transcript.

Can I use RAG instead of a memory layer?

RAG retrieves passages from documents, while a memory layer stores facts learned from users and updates them as they change. Many agents use both: RAG for product docs and policies, memory for what each user has said. The RAG vs agent memory entry covers the difference in more detail.

Related pages: Memory vs context window, Agent memory, Context rot, Why AI agents forget, Exabase vs Mem0, Best agent memory platforms, Customer support agents, Reduce token costs.

Cut your token spend and give your agent precise context.

Get started in minutes.

Cut your token spend and give your agent precise context.

Get started in minutes.