Overview
The memory system gives AI agents persistent context across sessions — they remember what happened, what decisions were made, and what patterns emerged. Without memory, every session starts from zero. With it, agents compound knowledge over time. Drevon’s memory (v2) is built around one principle the whole industry has converged on: bounded eager load, lazy detail. Instead of reading every memory file at the start of every session — which grows unbounded and both costs tokens and degrades answer quality — the agent reads a small, budget-capped index and pulls in individual detail files only when they’re relevant.On a real workspace this cut the per-session eager load from ~59,000 tokens to ~260 —
a 99.5% reduction — with no loss in answer quality (measured live: agents still cite
the exact right source, just retrieved on demand instead of dumped up front).
The three tiers
topics/user.md, topics/projects.md, topics/systems.md in place of
architecture/patterns.
How it works
1
Session start — read the index only
The agent reads
INDEX.md and nothing else. It carries the project summary, the
current focus, one-line pointers to every topic file, and the most recent log headlines
— all within a small token budget (default ~2,000).2
During work — load detail on demand
When a task needs a specific decision or pattern, the agent opens that one file
(the index points to it), or runs
drevon memory search to find older history. It never
reads the whole memory directory up front.3
Writing — via the CLI, never by hand
Agents record memory with
drevon memory log | decide | learn | note. These append to
small files and refresh the index automatically — so a write never requires re-reading a
large file.4
Compaction — keep it small over time
drevon memory compact rolls old log months into summaries and archives their bodies, so
memory stays fast no matter how long the project runs. Run it periodically, or use the
shipped memory-compact prompt for an agent-driven consolidation pass.Writing to memory
Agents (and you) record memory through the CLI so entries land cheaply and the index stays in sync:Keeping memory relevant
- Retention scoring ranks content by an Ebbinghaus-style forgetting curve (salience by type + recency), so compaction knows what to summarize. Decisions and architecture are never auto-evicted — only summarized in place.
drevon doctorwarns when the index exceeds its budget (runcompact) or when a CodexAGENTS.mdapproaches the 32 KiB truncation cap.drevon memory statusshows the eager load, per-tier token usage, and the budget.
Upgrading from v1
Older workspaces used four monolithic, append-only files (context.md, decisions.md,
patterns.md, log.md). To port them to v2:
archive/pre-v2-<date>/, and rewrites your config. It’s idempotent and also runs
automatically on drevon sync / drevon upgrade (pass --no-migrate to skip). See the
migration guide for details.
Disabling memory
npx drevon init --no-memory.
Memory is one of Drevon’s most valuable features — and in v2 it’s nearly free at session
start. Keep it on.