Skip to slide
Chapter 5 · Context Engineering and Memory
45 / 191

CHAPTER 05 · Context Engineering and Memory · 8 / 11

Layering the context

Think of context as layers assembled in order:

  1. Standing instructions: the system prompt: identity, universal rules, output protocols. Stable across calls.
  2. Task instructions: anything specific to this task (a selected workflow/template, loaded on demand rather than baked into the system prompt).
  3. Situational injection: what's available right now: the list of accessible documents, the user's current focus, retrieved snippets.
  4. History: the curated conversation slice, plus the prior-turn summary.
  5. The current user message: possibly annotated (e.g. mapping attachments to their handles).

Keeping these as distinct layers makes the assembly logic clear and lets you tune each independently. In particular, loading task instructions on demand (rather than concatenating every possible instruction into the system prompt) keeps every layer focused: the system prompt stays about universal behaviour, and task-specific detail arrives only when relevant.

← → arrow keys work too