Context Engineering for AI Agents: 4 Failure Modes to Avoid
Video by IBM Technology on YouTube · 10 min · uploaded October 2026
Notes and analysis by BrainTube, written from the video. Not affiliated with IBM Technology. Watch on YouTube
In short
IBM's video names four ways a long-running agent's context goes bad (poisoning, distraction, confusion and clash) and pairs each with a fix: validate, compact, curate and prune. The taxonomy is clear and the running example of a database-driver migration agent makes it concrete. The fixes are right in direction but thin on how to do them, and moving notes into files only helps if what gets written there is checked.
The argument
The video's claim is that bigger context windows do not make agents better at long tasks, and can make them worse. A model does not look things up in its context like a database reads a row. Every token competes for a fixed attention budget, so the more an agent piles into the window, the less reliably it uses any of it. In a typical run, the task is a few lines at the front, and the rest is system prompt, project instructions, tool definitions, step history and, largest of all, tool results. Context engineering is the job of deciding what goes into that window at each step. The four fixes the video offers have one thing in common: each works by removing information. An agent gets better at long tasks by holding less.
Key ideas, with timestamps
- 0:36
Context rot
The video cites a study of 18 frontier models in which all of them became less reliable as input length grew, and uses the name context rot. It does not name the study. The finding matches published 2025 research on long-context degradation and is the premise for everything that follows.
- 1:50
What fills the window
The example is an agent migrating an old codebase to a new database driver. Its context holds a system prompt, a two-line task, an agents.md file of project instructions, tool definitions, a growing message history and tool results such as file contents, test output, error logs and schema dumps. The task itself is a tiny fraction of the total.
- 4:03
An attention budget, not a lookup
He frames the core problem plainly: a window may hold a million tokens, but the attention spread across them is finite. That is why adding more context is not free even when it fits.
- 4:35
Poisoning: a wrong note treated as fact
Early on, the agent skimmed the driver docs and wrote itself a note that the new driver retries failed connections automatically, so old retry code can go. The note is wrong. Because the model treats its own notes as ground truth, it deletes working retry code file after file.
- 5:20
Distraction: history becomes the strongest pattern
A model continues patterns. After an hour of its own past actions in the window, that history can outweigh what it learned in training, and the agent drifts into repeating what it already did instead of asking what the job needs next.
- 6:03
Confusion: too many tools
Version control, a database console and a ticketing system each put their tool definitions in the window whether used or not. He cites a benchmark where a model failed a task with 46 tools on offer and passed the same task with 19. Clash, at 6:55, is the fourth mode: once the agent notices retries are not happening and records the correction, the window holds both the wrong note and the fix.
- 7:32
Validate and compact
For poisoning, check a conclusion against something real before writing it down. One connection test would have prevented the bad note. For distraction, summarize a long history and restart from the summary. He warns compaction is lossy, like a photocopy of a photocopy, and at 8:22 suggests moving detail into permanent files that are pulled in only when needed.
- 8:44
Curate and prune
For confusion, give the agent only the handful of tools the task needs and let it fetch others on demand. For clash, delete superseded information rather than leaving both versions, or start a fresh window that restates only the current, corrected state of the job.
What it gets right
The single running example is what makes the video work. One wrong note about retries causes poisoning, and the later correction causes clash. Seeing two failure modes come from one event shows that they are not separate bugs but stages of the same problem: unverified state entering the window and never leaving.
The point that every fix removes something is the most useful takeaway. Most agent builders respond to failures by adding more: more instructions, more examples, more tools. The video argues the opposite, and that matches what practitioners report. A lean, current context usually beats a large one.
The four names (poisoning, distraction, confusion, clash) are also a good shared vocabulary. When an agent fails, asking which of the four happened is faster than rereading a long trace without a hypothesis.
Where the fixes need more detail
- Validation is not always possible. A connection test works for a driver's retry behavior. Many agent conclusions, such as what a user intended or which design is cleaner, have no quick test. The practical rule is narrower: anything the agent will act on repeatedly should be checked once, and its source recorded next to it.
- Files can carry poison too. Moving notes out of the window into permanent files, as suggested at 8:22, reduces distraction. But if the agent writes its wrong retry note into a file, every future session loads the same mistake. Persistent notes need the same validation and pruning as the window, or they make poisoning last longer.
- Compaction needs rules. He says compaction is lossy but not what to keep. A good summary keeps the task, decisions made with their reasons, open problems and verified facts, and drops raw tool output. Without that, the summary can keep the wrong note and drop the correction.
- Tool curation has a discovery problem. Letting the agent fetch tools on demand requires some index of what exists. That index is itself context. Many MCP clients now let you enable tool sets per project, which is the simplest form of curation.
- The cited numbers are unsourced. The 18-model study and the 46-versus-19 tools result are given without names. Both are in line with public 2025 research, but treat the exact figures as illustrations, not benchmarks for your setup.
How this applies to memory across AI tools
The video's fix for distraction, keeping detail outside the window and pulling it in only when needed, is the same idea behind retrieval and external memory. It is the reason persistent memory differs from a big context window: a store you query beats a window you fill.
The lesson from poisoning applies directly to any memory you share across tools. A wrong fact saved once will be retrieved by every assistant that reads it. Memory you build from sources, such as transcripts and documents, is easier to validate than memory an agent writes about itself, because you can trace a claim back to its source. BrainTube takes the source-based approach. It saves YouTube videos with their transcripts, articles, PDFs and podcasts into one compiled knowledge base and exposes it as an MCP server, so Claude, ChatGPT, Cursor and other MCP clients can retrieve only the passages a step needs. For the underlying technique, see RAG explained.
Who should watch it
Watch it if you build or run agents that work for more than a few minutes, such as coding agents, research agents or migration scripts, and you want a vocabulary for why they degrade. The full list of failure modes is at 4:35 to 7:22 and the fixes at 7:32 to 9:28, so the whole video is worth the ten minutes. Skip it if you want implementation detail, such as how to write a compaction prompt or wire tool selection, because the video stays at whiteboard level.
Frequently asked
- What is context rot in LLMs?
- Context rot is the drop in reliability as the amount of text in a model's context window grows. Even when everything fits, the model uses any single piece of it less reliably, because attention is spread across more tokens. It is why a bigger window does not automatically make agents better at long tasks.
- What are the four context failure modes for AI agents?
- Poisoning is a false conclusion that the agent then treats as fact. Distraction is a long history that steers the agent into repeating itself. Confusion comes from offering too many tools. Clash is when the window holds conflicting versions of the same information. The video's matching fixes are validate, compact, curate and prune.
- How do you fix context poisoning in an agent?
- Check a conclusion against something real, such as a test, a query or the source document, before the agent writes it into its notes. If a wrong fact is already in the context, delete it rather than adding a correction, or restart from a clean summary of the corrected state. Apply the same checks to any notes saved to files, since those carry into future sessions.
Keep videos like this one searchable
BrainTube saves YouTube videos with their transcripts into one compiled knowledge base that Claude, ChatGPT, Cursor and other MCP clients can search.
Go deeper
More video notes
- What Is Context Engineering? Why It Matters for AI Agents · IBM Technology
- Is RAG Still Needed? Choosing the Best Approach for LLMs · IBM Technology
- Context Engineering for Agents · LangChain
- A Helping Hand for LLMs (Retrieval Augmented Generation) - Computerphile · Computerphile
Are you the creator and want this page changed or removed? Contact us and we will act within 48 hours.