Context Engineering vs Prompt Engineering
The prompt is only one part of what the model sees
Section titled “The prompt is only one part of what the model sees”Prompt engineering is about writing a good instruction. That still matters, and it is what most of this guide teaches.
But an agent that works for twenty steps sees much more than your prompt. On every turn the model reads the system prompt, the tool definitions, the examples, the files it opened, the search results it pulled in and the whole message history so far. Anthropic’s engineers call the discipline of managing all of that context engineering, and they describe it as the natural next step after prompt engineering, not a replacement for it.
The simplest way to hold the difference:
| Prompt engineering | Context engineering | |
|---|---|---|
| Question | How do I phrase the instruction? | What should the model be looking at right now? |
| Unit of work | One prompt | The whole context window, turn after turn |
| Typical task | One-shot: classify, write, extract | Multi-step agents and long sessions |
| Main failure | Vague or conflicting instructions | Too much, stale or irrelevant information |
Why “more context” is not “better context”
Section titled “Why “more context” is not “better context””Models now accept enormous context windows, so the tempting move is to put everything in. That backfires for two reasons.
1. Context rot. Benchmarks show that as the number of tokens in the window grows, the model gets worse at accurately recalling and using any particular piece of it. The information is technically there; the model just pays less attention to it.
2. A finite attention budget. Every token competes with every other token for the model’s attention. A pasted 40-page manual does not only cost money (Token Economics); it dilutes the five lines that actually matter for this step.
The goal: the smallest set of high-signal tokens that gets the job done. Informative, but tight.
The seven techniques
Section titled “The seven techniques”1. Write the system prompt at the right altitude
Section titled “1. Write the system prompt at the right altitude”There are two ways to get it wrong:
- Too low: brittle if-then rules for every case (“if the user says X, reply Y”). They break on the first case you did not foresee.
- Too high: vague slogans (“be helpful and accurate”) that assume the model shares context it does not have.
The fix: clear principles plus the key specifics, organised into labelled sections (background, instructions, tool guidance, output format). Start minimal, test, and add a line only when you see a real failure.
2. Keep the toolset small and unambiguous
Section titled “2. Keep the toolset small and unambiguous”Every tool is a decision the model has to make on every turn. If a human engineer cannot say which of two tools applies in a situation, the model cannot either. Fewer tools with clear names and non-overlapping jobs beat a large toolbox. This is why Claude Code defers MCP tool definitions until they are needed (see Claude Code Extensions).
3. Use a few canonical examples, not a list of edge cases
Section titled “3. Use a few canonical examples, not a list of edge cases”Three to five diverse, well-chosen examples teach the pattern better than twenty rules covering every corner. Examples are worth far more context than exhaustive instructions.
4. Retrieve just in time
Section titled “4. Retrieve just in time”Instead of loading every document up front, give the agent lightweight references (file paths, links, IDs, search tools) and let it pull in only what the current step needs. This is how a person works: you do not memorise the filing cabinet, you know where to look. The trade-off is speed, so many systems mix the two: load a small core up front and fetch the rest on demand.
5. Compact long histories
Section titled “5. Compact long histories”When a session gets long, summarise it and continue from the summary. Keep decisions, open problems and key details; drop raw tool outputs that have already been used. Clearing old tool results is the safest, lightest form of compaction. The hard part is choosing what to keep, so tune summaries on real sessions.
6. Let the agent take notes
Section titled “6. Let the agent take notes”Give the agent a place to write down progress outside the context window: a to-do file, a decisions log, a NOTES.md. It can re-read the notes after a reset or compaction instead of carrying everything in context. This is what lets an agent stay coherent over tasks that take hours.
7. Split work across sub-agents
Section titled “7. Split work across sub-agents”For big tasks, a lead agent hands focused jobs to sub-agents, each with a clean context. A sub-agent might read thousands of tokens of material and return a few hundred tokens of conclusions. The lead agent’s context stays clean and focused on the overall plan.
A quick self-audit
Section titled “A quick self-audit”Before blaming the model for a bad answer in a long session, check the context:
- Is the key instruction buried? Move it up, or repeat it close to the task.
- Is there stale information? Old tool outputs, superseded plans and dead ends confuse later steps.
- Are there overlapping tools or rules? Ambiguity in your setup becomes inconsistency in the output.
- Did you paste a whole document for one fact? Retrieve the section, not the book.
How this connects to the rest of the Blueprint
Section titled “How this connects to the rest of the Blueprint”- Long-Context Logic covers how to structure big inputs when you do need them.
- Terminal State covers the move from prompting to building real software around the model, which is where context engineering starts to matter.
- Token Economics covers the cost side of the same problem.
Source: Anthropic Engineering, Effective context engineering for AI agents.
Privacy policy · Privacy & cookie settings · © 2026 Guayoverse · Logo AI-generated with Google Gemini