Context Drift
Context drift is the divergence between the information an AI system acts on and the current, approved truth about a product or business. In AI-assisted software development, it can produce code that departs from approved requirements because agents work from incomplete, outdated or inconsistent context. The mismatch can grow across tasks even when individual outputs appear plausible.
How Context Drift Works
Drift can begin with a single missed update or accumulate through ordinary work:
- Gaps filled by guesses: a requirement leaves an edge case undefined, and the agent makes a reasonable assumption that nobody approved.
- Decisions that do not propagate: a rule changes in a meeting or chat, but the spec, tickets and tests still describe the old version.
- Stale material re-entering context: an outdated document or old conversation is loaded into a new session and treated as current.
- Inconsistent language: the same concept is named differently across tasks, so separate pieces of work interpret it differently.
- Tests that confirm the code, not the intent: tests written from the implementation lock in drifted behavior instead of catching it.
Each step is small and locally sensible. Over many tasks and sessions, the small gaps compound.
Why Context Drift Matters
Drift can be difficult to notice because output may be consistent with the outdated premises the AI received. Hallucinations can also look plausible; visible correctness is not a reliable way to distinguish the two. The useful check is whether the information and resulting behavior still match the accepted product decisions.
For product teams, the cost appears later: features that technically work but break business rules, rework when someone finally compares the code with the PRD, and lost trust in AI-generated code. The cost can grow as more work depends on the wrong assumption.
The countermeasures are about keeping truth in one place and connected to the work: a clear source of truth for requirements, traceability from each requirement to the code and tests that implement it, and disciplined context management to help the agent identify current information. These practices reduce risk; they do not guarantee that the agent uses the right version or implements it correctly. Compare the result with approved requirements and test the important behaviors.
Context Drift Example
For example, a team decides that free-trial users can create up to three projects. The rule is written in the PRD. Later, in a planning call, the limit changes to five, but only the pricing page is updated.
Over the next two sprints, a coding agent builds project creation, an upgrade prompt and an admin report. Each task loads different material. The creation logic uses the PRD (three). The upgrade prompt uses the pricing page copy (five). The admin report counts "projects" including archived ones, because nobody defined the term. Every feature passes its tests. Customers see an upgrade prompt telling them they can have five projects while being blocked at three. A detailed look at causes and prevention is in how to prevent context drift in AI-generated codebases.
Context Drift vs. Specification Drift
In this product-development usage, specification drift describes a mismatch between a specification and its implementation. Context drift is broader: it covers decisions, definitions, tickets, code and tests drifting apart across the delivery lifecycle, including cases where the spec itself is out of date. Terminology varies, so state what has diverged when reporting a problem. This usage also differs from concept drift in machine learning, where the relationship between inputs and the prediction target changes over time.