ai-agents
How context engineering differs from prompt engineering
Prompt engineering is about what you say to the model. Context engineering is about everything the model can see when it acts. What changed, what did not, and the four ways a context goes wrong.
In March 2023, Anthropic advertised a "prompt engineer & librarian" role with a salary range of $175,000 to $335,000, Fortune reported. Two years later, TechRepublic, citing The Wall Street Journal, described the job as "basically obsolete".
The skill did not disappear. It became one part of a larger one, which now has its own name.
The short answer
In June 2025, Shopify's Tobi Lütke wrote that he preferred "context engineering" because it describes "the art of providing all the context for the task to be plausibly solvable by the LLM". Andrej Karpathy agreed: people hear "prompt" and think of a short task description, while real applications depend on "filling the context window with just the right information for the next step".
The context window is everything the model reads before it answers: instructions, tool definitions, files, earlier turns, tool results, notes. Your prompt is one slice of it.
Prompt engineering and context engineering compared
| Aspect | Prompt engineering | Context engineering |
|---|---|---|
| Unit of work | One request | A whole session or agent run |
| Main question | How should I phrase this? | What should the model see now? |
| Main skill | Writing | Selecting, saving, and cutting |
| Typical fix | Reword the instruction | Remove, summarise, or load something |
| Who writes most of it | You | Your tools, files, and the agent itself |
Sources: Anthropic's guide to context engineering and LangChain's context engineering for agents.
The last row is the real shift. In a long agent run, most tokens come from file reads, search results, and the agent's own output, not from a person.
Why more context is not the answer
Bigger windows did not remove the problem. Chroma's context rot report tested 18 models and found that performance "consistently degrades with increasing input length", even on simple tasks. A single distracting passage, one that looks relevant but is not, lowered accuracy.
Anthropic's guide gives the practical rule: context is "a finite resource with diminishing marginal returns", so the goal is "the smallest possible set of high-signal tokens" for the outcome you want.
Prompt engineering asks what to say. Context engineering asks what to leave out.
The four moves
LangChain sorts the techniques into four groups:
- Write: save information outside the window, such as a spec file, a notes file, or a handoff report.
- Select: pull the right piece back in when it is needed, by a file path, a search, or a memory lookup.
- Compress: keep only the tokens the task needs, for example by summarising a long session before it hits the limit.
- Isolate: split work across subagents so each one starts with a clean window.
Anthropic's guide describes the same moves as compaction, structured note-taking, and sub-agents. It adds "just in time" loading: keep a lightweight reference, such as a file path, and open the file only when the agent needs it.
A worked example
I took this blog's cover images through a coding agent. My first request was two words, "draw them". I got four covers with the same dark background and the same teal accent, and threw them away.
The wording was not the problem. The agent needed the existing covers, the site's palette, and my rules for what a cover may contain. Two words carried none of that. The second attempt started with the agent inspecting the site and writing a proposal I approved, so the right material was in front of it before any file changed. Afterwards, the cover rules went into a file my writing skill loads every time, so the next session starts with them.
Four ways a context goes wrong
Drew Breunig names four failures. Each one has a fix from the moves above.
Four context failures and a fix for each
| Failure | What happens | A fix |
|---|---|---|
| Poisoning | An early error stays in the context and keeps being referenced | Start a fresh session from a written summary |
| Distraction | A long history crowds out what the model already knows | Compact the session, or split the task |
| Confusion | Irrelevant tools or text shape the answer | Load fewer tools; load files just in time |
| Clash | New information contradicts older information in the window | Keep one current source of truth in a file |
Sources: failure names and definitions from Breunig; fixes from Anthropic's guide and LangChain.
Most of these fixes are deletions: fewer tools, a shorter history, a fresh window. Prompt engineering rarely asked for that.
What did not change
Wording still matters. Anthropic's guide warns against system prompts that are either brittle and over-specified or vague. A clear instruction is still the cheapest improvement. It is now one decision among several.
Takeaways
- When an agent gets something wrong, check what it could see before you reword the request.
- Write decisions to files. A file can be selected into the next session; a chat message cannot.
- Treat every tool definition, file, and old turn as costing attention, and remove the ones that do not earn it.
Sources
- Anthropic — Effective context engineering for AI agents (29 September 2025)
- Chroma — Context Rot: How Increasing Input Tokens Impacts LLM Performance (14 July 2025)
- LangChain — Context Engineering for Agents (2 July 2025)
- Drew Breunig — How Long Contexts Fail (22 June 2025)
- Tobi Lütke on X — context engineering (June 2025)
- Andrej Karpathy on X — "+1 for context engineering" (June 2025)
- Fortune — New AI jobs: prompt engineer & librarian at Anthropic (9 March 2023)
- TechRepublic — Forget prompt engineering (28 April 2025)
More articles
The AI race at work is no longer about tokenmaxxing
Meta, Microsoft, Uber and Amazon have backed away from token counts as a measure of engineering work. Here is what they track now, and what that means for developers.
How grill, spec, review, retro works: four gates for building with coding agents
Grill before you spec, spec before you build, review before you ship, retro after. What each gate is for, what it should leave behind, and when to skip it.
