lockstep
5 min readNaman Jain

Context engineering vs prompt engineering: the difference

Context engineering vs prompt engineering: prompt engineering writes the instructions, context engineering curates everything else the model sees. Examples.

A team spends a week tuning the system prompt for their support agent. It scores well on single questions. In production, twenty turns into a real conversation, it starts ignoring the refund policy that's right there in the prompt. The prompt didn't change. Everything around it did: tool results, retrieved documents, and message history piled up until the instruction that mattered was a small part of a large context.

That's the gap between prompt engineering and context engineering. This guide explains the difference, mainly from Anthropic's Effective context engineering for AI agents, checked on 16 November 2026.

The short answer

Prompt engineeringContext engineering
QuestionHow should I word the instructions?What should the model see on this turn?
ScopeSystem prompt and user promptPrompt, tools, examples, retrieved data, message history, memory
WhenWritten once, then revisedCurated every turn as the agent runs
Main riskUnclear or brittle instructionsContext overload, stale or missing information
Typical workWording, structure, few-shot examplesRetrieval, compaction, notes, subagents, tool design

Anthropic's framing: prompt engineering is about writing and organizing instructions; context engineering is about curating the best set of tokens during inference, including everything that lands there outside the prompt. It calls context engineering the natural progression of prompt engineering.

Why the shift happened

Early LLM work was mostly one-shot: classify this, summarize that. The prompt was the whole input, so getting it right was the whole job.

Agents changed that. An agent calls tools in a loop, and every step adds more to its context: file contents, search results, command output, its own reasoning. The prompt becomes a small part of what the model reads. Deciding what to add, what to drop, and what to fetch later becomes the main lever.

Why more context isn't better

Anthropic describes context rot: as the number of tokens in the context window grows, the model's ability to recall information from it goes down. It happens across models, some more gently than others. The post treats context as a finite attention budget, where every token spent on noise is attention not spent on what matters.

The guiding principle it gives: find the smallest set of high-signal tokens that makes the result you want most likely. That is the core of context engineering. See the context rot glossary entry.

What context engineering involves

Each part of the context gets its own decisions:

  • System prompt: clear, direct, and at the right level, between hardcoded if-else rules and vague guidance that assumes shared knowledge. Prompt engineering lives on here.
  • Tools: few, with clear purposes and token-efficient output. If an engineer can't say which tool to use in a situation, the agent can't either.
  • Examples: a few varied, canonical examples rather than a long list of edge-case rules.
  • Just-in-time retrieval: keep references such as file paths and queries, and load the data only when needed.
  • Compaction: summarize a long conversation and continue from the summary.
  • Notes outside the window: the agent writes progress to a file and reads it back later.
  • Subagents: send noisy work to a separate context and get back a short summary.

A coding agent example

Claude Code is Anthropic's own example of a hybrid approach. CLAUDE.md loads up front every session, while tools like glob and grep let Claude find and read files only when it needs them, instead of indexing the whole codebase in advance.

For a developer using it, context engineering looks like:

  • Keeping CLAUDE.md short, and moving long procedures into skills that load on demand
  • Using /clear between unrelated tasks and /compact with a focus on long ones
  • Sending test runs and log reading to subagents
  • Writing the task's goal and acceptance criteria in the prompt, and nothing the agent can look up itself

The prompt is still there, and still matters. It's one input among many. More in context engineering for coding agents and Claude Code.

Prompt engineering still matters

Context engineering doesn't make prompt wording irrelevant. A vague instruction stays vague no matter how well the rest of the context is curated. Think of it as nested: prompt engineering is the part of context engineering that deals with instructions. For a single-turn task with no tools, it's still most of the work.

The context nobody curates

Most context engineering advice is about one agent's single run: what to load, what to compact, what to fetch. Teams hit a different gap. The decisions that should shape the work, such as which API version to keep or why a library was rejected, live in Slack threads and meetings. No retrieval step finds them, because they were never written anywhere an agent looks.

Where Lockstep fits

Lockstep supplies that piece of context. It captures decisions from PRDs, Slack, and pull requests, routes each to its owner for approval, and briefs Claude Code sessions with the approved decisions that apply to the current work, ranked so the most important come first. Any MCP client can also query the decisions through Lockstep's tools.

See how it works.

Sources checked 16 November 2026

For what loads into Claude Code's context and when, see how Claude Code memory works. For memory versus retrieval, see agent memory vs context window vs RAG. For saving tokens in practice, see how to reduce Claude Code token usage. For the software around the model, see what an AI coding agent harness is. For keeping context cheap, see prompt caching explained.

Frequently asked questions

What is the difference between context engineering and prompt engineering?
Prompt engineering is about how to write and organize the instructions a model gets, especially system prompts. Context engineering covers everything in the context window on each turn: instructions, tools, examples, retrieved data, message history, and memory, and how that set is curated as an agent runs.
Is context engineering replacing prompt engineering?
No. Anthropic describes context engineering as the natural progression of prompt engineering. Writing a clear prompt is still part of the job; it's one input among several once an agent runs in a loop and keeps gathering information.
Why does context engineering matter?
Models get worse at recalling information as the context grows, a problem Anthropic calls context rot. Context is a limited budget, so the goal is the smallest set of high-signal tokens that gets the result you want, rather than everything that might be relevant.
What are examples of context engineering?
Loading files only when needed instead of up front, compacting long conversations into a summary, having an agent keep notes outside the context window, sending noisy work to subagents, writing clear tool descriptions, and keeping always-loaded instruction files short.
Do I need context engineering for a chatbot or only for agents?
It matters most for agents that run many steps, where each tool result adds to the context. A single-turn prompt is mostly prompt engineering. Once a system has memory, retrieval, tools, or long conversations, deciding what to include is context engineering.

Keep reading