All modules
MODULE 03~12% of exam · 40 min read

Context Engineering

Caching, compaction, memory, and citations — managing the scarcest resource in the system.

1 of 5

Context engineering as a discipline

From 'write a good prompt' to 'curate what the model sees on every single turn'.

Prompt engineering asks *what do I say?* Context engineering asks *what is in the window right now, why is it there, and what should be evicted?* In agentic systems the second question dominates: the prompt is written once, but the context is reassembled on every one of a hundred turns.

The failure mode has a name: context rot. As a long session accumulates tool outputs, retrieved documents, and prior reasoning, signal-to-noise falls. The model starts referencing stale results, re-running work it already did, or being pulled off-task by an irrelevant fragment from twenty turns ago. Bigger windows delay context rot; they do not prevent it.

The principle

Find the smallest set of high-signal tokens that maximises the chance of the desired outcome. Every token you add must earn its place.

Exam-ready takeaways
  • Context is assembled per turn; treat assembly as a first-class component with its own tests.
  • Context rot degrades long sessions even when everything technically fits.
  • Curate aggressively: relevance beats completeness.
divider
Next module · Tool Use & MCP