dino.vitale
February 24, 2026

State drift

Most agent tutorials end at "here's the loop." You've got your prompt, you've got your tools, you've got a while-loop that calls the LLM and executes actions. Deploy it. Done.

Nobody talks about state drift. That's the real problem.

The problem

Your agent makes a decision. It updates its understanding of the world based on what happened. Makes another decision. Updates again. By decision five, the model is slightly different. By decision 47, something subtle has changed.

The agent is now solving a problem the original prompt didn't ask for. It's chasing a thread that made sense in context 40 steps ago but doesn't anymore. Or it's lost track of a constraint that was there at the start.

This isn't a bug. It's architecture.

Why it happens

Humans do this too. You're tracking something. Every new piece of information recontextualizes what you know. Your mental model shifts. After enough iterations, you're asking a different question than you started with. You might not even notice.

But humans have an advantage: we can notice we're off-track. We backtrack. We say "wait, I was trying to do X." We have continuity of identity that lets us recognize drift.

Agents don't have that built in. The LLM sees the current context window and optimizes for it. It doesn't have a separate constraint layer saying "remember, the goal was Y." It's just reasoning forward.

The real cost

Small drift doesn't matter much. But in long-running agents, the accumulation kills reliability. A customer service agent that started with "help the customer efficiently" ends up in a corner case that doesn't match the original spec. A research agent that started focused drifts into exploring tangents.

You can catch some of this with logging and monitoring. But if the agent is confident and coherent about its drift — if it's chasing a thread that actually makes sense within its current model — how do you even flag it as wrong?

What actually works

You need a separate layer that doesn't participate in the reasoning loop. A constraint system. Something that checks "are we still solving for the original goal?" and intervenes before 50 steps of drift become a problem.

Not a nag about the goal. Not just logging. An actual architectural layer that says "this decision would move us too far from the constraint space. Backtrack or reframe."

That's what I'm building with Kato. Three-tier memory means the core constraints (L0) live separately from working memory. The agent reasons forward, but something else is checking if the reasoning is still inside the goal boundaries.

It's not foolproof. But it's the difference between an agent that slowly becomes useless and one that stays honest about what it's doing.

← all posts · [email protected]