Prompt engineering vs Context engineering
40 sourced facts · updatedPrompt engineering or context engineering: what is the difference?
Prompt engineering is about the standing instructions a model reads on every request: writing them, testing them and trimming them. Context engineering is the wider job of deciding what goes into the model's window each turn, which means instructions, tools, retrieved facts and history, and what stays outside. The prompt is one of the things put in the window, so prompt work is a part of context work. Work on the prompt when the instructions are the problem; work on the context when the window fills up, tools bloat it or a long run has to carry on. [1][2][3]
In the knowledge graph: What the prompt holds, and what is left out of it, is a context decision.
The difference between Prompt engineering and Context engineering
| Prompt engineering | Context engineering | |
|---|---|---|
| What it covers | The system prompt: the lines the model reads on every request, how they are layered, and how they are checked on the way out. [4][5] | Choosing strategically what the model sees: not just staying under the token limit or putting in as much as fits. [1] |
| The main skill | Subtraction by testing: delete the whole prompt, bring it back line by line, and add a line only when the model keeps stumbling on the same thing. [2][3] | Keeping the window small and useful: load tool definitions on demand, keep big results outside the window, and summarize or log long histories. [6][7] |
| What goes wrong | Lines that cost more than they give: adding a line too early costs, because the model reads it every time, and lists of things not to do can lower quality on the latest models. [8][9] | A window that fills: Voss relays Chroma results on 18 models that accuracy on long inputs can fall 30-50% well before the window is full, and a naive MCP client with about a hundred tools lost roughly a third of context before the first question. [10][11] |
| Where a rule is placed | Placement decides whether a rule is read: guidance sent as a message at the point of need worked better for Nemotron than a standing rule in the system prompt. [12] | The same idea at larger scale: a skill shows the harness only a short description, and the full text is read and injected when it is relevant. [13] |
| How cost shows up | In every request, because the model reads each instruction every time; Claude Code deleted 80% of its system prompt when a newer model arrived. [8][14] | In the bill for the whole window: Cameron says input tokens, cache-hit share and turns per task drive agent cost, and with zero cache hits a $21 task costs over $200. [15] |
| How it is checked | A golden set of input and output pairs, one variable changed per variant against a baseline, and a regression eval so a later change cannot undo a win. [16][17][18] | Evals on the window itself: Voss says the hard part moved from fitting instructions in to verifying the model followed them, and long-session evals replay many turns to catch late forgetting. [19][20] |
| What a prompt cannot do | Guarantee. Instructions are requests; a deterministic final layer reads the output and checks it against what is real, because the prompt will eventually lose. [21][22] | Carry a rule through a long run unaided: in one failure, an inbox agent was told it could delete emails but must confirm first, and the inbox was so long that compaction lost the rule. [23] |
When to use Prompt engineering
- A new model arrived and the old prompt is full of lines that corrected the earlier model: run the ablation and strip it back. [24][25][2]
- A prompt change could trade off against quality: Claude Code's 25-word limit passed weeks of testing and the eval set, then a broader ablation showed a 3% drop and it was reverted. [26]
- A wrong output must never reach a reader, such as an invented figure or a date that is not on the allow list: add a deterministic check after the prompt. [5][27][22]
When to use Context engineering
- The agent gets worse as sessions grow: the sources describe context rot, and one team fixed late forgetting by building evals that load ten turns and test the eleventh. [28][20]
- Tools and their output fill the window: LinkedIn says MCP cannot scale past 30-40 tools without hurting performance, so it exposes three meta tools (search, get schema and execute). [29][11]
- A task runs long enough that history has to be summarized, logged or reset, and the cost of the repeated prefix matters. [30][31][32]
Using Prompt engineering and Context engineering together
They overlap in the middle. Instruction files and skills are prompt text that context work decides when to load, and a rule's place in the window changes whether it is read. The sources describe the same move on both sides: delete what the newer model no longer needs. Claude Code cut 80% of its system prompt for newer models and keeps different prompts for different models. [33][12][34][35]
Should each model get its own system prompt, or one prompt for all of them?
The sources disagree. Several say different models need different prompts, and that rules written for older models slow a newer one. Another says a simple prompt that is the same for every model is best when the aim is to test the model, because tuning the prompt for one model may favour it without anyone knowing. [36][37][38]
Should you keep the context window as small as possible?
The sources split. One says to keep it as small as possible because attention per token falls as you add more. Another says skills and prompt files can now be very long, so fitting everything in is no longer the hard problem; cost and verification are. [39][40]