Context Drift in LLM Systems: A Practical Governance Guide
This article explains context drift, a governance problem where multiple project sources gradually fall out of sync and give an AI agent conflicting facts, even in a brand-new session. It distinguishes drift from context rot, summarizes a controlled experiment showing that agents almost always follow local task instructions over global rules and rarely disclose conflicts, and outlines why drift emerges without any single mistake. The guide then presents a governance framework covering a single source of truth, explicit priority and conflict-disclosure rules, document ownership and expiry metadata, automated drift detection in CI, and acceptance tests that verify factual consistency, followed by a practical rollout checklist.
1. A Seemingly Simple Problem: Why New Sessions Still Return Contradictory Answers
Consider a customer support Q&A scenario. The root-level project rules file has updated the refund window to 14 days, but a task-specific skill instruction file still says 30 days, and the docs directory still contains a note from three months ago. All three sources sound equally confident and are formatted just as cleanly. Even if the user clears the history and starts a brand-new session, the agent may still return one of those numbers, and the user has no way to tell from the answer whether it ever saw the others.
This kind of behavior is often lumped together as a “context problem,” but it is not the same thing as the long-conversation noise most people are more familiar with. Separating the two is the first step toward governing it.
2. Context Rot vs. Context Drift: Two Different “Context Problems”
The industry often uses “context rot” to describe the decline in answer quality within a single session as turns accumulate and historical noise builds up. Typical symptoms include the model repeatedly picking up an approach that already failed, or losing a key constraint after the history is compressed. The remedies are relatively mature: clear the history, restate the task, and proceed in stages.
The problem this article focuses on, “context drift,” is a different layer: multiple information sources inside a project gradually lose synchronization during long-term iteration and start giving inconsistent facts. Its key characteristics are:
- Different trigger point: drift can appear in the very first turn of a session, regardless of how long the conversation has run.
- Different user-visible symptom: the answer is often fluent and presents only one version, with no sign of the internal disagreement.
- Different starting point for investigation: you do not need to clear the history; you need to find the conflicting source text in the repository and check which one is still valid.
| Dimension | Context Rot | Context Drift |
|---|---|---|
| Root cause | Noise accumulating in a single session’s history | Facts across multiple sources falling out of sync over time |
| When it appears | Late in a long conversation | First turn of a new session |
| Perceptibility | Answers go off track, repeat ineffective approaches | Answers are smooth but may pick the wrong fact |
| Governance entry point | Clear history, restate the task | Unify the source of truth, eliminate copies |
3. Key Findings from a Controlled Experiment
A developer relations practitioner ran a personal experiment using two coding agents and a sandbox task with real repository files, constructing a matching scenario where “the task instructions contradict the project-wide rules.” Three reusable observations came out of it:
- Highly consistent prioritization: in conflict scenarios, the model followed the task instructions in roughly 95% to 100% of runs, showing that local instructions naturally override global rules.
- Almost zero conflict disclosure: across 110 runs in which the model was not asked to report conflicts, the number of times it proactively told the user “there is another answer” was 0.
- Tests do not act as a safety net: across hundreds of tasks, tests could still be all green even when the fact sources conflicted, because the assertions only covered code behavior and not factual consistency.
It is worth stressing that these numbers are limited to the specific two models and this task design and cannot be extrapolated into a universal law for all systems. But the structural risk it points to is general: agents default to “pick one and execute” rather than “surface the disagreement first, then execute.”
Illustrative pseudocode can summarize this default behavior:
read(task_spec, project_rules, docs)if conflict(task_spec, project_rules):follow(task_spec) # local wins, and no reportanswer(only_one_version) # the user never sees the disagreement
4. How Drift Happens: Nobody Makes a Big Mistake
Drift is usually not the result of someone writing something wrong; it is a natural outcome of the collaboration structure:
- One team updates the onboarding instructions, while another team keeps its own maintained copy.
- A new colleague finds only one of them in the task directory, follows it, and still delivers.
- Months later, the model faces two equally confident documents and inherits exactly the information gap that was dropped during the human handoff.
In other words, drift is the inevitable product of “no single source of truth for the docs + no expiry mechanism.” The agent merely makes this long-standing inconsistency explicit.
5. Governance Framework: From Source of Truth to Acceptance
5.1 Establish a Single Source of Truth
Consolidate key facts such as the refund window, billing rules, and permission boundaries into one place, and allow only references elsewhere, not copies. You can use relative-path references instead of pasting the body text:
# Project Rules (Single Source of Truth)- Refund window: 14 days- See also: docs/refund.md#policy
# Customer Support Task Skill Instructions- Refund window: see ../../docs/refund.md#policy
5.2 Define Priority and Conflict-Disclosure Rules
State clearly in the project rules “how to handle it when task instructions conflict with the project rules,” and require the agent to output a conflict list before executing when it detects a conflict. For example:
If a local instruction is inconsistent with the project rules:1) List the conflicting items and their respective sources;2) Note which one will be used and why;3) Wait for confirmation or continue according to the established priority.
5.3 Add Timeliness and Ownership to Documents
Mark the version, effective date, and maintainer at the top of each rules file. Entries that expire without confirmation automatically go into a pending-review list, so that a “note from three months ago” no longer takes part in decisions.
5.4 Use Automation for Drift Detection
Add a lightweight check to continuous integration that extracts key facts into structured entries and compares them:
# Illustrative: fact consistency checkfacts:- key: refund_dayssources: [AGENTS.md, skills/support.md, docs/refund.md]expect: 14
When the same key has different values across different sources, the check fails outright, turning “relying on someone to remember to sync” into “the pipeline blocks the inconsistency.”
5.5 Acceptance Must Cover Factual Consistency
Traditional tests only verify code behavior, so they can be all green while masking conflicts. It is recommended to add two kinds of assertions: first, factual assertions that check whether the key numbers in the answer match the single source of truth; second, disclosure assertions that construct conflicting inputs and require the output to contain a conflict notice.
6. Rollout Checklist
- Inventory all rules and skill instruction files, and flag duplicated facts.
- Choose the single source of truth and change the rest to references.
- Write in the priority and conflict-disclosure rules.
- Add version, effective date, and maintainer to the files.
- Add a fact consistency check to the pipeline.
- Add conflict-disclosure cases to the acceptance set.
- Periodically review expired entries and clean up unmaintained copies.
7. Conclusion
The essence of context drift is not a model capability problem but an engineering governance problem. When multiple equally confident copies of a key fact exist and there is no expiry or detection mechanism, even the strongest agent will “pick one and stay quiet.” Only by consolidating the facts, making conflicts explicit, and bringing consistency into acceptance can an agent give a trustworthy, auditable answer in the very first turn of a brand-new session. If you combine this with common cloud capabilities such as object storage, logging services, and monitoring alerts, and keep a record of rule file versions and detection results, drift governance can evolve from a one-time cleanup into a continuously controllable engineering process.
