I work with three AI coding agents at once. Claude leads and plans, Codex reviews and takes the hard bugs, and OpenCode does the cheap, mechanical work. It's a great team, apart from one thing. None of them remember anything. Close the terminal, and the decision we spent twenty minutes on is gone. Open a new session tomorrow, and I'm explaining the database choice all over again, to an agent that confidently picks the other one.
So I built AgentMem, a shared memory for all three. The plan sounded simple. Save every session, summarize it, and keep one note per project saying where things stand. When a new session starts, hand it that note before anyone types a word.
The first version worked. At least it looked like it did.
01The memory that leaked
Saving sessions was the easy part. Hooks in each agent fire when a turn ends, and a background worker picks up the transcript, strips out secrets, and asks a small model for a summary. The summaries landed in my Obsidian vault, and the project notes got rewritten from them. It was searchable and tidy, and all the tests were green.
Then I asked a different question. Never mind whether each part works. If I start a brand-new session, does it actually know where the project stands? I scripted real agents through a week in the life of a project: decide something, quit, come back, change my mind, get killed mid-task. Then I read what the next session was handed.
The worst one was the quietest. One week I decided against something, and a later session cheerfully brought back the old decision, because the reversal had happened in a session the system decided wasn't worth saving. Memory that is confidently wrong is worse than no memory at all.
02The wiki detour
My first instinct was to go bigger. Andrej Karpathy had sketched a pattern he calls the LLM Wiki. Instead of searching raw documents every time you ask something, you let the model build and maintain a living wiki. It ingests new sources, links them together, and periodically lints itself for contradictions. Knowledge gets compiled once and kept current, so it compounds.
I built a version of it: a claim store where every fact points at its evidence and every decision knows what it replaced. Then I benchmarked it against plain search, and on a set of made-up test questions it crushed it.
On questions pulled from my real repositories, though, the improved plain search was level with it or ahead. Worse, the store sometimes served an outdated decision as current, which is the exact bug I was trying to kill. And the benchmark itself was asking the wrong question. It tested whether memory can answer things. What I actually needed was memory that tells a new session where we are, before anyone asks.
So I kept the idea and dropped the second system. The rest of this story is the briefing.
03One page per project
Every project now has a single status page. It has seven fixed sections: purpose, what works, latest progress, active work, open questions, key decisions, and next steps. That page is the only place that says what is true now. Everything else, every old session and every retired decision, is history. You can still search history. It just never gets to pretend it's current.
Current state: switched to Postgres for multi-user
Decided: dates stored as 20261016
Decided: ISO dates only
Working on: overdue filter
Working on: overdue filter (done?)
Next: run the tests
Next: wait for review from the reviewer
Note: the temp folder is part of the project
Pending: 140 more lines from old sessions…
Pending: …
Pending: …
Pending: …
Active work
- Overdue filter: list --overdue not wired yet (oct-24 #e4)Next steps
- Wire list --overdue and test it (oct-24 #e6)Key decisions
- Postgres, because multi-user needs concurrent writers (oct-23 #e2)- ISO dates only; week dates were ambiguous (oct-24 #e2)
What works
- Due dates and priorities, sorted listing (oct-22 #e5)Those little #e4 tags matter. When a session ends, its note gets numbered evidence entries, and each one is a quote from the actual transcript. A claim can only reach the status page if it points at one of those quotes, and if the quote really contains what the claim says. The summarizer's invented facts died right there. You can't cite a quote that doesn't exist.
04Change your mind. Watch it happen.
Here is the move that broke the old system: deciding one thing on Monday and the opposite on Wednesday. Click through the week.
05The model proposes. Code decides.
A small model reads each finished session and proposes an update to the page: what to keep, what to add, what to retire. It's good at that. What it is not good at is following rules every single time. The rules I left to the prompt alone kept getting broken in live runs. So the model only proposes, and a plain piece of code checks every proposal before anything touches the page.
because: next step "run tests"
using evidence from Oct 22
06Back to the wiki, sort of
Funny thing. Once the status page settled, I looked back at Karpathy's sketch and realised I'd ended up building a version of it after all. It's just smaller, and it has a stricter editor.
07The bug that hid in plain sight
The nastiest bug of the project only showed up once real agents were driving. Hundreds of tests had sailed past it. AgentMem skips trivial sessions, which is good, because nobody needs a note for "what time is it?". But it judged each turn on its own. Picture a session where you talk through a decision first and write the code afterwards:
That bug had probably been eating discussion-heavy sessions all along, and those are exactly the ones where decisions get made. No unit test caught it, because each test checked one turn. The only thing that caught it was running two real sessions end to end and noticing that the second one didn't know what the first had decided.
08What a session sees now
Open a new session in any of my projects, in any of the three agents, and before I type anything it already has the briefing:
Ask it "what are we doing and what's next?" and it answers from the briefing, correctly, without opening a file. That was the whole point.