The Problem Everyone Diagnoses Wrong
Your AI agent works fine for the first ten steps. It picks the right tools. Reasons clearly. Stays on task. Then around step fifteen or twenty, something changes. It forgets what you asked for. Calls tools that don't make sense. Starts producing lower-quality outputs.
Most people's first diagnosis: the model is the problem. Upgrade to a better model.
Usually wrong. The issue is not what the model is capable of. It is what the model is seeing. Organizing what the model sees is called context engineering , and it is becoming one of the most important skills for anyone building AI systems.
The Four Failure Modes
Research from practitioners identifies four ways agent context goes wrong as a session grows.
Context poisoning. A hallucination or error enters the agent's context early and gets referenced in every subsequent step. If a tool returned bad data in step three, the agent keeps building on that bad data through step twenty. The error compounds.
Context distraction. Irrelevant information builds up in the context window. The agent pays attention to things that don't matter, which means it pays less attention to things that do. Quality degrades without any single obvious cause.
Context confusion. Contradictory information accumulates. Step seven said X. Step fourteen produced something inconsistent with X. The agent now has to reconcile them , and usually just picks one, often the wrong one.
Context overflow. The context window fills. Older information is truncated. The agent loses access to critical early instructions or established decisions.
The Four Strategies That Fix Them
Write-what-matters, discard-what-doesn't. Active context management: after each major step, summarise the relevant findings and discard the raw process. The context should contain conclusions, not transcripts.
Layered context structure. Separate the types of information. System-level instructions go in the system prompt. Background knowledge goes in a knowledge layer. Current task state goes in a separate working memory. These layers don't bleed into each other.
External memory for long projects. Anything that needs to persist beyond one session goes external , a file, a database, a structured note. The agent reads what it needs, when it needs it, rather than carrying everything in context.
Fresh sub-agents for isolated tasks. When a sub-task is truly independent, launch a fresh agent with only the context that task needs. Clean slate, no baggage from the parent session's accumulated noise.
Why This Is a Skill, Not a Feature
Platforms are building tools to manage context automatically. Compression algorithms, automatic summarisation, context windows that extend further. These help.
But the underlying skill , deciding what information matters, how to structure it for the model, what to keep and what to discard , remains a human judgment call. The best context engineers are not the ones who know which tool to use. They are the ones who have thought carefully about what their agent actually needs to see at each step.
That thinking is the skill. The tools are just implementations of it.