What is the difference between context and memory?
Answer
Context is the token budget for the current request. It is ephemeral. When the request ends, it is gone. The model has no persistent state between calls.
Memory is anything outside the model that stores information and puts it back into context later. It is not a model capability; it is infrastructure you build.
A memory system needs three parts:
- Storage. A file, a database, a vector store, a knowledge graph.
- A write policy. What gets saved, and when. This is the hard part, and the part usually done badly.
- A retrieval policy. What gets pulled back in for a given request, and how much.
The retrieval step is where memory systems fail. Retrieving too much crowds the window and buries the current task. Retrieving too little means the memory may as well not exist. And retrieval is usually similarity based, which is not the same as relevance.
The simplest memory that works is a file the agent reads at session start, such as CLAUDE.md or AGENTS.md. No embeddings, no retrieval logic, fully inspectable, and you can correct it by editing a file. For a large fraction of use cases this is sufficient, and teams reach for vector stores earlier than they need to.
Common wrong answer
Saying models "remember" previous conversations. They do not. Any apparent memory is a system re-injecting prior text into context. If a product appears to remember you, something stored that and retrieved it.
Another mistake is treating a vector database as synonymous with memory. It is one storage option, and it only handles semantic similarity retrieval. Recency, structure, and explicit facts often matter more.
Likely follow-ups
- How would you implement memory for an agent?
- What should never go into memory?