Context and Its Ingredients
Working with an agent can feel like gambling. You press Enter. Sometimes you get exactly what you wanted. Sometimes you get something generic, confused, or confidently wrong. You do not know which agent you are going to get.
It is tempting to blame the model or search for a magic prompt. Often, the real problem is the information the agent received. Something important may be missing, stale, contradictory, or buried under information that does not matter.
The agent’s view of the world is its context: all the text available to the language model inside the agent. This is literally all it can see. Once you understand context, an agent’s failures become easier to explain and correct. You can give it the information it needs, remove noise, and help it stay on track.
Starting Points
-
Start with Philipp Schmid’s Context Engineering. It introduces context, the context window, and why the information given to an agent matters. Pair it with Matt Pocock’s definitions of context and the context window.
-
Use Matt Pocock’s dictionary to name the main parts of the context window: the system prompt, the current user request and conversation history stored in the session,
AGENTS.md, tools and tool results, skills, and contextual knowledge retrieved from files, webpages, and other sources. -
Continue with fuller explanations of those parts:
- Simon Willison’s Highlights from the Claude 4 system prompt walks through instructions supplied by an AI product.
- The Instruction File pattern
explains why agents need standing project instructions, how those
instructions enter context, and how files such as
AGENTS.mdandCLAUDE.mdexpress the same idea in different products. - Anthropic’s Equipping agents for the real world with Agent Skills explains how a Skill is organized and how its instructions, references, and scripts are loaded into context only when they are needed.
Deep Dive
- Lance Martin’s Context Engineering for Agents connects common context failures to four ways of managing what the agent receives: write, select, compact, and isolate.
- OpenAI’s Unrolling the Codex agent loop diagrams how conversation, instructions, tools, results, and retrieved files are assembled for a coding agent.
- Anthropic’s published Claude system prompts provide real examples of the instructions an AI product adds before the user types anything.
- Anthropic’s Effective Context Engineering for AI Agents goes deeper into long tasks, compaction, notes, tools, and subagents.
- Lost in the Middle studies how the position of information can affect whether a model uses it.
- Chroma’s Context Rot tests how model performance changes as context grows.