Chapter 2. Context Engineering Fundamentals
Context engineering is the delicate art and science of filling the context window with just the right information for the next step.
Andrej Karpathy
When you interact with an AI coding agent, everything the model knows about your task, your codebase, your coding standards, and your intentions must arrive in a single place: the context window. The model can’t browse your files on its own initiative, remember what you agreed on last Tuesday, or look up your team’s preferred testing library unless something in its environment delivers that information. It can only work with what it receives. And what it receives, you control.
That’s the insight behind context engineering: what matters most isn’t how clever your prompt is. It’s whether the model receives the right information to reason well. Your system prompt, your rules files, the code snippets you reference, the tool definitions the runtime injects, the conversation history that accumulates over the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access