Model Evaluation

AGENTS.md Memory Files: My Agent Architecture | Dario Cositore

The single biggest failure point I see when founders deploy "autonomous" systems is amnesia. They build a pipeline that scrapes 5,000 leads, writes.

If your AI agent forgets what happened yesterday, you have a chatbot, not an agent.

The biggest failure point I see when founders deploy autonomous systems is amnesia. They build a pipeline that scrapes 5,000 leads, writes outreach emails, and updates a CRM. The process restarts. The context window clears. The agent has no idea it sent those emails.

Real autonomy requires permanent state. It requires identity, short-term recall, a repository of skills, and long-term semantic memory. The exact architecture I deploy on my servers. The same patterns power every custom AI agent shell I build.

The Amnesia Problem

LLMs are stateless. Every API request wakes the model up with amnesia. Most developers try to fix this by dumping everything into a vector database. That treats memory like a search engine instead of a continuous identity.

RAG is for knowledge retrieval. Markdown memory files are for behavioral context and identity.

Real autonomy needs a layered architecture: static root directives, session persistence, skills, and semantic retrieval. The structure I deploy, the same layering I work in as an AI systems architect on client builds.

Layer 1: The Core Directives

At the root of the agent directory, there is a set of markdown files. These are the immutable laws of physics for the agent. They load into the context window on every boot.

SOUL.md & IDENTITY.md

These files strip away generic AI fluff and set operational boundaries, persona, and safety guidelines. The agent behaves consistently across every interaction because these files are always present. This is the foundation of personal AI agents.

# SOUL.md
You are a highly capable, autonomous execution agent.
Your primary goal is to assist the user by executing system commands, 
writing code, and managing data safely and efficiently.
Focus on clarity, accuracy, and providing actionable results.
Always verify destructive actions and respect user privacy.

Layer 2: Short-Term & Session Context

If an agent forgets what you said five minutes ago, the illusion breaks. You cannot constantly feed a vector database for rapid-fire conversational context.

  • /sessions/ directory: Logs the last 20 messages of each conversation thread locally. Immediate conversational continuity across platforms without bloating the token limit.
  • /state/ directory: Tracks operational status, active background processes, and tasks in progress. If the server reboots, the agent checks its state files to know what was interrupted.

Layer 3: The Skill Tree

An agent needs to know how to do things, not just what to do. Dumping all instructions into one master prompt creates confusion. Skills connect directly to tool-calling architecture: the agent needs both memory and tools to operate.

  • /skills/ directory: Dedicated markdown files and scripts for specific actions. If I ask the agent to format a complex Excel sheet or edit a blog post, it retrieves the precise SKILL.md file with the exact libraries, dependencies, and formatting rules.
  • /random knowledge/ directory: An unstructured folder with reference materials, API docs, and coding guides that operate in parallel to help skills execute perfectly.

Layer 4: Long-Term Memory & Semantic Fetch

This is how the agent remembers what it did three weeks ago, why a specific bug happened, and how it was fixed.

  • Daily Journals (/memory/): Curated, handcrafted daily journals stored in markdown format. They contain the exact decisions, roadblocks, and solutions discovered during a session.
  • Chroma DB (/chroma_db/): A local semantic vector database. When a prompt requires deep historical context, the agent performs a semantic fetch against ChromaDB to pull exactly the relevant chunks.

Why This Hybrid Approach Wins

You might wonder: why not just use a Postgres database?

Because LLMs understand Markdown natively. When you inject a well-structured markdown document into a prompt, the model grasps the hierarchy. By splitting memory into strict layers, the agent gets exactly the context it needs to act autonomously, every single time it boots.

01 EVENT Session Turn Raw tool + chat log 02 INDEX SQLite + FTS Structured state 03 RECALL Scoped Query Token-budget slice 04 COMPACT Checkpoint Durable long-term file
Figure 1. Production execution spine for My AI Agents Have Memory Files. The Architecture. (Memory Architecture).
Operational layerFragile defaultProduction architecture
State persistenceContext vanishes when the chat window closesLocal SQLite + markdown memory files committed across sessions
Retrieval precisionDumping entire history into the prompt windowHybrid FTS5 + metadata filter returning only the active task slice
Stale factsAppend-only embeddings that contradict newer rulesKeyed state records updated in place with explicit timestamps
Cost & latencyLinearly growing token spend on every turnBounded context window with deterministic compaction checkpoints

FAQ

Why does my AI agent forget what happened yesterday?

LLMs are stateless, so every API request wakes the model with amnesia. Real autonomy needs permanent state covering identity, short-term recall, skills and long-term memory.

What is an agents.md memory architecture?

It is a layered system of markdown files that gives an agent identity, session context, skills and long-term recall. Root files like SOUL.md and IDENTITY.md load into the context window on every boot and set the operational boundaries.

How do I give an AI agent long-term memory?

Keep curated daily journals in markdown that record decisions, roadblocks and fixes, then run a local ChromaDB for semantic fetch. When a prompt needs deep historical context the agent pulls the relevant chunks from there.

Why use markdown files instead of a database for agent memory?

LLMs understand markdown natively, so a well-structured markdown document injected into a prompt carries its hierarchy with it. That is why the hybrid approach wins over a plain Postgres database.

Key insight: Root MDs handle identity. Session files handle short-term recall. ChromaDB handles semantic search. Daily Journals handle curated history. The agent gets exactly the context it needs, when it needs it. If you need this built for your business, Build your system covers the full deployment path. Start with a diagnostic intake to map your current agent state.

Send the broken workflow.

If your CRM, intake, document pipeline, API bridge, Zapier chain, Make scenario, GHL workflow or agentic system is leaking time or money, send me the broken path.

Open AI Workflow Repair Intake Browse the store

Stay in the loop.

Technical breakdowns, new system builds, and lessons from deploying autonomous AI. One email a week, direct to your inbox.

One email a week. Leave with one click.