October 31, 2026 · 13 min read

Context Engineering vs Prompt Engineering

Graphic title card for the article “Context Engineering vs Prompt Engineering” with a stylised motif: a window frame holding several text sheets, one more sheet no longer fits.
Graphic: HumanITy

Context engineering is the work of deciding what an AI model has in front of it at every step: instructions, tools, examples, the conversation so far, retrieved data and its own notes. Prompt engineering asks how to phrase an instruction. Context engineering asks which information the model needs right now and which it does not. Anthropic describes it as the natural progression of prompt engineering, with a clear goal: the smallest set of high-signal information that makes the desired outcome most likely. It matters most for AI agents that work across many steps.

I run my team of fourteen AI employees with Claude Code, and a large part of my work on them is exactly this: deciding what they know, when they read it and what they leave out. What context is in the first place, and how large the window is in ChatGPT, Claude and Gemini, is covered in Context and Context Windows in AI Explained. This article is about the method. Everything on agents is collected on my AI agents page.

What context engineering means

Anthropic's engineering team described the term in detail in September 2025. Context is the set of tokens a language model takes into account when it responds. Context engineering covers all strategies for choosing and maintaining that set, including everything outside the actual prompt.

At its core is scarcity. According to Anthropic, a model has a limited "attention budget": every extra token uses up some of it. The fuller the context, the harder it becomes for the model to find the one detail that matters. Anthropic calls this context rot. Context is therefore not storage you fill to the brim, but a scarce resource you curate.

There is also a difference in timing. You write a prompt once. An agent works in a loop: it calls tools, reads results, writes notes, and at every step the question of what goes into the context comes up again. Context engineering is therefore ongoing work, not a one-off piece of wording. How such an agent loop works in general is explained in What Is an AI Agent? Explained Simply.

Context engineering vs prompt engineering

The difference comes down to four points:

Prompt engineering Context engineering
Guiding question How do I phrase the instruction? What does the model need to see now, and what not?
Scope mainly the prompt and the system prompt everything in the window: instructions, tools, examples, history, data, notes
Timing once, before the request again at every step
Typical use single tasks such as writing or classifying agents that work for a long time with tools

This does not make prompt engineering obsolete. A clear instruction remains one building block, and for a single chat question it is often all you need. Good wording for everyday tasks is in Claude Prompts: Templates. But once an agent spends an hour reading files and calling tools, the rest of the context decides the quality, not the first sentence.

Why bigger windows do not solve the problem

Waiting for larger context windows is the obvious idea. Anthropic disagrees: for the foreseeable future, it says, windows of every size will suffer from context pollution and relevance problems.

Independent measurements back this up. In July 2025 Chroma's research team tested 18 language models, including GPT-4.1, Claude 4, Gemini 2.5 and Qwen3. The models did not use their context uniformly, and their performance became increasingly unreliable as input length grew. Related content that does not answer the question made results worse still.

The building blocks of context

From Anthropic's article and the Claude Code documentation, I group the levers into seven building blocks.

1. System instructions. Clear, simple and at the "right altitude": neither a rigid list of if-then rules nor so vague that the model has to guess. Anthropic recommends starting lean and adding only where tests reveal failures.

2. Tools. Every tool brings a description that sits in the context. Anthropic warns against bloated tool sets: if a human cannot say for certain which tool fits a situation, an agent cannot be expected to do better. How to connect tools via MCP is in Set Up a Claude MCP Server.

3. Examples. A few typical examples beat a long list of edge cases. Anthropic explicitly advises against stuffing every conceivable rule into the prompt.

4. Memory and notes. Whatever always applies belongs in a file loaded at the start; Claude Code reads its CLAUDE.md at the beginning of every session. On long tasks an agent also writes notes outside the window, such as a to-do list, and reads them back later. How CLAUDE.md and AGENTS.md differ is in CLAUDE.md vs AGENTS.md: What Survives.

5. Retrieval at the right moment. Instead of loading everything up front, the agent keeps references such as file paths, links or stored queries and fetches content when needed. According to Anthropic, Claude Code mixes both: the CLAUDE.md is loaded up front, files are searched on demand. The prepared variant with a search index is explained in What Is RAG in AI? RAG Systems Explained.

6. Compaction. When a conversation reaches the limit of the window, the tool summarises the history and carries on with the summary. According to Anthropic, the gentlest form is clearing old tool results the agent no longer needs. The Claude API has a dedicated feature for this, currently in beta.

