Agents have Amnesia. I Gave It a RocksDB.
A shared, durable, cross-session memory in about 300 lines — and an honest look at where RocksDB is the wrong tool.
TL;DR
- Coding agents start every session from zero. The usual fix — a hand-maintained static CLAUDE.md or rules file.
- RocksDB is a good fit for agent memory: ordered keys make prefix scans your query language, column families give you tiered retention, and LSM storage suits a write-heavy event log.
- It has one constraint that nearly disqualifies it: exactly one read-write process per database, and the lock fails immediately rather than waiting.
- The fix is architectural, not clever. Let the MCP server own the database handle. It's already a single long-lived process that many sessions talk to.
- Working code and tests at the end. Also: the bug my test suite caught, and a table of when you should just use SQLite instead.
The amnesia tax
I spend a nontrivial part...
Copyright of this story solely belongs to hackernoon.com. To see the full text click HERE