Depth 1 · 174 s
A note in a file
A week later, in a new session, the agent remembers something you said once. The model remembers nothing, so where was it kept? How agent memory works, and why its notes are worth reading.
About this video
Last week you mentioned, once, that your manager likes the newest month on the left of a chart. This week, in a brand-new session, the agent draws the chart that way without being asked, and you never wrote it in your instruction file. So who remembered?
Not the model: it keeps nothing between requests. Not the session's context: it started empty. It was written down, in a file on the computer. That is agent memory: notes an agent writes to files during one session and reads back in later ones. It works in two steps. While you work, the agent notices something worth keeping and saves a short note with an ordinary file tool, one more action you can often see. At the start of the next session, the harness puts the memory into the context, just as it does with an instruction file.
A year of notes would fill the context window, so memory usually comes in two layers: a short index, one line per note, loaded into every session (Claude Code loads about the first 200 lines of its memory index), and the notes themselves, opened only when a line looks relevant.
Memory and the instruction file are both text loaded at the start of every session. The difference is who writes them. You write the instruction file on purpose; the agent writes its memory from what it understood at the time. It can misunderstand (blue charts, when you meant just once), and notes go stale. Because the memory is loaded every session, a wrong note is a mistake repeated, confidently, until someone fixes it. It's plain text, though: in Claude Code, /memory shows your instruction files and the agent's memory, so you can read, fix and delete notes. This video explains agent memory on Knaph.
This video shows depth 1 of Agent memory.
Learn Agent memoryTranscript
- 0:00Last week you mentioned, once, that your manager likes the newest month on the left.
- 0:07This week, in a brand-new session, the agent draws the chart that way without being asked.
- 0:13You never wrote it in your instruction file. So who remembered?
- 0:18Not the model. It keeps nothing between requests.
- 0:23Not this session's context. It started empty.
- 0:28So it has to be written down somewhere. In a file, on the computer.
- 0:38Step one: writing.
- 0:41While you work, the agent notices something worth keeping.
- 0:45It uses an ordinary file tool to save a short note. One more action, which you can often see.
- 0:52Manager likes the newest month on the left.
- 0:56The note stays on the computer after the session ends.
- 1:02Step two: reading.
- 1:05At the start of the next session, the harness puts the memory into the context, just like an instruction file.
- 1:13So the model still remembers nothing. The file does.
- 1:17That's what agent memory is: notes in files.
- 1:22But a year of notes would fill the window. So memory comes in two layers.
- 1:28A short index, one line per note, is loaded into every session.
- 1:33Claude Code loads about the first two hundred lines of it.
- 1:37The notes themselves are opened only when a line looks relevant.
- 1:42Like a contents page, and its chapters.
- 1:46So how is memory different from your instruction file?
- 1:50You write the instruction file on purpose. You chose every line.
- 1:55The agent writes its memory, from what it understood at the time.
- 2:00Both are loaded every session.
- 2:04And the agent can misunderstand.
- 2:07You asked for blue charts once. It writes: charts are always blue.
- 2:12Now every session loads that note, and believes it.
- 2:16A wrong note isn't a one-time mistake. It's a mistake repeated, confidently, until someone fixes it.
- 2:24The good news: memory is plain text.
- 2:27Open it, read it, fix what's wrong, delete what's stale.
- 2:32In Claude Code, slash memory shows your instruction files and its memory.
- 2:37And don't just correct it in the chat. Tomorrow, the old note loads again.
- 2:44The model remembers nothing. The files do. So read them.