What is Context Engineering?
The practice of deliberately designing what context an AI model receives: system prompts, retrieved documents, conversation history, tool outputs, and structured metadata. Context engineering treats the model's input as a first-class engineering artifact, not an afterthought. The quality of AI output is bounded by the quality of the context you provide.
My perspective
In practice
The difference between a mediocre AI workflow and a great one is almost always context, not model choice. Context engineering includes: curating knowledge bases for RAG, writing system prompts that encode domain expertise, structuring conversation history to prevent context rot, and designing tool schemas that give agents the right information at the right time. Teams that invest in context engineering see their AI systems get consistently better over time.
Why it matters now
A capable model can fail when the information around a task is stale, irrelevant, incomplete, or contradictory. Context engineering designs what reaches the model, where it comes from, and how it changes as the task progresses.
Daniel's take
The system matters more than the model
I treat the context window as a temporary workspace, not durable memory. I want the model to receive enough evidence to act well without hiding the important constraints in a pile of unrelated material. When an agent repeats a mistake, I inspect the context supply before simply expanding the prompt.
What it is, and what it is not
Context is broader than the prompt
Instructions are one component. Retrieved documents, tool results, examples, task state, conversation history, and available actions also shape what the model can do.
A larger window is not better selection
Capacity does not establish relevance. Additional material can increase cost, introduce conflicting instructions, and make decisive evidence harder to use.
A grounded example
Give a coding agent the relevant decision
Situation: An agent repeatedly introduces a dependency that conflicts with an earlier architectural choice.
Response: The harness retrieves the current decision record and relevant module contract before implementation, then checks the resulting dependency against a structural test.
Lesson: The useful intervention supplies the missing evidence and a feedback loop rather than another generic instruction to be careful.
Systems and technical depth
Separate authority from retrieved content
External documents and tool output are evidence, not trusted instructions. Label their origin and keep permissions and execution policy outside untrusted content.
Evaluate the retrieval boundary
Check whether the system finds the right material, preserves provenance, and handles absence explicitly. Track token budgets and context updates alongside task outcomes.
Executive and organizational depth
Maintain the sources agents depend on
A context pipeline cannot repair an ownerless knowledge base by itself. Teams need review rules for the policies, decisions, and reference data that guide action.
Make context failures diagnosable
Reviewers should be able to inspect which evidence was supplied and why. This helps distinguish a missing fact from poor reasoning or a tool failure.
Questions for your system
- What evidence was actually available when the agent failed?
- Which context should persist outside the conversation?
- How do you distinguish trusted policy from retrieved text?
Sources and further reading
- Anthropic: Effective context engineering for AI agents ↗
Context selection, compaction, and the working environment around agents.
- Lewis et al.: Retrieval-Augmented Generation ↗
Research on combining retrieved information with generative models.
- OWASP: Prompt Injection ↗
Risks introduced when untrusted content influences model instructions or actions.