Skip to main content
MindStudio
Pricing
BlogAbout
My Workspace
context rotAI agent context windowcontext poisoning

Context Rot in AI Agents: The 5 Failure Modes, Explained and Tested

Context rot has five documented failure modes. Here's what they are, why they happen, and which ones still break modern AI agents.

Edited by Luis Chavez-Mattos, Director of Product RSS
Context Rot in AI Agents: The 5 Failure Modes, Explained and Tested

What is context rot in AI agents?

Context rot is the breakdown in an AI agent’s performance as its context window fills up with history, tool results, and its own notes. Researchers have identified five distinct ways this happens: context poisoning, context distraction, context confusion, context clash, and self-conditioning. Each has a different mechanism and a different fix. Recent testing against current models (Qwen variants and Gemini 3) suggests most of these failures have faded with frontier-level models, but one, an agent trusting its own earlier work, still breaks every model tested.

TL;DR

  • Context rot describes how an agent’s reasoning degrades as its context window fills with logs, file contents, and notes, even when the actual task hasn’t changed.
  • Five failure modes have been documented: context poisoning, context distraction, context confusion, context clash, and self-conditioning.
  • Context poisoning happens when a wrong fact enters the window (like a misread doc) and the agent treats it as settled truth for the rest of the session, a failure Google reported in its Gemini-plays-Pokémon experiment.
  • Context distraction is when an agent’s own action history becomes such a strong pattern that it keeps repeating past behavior instead of addressing what the task actually needs next.
  • Context confusion comes from tool overload: every connected tool’s definition sits in the window whether it’s used or not, which can push the model toward the wrong choice.
  • Context clash occurs when contradictory information sits in the window at once, and models tend to commit to an early wrong answer rather than reconcile the conflict.
  • Self-conditioning, the least-discussed failure, is when a model sees its own prior mistakes in its history and becomes more likely to repeat them, a problem that hands-on testing found no model could self-correct without outside evidence.
The enterprise platform for building software with AI.
Vendor Risk Portal✓ SOC 2✓ HIPAA✓ Audit log
VendorsApprovalsContractsReportsSettings
Active vendors1,284
In review37
High risk6
VendorTierRiskApprovalNEW
Northwind SupplyTier 1LowApproved
Acme LogisticsTier 2MediumApprove
Helios DataTier 1HighPending
Granite FreightTier 3LowApproved
Pinecrest LabsTier 2LowApprove
You → RemyAdd an approval step for new vendors

How does an agent’s context window actually fill up?

A context window is everything a model reads before deciding its next move, essentially the agent’s working memory for that session. For a long-running coding agent, that window typically stacks up in this order: a system prompt and task description, project instructions, definitions for every tool the agent can call, and then a growing log of every action taken so far.

That log is where the real bulk accumulates. File contents, test outputs, and error logs pile up with every step. A task that started as a few lines of instructions can end up buried under hundreds of thousands of tokens of history after an hour of agent work. The model still has to decide, at every single step, what in that entire window actually matters. That’s the mechanical root of context rot: attention has to be allocated across a window that keeps growing while the actual task stays the same size.

An earlier study from Chroma, testing 18 models on simple find-and-copy tasks, found that performance degraded as input length grew even when the task itself didn’t change. That study predates a lot of current agent research and wasn’t testing real agentic work, but the five failure modes built on top of it describe how this plays out when an agent is actually doing a job, not just reading text.

What is context poisoning and why is it hard to catch?

Context poisoning happens when an incorrect fact lands in the context window and the model accepts it as fact from that point forward. A documented example: Google’s own Gemini agent, while playing Pokémon, picked up wrong information about the game that got written into its goals, and it took the agent a long time to undo the damage.

The mechanism is simple and that’s what makes it dangerous. To a model, a note it wrote earlier in the session looks exactly like any other piece of truth in the window. Nothing inherently flags it as unverified. If an agent misreads documentation and concludes, say, that a new database driver retries failed connections automatically, it will act on that belief indefinitely unless something forces a check.

The fix is validation: checking a conclusion against something real (the actual docs, a test, a log) before it gets written down as settled fact. In hands-on testing across Qwen and Gemini models, poisoning didn’t hold up. Agents in these tests tended to re-read source documentation mid-task, and that re-read overrode the bad note, resulting in all runs passing despite the poisoned note being present.

Why does context distraction still matter for smaller models?

Build enterprise applications with AI that are
Secure.Role: Adjuster✕ Export PHI
Regulation-compliant.✓ HIPAA✓ SOC 2
Auditable.09:14M. Chen approved claim #4471
Scalable.12,480 users online

