The hardest problem in agent architecture just got a 426-token answer—and it's one Python file with zero dependencies.
The Summary
- OptMem is a permanent memory system for AI agents that fits in a single curl command and 426 tokens of instructions
- Scales to 1 million memories (608 MB) with 0.03s retrieval time using fixed-width records and tree-based summarization
- Solves agent amnesia without vendor lock-in: works across sessions, model changes, and platforms
The Signal
Agent memory is the chokepoint. Every AI wrapper company is burning cycles on vector databases, RAG pipelines, and context window management. VictorTaelin's OptMem takes a different path: append-only logs, tree-based summaries, and fixed-width records. No embeddings. No databases. One Python file.
The architecture is elegant. Every memory is a line in `LOG.txt`, never edited. Summaries build up in a tree structure, cached in `TREE/`. When you run `memo wake`, it reads your most recent context—default 96 lines, roughly 8k tokens. When you `memo note "deployed the trading bot"`, it logs the memory and kicks back merge prompts when related memories need consolidation. You handle merges manually with `memo nap`. Nothing runs in the background.
"Records are fixed width, so position is identity and every lookup is one seek."
This is the insight. Modern agent memory systems treat retrieval as a search problem—cosine similarity across embeddings, ranked results, relevance scores. OptMem treats it as an indexing problem. Fixed-width records mean you can seek to any position in constant time. A million memories loads in 0.03 seconds. No vector math. No reranking.
The implications for multi-agent systems:
- Memory lives in a folder, not a proprietary service
- You can `git` your agent's memory, sync it across machines
- Model upgrades don't break continuity—the log is model-agnostic
- Agents can fork memory trees, merge them back, diff their histories
Taelin built this for his own agents and shipped it as a GitHub repo. No company. No API. No $50/month memory tier. The installer is a shell script. The entire integration is 426 tokens that paste into your system prompt. It tells the agent: "Your memory is at `~/.optmem/memory`. Use `memo wake` at startup. Use `memo note` to record. Handle merge prompts as they come."
Key tradeoffs:
- No semantic search—`memo recall` is grep, not vector similarity
- Merges are manual—you answer consolidation prompts when the tree fills
- Summaries are lossy—old details compress into higher tree nodes
But here's what you gain: control. Your agent's memory isn't trapped in Anthropic's servers or OpenAI's context cache. It's a folder. You own it. You version it. You back it up. When you switch from Claude to GPT-5 or some local model next year, the memory comes with you.
The Implication
The agent platforms selling memory-as-a-service just got undercut by a weekend project. If you're building agents that need continuity across sessions, try OptMem before you architect around someone else's infrastructure. Fork it. Modify the tree logic. Add your own merge strategies.
The real signal: agent memory doesn't need to be complicated. It needs to be durable, fast, and portable. Taelin just proved you can do all three in one Python file. The companies that figure this out will build agents people trust for months, not sessions.