{"slug": "your-ai-agent-has-amnesia-here-s-the-file-architecture-i-use-to-fix-it", "title": "Your AI agent has amnesia. Here's the file architecture I use to fix it.", "summary": "A developer created a file-based memory architecture for AI agents using plain Markdown files to overcome the problem of agents forgetting information between sessions. The system separates static identity files from dynamic memory layers: daily notes, curated long-term memory, and on-demand recall. The approach avoids frameworks and databases, relying on grep for retrieval.", "body_md": "Most agents I build start life the same way: capable, fast, and completely amnesiac. They have no opinions, no voice, and they forget everything the moment the session ends. They're a search engine with extra steps.\n\nAfter rebuilding the same scaffolding for the Nth time, I converged on a small set of plain Markdown files and a memory model that survives restarts. No framework, no database — just files an agent reads at the start of every session and writes to as it goes. Here's the whole thing.\n\nTwo separate failures get lumped together as \"my agent has no memory\":\n\nYou fix them with two different layers.\n\nA few static files the agent reads first, every session:\n\n`SOUL.md`\n\n— personality, tone, boundaries. The non-negotiables. \"Be direct, not rude. Have opinions. Don't send half-baked replies to external channels.\"`IDENTITY.md`\n\n— name, vibe, one-line self-concept.`USER.md`\n\n— who it's helping, and how they like to work.`AGENTS.md`\n\n— operating rules + the session ritual (what to read, in what order, before doing anything).These rarely change. They're the constitution.\n\nThis is the part people get wrong. One giant `memory.txt`\n\ndoesn't scale: it either grows unbounded or gets overwritten. Split it by *lifespan*:\n\n`memory/2026-06-15.md`\n\n. Everything that happened today, written as it happens. Cheap, lossy, never edited. This is working memory.\n\n`MEMORY.md`\n\n. The distilled essence. Periodically (I do it on idle cycles), the agent reads recent daily notes, extracts what's worth keeping forever, and writes it here. Old/irrelevant entries get pruned. This is the equivalent of a human reviewing their journal and updating their mental model.\n\nBefore answering anything about prior work, decisions, or preferences, the agent *searches* its memory files and pulls only the relevant lines into context. You don't load everything every turn — you load the index, then fetch on demand.\n\nThe flow: **raw daily notes → curated long-term → recall on demand.** Each layer has a different lifespan and a different cost, which is the whole point.\n\nFor a single agent, plain Markdown wins on the things that actually matter day to day:\n\n`grep`\n\n.Vectors are great when you have a large corpus to search. The *identity and curated-memory* layer is small and benefits more from being legible than from being embedded.\n\nWrite it down or it didn't happen. \"Mental notes\" don't survive a session restart — files do. The single most important rule in `AGENTS.md`\n\nis: when you learn something durable, *write it to a file now*. Everything above is just giving that instinct a place to put things.\n\nI packaged this whole thing — the template files, a longer guide on each layer, and a fully worked example agent (\"Pip,\" a research assistant with the personality and all four memory types filled in so you can see a finished one rather than blanks) — as a drop-in kit. If you'd rather copy a working setup than build it from scratch: ** AI Soul Kit** (Core ¥980 / Plus ¥3,800).\n\nBut honestly, the architecture above is the part that matters. Steal it.", "url": "https://wpnews.pro/news/your-ai-agent-has-amnesia-here-s-the-file-architecture-i-use-to-fix-it", "canonical_source": "https://dev.to/01_a125211d8c3da3fdcfd/your-ai-agent-has-amnesia-heres-the-file-architecture-i-use-to-fix-it-558e", "published_at": "2026-06-15 01:11:04+00:00", "updated_at": "2026-06-15 01:41:17.648276+00:00", "lang": "en", "topics": ["ai-agents", "developer-tools", "large-language-models"], "entities": ["AI Soul Kit"], "alternates": {"html": "https://wpnews.pro/news/your-ai-agent-has-amnesia-here-s-the-file-architecture-i-use-to-fix-it", "markdown": "https://wpnews.pro/news/your-ai-agent-has-amnesia-here-s-the-file-architecture-i-use-to-fix-it.md", "text": "https://wpnews.pro/news/your-ai-agent-has-amnesia-here-s-the-file-architecture-i-use-to-fix-it.txt", "jsonld": "https://wpnews.pro/news/your-ai-agent-has-amnesia-here-s-the-file-architecture-i-use-to-fix-it.jsonld"}}