Long-Term Memory for AI AgentsLimited sources1 source listed so far, so check specifics before you rely on them.This rates where the sources come from. It doesn't prove every claim.
Persist agent knowledge beyond the context window — vector stores, key-value caches, and structured stores for cross-session recall.
By Amit UpadhyayPublished Updated 12 minArticle 8 of 16 in Agentic Systems
AI assistant · answers from this article
1 of 6
Each session stands alone
Nothing to add yet
An assistant that forgets is simple, cheap and private. Everything you store is something you must later keep correct and be able to delete.
On this page
Long-term memory, in one sentence
Long-term memory is what an assistant remembers about a person between sessions, and the hard part is what to write, how to keep it correct and how to delete it.
You reach for it when an assistant should remember stable facts about each user, such as preferences, defaults and constraints, across sessions. Not before: it costs a write-back step, rules for conflicting facts, and deletion that has to reach every copy.
The cheat sheet
What to use when
You do not need all of this on day one. Each row is one signal and the piece that answers it. Stop at the row your system has reached, or pick one to see it in the picture above.
Where you areThe signalWhat to useWhat it costs
None. Nobody needs the assistant to remember them.Nothing. Start every session freshNothing
In every session, users explain again who they are and how they like things done.A small, explicit profile that is always in the promptThe three tiers ↓A store to run, and a step that writes to it
It remembers something the user never said, or a claim that nobody confirmed.Write a fact only when the user states or confirms itThe write-back loop ↓Fewer facts saved, and a confirmation for the sensitive ones
The user moved or upgraded months ago, and the old fact still wins.Update a fact in place, with a date and a sourceAfter six months ↓Rules for which fact wins
A deletion request arrives, and the facts are spread across transcripts, stores and indexes.One delete operation that reaches every copyForgetting ↓Every write tagged by user, and a delete path you test
A memory from one customer appears in another customer’s session.Filter by tenant and user inside the query itselfFailure modes ↓Isolation enforced in the data layer
Start With No Memory
An assistant that forgets everything between sessions is simple, cheap and private, and for one-off questions it's the right design. Memory is worth adding when the same people come back and have to explain themselves each time. Start small when you do, because everything you store is something you'll later have to keep correct and be able to delete.
Long-term memory is what the agent remembers across conversations. Without it, every session starts from zero — the user re-explains their job, their tone preferences, the project context, and the bug they reported yesterday. With it, the agent feels like a coworker; without it, it feels like a customer-service hold queue.
Before you store everything
Users complain the agent "forgets everything" between sessions
You stuffed the whole user history into the system prompt and it costs $0.20 per question
You don't know how to forget when the user asks you to
Pro deep dive12 min full read
Keep reading with Pro
This is one of our advanced production deep dives. Pro unlocks the rest of it, every other deep dive, and the See, Animate, Test and Build modes on every topic.
What it covers
Persist agent knowledge beyond the context window — vector stores, key-value caches, and structured stores for cross-session recall.