What Is Context Engineering
The skill that superseded prompt engineering. Treat the context window as a budget, not a bucket — and manage it with four moves: write, select, compress, isolate.
If you've been paying attention to how people talk about building with AI, you've noticed a phrase quietly taking over from prompt engineering
: context engineering. It's not a rebrand or a buzzword swap. It names a genuinely bigger job — and in 2026 it's become the skill that separates AI features that work in production from ones that only work in the demo.
From what you ask
to what the model sees
Prompt engineering is about the question you write. Context engineering is about everything the model sees at the moment it answers — the instructions, yes, but also the retrieved documents, the conversation history, the tool outputs, the examples, the memory of past interactions. The prompt is one ingredient. Context engineering is managing the whole plate.
Here's the reframe that makes it click: treat the context window as a limited, precious resource — a budget you're spending, not a bucket you're filling. A model might accept hundreds of thousands of tokens of input, but its ability to use them well doesn't scale one-for-one with the amount you cram in. Give it too much, or the wrong things, and quality drops even though the window technically had room. The job isn't to fill the window; it's to get exactly the right information in front of the model at exactly the right time, and keep everything else out.
That's why the discipline exists. As one common framing puts it, context engineering isn't a workaround for a temporary limitation — it's a permanent discipline for building reliable AI systems.
The four moves of context engineering
A useful way to organize the whole field: everything you do with context falls into one of four strategies — write, select, compress, isolate.
Write — put information somewhere the model can use later
Not everything can live in the context window at once. Writing means persisting information outside the immediate prompt — to memory, to notes, to storage — so it can be pulled back in when relevant. This is how an agent remembers
something from an hour ago without carrying the entire hour in its context.
Select — bring in only what's relevant right now
The heart of the discipline. Out of everything you could show the model, choose the slice that actually matters for this step. This is what retrieval does (fetch the three relevant documents, not all three hundred), what memory retrieval does (surface the two past facts that bear on this question), and what good tool design does (return the relevant result, not a raw dump). Recency, relevance, and semantic similarity are the usual levers.
Compress — make what you keep smaller
When information has to stay in context but is taking up too much room, compress it. The marquee example is compaction: when a long conversation approaches the window limit, you summarize the older portions into a tight, high-fidelity digest and continue from there — the agent keeps the gist without dragging every original token along. Modern agent systems do this automatically as sessions run long.
Isolate — keep unrelated context apart
Not everything belongs in the same context. Isolation means separating concerns — different memory types, different sub-tasks, different agents each with their own clean context — so one job's clutter doesn't degrade another's reasoning. This is a big part of why multi-agent systems can outperform a single overloaded agent: each sub-agent gets an uncluttered window.
Why agents made this urgent
Context engineering existed quietly for years — anyone doing retrieval was doing a piece of it. Agents turned it into the main event, because an agent generates its own context as it runs. Every tool call returns a result that piles into the window. A long task can accumulate dozens of tool outputs, most of them no longer relevant, each one crowding the model's attention and its budget.
So production agent systems lean hard on context moves: tool-result clearing (drop old, re-fetchable results while keeping the note that the call happened), compaction (summarize the long tail of the conversation), and memory offloading (write durable facts to storage, select them back when needed). Without these, a long-running agent slowly chokes on its own history. With them, it can run for hours and stay sharp.
What this means for you
You don't have to build a memory system to practice context engineering. The mindset applies at every level:
- Show the model less, more deliberately. Before adding something to a prompt, ask whether it earns its place. Relevant beats comprehensive.
- Order matters. Put the most important information where the model attends best — typically the beginning and the end of the context, not buried in the middle.
- Retrieve, don't dump. When you have a big knowledge source, fetch the relevant pieces instead of pasting the whole thing. (When to retrieve versus just use a big context window is its own decision — see RAG vs Tools vs Long Context.)
- Curate tool outputs. If you're building agents, a tool that returns a tight, relevant result makes the whole system reason better than one that returns everything.
The takeaway
Prompt engineering asks, how do I word this?
Context engineering asks the bigger question: what should the model see when it answers, and what should it *not* see?
Treat the context window as a budget, spend it on the highest-value information, and use the four moves — write, select, compress, isolate — to keep it clean as things scale. That shift in thinking is what makes AI systems reliable once they leave the sandbox.
It builds directly on the fundamentals in The Complete Guide to Prompt Engineering in 2026, and pairs naturally with prompt caching (which makes a stable context prefix cheap to re-send) and building agents (where context management becomes the core of the work). Prompts to build on are in the prompt library.