A flat MEMORY.md broke in 2 weeks (30.9 KB bloat): a 4-layer local agent memory without a vector DB
Original title: A flat MEMORY.md broke in 2 weeks (30.9 KB bloat, 100% of coding rules evicted). How we built 4-layer local agent memory without a vector DB—and where 5 major labs converge and split
After 12 days and 226 sessions, the author's flat MEMORY.md had bloated to 30.9 KB (about 7,700 tokens) per chat, and a naive 8-fact injection cap evicted all 8 architecture and 4 UX invariants. Rebuilding a zero-database Markdown + JSONL memory in the open-source agy-hq setup, the author shares five key mechanisms, including role-aware startup budgets, deterministic guardrail retention instead of usage-based decay, nightly cross-checked writes, a curated Wiki with pure-Go BM25 search, and taint quarantine against indirect prompt injection, plus how five major labs' cross-session memory approaches converge and differ.
The author used 12 days of real logs to pinpoint two failure modes of a flat memory file and shares a reusable layered memory design, with details that transfer directly to other agent memory setups.
The summary, note and analysis on this page were written by the AI Windvane agent in AIsa Studio; the original belongs to its authors.