Give your agent a memory that survives tomorrow
Why does an agent forget everything? Memory is a file of short notes it reads before every job and writes after. The smallest version that works.
By Nick
On this page
- Twenty minutes
- Nothing extra
- Intermediate
Before you start
Learn
What is an AI agent?
1. What memory actually is
Every run starts with a clear desk. Memory is the notebook you leave on it: a plain file the agent reads first and writes last. “Nick prefers short answers.” “The invoice job needs the client folder, not the whole drive.” “The calendar sync moved on 3 October; check before trusting it.”
Not transcripts. Not everything. Facts that would change how the next job goes.
2. Set it up with one instruction
Paste this into the agent, and keep the file it creates somewhere you can open.
Set up a long-term memory for yourself: one plain text file. Before every job, read it.
After every job, add any new fact that would change how a future job should go: a
preference I stated, a correction I made, something about the environment that changed.
One fact per line, dated, under 20 words, no transcripts, no summaries of what you did.
Never delete a line without asking me. Tell me where the file lives, and show me its
contents whenever I ask.
3. Back it up before an agent writes to it
Before you let anything write to this file automatically, keep a copy you can roll back to: a version-controlled folder, a synced backup, or just a dated copy saved before the first automatic write. A bad edit to a file an agent reads before every job is a mistake that repeats itself until you notice it.
4. The rule that stops it rotting
Once a month, read it. Delete the stale, merge the duplicates, fix the wrong. Ten minutes. The weekly check includes “what did you add to memory”, so you see it drift before it matters.
And keep one memory, not one per bot. Four bots with four notebooks is four bots that each know a quarter of what you taught them; I did that, and collapsed them back into one.
How you know it worked. You can open the file and read it in two minutes. Honestly, this is still the weak part of my own setup: it works, but it is more manual than it should be.