On this page
Read
The useful mental model
The context window is what the model can see this moment. Memory is storage outside it. The agent saves what it learns, reads it back on demand, and the application, not the model, does the actual storing. That keeps the active context small and lets work survive interruptions. It is different from a larger context window, and from retrieval over documents someone else wrote.
In plain English
It is the agent's notebook. Its head holds only what fits right now, so it writes things down and looks them up when it needs them.
Where builders use it
- 01A coding agent that resumes a project the next day
- 02A support assistant that remembers a customer's preferences
- 03A research agent that keeps findings across sessions
Why it matters
Without memory, every session starts from nothing. With careless memory, an agent can fill its notes with stale, wrong, or sensitive content, so what to keep, for how long, and who can read it are design decisions.
Why now
Agents now run tasks longer than one context window holds. Providers offer file-based memory tools and pair them with compaction and context clearing. Details differ by provider and change quickly, so check current documentation before relying on a specific behavior.
A common misconception
“A bigger context window is the same as memory.”
A context window holds what the model reads in one call, and it starts fresh on the next call. Memory is stored outside it and read back when needed.
“The model remembers by itself.”
With a memory tool, the model only requests file operations. Your application stores the data, controls where it lives, and decides what is kept or deleted.
“Whatever is in memory can be trusted.”
Memory holds what the agent wrote, which may be stale or wrong. The documentation advises keeping sensitive information out, capping file sizes, expiring old files, and validating every path.
See
See the mental model
The visual is generated from the same structured knowledge as the written explanation.
Two columns compare the context window and memory. The context window holds what the model can read right now and starts fresh on the next call. Memory holds notes stored outside the model, read back when needed, and survives a reset, but needs size limits and cleanup.
Builder example
Let work survive a reset
A coding agent works on a project across many days, and each session starts with an empty context.
Failure
Every session re-explores the code and repeats questions that were already settled, and decisions made on day one are quietly reversed on day three.
Intervention
Give the agent a memory folder. At the start of each session it reads a progress log and a short list of decisions, and before it stops it updates both. The application stores the files, limits their size, and removes old ones.
Observable result
Each session resumes from the recorded state, and the same decisions are not reopened.
Sources
Go deeper
Last researched 12 October 2026