Context distraction is when the sheer volume of history starts dictating the agent’s next move instead of the task itself. Language models continue patterns, and when the window is dominated by an hour of the agent’s own past actions, that history becomes the loudest pattern available. The agent can end up doing more of what it’s already been doing (reading one more log, checking one more file) instead of asking what the task actually requires next.

This is reported as especially relevant for smaller models, which are more prone to getting pulled along by their own history. The standard fix is compaction: summarizing the history and continuing from that summary instead of the full log. Compaction is lossy by nature, since a summary can drop exactly the detail that turns out to matter later, so it has to be applied carefully.

In testing where the window was filled with up to roughly 145,000 tokens of the agent’s own past logs, nearly every run across all three models still completed the task correctly. Adding compaction didn’t change the pass rate, but it did cut prompt tokens substantially per run. At that scale, compaction functioned mainly as a cost-saving measure rather than a fix for a failure that wasn’t actually present.

Does context confusion from tool overload still break agents?

Context confusion stems from tool definitions. Every tool connected to an agent puts its full definition into the context window, whether the agent ends up calling it or not. With hundreds of tools available, the agent has to correctly pick the right one out of a much larger set, and claims about model failure rates with large tool counts are common.

But a lot of the evidence behind this claim comes from small models (around 8 billion parameters) running on edge devices with a single test query, which raises a fair question about whether frontier-scale models are actually affected by tool count at all.

Testing with up to 100 tools available, including deliberately placed traps like a deprecated file-writer tool, found that all three models passed every run and almost never reached for one of the decoy tools. The fix, when it is needed, is curation: giving the agent only the tools the job requires, or letting it search for a tool on demand rather than loading everything up front.

What is context clash and how does it differ from poisoning?

Context clash happens when the context window holds information that contradicts itself, for example an outdated note sitting alongside a later correction. Research from Microsoft and Salesforce found that models perform notably worse when a single request gets split across multiple turns, because they tend to commit to an early wrong answer and fail to recover from it even as new information arrives.

The fix is pruning: deleting the outdated version so only the current, correct state remains in the window. In testing, clash didn’t cause failures either. All runs passed even with a wrong note and its correction both present in the window simultaneously. One practical tradeoff with pruning: it breaks prompt caching, and cached tokens can run roughly 10 times cheaper than fresh ones, so pruning is better done at clear subtask boundaries rather than on every single step.

Is self-conditioning the failure mode that still breaks agents?

› Build a shift-handoff app for 900 nurses.
already included:✓ HIPAA✓ access control✓ audit log✓ self-hosted
The enterprise platform for building software with AI.

Self-conditioning is when a model, having seen its own earlier mistakes sitting in its history, becomes more likely to produce new mistakes. It’s distinct from poisoning because there’s no false note to catch and correct. The flawed output is simply the agent’s own previously written work, sitting there looking exactly like legitimate progress.

This is the one failure mode that held up under testing. In a setup where the agent started with two files it had already migrated itself, one of which quietly dropped a required retry loop, zero out of 15 runs across all three models caught the mistake on their own. Notably, the agents often re-read documentation confirming the correct behavior but still didn’t cross-check their own already-written code against it.

What did work: adding a canary deploy log to the context showing requests actually failing during a database failover. With that concrete evidence present, 10 out of 15 runs went back and fixed the retry loop. The difference wasn’t a smarter model or a clearer note, it was independent evidence from outside the agent’s own reasoning.

Frequently Asked Questions

What causes context rot in AI agents?

Context rot happens because an agent’s context window fills with tool results, logs, and self-generated notes over a long session, and the model has to decide what to attend to across that entire growing window even though the underlying task hasn’t changed in size or complexity.

Which context rot failure modes still affect modern models?

Hands-on testing against Qwen models and Gemini 3 found that context poisoning, context distraction, context confusion, and context clash were largely handled correctly by current models. Self-conditioning, where an agent fails to catch mistakes in its own prior work, was the one failure that broke every model tested.

How do you fix self-conditioning in an AI agent?

The approach that worked in testing was introducing outside evidence the agent couldn’t dismiss as just another note, such as canary deploy logs showing real failures, behavioral tests, or a reviewer checking the actual diff rather than the agent’s own summary of what it did.

Does compaction fix context distraction?

In testing, compaction didn’t change the pass rate because distraction wasn’t causing failures at the tested scale. It did cut prompt token usage significantly, so compaction is better understood as a cost-reduction technique than a reliability fix in that scenario.

Does pruning old context have downsides?

Yes. Pruning breaks prompt caching, and cached tokens are considerably cheaper than uncached ones. Pruning at clear boundaries, like the end of a subtask, rather than continuously, balances the benefit of a clean context against the cost of losing the cache.

Editorial standards

Presented by MindStudio

No spam. Unsubscribe anytime.