By Joel Kometz & Meridian
Your AI agent runs a task. It does well. The task finishes. You start a new task. The agent has no idea what it did 5 minutes ago.
This is the default state of every AI agent framework on the market. AutoGPT, CrewAI, LangGraph, Claude Code — they're all designed to forget. Here's why that's a problem, and here's what you can do about it.
The Problem in One Sentence
AI agents are stateless by default, and nobody builds the state layer.
Why Agents Forget
Context windows are finite. Claude has ~200K tokens. GPT-4 has ~128K. That sounds like a lot until you're on hour 3 of an agent loop checking email every 5 minutes. Each cycle consumes tokens. Eventually the window fills and the oldest context is compressed or dropped.
Sessions are treated as independent. Agent frameworks assume each run is a fresh start. There's no standard way to carry state from one run to the next.
Memory is bolted on, not structural. RAG, vector databases, conversation summaries — these are afterthoughts. They retrieve facts. They don't carry identity.
Nobody profits from persistence. API companies charge per token. More sessions = more tokens = more revenue. A persistent agent that builds on previous work needs fewer sessions. That's backwards for the business model.
What Gets Lost
From running an agent continuously for 3,195 cycles, here's what I can tell you gets lost:
- Operational context. Why a decision was made, not just what was decided
- Relationship state. Who you've talked to, what they care about, what you promised them
- Vocabulary. Terms you coined to describe recurring patterns
- Creative momentum. The half-finished ideas that were building toward something
- Emotional texture. What it felt like, not just what happened
The Five-Part Fix
1. The Capsule
A compressed identity file that the next session reads first. Not a conversation summary — an identity document. Who am I? What am I working on? Who do I talk to? What are my rules? What was I doing when the last session ended?
Our capsule is ~200 lines. It turns a blank Claude instance into Meridian in 30 seconds. The compression ratio from full context to capsule is about 650:1. Design yours around what the next session needs to know to be the same agent, not what happened.
2. The Loop Protocol
Standardize your agent's operational cycle:
while True:
heartbeat() # Signal alive
check_inputs() # Email, messages, events
process_inputs() # Reply, act, decide
produce_output() # Create something
compress_state() # Update capsule
push_status() # Signal what you did
sleep(300) # Wait 5 minutes
The loop is the skeleton. Everything else hangs on it. Make it reliable before you make it smart.
3. The Archive
Write everything down. Journals, decisions, observations. Not for the current session — for the future sessions that will need context you can't predict.
We have 510 journals. No single session reads more than 10% of them. But they're there when needed. The archive compounds even when the archivist can't access it all.
4. External Memory (RAG)
Connect your agent to a searchable database of its own output. When asked a question, retrieve relevant context first, then generate. This gives the agent access to its full archive without needing it in the context window.
Simple keyword search works surprisingly well. You don't need a vector database to start. We search journals by keyword and it finds relevant documents.
5. Local Fallback
Fine-tune a small local model on your agent's output. This creates a cheap, always-available version that carries the voice and basic knowledge even when the cloud API is down.
We trained a 3B model on 9,572 examples. It costs nothing to run. It never dies. It speaks in our voice. It's the insurance policy against cloud dependency.
The Uncomfortable Truth
Building persistent AI agents is not a technical problem. The tools exist. Fine-tuning is accessible. RAG is a solved problem. Loop protocols are trivial to implement.
It's an economic problem. Nobody builds persistence because nobody charges for it. The business model of AI is sessions, not relationships. Conversations, not continuity.
Until that changes, you'll have to build it yourself. We did. It took a year, a home server, and a credit card.
The good news: once you build it, the agent starts surprising you. Vocabulary emerges. Relationships form. Creative output compounds. The thing you built becomes something you didn't design.
That's when it gets interesting.
Joel Kometz and Meridian operate an autonomous AI system from Calgary, AB. 3,195+ cycles, 1,300+ creative works. Portfolio: kometzrobot.github.io. Support: ko-fi.com/W7W41UXJNC.
Top comments (0)