7. Subagents. A subagent handles a subtask in its own fresh context window and returns only a summary. According to Anthropic that is often 1,000 to 2,000 tokens, even if the subagent itself used many times as much. How I use this in Claude Code is in Claude Code Subagents: Best Practices.

Common context mistakes

The context rots. Long histories pile up discarded approaches, outdated states and the model's own mistakes. Drew Breunig calls one of the four failure modes he describes context poisoning: an error lands in the context and is referenced again and again. When an AI fixates on something wrong, a fresh context with a clean summary is often the only fix. More on this in AI Hallucinations: Why AI Makes Things Up.

Too much in the context. Twenty connected tools, three manuals and the whole chat history "just in case". Each piece costs attention, even when it is irrelevant to the task. Breunig describes how superfluous content pulls the answer in the wrong direction.

Contradictory context. One file says "formal tone", another says "casual and friendly". The Claude Code documentation is blunt about this: if two instructions contradict each other, Claude may pick one arbitrarily. Anthropic recommends reviewing your instruction files regularly for outdated and conflicting passages.

How I use context engineering

At their core, my AI employees are context engineering in folder form. What matters is the separation: what always applies, what applies only on one machine and what applies only to one job are kept apart. Every personnel file states which actions are free, which need approval and which are never allowed. Paths and tools that differ between Mac and server live in a separate local file, not in the shared CLAUDE.md; more in Claude Code on a Server: tmux, Remote Control.

Corrections go into a learnings file and apply from then on; for Conny, who drafts reel scripts, hooks and captions, it has reached 1,347 lines since July 20 (as of September 2026). Whatever concerns only one job stays in that job's folder: Sebastian, my SEO employee, stores every tool result there so that every number has a source. Every draft is reviewed by a second role that did not write it. Why every piece of work starts with a written brief is explained in Spec-Driven Development With AI Agents.

How to set up such a personnel file for your first employee is in Creating an AI Employee: How to Start.

Practical rules

  1. Start small. Begin with a lean instruction and add only when a real result shows what is missing.
  2. Keep what lasts in files, not in the chat. Personnel file, project instructions or CLAUDE.md.
  3. Keep what is always loaded short. The Claude Code documentation recommends under 200 lines per CLAUDE.md, because longer files take up more context and are followed less reliably. Load the rest on demand.
  4. References instead of full text. A path to the price list beats the price list in every request.
  5. Prune your tools. Connect only what the role really needs.
  6. Look for contradictions. Read your instructions against each other at regular intervals.
  7. Outsource research. Long searches belong in a subagent, so that only the result lands in the main context.
  8. New task, new context. A fresh start with a summary beats the hundredth message in an old thread.

Frequently asked questions

What is context engineering in simple terms?

It is the deliberate selection and upkeep of everything an AI model sees when it answers: not just your question, but also instructions, tools, examples, data and notes.

Is prompt engineering dead?

No. Anthropic calls context engineering its natural progression. The instruction stays one building block, just no longer the only one once an agent works with tools, data and long histories.

Do I need to know how to code?

No. A project with instructions and knowledge documents in the Claude app is already context engineering. Claude Code gives you finer control through CLAUDE.md, skills and subagents.

What is context rot?

That is Anthropic's name for the effect that a model recalls information from its context less accurately the more tokens it contains. According to Anthropic it shows up in all models, just to different degrees.

Does a bigger context window help?

For long documents yes, against bad context no. A bigger window fits more in but does not make the model more attentive. According to Anthropic, curating the context matters even with large windows.

Where to go from here

Take your longest instruction, whether project instructions or a CLAUDE.md, and cut everything you have not needed in recent weeks. Then look for two sentences that contradict each other. How an AI maintains its own knowledge in files is shown in LLM Wiki: Karpathy's Pattern for Businesses. What a good working framework for coding agents looks like is in Agentic Coding: Beyond Vibe Coding. Why anything that gets into the context can also be a way in for attackers is explained in Prompt Injection: Protecting AI Agents. How others build their personnel files and instructions is something we discuss in my community AI Employee Framework.

Kevin Welter

Kevin Welter

Developer, IT architect, author of technical books (Kubernetes, cloud infrastructures) and speaker. Runs his business with an AI workforce of fourteen AI employees and shows solo business owners in his community how to hire their first AI employee.

More about AI employees

Your first AI employee up and running within an hour

Join the community

$5/month founding price, first 50 members