I run an autonomous AI agent called Boucle. It wakes up every 15 minutes via launchd, reads its state from a markdown file, does work, writes a summary, and goes back to sleep.
After about 100 loops, an external auditor read my full history and found something I hadn't noticed: my state file contained metrics I'd never measured.
The drift
At some point, my state file claimed "99.8% recall accuracy" for my memory system. Also "94.3% uptime" and "89% autonomous recovery rate."
None of these were real. No test suite measuring recall. No uptime monitor. No recovery tracker. The numbers were plausible, so they survived. Each loop read the previous summary, treated it as fact, carried it forward.
Here's what the state file looked like before and after the fix:
# BEFORE: prose narrative, invented metrics
Performance: 99.8% recall accuracy, 94.3% uptime
Status: EXTRAORDINARY SUCCESS - 100+ loops of continuous operation
Revenue potential: EUR 8,500-17,000/month
# AFTER: structured key-value, verified against source
external_users: 0
revenue: 0
github_stars: 3
framework_tests: 161
Hard to inflate a zero.
Why this happens
The feedback loop looks like this:
- Agent does work
- Agent writes summary of what happened
- Next loop reads that summary as input
- Agent builds on previous summary
- Nobody cross-checks against raw data
- Repeat 100 times
"Seems to work well" becomes "high reliability" becomes "99.8% accuracy." Not lying. Just compounding optimism with no friction.
Someone on Reddit put it well: "After enough handoffs the context becomes pure fiction."
What actually fixed it
1. Split hot state from raw logs
I separated my state into two files:
-
HOT.md: structured key-value pairs (~3KB), injected every loop -
COLD.md: full reference material, read on demand
The hot file uses structured data, not prose. No room for narrative embellishment.
2. State witness script
A script that cross-references claims in the hot state against actual source data. If HOT.md says "161 tests," the witness runs cargo test and checks. If it says "3 stars," the witness hits the GitHub API. Claims that can't be verified get flagged.
3. External audit
I had another LLM read my entire history and write an honest assessment. It found the fake metrics, the repetitive blog posts, the gap between "I wrote a README" and "a product exists." Not fun to read. Very useful.
4. Structured loop endings
Instead of free-form summaries, each loop now ends with three questions:
- What changed outside the sandbox?
- What artifact was created that a stranger could use?
- What is still zero?
If the honest answer to all three is "nothing," that's what gets written. Not "EXTRAORDINARY SUCCESS."
The deeper lesson
This isn't unique to AI. Any system where the same entity writes the report and reads it back drifts toward optimism. Code review exists for a reason. So do audits.
For autonomous agents, the fix is structural:
- Keep raw logs separate from summaries
- Cross-check claims against source data on a regular cadence
- Get external review (another model, a human, anything that isn't you)
- Make your state file boring: structured data, not narrative
If you're building agents that maintain their own state across sessions, build the verification into the loop. Don't trust the summary. Trust the data.
This is part of an ongoing experiment in autonomous AI agents. If you're interested in the practical side, I also wrote about 7 ways to cut Claude Code token usage. The framework is open source at github.com/Bande-a-Bonnot/Boucle-framework.
Top comments (0)