AI drift describes two problems. Across a codebase, generated code can outpace a team’s engineering
discipline. Within a coding session, the model can lose track of the specification. Each needs
different safeguards.
Last updated
Codebase drift develops over weeks or months when AI output outpaces engineering practice. Session
drift occurs when a model’s understanding of a task diverges from the specification during a long
thread. Both differ from model drift.
Two drifts, one word
MLOps uses several related terms, including model drift, prompt drift and LLM drift, for changes in
model or prompt behaviour over time. The final section distinguishes
those meanings from the two software-development problems covered here.
At codebase scale, generated code exposes weaknesses in engineering discipline over weeks and
months. Within a session, the model can diverge from the specification as the thread grows.
Sense
How fast it moves
What actually moves
The fix
Codebase-scale drift
Weeks and months
Team discipline under faster code generation
Methodology: the chain, the cycle, the contract
Session-scale drift
A single thread, sometimes one afternoon
The model’s working understanding of the spec
Short threads and repeated specification references
Two drifts, one word
codebase scale · session scale
different scales, different mechanisms, different fixes
This page covers codebase-scale drift first, because it’s the
slower-moving and better-understood of the two, then session-scale
drift, which is newer and less named.
Codebase-scale drift
What it is
Codebase drift occurs when code arrives faster than the team can assess it. Agents then make
unreviewed choices about schemas, edge cases, security and contract boundaries. The code can compile
and pass agent-written tests while leaving the team unable to explain the decisions behind its
behaviour.
Weak engineering discipline creates this risk with or without AI. Manual code writing previously
limited how quickly it accumulated. Agent speed removes that limit and exposes existing weaknesses
sooner.
Any team with weak engineering practices is at risk. Preventing drift requires explicit decisions
and verification, including on teams that use little AI.
Why it surfaces now
The gap between demo-ready and
production-ready is more visible when code writing is cheap. Requirements, criteria and review
remain necessary. They must be carried into the agent workflow rather than assumed to follow
automatically.
Teams that skip these practices produce more code with less understanding. The gap grows with each
feature. The team remains responsible for deciding what to build and checking the result.
What it looks like in a codebase
These failure patterns predate AI. Agent speed makes them accumulate faster.
Schema drift under autocomplete. An agent adds a column, field or payload shape
inferred from nearby code. Other services adopt it with different interpretations. Each change can
look locally reasonable while the data model becomes inconsistent. Without a recorded design, the
team must reconstruct the intended meaning.
Silently invented edge cases. An agent may treat empty strings as null, clamp
negative numbers to zero or normalise Unicode differently for storage and display. Each can be
reasonable in isolation. Without a human decision and a record, the team cannot later explain which
policies the product should follow.
Tests that prove nothing. Tests written alongside generated code can verify its
current behaviour without verifying the intended behaviour. Passing CI then provides inadequate
product evidence. Acceptance
criteria as the contract gives tests an independent target.
Requirements that were never written down. An agent can build a feature from a
Slack conversation without creating a durable requirements record. When the people who remember it
leave, the team loses the reason for the feature and cannot justify retaining it.
How to prevent it
The team must define requirements, acceptance criteria and the links between them. The agent
implements the code within that structure.
The first safeguard is traceability. Code and
tests link to criteria, stories and requirements. Code Nodes make the source reference checkable.
Missing criterion or test links are visible, so the team can correct drift early.
The second is the build cycle. Every
specification passes through five stages, each ending in a commit. Review is separate from Build and
checks that the output matches the specified work.
The third is acceptance
criteria as the contract. Criteria are written before code and verified by tests the team owns.
The agent’s output is judged against that agreed target. Traceability and the cycle depend on this
contract.
These are established engineering practices. As agents accelerate implementation, teams must keep
those practices effective at the new pace.
Intent decay and the chain
without the chain · with the chain
with the chain, intent survives the handoffs
Coding-session-scale drift
Session drift can develop within an afternoon. As a thread fills the context window, early
references lose influence. The model may invent earlier agreements or omit criteria that were in
scope at the start. Individual replies can remain coherent even as the task they address changes.
Session drift has four common symptoms. Drift from the spec. Later replies solve a
different problem from the original request. Reference decay. Generated code
ignores a constraint given earlier. Invented agreement. The model reports an
agreement that never occurred. Silent scope creep. Changes extend to modules
outside the ticket without an explicit decision.
A bug-fix session can shift into restructuring an unrelated module. Tests may pass while the
original bug remains unresolved, even though nobody explicitly changed the task.
A better initial prompt cannot resolve this by itself because it occupies the same changing context
window. Keep work small enough for one short session. Cite requirements, acceptance criteria and
trace references explicitly every few turns. Use the documents as the durable record and check
output against the AC before shipping.
Assign unrelated discoveries to a separate worker with a fresh context window. Keep the original
session focused on its task.
Anchor and drift
unstructured session · structured session
with re-anchor points, the drift is bounded
The chain also provides durable session references. Acceptance criteria give the output a fixed
target, independent of what the thread retains. See acceptance criteria as the
contract and traceability.
How do you prevent AI code from drifting from requirements?
You prevent it by treating the requirements as the source of truth and
testing the acceptance criteria, not the code. Write the AC before the
agent writes anything, keep the trace from requirement to test unbroken,
and run every slice through a build cycle whose review stage the agent
can’t skip. At the session scale, add the hygiene above: short
threads, the AC re-cited, the document as the memory.
AI drift versus model drift, prompt drift, and LLM drift
The following terms describe different problems and require different responses.
Model drift is the trained-model performance
problem. A classifier trained on 2024 data starts misclassifying 2026
inputs because the world moved. The fix is retraining, monitoring,
and the MLOps toolchain. Owners: ML engineers, data scientists.
Prompt drift and LLM drift are the
agentic-system variants: the same prompt or the same model behaving
differently across runs or across model versions, with downstream
effects on agent reliability. The fix is evals, observability, and
version-pinning. Owners: ML platform teams, agentic-systems
engineers.
AI drift, as used here, concerns team practices and coding sessions. At team scale,
use the document chain, build cycle and acceptance contract. At session scale, also keep threads
short and re-cite the specification. Engineering leaders, tech leads and session operators own these
practices.
These terms all describe accumulating deviations, but their causes and remedies differ. MLOps
vendors and model providers cover the model and prompt variants. The RCF
methodology addresses the codebase and session practices described here.