How context drift affects your AI agents: 470 experiments and a free MCP fix
How Context Drift Impacts Your AI Agents
Google AI developer Patrick Kelly ran 470 tasks to distinguish context rot from context drift. In sandboxes with Gemini 3.8 Flash and Gemini Pro, he found that the model internally detected file conflicts in 73% of runs, but proactively told the user in 0% of them, and in 95%-100% of cases task-level skill files overrode the strict rules in AGENTS.md.
The author ran 470 tasks to distinguish context rot from context drift, and offers a zero-cost, reusable tool for reporting conflicts.
Most people building with AI in late 2026 understand that the quality of your context determines the quality of your output. But what exactly determines the quality of your context?
First, let's break down all the different types of context:
- One-off prompts that you type into chat conversations
- Your base instruction files like
AGENTS.md, injected automatically into each new session - Skill files, which are ideally custom procedural instructions, loaded dynamically as-needed in relevant situations
- Word documents and spreadsheets in your Google Drive or similar system
- Local markdown files in your code repo
- Memories (usually automatically managed by your agent harness and generally not exposed to you visually)
With all these different sources, likely maintained by different people, there's a very high chance you have legacy process docs and out-of-date facts, metrics, decisions, and strategies.
So what happens if your agent finds the wrong information? Or if it finds conflicting information? Doc A says the refund policy is 14 days, Doc B says 30 days. Which one does your agent trust?
If the documents are clearly dated or the agent reads the metadata, it might figure it out, but we want better than a chance of factual correctness.
In search of a solution, I started wondering: what types of conflicts or issues create the biggest problems? I decided to run an experiment to answer this question.
Context rot vs. context drift
People often lump every context issue under context rot, a term coined last year to describe how an LLM's accuracy drops as a session grows too long and fills up with noise, dead ends, and distractors.
What happens across a real team's files is slightly different. Over weeks and months, your underlying sources (AGENTS.md, skills, docs, memories, and code) gradually fall out of sync, so your agent can get conflicting instructions on the very first turn of a brand-new session. That's really context drift.
To test both side by side, I built a realistic coding sandbox (a git repo with real files and terminal tools) and ran 470 tasks across Gemini 3.8 Flash and Gemini Pro, intentionally planting bloat, duplicate rules, stale docs, and direct contradictions.
What broke (and what didn't)
I went in expecting context rot from pure bloat to cause obvious mistakes. Instead, injecting 50,000 tokens of unrelated chat history and duplicating agreeing rules across files caused zero rule violations, even on Gemini 3.8 Flash.
Context drift was a different story, and I only caught what was happening by reading the summaries of the model's internal thinking process (its private mental scratchpad).
In 73% of runs, the model explicitly noticed in its thinking that two sources disagreed. Yet across 110 unprompted runs, it mentioned that conflict to the user 0% of the time.
Instead of warning you, the model quietly picks a winner and moves on. On 95% to 100% of matching tasks, a task-specific skill file overrode the root AGENTS.md, even when AGENTS.md used strict MUST wording. If you update a repo-wide rule in AGENTS.md and forget to update a task-specific skill file that still has the old value, your agent will silently follow that stale skill file almost every time.
Stale docs against live code were even sneakier. When a doc referenced an old test helper name that had already been renamed in the codebase, 9 out of 15 runs quietly wrote a one-line wrapper inside their new test file so pytest would still pass without mentioning the mismatch.
My guess is that this comes from RLHF training. Modern models are trained to be decisive and finish the job rather than pestering you with questions on every minor ambiguity, which is normally what keeps agentic workflows pleasant to use.
The only other measurable penalty was deliberation: when two peer skill files disagreed with no clear tie-breaker, the model spent 47% more thinking tokens debating the conflict across turns.
Giving the agent an escape hatch
Once I saw that the model was already spotting these conflicts in its thinking trace, I tried adding one line to AGENTS.md asking it to mention disagreements in chat. That worked on 100% of completed runs (16 out of 16).
Still, I didn't want my agent interrupting every coding session to complain about docs. So I turned it into a tool instead: a tiny read-only escape hatch called report_inconsistency, with two categories (conflict and stale).
(I originally tested a duplicate category too, though asking agents to log harmless repeats wasted extra turns on normal cross-references and pushed more runs into our sandbox's 34-turn limit, even though 95% still wrote the code, so I cut it.)
Because the model is already checking whether one file supersedes another while exploring, calling the tool takes almost no extra effort.
Even with no instructions added to AGENTS.md, simply having the tool available got the agent to log 98.7% of the conflicts it encountered across Gemini 3.8 Flash and Gemini Pro (150 out of 152 runs), with zero false alarms on Flash.
Token cost stayed flat too. In our matched tests, total turns barely moved and thinking tokens dipped slightly (~19% on average, within normal run-to-run noise), so the real takeaway is simple: passive logging is essentially free.
Running it passively in practice
Moving this into my daily coding setup surfaced two quick catches worth knowing:
- Logging replaces chat warnings: Once the tool exists, the agent stops mentioning conflicts in chat (0%) unless you add one line asking for both.
- Keep the tool and file list visible up front: Larger models like Gemini Pro take far fewer exploratory steps than Flash, so they only catch drift in skill or memory files when summaries are listed in the prompt (and when the MCP tool is loaded eagerly rather than hidden behind tool search).
How you act on a logged conflict is up to you. You could pause the agent on the spot, though for everyday work I prefer keeping it passive: the agent logs the file paths, exact quotes, and which version it followed while finishing my task, and I review the cleanup queue later.
Plugging one tiny MCP tool into a local log file gives your agent a built-in sensor for context drift at zero extra cost. Within 24 hours of turning it on in my own setup, it had already caught a real spec-vs-code mismatch during a PR review without me asking.
Source: Google AI: Exclusive for DEV Authors · dev.to

