AI CompendiumA public chart of the language
Home / Prompting & Structure / Context Engineering
Prompting & Structure

Context Engineering

Deciding what goes in the window, in what order, at all.

Definition

The broader discipline of assembling the model’s context: which documents, tool results and history are present, how they are formatted, ordered and trimmed. Prompt engineering is the narrower craft of the instruction itself.

As agents grew more capable, this became the higher-leverage activity. Most quality gains now come from giving the model the right information in the right shape, not from cleverer instructions.

The shift in emphasis is real and worth internalising: as models got better at following instructions, instruction craft stopped being the bottleneck and context assembly became it. Most quality gains now come from what the model can see and how it is arranged, not from how cleverly it is asked.

How people use it
A team whose results plateaued.
"Stop rewriting the prompt. Show me the assembled context — there are three stale tool results crowding the window."
Worked examples

The plateau that was never about the prompt

A team rewrites instructions for the third week running with no improvement.

Print the assembled request. The problem is usually structural: eleven retrieved chunks of which two matter, three stale tool results, and the actual question at the bottom of four thousand tokens. Fixing the assembly beats rewriting the instruction.

Just in time instead of just in case

An agent needs occasional access to a large reference document.

Keep a pointer and a one-line description in context; let it fetch the section when the task needs it. Preloading everything "just in case" spends the attention budget on the ninety percent of the task that did not need it.

Sources
  • blogEffective context engineering for AI agents ↗Anthropic Engineering · 2025

    Defines context engineering as curating everything supplied at inference, names context rot, and covers just-in-time retrieval, compaction and keeping the window high-signal.

  • docsContext windows ↗Claude platform docs · 2026

    What actually consumes the window — input, tools, thinking and output — plus context rot and compaction. Authoritative for this product, not for models generally.

  • paperLost in the middle: how language models use long contexts ↗Liu et al. (TACL) · 2024

    Measured U-shaped performance: relevant information in the middle of a long context is used less reliably than at the beginning or end. Order your context deliberately.

Related terms