Capstone

Context Engineering · ~8 min

The Whole Discipline

Twenty-three lessons collapse into one sentence and one habit. Here's the whole map, and how to use it.

Why this, for you: the synthesis. By the end you should be able to diagnose any context problem and name the technique that fixes it — the core skill behind sharper daily sessions (#1), better harnesses (#2), and being able to teach this (#3).

Every technique in this course is one move toward a single goal, stated by Anthropic and worth memorising:

Find "the smallest set of high-signal tokens that maximize the likelihood of your desired outcome." Signal density, not volume. Everything else is how.

The context window is the agent's entire world — what isn't in it doesn't exist, and what is in it competes for a fixed pool of attention. So the whole discipline splits into three arenas:

Part 1 — Shape the prefix

  • Attention is U-shaped; rules at the edges (02)
  • Only non-discoverable context earns space (05)
  • One rule, one layer; mind the @-import (06)
  • Static-first for the cache (07)
  • Compress ceremony, not meaning (08)

Part 2/3 — Tame the tail & load right

  • Quality drops before you're full — the dumb zone (01)
  • Pick the move: continue/rewind/clear/compact/delegate (04)
  • Mask, offload, summarise — in tiers (09, 10)
  • Pull on demand; isolate in sub-agents (11, 13)
  • Recite the goal; preserve the failures (12)

Part 4 — Guard integrity & operate

  • The window is provenance-blind; poison & injection (19)
  • Diagnose which tool ate the window before pruning (20)
  • Prime broad→narrow; the preload to JIT's pull (21)
  • Carry typed state; O(n²)→O(n) on long loops (22)
  • An anxious "done" isn't done — give runway (23)

The diagnostic table: symptom → move

The skill isn't memorising 24 techniques — it's recognising the symptom and reaching for the right one.

When you notice…Reach for
The agent "forgot" a rule you wroteCheck position & layer; move it to an edge or restate02·06
Output getting vague mid-sessionYou're in the dumb zone — compact now, don't wait for 95%01·04
Window filling with tool outputMask single-use outputs; offload big payloads09·10
Long task drifting off-objectiveRecite the goal at the tail; keep a todo.md12
The agent looping on the same errorPreserve the trace (recovery), then break the doom loop12
The bill / latency too highStabilise the prefix; static-first; watch cache_read07
CLAUDE.md is bloated & ignoredCut discoverable lines; compress to crisp rules05·08
Coding against the wrong API versionFeed it the real versions / live docs15
Exploration polluting the main threadDelegate to a sub-agent; it returns a summary11·13
A token optimization that "feels" rightA/B it on a real task before trusting it18
A confident diff built on a wrong premiseContext poison — hard-reset, re-anchor on ground truth19
External content following its own instructionsInjection — treat as untrusted; layer the defence19
Window full but you don't know from whatRun /context; attribute, then fix the culprit20
Agent writing generic, off-codebase codePrime it: read broad→narrow before you ask21
A long unattended loop's token bill explodingCarry typed state outside the prompt; O(n²)→O(n)22
Work marked "done" with sub-tasks unfinishedContext anxiety — give runway, counter-prompt, verify23

↪ Your win: one question, asked constantly

The whole discipline reduces to a habit. For every token you're about to add — a file, a rule, a tool result, a preloaded doc — ask:

"Does this improve output on this specific task?" If no, it's pollution — leave it out, fetch it later, or summarise it away.

Final review — mixed recall across the course

Question 1 · Lesson 01Output-quality degradation onset is best modeled as…

Question 2 · Lesson 07A cached-prefix read costs roughly…

Question 3 · Lesson 19Indirect prompt injection succeeds because the model is…

Question 4 · Lesson 22Typed state-carry bends a long loop's cost from…

Question 5 · Lesson 23An agent marking work "done" too early is showing…

You've finished the course. Ask me anything — and the real test is outside here: point me at a repo, a harness, or a session that went sideways, and we'll diagnose it with the table above. The companion skills (audit-instruction-file + compress-prompt) turn this knowledge into tools you can run.
✎ Feedback