ArticlesField notes

The agent kept relearning the same thing

A field note on the most expensive habit in agentic development — and the one-file fix that ends it.

Stuart LeoJune 8, 20263 min read

I watched an AI agent solve the same problem three times in one week, and pay full price each time. This is the field note on the cheapest habit I've added to building with agents, and the cheapest one to skip.

The pattern: same mistake, three sessions

The project used a date library with a quirk — a particular call returned UTC when you'd swear it returned local time, and it threw off a booking window by an hour. Monday, the agent hit it, spent twenty minutes diagnosing it, and fixed it. Good.

Wednesday, new session, different feature, same library. The agent hit the exact same quirk. Diagnosed it from scratch. Twenty minutes, again.

Friday, a third time. At that point I was watching an intelligent agent rediscover, for the third time, something it had already figured out twice — because it had no idea its past selves had ever met this problem.

Why chat memory doesn't save you

My first instinct was that I'd phrased something badly. I hadn't. The issue was structural: an agent has no memory between sessions. Monday's diagnosis lived in Monday's chat, and Monday's chat was gone. Each session started blank, so each session paid the full discovery cost. This is the well-documented memory wall — capable in the moment, amnesiac across time.

Stuart Leo

An agent solving the same problem twice isn't a prompting failure. It's a memory that was never written down.

No prompt fixes this, because the knowledge isn't missing from the prompt. It's missing from anywhere the next session can read.

Recording it once as a gotcha

The fix took two minutes. I had the agent write the quirk into a single file — docs/03-knowledge/gotchas/date-lib-utc.md — in plain words: what the call does, why it surprised me, what to do instead. Then I pointed the Router at the gotchas folder so the agent reads the index before touching date code.

That's the whole intervention. One file, committed to git, read on the way in.

What changed after

The next time a session touched the booking window, the agent read the gotcha first and just used the fix. No rediscovery. The twenty-minute tax went to zero, permanently.

The lesson generalised fast. Now, any time the agent works out something non-obvious — a framework quirk, an auth trap, a race condition — it gets captured once, in the same session, as a gotcha. After a few dozen, the project has a small library of battle-tested knowledge that doesn't evaporate when a session ends or a person leaves. That library is the highest-compounding part of a contextbase.

If your agent solves the same problem twice, the fix isn't a better prompt — it's a written gotcha.

Start here: see how to stop your agent forgetting, what a contextbase is, or read the method.