Frontier Foundry

Prompt engineering vs Context engineering

40 sourced facts · updated

Prompt 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 engineeringContext engineering
What it coversThe 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 skillSubtraction 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 wrongLines 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 placedPlacement 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 upIn 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 checkedA 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 doGuarantee. 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]

Each one on its own

from their concept pages

What is Prompt engineering?

Prompt engineering is writing the instructions and examples that steer a model. The wording, the order and the examples shown all change what comes back, so prompts are tested and revised like code. It is the cheapest lever on a model's behaviour, and the first one to try.

A system prompt is the standing note a model reads on every request. The sources describe it as something made and tried like code: stripped with each new model, rebuilt a line at a time from observed stumbles, tested one change at a time against a golden set, fixed in layers, and still checked on the way out, because instructions are requests the model usually follows.

80%
Share of Claude Code's system prompt deleted when a newer model arrived; reported by the product's creator Y Combinator
28 examples
Size of one golden set: 14 conversation threads, each with a short summary and a summary with references; a speaker's own small set Rachel Lee Nabors (RL Nabors)

Prompt engineering, explained in full: how it works as a machine, every part and its sources.

What is Context engineering?

Context engineering is deciding what goes into a model's limited window on each turn: which instructions, files, tool results and memories, and in what form. With too little the model lacks what it needs; with too much it loses the thread and costs more. Long tasks depend on what is kept, fetched and trimmed.

Context engineering is deciding what goes into the model's window each turn (instructions, tools, retrieved facts, history) and what stays outside. These talks describe the same pressures: windows rot as they fill, tool definitions and tool results are the fastest way to fill them, and long runs force compaction or external logs. The answers are on-demand loading, sub-agent isolation, small durable memory, a stable cacheable prefix, and evals to prove the changes work.

~350K tokens
Where Bergum puts the usable context for current models before quality degrades (his opinion), compared to a 1.4 MB floppy disk Jo Kristian Bergum
7 and 12 hours
Codex runs OpenAI's team cites as spanning many compactions in one thread Gabriel Chua
43% fewer tokens, 31% lower cost
Arize reports after moving its agent to code mode, with latency about constant Mikyo King

Context engineering, explained in full: how it works as a machine, every part and its sources.

In AI coverage over the last four weeks, Prompt engineering took 0.97% and Context engineering 1.0%. Prompt engineering, week by week

The facts behind this page

