Skip to the document
Madhuopen lab

§6 Learn · a course

Why AI Agents Forget

Memory for AI agents in five-minute reads: what to store, when to write it, how to find it again, and what it costs to be wrong.

11 chaptersabout 1 hours33 recall cardsnot startedBegin chapter 1

Part I — Why memory, and what kinds

01Why do AI agents forget?Why a Large Language Model forgets everything between two conversations. We will also see why the obvious fixes fail, and what a memory layer costs compared to them.3 min02What kinds of memory does an agent need?The two big kinds of memory an AI agent has, short-term and long-term, and the three flavours of long-term memory. We will also see why the same fact belongs in a different place depending on how it will be used.4 min03How does an agent decide what to remember?About the write path: how a chat transcript becomes a handful of memories. We will also see the big debate of 2026, whether the extractor should be allowed to update and delete old memories, and why the winning answer is "no".4 min04How does an agent find the right memory?About the read path: how a question turns into the three or ten memories that go into the prompt. We will also see why one search signal is never enough, and how three signals are fused into one ranking.4 min

Part II — How real systems do it

05How does memory stay true when life changes?How a memory system handles facts that change: a move, a new job, a broken habit. We will also see the two clocks every fact needs, and why "git for facts" is the right mental model.3 min06Why does a memory system need a delete button?Why an agent that never forgets gets worse over time, not better. We will also see the three forgetting policies that keep a store small and true, and what forgetting has to do with privacy.4 min07How does Mem0 work?How Mem0, the most used open-source memory library, works under the hood. We will walk through the actual code in `mem0/mem0/memory/main.py` and see what changed between the 2025 paper and the 2026 rewrite.4 min08How does HydraDB think about memory?How HydraDB frames agent memory as a database problem rather than a prompt problem. We will also see which of its ideas are old database ideas wearing new clothes, and which ones we borrow.4 min

Part III — Measuring and building one

09How is agent memory measured?About the three public benchmarks for long-term memory: LoCoMo, LongMemEval, and BEAM. We will also see why two systems reporting "92" and "94" cannot be compared, and what a fair comparison needs.4 min10What are we building?The design of our hybrid memory layer, called `hmem`. We will see where each piece comes from, walk one fact through the whole system, and look at the code layout. The goal is a system you can explain on a whiteboard in five minutes.4 min11How does memory scale to a million users?What breaks when the card file grows from one user to a million, and the three moves that fix it: async writes, sharding by user, and compressing vectors. We will also see what TurboQuant does and why it fits a store that changes every second.4 min