Course contents · How AI agents actually work
- 1What is an LLM?
- 2Prompts: brief it like a contractor
- 3Tools: how an AI does things
- 4Context: what's on the desk
- 5Memory: the filing cabinet
- 6What is an AI agent?
- 7Evals: how do you know it works?
- 8Who approves what an agent does?
- 9RAG: finding the right page
- 10Subagents: when an agent delegates
- 11MCP: one plug for every tool
- 12Not everything needs to be an agent
- 13The whole picture
Lesson 5 of 13
Memory: the filing cabinet.
How an agent carries useful facts from one conversation to the next, and why remembering everything is as bad as remembering nothing.
CTO and co-founder, LaunchLemonade7 minReading timeThink of an office where you hot desk. Every morning you sit at a clean desk with nothing on it. That desk is the model's context: each new conversation starts empty. But the filing cabinet in the corner stays put, and you always know where it is. That cabinet is memory.
Memory is a system, not a recording
An LLM forgets everything between calls. Each new conversation is a new desk with nothing on it. If an agent seems to remember you, something around the model is saving facts and putting them back on the desk at the right moment.
So memory for an agent isn't a single feature. It is a system for deciding what to keep, how to find it again, and when to let it go. Like context, it is harder to get right than it sounds.
- Context
- the desk: what the model can see right now, for this one decision
- Memory
- the filing cabinet: what survives after the desk is cleared
Three jobs: write, retrieve, maintain
- Write: decide what's worth keeping
- Retrieve: find the few memories that help with this turn
- Put them on the desk (into the context)
- Maintain: update, merge and forget as things change
Write. Keep the salient facts, not the transcript. "Prefers a phone call to email" is worth filing. The whole conversation where you mentioned it is not.
Retrieve. When a new task starts, fetch only what helps with it. This is the same idea as RAG, which has its own lesson later, pointed at the agent's own history instead of a library of documents.
Maintain. Facts go out of date, and old facts can contradict new ones. Memory that only ever grows slowly rots. Good systems update, merge and forget. Some people call this tidying-up step "dreaming".
How memory goes wrong
The failure modes are fairly predictable once you see memory as a filing cabinet:
- Remember everything
- expensive and noisy, and finding the right thing gets harder
- Forget everything
- no continuity: every session starts cold
- Retrieve the wrong thing
- confidently wrong, which is worse than uncertain
The last one is the sneaky one. A memory that was true in March, brought back in October, looks just as authoritative as a fresh fact. The model has no way of knowing it has gone stale unless the system tells it.
Memory and privacy
Anything an agent remembers can come back later, in a different conversation, possibly in front of a different person. That is useful when it is your own preferences. It is a problem when it is a client's private details, or advice based on something that is no longer true.
So the questions worth asking of any AI tool with memory are simple: what does it save, can I see it, can I edit or delete it, and who else can it surface it to?
Running example
The running job
Chasing last month's unpaid invoices, one lesson at a time.
Priya's invoice chaser runs once a month. Each run starts at a clean desk. Without memory, it would treat every client as a stranger every month.
- Worth filing
- this client disputed an invoice in May; this one prefers a phone call; this one always pays a week late but always pays
- Not worth filing
- every reminder email ever sent, word for word
- Needs maintaining
- the dispute was settled in June, so that note should be updated, not left to block future reminders
At the start of each run, the chaser retrieves only the notes for the clients it is about to chase. The rest stays in the cabinet.
Practice
Try it yourself
About five minutes, in any AI chat app
Be the filing cabinet
Open any AI chat app. Paste in a short, messy note about a client, the kind you'd jot after a call. Include a few useful facts and a lot of chatter.
Ask: "If you could only remember three facts from this for next month, which would they be, and why?"
Then ask: "Which of these facts might be out of date in six months, and how would you check?"
What to look for
A good answer keeps durable facts (preferences, standing arrangements) and drops the chatter. Notice that it's the system around the model, not the model, that would have to actually save those three facts and bring them back next month.
Common mistakes
Saving whole conversations and calling it memory.
Save short, specific facts. A transcript archive is the messy desk in a filing cabinet.
Never letting anything go.
Give memories a way to be updated or removed. Old facts that contradict new ones cause confident mistakes.
Forgetting that memory can surface later.
Decide up front what must never be remembered, such as client personal details, and check what your tool actually stores.
Quick check
3 questions to see what stuck. Nothing is scored or saved.
1. In the desk and filing cabinet picture, what is memory?
2. Which of these is the best thing to write to memory?
3. Why is retrieving the wrong memory worse than having none?
Remember
Memory is a filing cabinet with three jobs: write what matters, retrieve what helps, and maintain it so it doesn't rot.
Sources and further reading
- 1.The LinkedIn post this lesson grew out of: Memory
Finished this lesson?
0 of 13 done in this course. Progress stays in this browser, no account needed.