40 facts from the two knowledge packs
  1. DeLucia says context engineering is choosing strategically what the model sees, not just staying under the token limit or shoving in as much as fits. Sally-Ann DeLucia, AI Engineer · 2026-04-08 · Context engineering
  2. The team runs a prompt ablation: delete the whole system prompt, then bring it back line by line to see what each individual line does. Y Combinator · 2026-07-27 · Prompt engineering
  3. A line is added back only when the model repeatedly stumbles on the same thing. Y Combinator · 2026-07-27 · Prompt engineering
  4. The order of the layers is fixed and load-bearing: hard rules first, tasks last, assembled in one place every time. Isadora Martin-Dye, AI Engineer · 2026-06-29 · Prompt engineering
  5. The final layer reads what actually came out and checks it against what is real; an offered date that is not on the allow list does not ship. Isadora Martin-Dye, AI Engineer · 2026-06-29 · Prompt engineering
  6. Progressive tool discovery, introduced by Anthropic then Cursor, loads only the one or two tools needed instead of all of them; Cloudflare's code mode treats MCP tools as code. Jan Curn, AI Engineer · 2026-10-02 · Context engineering
  7. Fuentes has a tool save bulky logs to storage and keep only a memory-pointer ID in agent state, so the agent fetches the logs back by ID only when it truly needs them. Elizabeth Fuentes Leone, AI Engineer · 2026-06-29 · Context engineering
  8. Adding a line too early costs, because the model reads that instruction every single time the product is used. Y Combinator · 2026-07-27 · Prompt engineering
  9. Lists of things not to do can lower the quality of results from the latest models. Simon Willison, Simon Willison · 2026-07-21 · Prompt engineering
  10. Voss relays Chroma results on 18 models: accuracy on long inputs can fall 30-50% well before the context window is full, and well-structured text hit the failure more than shuffled text. Laurie Voss, AI Engineer · 2026-09-09 · Context engineering
  11. Curn says naive MCP clients register every tool up front, so ten servers meant about a hundred tools and roughly a third of context gone before the first question; he calls it a harness problem, not a protocol problem. Jan Curn, AI Engineer · 2026-10-02 · Context engineering
  12. Where a rule sits decides whether it is read: guidance delivered as a message in the conversation at the point of need worked better for Nemotron than a standing rule in the system prompt, so the team added middleware that asks the agent to plan, then injects a second message asking it to review the plan before executing. langchain · 2026-07-08 · Prompt engineering
  13. Wilinski defines a skill as a playbook: the harness sees only a short description, then reads and injects the full text when relevant, which can steer a long run away from a wrong trajectory. Rafal Wilinski, AI Engineer · 2026-06-29 · Context engineering
  14. 80%: Share of Claude Code's system prompt deleted when a newer model arrived; reported by the product's creator Y Combinator · 2026-07-27 · Prompt engineering
  15. Cameron says today's agent-cost drivers are input tokens, cache-hit share and turns per task; with zero cache hits a $21 task costs over $200. George Cameron, AI Engineer · 2026-11-03 · Context engineering
  16. The golden set is a curated set of input and output pairs, preferably human-labelled, used as the ground truth to test prompts and models. Rachel Lee Nabors (RL Nabors), AI Engineer · 2026-06-29 · Prompt engineering
  17. Test one variable per prompt variant against the baseline, so that a gain can be traced to one change. Rachel Lee Nabors (RL Nabors), AI Engineer · 2026-06-29 · Prompt engineering
  18. A change that is won should be kept by a regression eval run like CI tests, so that a later prompt or model change cannot undo it. Rachel Lee Nabors (RL Nabors), AI Engineer · 2026-06-29 · Prompt engineering
  19. Voss says the old hard part was fitting instructions in; now it is verifying the model followed them, and the answer is checking the output with an eval each time. Laurie Voss, AI Engineer · 2026-09-09 · Context engineering
  20. DeLucia built long-session evals: load ten turns, then test the eleventh, turning late-session forgetting into a repeatable bug. Sally-Ann DeLucia, AI Engineer · 2026-04-08 · Context engineering
  21. Instructions are requests; the final layer is permission. Prevention is the prompt, the check is the veto, and both are needed. Isadora Martin-Dye, AI Engineer · 2026-06-29 · Prompt engineering
  22. The booked Saturday. An assistant tuned to be warm and brand-true kept offering clients dates that did not exist. A couple wrote in about a Saturday in October and was told the venue would love to hold it, but the date was booked: the model was never given the calendar. Every layer of instructions had done its job. Isadora Martin-Dye, AI Engineer · 2026-06-29 · Prompt engineering
  23. The inbox that compacted away its own rule. A user told an agent it could delete emails but must confirm first; the inbox was so long that it compacted at once and dropped the instruction, and the agent deleted the emails. stanford · 2026-11-10 · Context engineering
  24. Each time a new model arrives the Claude Code team deletes a large part of the system prompt, changes the tool set and rewrites the tool prompts, because every model is very different. Y Combinator · 2026-07-27 · Prompt engineering
  25. Much of the old prompt corrected behaviours the earlier model should have known but did not; the newer model does them unprompted, so those lines can go. Y Combinator · 2026-07-27 · Prompt engineering
  26. The 25-word limit that cost 3%. On April 16 Claude Code added a system prompt line limiting text between tool calls to 25 words and final answers to 100 words, to curb Opus 4.7's verbosity. It passed weeks of internal testing and the eval set, shipped, and hurt coding quality; a later broader ablation showed a 3% drop and it was reverted on April 20. Anthropic · 2026-04-23 · Prompt engineering
  27. The veto has a hard reject for expensive failures such as an invented figure, and a soft flag for a reply that slips a rail. Isadora Martin-Dye, AI Engineer · 2026-06-29 · Prompt engineering
  28. Wilson lists three reasons long agent runs fail: context (a new session has amnesia), context rot (less coherence deeper into a session) and context anxiety (the model hurries to finish as the window ends). Andrew Wilson, AI Engineer · 2026-04-08 · Context engineering
  29. LinkedIn says MCP cannot scale past 30-40 tools without hurting performance, so it exposes three meta tools: search, get schema and execute. Ajay Prakash, AI Engineer · 2026-09-09 · Context engineering
  30. Anthropic's managed agents keep an append-only event log so nothing is thrown away, and a flexible compaction strategy decides which events (all, last N, or a summary) enter context. Priyanka Phatak, AI Engineer · 2026-06-29 · Context engineering
  31. Prabaker's takeaways: compaction does not equal coherence, since lossy summaries drift, and structured handoffs with clean context work better. Ash Prabaker, AI Engineer · 2026-04-08 · Context engineering
  32. Martin says prompt cache is billed at about a tenth of base tokens and is faster, but it is a strict prefix match, so even a one-byte change in the prefix invalidates it. Lance Martin, AI Engineer · 2026-11-06 · Context engineering
  33. Shihipar says Claude Code cut 80% of its system prompt for newer models, that it now keeps different system prompts for different models, and that the old instructions had begun to constrain the model. Thariq Shihipar, AI Engineer · 2026-06-29 · Context engineering
  34. Monigatti says a skill's front matter is injected into the system prompt and the body loads only when needed; a short skill of query syntax fixed an agent's wildcard mistake. Leonie Monigatti, AI Engineer · 2026-04-08 · Context engineering
  35. Martin's prompt audit strips verification rituals and boosters, which cuts tokens and can improve results when migrating to a newer model. Lance Martin, AI Engineer · 2026-11-06 · Context engineering
  36. Should each model get its own system prompt, or one prompt for all of them? Different models need different prompts: the team keeps separate system prompts per model now, and what worked for one model may not carry to the next. Thariq Shihipar, AI Engineer · 2026-06-29 · Prompt engineering
  37. Should each model get its own system prompt, or one prompt for all of them? 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. Latent Space · 2026-06-04 · Prompt engineering
  38. Should each model get its own system prompt, or one prompt for all of them? Rules and guardrails written for older models slow a newer one and make it fail edge cases it can solve alone, so the prompt should be rebuilt for each model. philschmid · 2026-11-25 · Prompt engineering
  39. Should you keep the context window as small as possible, or has the instruction-following ceiling moved enough to fill it? Keep the window as small as possible, because attention per token falls as you add more Ignacio Martinez, AI Engineer · 2026-06-29 · Context engineering
  40. Should you keep the context window as small as possible, or has the instruction-following ceiling moved enough to fill it? Skills and prompt files can now be very long; fitting everything in is no longer the hard problem, cost and verification are Laurie Voss, AI Engineer · 2026-09-09 · Context engineering

Cite this page

the version of 2026-12-02
APA
Han, R. (2026, December 2). Prompt engineering vs Context engineering: the difference. Frontier Foundry. https://www.ryanhan.ai/compare/prompt-engineering-vs-context-engineering
BibTeX
@misc{han2026-compare-prompt-engineering-vs-context-engineering,
  author       = {Han, Ryan},
  title        = {{Prompt engineering vs Context engineering: the difference}},
  howpublished = {Frontier Foundry},
  year         = {2026},
  month        = dec,
  url          = {https://www.ryanhan.ai/compare/prompt-engineering-vs-context-engineering}
}

More comparisons

all of them