Victor Taelin's OptMem Gives AI Agents Permanent Memory Without a Database
Victor Taelin's OptMem gives any coding agent persistent memory using an append-only log, a binary merge tree of summaries, and a 426-token prompt.
PRO- Victor Taelin released OptMem, a plug-and-play permanent memory system for AI agents
- Ships as a 426-token prompt plus a single dependency-free Python script
- Append-only LOG.txt stores every memory forever; TREE/ caches binary merge-tree summaries
- memo wake prints a fixed-size document where recent memories are verbatim and older ones fade
- memo zoom lets agents navigate the tree down to raw memories for precise recall
- Regex-only retrieval, no semantic search; targets single-user single-machine agents
Every AI coding agent has the same amnesia problem. The context window is its whole world, and that world ends the moment the session closes. Victor Taelin, the author of HVM and Kind, got tired of the usual patches (notes files, vector stores, memory servers) and shipped his own fix: OptMem, a permanent memory layer for agents that amounts to a text file and a Python script.
The pitch is unusually minimal. OptMem ships as a 426-token prompt block and a single Python file with no dependencies. You paste the prompt into your AGENTS.md or CLAUDE.md, and the agent starts writing one-line notes to an append-only log on disk. No vector database, no embeddings, no server, no daemon.
The two-file trick
The core design splits the memory problem in half. Every entry is appended to LOG.txt and never edited or deleted, so nothing is ever forgotten. What the agent actually reads on wake-up is a fixed-size document: memo wake prints a bounded number of lines, with recent memories verbatim and older ones progressively compressed. At a hundred million memories it is still the same number of lines.
The compression cache lives in a TREE/ directory as a binary merge tree over the log. A block is an aligned power-of-two range of memories compressed into a single line, and each block is built from its two halves. Entries #0 and #1 fuse into block 0-1, that pair fuses with 2-3 into 0-3, and so on. Every node, no matter how many raw entries it covers, is one line of at most 280 characters.
This story is for Pro members
You've reached the end of the free preview. Upgrade to AlphaSignal Pro to read the full article - and everything else behind the paywall.