Learning outcomes

  • Design a context budget
  • Rank information by utility
  • Isolate untrusted content

Mental model

Context engineering designs the complete information environment for a model call: selection, ordering, compression, trust boundaries, and lifecycle.

Available information
Select and rank
Budget and isolate
Assemble context
Evaluate outcome

Theory

The system assembles stable instructions, current request, relevant state, retrieved evidence, examples, and tool results under a budget. Every segment should justify its expected utility. Context is refreshed at task boundaries, summarized with provenance, and isolated by trust level. The goal is the smallest sufficient context, not the longest prompt.

Alternatives and trade-offs

Long context retains raw material, retrieval selects external evidence, memory persists state, caching reuses stable prefixes, and fine-tuning moves stable behavior into parameters.

Failure modes and misconceptions

Do not dump full histories, mix instructions with evidence, keep stale summaries indefinitely, or measure only answer quality while ignoring tokens and latency.

Knowledge check

Reflect before revealing the guide

What criteria should determine whether an item enters a model context?

Decision scenario

For incident support, include the active alert, relevant runbook sections, recent approved actions, and current system state; omit unrelated historical logs.

Relationships

Primary sources