
Context engineering is the work of deciding what an AI model sees at each step: which instructions, records, tools and history enter its context window, in what form, and what stays out. An agent that is handed too much, the wrong version of a policy or a schema it cannot interpret will give wrong answers, and a stronger model reading the same context makes the same mistakes. An enterprise context layer is where those decisions are made once, for every agent that reads your data.
The evidence for this is now measured. Chroma tested 18 models in July 2025, including GPT-4.1, Claude 4 and Gemini 2.5, and found that their performance grows increasingly unreliable as input length grows. A Microsoft and Salesforce team ran more than 200,000 simulated conversations and found that the same tasks scored 39% lower on average when the information arrived over several turns instead of one, because models make early assumptions and, in the authors' words, get lost and do not recover. Enterprise agents work in exactly those conditions: long tasks, many systems, and data that changes between steps.
Anthropic's engineering team defined it in September 2025 as the set of strategies for curating and maintaining the optimal set of tokens during inference. The prompt is one part of that set. The rest is everything else that lands in the window on a given step: tool definitions, retrieved documents, records from your systems, the conversation so far and any notes the agent wrote to itself.
Anthropic describes a model as having an attention budget that every token draws down, so the goal is the smallest set of high-signal tokens that gets the step right. For an enterprise agent that means a design decision for every source. Which systems may it read, how a record is translated before the model sees it, when it is fetched, how long it stays, and who may see it.
Prompt engineering is about how the instructions are written. Context engineering is about what the model receives alongside them, and it is repeated on every step of an agent's run rather than written once.
| Aspect | Prompt engineering | Context engineering |
|---|---|---|
| Works on | The wording of instructions | Everything in the context window on each step |
| Done | Once, when the prompt is written | On every step, as the agent runs |
| Data | Pasted in or described | Retrieved, filtered and formatted at runtime |
| Fails as | A misread instruction | Stale, conflicting or excess material in the window |
| Owned by | Whoever writes the prompt | The team that owns the data and the pipeline |
Good prompts still matter. A precise instruction cannot rescue an agent that is reading last year's policy, though, and that is the more common failure on enterprise data.
In June 2025 Drew Breunig gave the failure modes names that have stuck: poisoning, distraction, confusion and clash. Each has a documented case. Google's Gemini 2.5 technical report describes a Pokémon-playing agent whose goals and summaries were poisoned with misinformation about the game, which cost it many hours chasing a goal it could not complete. The 39% multi-turn drop above is clash: early guesses stay in the context and contradict what arrives later. Pick the symptom you are seeing to find the failure behind it.
None of the four is fixed by a better model or a stronger prompt, because each one is a problem with what reached the model. That is why diagnosing an agent starts with its context: what was in the window on the step that went wrong, and where each piece came from.
Larger windows invite a simple fix: if the agent is missing something, give it everything. Chroma's study shows the cost. Adding a single distractor, a passage similar to the answer but wrong, lowered accuracy against the clean baseline, and four distractors lowered it further. An enterprise index is full of near-duplicates of exactly that kind: superseded policies, draft contracts, the same process described by three teams.
Size also costs money on every call. Each token in the window is billed and adds latency, so an agent that carries a 38,000-token policy manual to answer a question about one discount rule pays for the manual every time. Switch between the two windows below to see the same request built both ways.
The engineered window is smaller because each piece was chosen for this request. The rule comes from a versioned store, the account arrives in business terms rather than column names, and the decision itself goes to a rules engine that returns a fixed answer. Our post on mapping business rules into the context layer shows how those rule records are written and owned.
Seven techniques cover the four failures between them. Four of them appear in Anthropic's guidance, and the other three are how our context layer handles rules and permissions.
Two of our builds show what this looks like in practice. An insurance client's daily MI alerting system calculates every figure in PostgreSQL views and hands the model finished numbers to write a sentence around, and a verification step names any figure the model was not given. Pinkcube's chat agent answers from a knowledge base built from Pinkcube's own resolved support conversations, filtered before the agent can use them. After 76 hostile test scenarios, the worst-scoring case became a rule: questions about a specific product now escalate to a ticket and override retrieval (Pinkcube case study).
One agent can carry its own retrieval code. Ten agents built that way each keep their own copy of the rules, their own schema translations and their own permission filters, and they drift apart. A context layer moves that work into shared infrastructure: sources connected once, permissions checked before retrieval, rules stored as versioned records, and every retrieval logged with its provenance.
Our enterprise context layer is built inside your VPC on n8n and the Model Context Protocol, and every agent reads from it through one interface. The five-layer blueprint covers how each layer is built, context layer vs semantic layer covers where it differs from the metric definitions your BI tools already use, and what is an MCP server explains the protocol it delivers through.
The same log answers the governance questions later: who asked, what the agent read and which version of each rule it applied. Our post on data governance for AI covers what to record, and AI guardrails covers the checks that stop a bad answer before it becomes an action.
Context engineering is the design of everything an AI model receives at inference time: instructions, retrieved data, tool definitions, conversation history and memory. Anthropic defines it as curating the optimal set of tokens for each step. For agents it is repeated on every step of a run.
Prompt engineering shapes how instructions are worded. Context engineering decides what data, tools and history sit beside those instructions, how they are formatted, and when they are fetched or dropped. Prompt engineering is one part of context engineering.
When the model is capable of the task, the failure usually sits in the context: an early error the agent keeps building on, a history so long it crowds out the instructions, tools and records the task did not need, or sources that contradict each other. Logging the full context on the failing step usually shows which one.
Context rot is Chroma's name for the decline in model reliability as the input grows. Its July 2025 study of 18 models found performance grows increasingly unreliable with input length, and that distractor passages lower accuracy further.
No. A larger window lets more irrelevant or conflicting material in, which makes distraction, confusion and clash more likely and adds cost and latency to every call. A smaller window chosen for the step usually does better.
A context engineer designs how data reaches the model: which sources an agent may read, how records are translated into business terms, how permissions are checked before retrieval, when history is compacted, and what is logged for each answer.
To find the workflow where better context would pay off first, start with the AI Audit, or book a discovery call and walk through an agent that is failing today.