Pick a depth. Each prompt opens in your AI pre-loaded with the lesson. Click a row to preview the prompt.
Before the deep dives, it helps to hold the whole map in your head: the levers you can pull and the order to reach for them. The levers are select (what to include), order (where to place it), compress (shrink what you keep), cache (reuse what's stable), and measure (know if it worked). Most teams reach for 'bigger model' or 'better prompt' first; experienced context engineers reach for select and order first, because they're cheap and high-impact. This mental model is the spine of the rest of the course.
The toolkit as a priority list, encoded. When answer quality is poor, walk the levers top-down: is the right content selected? Is it ordered well? Only then consider compression, caching, and finally model/prompt changes. The function returns the next lever to try.
def next_lever(diagnosis: dict) -> str:
if not diagnosis["right_content_present"]:
return "SELECT: fix retrieval/inclusion — the evidence isn't even in the window"
if diagnosis["evidence_buried_in_middle"]:
return "ORDER: move key evidence to the start/end of context"
if diagnosis["over_budget"]:
return "COMPRESS: summarize history / prune low-value blocks"
if diagnosis["latency_or_cost_too_high"]:
return "CACHE: cache the stable prefix (system + tools + corpus)"
if not diagnosis["have_eval"]:
return "MEASURE: you can't tune what you can't see — build an eval first"
return "Only now consider a bigger model or prompt rewrite"
print(next_lever({"right_content_present": False, "evidence_buried_in_middle": False,
"over_budget": False, "latency_or_cost_too_high": False, "have_eval": False}))python3 main.py