What an agent's memory is, and what it replaces
A memory is a record written in one session and read in a later one. What it replaces is working the answer out again from the documents, so a store is a trade, not an upgrade.
The definition, and the alternative
A memory is a record written during one session and read during a later one. All the machinery around memory exists to serve that one sentence.
What matters isn’t what a memory is. It’s what it replaces: going back to the documents and working the answer out again.
| reading a record | working it out again | |
|---|---|---|
| cost | one lookup | reading the documents, every time |
| right when nothing has changed | yes | yes |
| right after a document changes | only if something noticed | yes, always |
| can answer what did we say last quarter? | yes | no |
- The record wins on cost.
- Working it out again wins once something has changed.
- Only the record can say what you told someone. Step 11 is about that row.
- Both routes answer the question, and reading the record arrives first: that’s the whole appeal.
- Then one document is edited, and only the long route’s answer changes.
- The record isn’t wrong because anyone made a mistake. It was written before the edit, and nothing has looked since.
A store is a trade
Most writing on this subject says memory makes an agent better. More precisely, a store saves you the cost of working the answer out again, and in return you risk being confidently out of date. Whether that’s a good trade depends on two things you can measure and one you have to decide:
| # | what to find out | where it comes from |
|---|---|---|
| 1 | how expensive working the answer out again really is for you | measure it |
| 2 | how often your documents change | measure it |
| 3 | what a confidently wrong answer costs you | you decide |
In these labs, working it out again is always possible and always right, because the documents are small. That’s a property of the labs, not of the world, and step 12 says so plainly, because everything here rests on it.
What this volume doesn’t count as memory
- The context window. It’s a working area, cleared at the end of the session. Step 2 defines it and then leaves it alone.
- A transcript. Keeping every message is a recording, not a memory system: nothing in it was chosen as worth keeping, and nothing in it can go stale, because nothing in it claims to be true. The moment you pull a claim out of a transcript, you’ve built what this volume is about, and step 5 measures exactly that moment.
python3 lab.py answer
Part 1 runs the five sessions with nothing remembered: every answer comes from the documents, and every one is right.