# 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.

- **Source:** https://ainativesoftware.engineering/roadmap/day-4/from-prompt-engineering-to-context-engineering
- **Site:** AI-Native Software Engineering — https://ainativesoftware.engineering/book

- **Day:** 4 · position 1 of 8
- **Reading time:** 1 minute
- **Day overview:** [Day 4](https://ainativesoftware.engineering/roadmap/day-4.md)

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.

## 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.

**Theory resources**

- [Context Engineering as a Pillar of AI-Native Engineering (jsdevai.com)](https://jsdevai.com/pillars/context)
- [Effective Context Engineering for AI Agents – Anthropic](https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents)

- **Previous topic:** [Automated Code Review With AI](https://ainativesoftware.engineering/roadmap/day-3/automated-code-review-with-ai.md)
- **Next topic:** [Rules and Instructions: Persistent Context for Your Agent](https://ainativesoftware.engineering/roadmap/day-4/rules-and-instructions-persistent-context-for-your-agent.md)

---

_AI-Native Software Engineering by Alfonso Graziano (O'Reilly Media, Early Release; print edition February 2027). Every page of ainativesoftware.engineering is also served as Markdown: append `.md` to any URL. Index: https://ainativesoftware.engineering/llms.txt — whole site in one file: https://ainativesoftware.engineering/llms-full.txt._
