Context engineering

Compass

Deciding what a model should have in front of it for a given task, which has largely displaced prompt wording as the discipline that matters.

What is context engineering?

Context engineering is the discipline of deciding what a model should have in front of it for a given task. It covers which passages are retrieved and in what order, together with the instructions that accompany them. It has largely displaced prompt wording as the part of the work that determines whether an answer is correct.

Why rewording a prompt stopped being the lever that mattered

Prompt engineering was a reasonable name for the work when the model had little else to read. Once an answer rests on retrieved passages alongside tool outputs and prior turns, the wording of the instruction is a small part of what determines the result, and the selection of material is most of it. A team that spends a quarter refining phrasing while retrieval returns the wrong passages has misdiagnosed the problem entirely. Context engineering names the actual decision, which is what the model sees and in what order.

  • Answer quality is governed by the material supplied rather than the phrasing around it.
  • Context is finite, so every passage included displaces another.
  • The order of passages changes which one the model actually relies on.
  • Context decisions are testable, where prompt wording is usually argued about.

How context engineering works

  • The task is specified, along with what a correct answer would have to reference.
  • Retrieval returns candidates, which are then reranked for the specific question.
  • Redundant and contradictory passages are reduced to the set that earns its place.
  • Instructions and tool definitions are assembled in a stable, documented order.
  • Token budget is allocated deliberately between evidence and conversational history.
  • The assembled context is recorded with the answer for later reconstruction.

How context engineering is evaluated

Context engineering is assessed by varying the material supplied while holding the question constant. Measure the following across a labelled question set:

  • answer accuracy as the number of retrieved passages varies
  • sensitivity of the answer to the order of the passages supplied
  • proportion of the token budget occupied by evidence rather than history
  • frequency of contradictory passages reaching the model together
  • accuracy on questions whose evidence falls in the middle of a long context

Limitations, risks and common failure modes

  • Teams enlarge the context window instead of improving what goes into it.
  • Conversation history crowds out the evidence the current question needs.
  • Contradictory passages are supplied together with no indication which is current.
  • Context assembly is undocumented, so an answer cannot be reproduced later.
  • Evidence placed in the middle of a long context is reliably underweighted.

All 315 terms