Agent memory is an agent's ability to remember information while it works on a task and to call that information back up in later steps. It is not the same thing as the context in a chat window: context is the text the model can see directly in the current conversation, and it disappears once the window closes or the length limit is exceeded; Agent memory is what survives across turns and across tasks — user preferences, steps already finished, mistakes made before. An agent without memory starts from zero on every turn; with memory, it can see a long task through.
Short-term memory handles the now; long-term memory handles later
Memory splits into short-term and long-term memory by how long it lasts and where it lives, and the two do completely different jobs.
| Short-term memory | Long-term memory | |
|---|---|---|
| What it stores | The current task's intermediate state, freshly received tool results | User preferences, past conclusions, recurring facts |
| How long it lasts | Within one task; cleared when the task ends | Kept across sessions, until deleted or expired |
| Where it lives | The context window, temporary variables in the session | A vector database, a database, local files |
| What happens if it is lost | The current task breaks and has to be redone | Next time you have to ask and try again |
Where memory lives decides what it can remember
Short-term memory leans on the context window: once the window fills up, the earliest content gets pushed out, which is why agents in long tasks so often "forget" what was said at the start. Long-term memory has to be written in first and fetched back on demand: when writing, the key points are distilled and stored in a vector database or a regular database; when needed, the most relevant entries are retrieved by similarity and fed back into context. The more that is fetched back, the more crowded the context gets; fetch too little and the answers go off track — retrieval quality is what decides whether memory actually works. Context engineering is about how to organise what gets packed into the window, and the two are often used together.
Three misconceptions to drop first
First, bigger memory is not better memory. Store a lot and retrieve badly, and you are stuffing noise into the context, which only makes the agent answer worse. Second, long-term memory does not mean "the model remembers you". In most products the records sit in an external store — switch models or wipe the records, and the memory is gone. Third, memory is neither a privacy breach by definition nor automatically safe. Before writing anything sensitive into memory, check where it lives, who can read it, and whether it can be deleted — those three points matter more than the feature itself.
Agents with memory fit tasks that run across many turns: a long-term project assistant, personal knowledge management, customer support that talks to the same people again and again. One-off questions gain nothing from memory, and confidential material should never be written into it. When choosing a product, check three things first: can memory be viewed, edited, and deleted. Among open-source options, Mem0 is one implementation of long-term memory — understand those three points first, then decide whether to plug it in.