Skip to content

From Prompt Engineering to Context Engineering

Why the craft has shifted from writing clever individual prompts to curating the full state an agent receives: tools, history, files, rules, and constraints. How that shift changes what good engineering looks like.

  • 1 min read
  • Theory
  • Day 4 of 7

Theory

Early AI tooling was mostly about prompting: if you phrased the question the right way, the model gave you a better answer. That still matters, but it's no longer the whole picture. As agents became capable of multi-step work, the real variable shifted from the single prompt to the entire message state passed to the model at inference time. That is what context engineering is: the practice of deliberately assembling, structuring, and optimizing everything the model receives.

Context is not just your text. It includes the system prompt (identity, goals, constraints), tool definitions (what the agent can call and how), conversation history, files and code retrieved from the codebase, rules and style guides, and any memory carried across sessions. All of it lands in a fixed-size context window measured in tokens.

Here is the core tension. Research shows that simply adding more context does not improve results: the effective context window, the range where models perform reliably, is often a fraction of the advertised maximum. Past a certain point, adding tokens hurts accuracy, raises cost, and slows inference. Too little context makes the agent blind. Too much makes it distracted.

Context engineering is the discipline of finding the right balance. It means being intentional about what you include and what you leave out, structuring information so attention lands where it should, and keeping context clean across sessions so the agent stays aligned with reality.

The rest of day 4

  1. 01From Prompt Engineering to Context EngineeringYou are here
  2. 02Rules and Instructions: Persistent Context for Your Agent
  3. 03Skills and Commands: Reusable Patterns
  4. 04Custom Agents and Personas
  5. 05Rules, Skills, Commands, and Custom Agents: Knowing What to Use When
  6. 06Model Context Protocol (MCP): What It Is and Why It Matters
  7. 07MCP Security: What Can Go Wrong
  8. 08Harness Engineering: Everything Around the Model
Where this comes from

This path is the shortest route to the ideas. AI-Native Software Engineering (O'Reilly Media) is where each one is worked out in full, with the patterns, the trade-offs and the failure modes. The pillars cover the foundations one long essay at a time.