Courses · Course 3 of 7
Context Engineering
Design the context of an agent: right-altitude instructions, just-in-time retrieval, compact tool results, memory on disk, sub-agent isolation and cache-friendly ordering.
18lessons
5modules
11open now
Who it is for
Builders whose agents get worse as tasks get longer, or who pay for tokens the model never needed.
Each lesson is a short simulation: you read what an agent did, a config or a tool output, make one decision and see at once whether it holds. Real terms, real commands, sourced from primary documentation.
5 modules
- Context is a budget3 lessons
- Getting the right information in5 lessons
- Keeping it small4 lessons
- Context across agents3 lessons
- Context and cost3 lessons
Modules · 11 of 18 lessons open, the rest are being built
01Context is a budget
- 01Context rotOpenShow recall falling as the token count grows, and why bigger windows do not fix it.
- 02The right altitude for a system promptOpenRewrite a prompt that is either brittle if-else rules or vague wishes into the middle zone.
- 03Canonical examples instead of rule listsOpenReplace a laundry list of edge-case rules with 3–5 canonical examples plus clear instructions.
02Getting the right information in
- 04Just-in-time retrievalOpenHold file paths and queries, load content only when needed.
- 05Retrieval that citesOpenGround answers in retrieved sources and verify each claim against them.
- 06AGENTS.md as a map, not a manualOpenCut a long instruction file into a short index that points to deeper docs.
- 07Skills: write the project knowledge down onceOpenMove repeated instructions into a skill the loop loads only when needed. Also in Loop Engineering.
- 08The repo as system of recordOpenPut plans and decisions in versioned files, since what the agent cannot reach does not exist.
03Keeping it small
- 09Token-efficient tool resultsComingPaginate, filter and truncate tool output with sensible defaults.
- 10Compaction or a context resetOpenChoose between summarising in place and starting a fresh agent with a structured handoff. Also in Loop Engineering.
- 11Progress files: the spineOpenKeep what is done and what is next on disk so a fresh session resumes in one read. Also in Loop Engineering.
- 12Memory across sessionsComingDecide what is remembered, where, and how it is corrected.
04Context across agents
- 13Sub-agents: maker, checker, researcherOpenScope sub-agents so their work does not overlap and their reports come back short. Also in Loop Engineering.
- 14Scoped handoffsComingPass only the slice of context the next agent needs.
- 15Delegation briefsComingWrite what a fresh agent does not know: goal, constraints, done criteria, format.
05Context and cost
- 16Prompt cachingComingOrder static content first so the prefix is cached, and see the cost and latency drop.
- 17Structured outputComingAsk for schema-valid output so the next step can check it.
- 18Capstone: re-engineer a failing agent's contextComingTake an agent that degrades on long tasks and fix it with measured before/after.
Built on primary sources
- Claude docs, Prompt caching
- Anthropic, Effective context engineering for AI agents (Sep 29, 2025)
- Anthropic, Demystifying evals for AI agents (Jan 9, 2026)
- Anthropic, How we built our multi-agent research system (Jun 2025)
- Claude docs, Structured outputs
- Anthropic, Writing effective tools for agents (Sep 11, 2025)
- Anthropic, Best practices for Claude Code
- Google Developers Blog, Architecting efficient context-aware multi-agent framework for production (Dec 4, 2025)
- MCP specification 2026-07-28, changelog
- OpenAI, Harness engineering: leveraging Codex in an agent-first world (Feb 11, 2026)
- Claude docs, Citations
- Claude docs, Search results
- Claude docs, Reduce hallucinations
- Liu, Zhang & Liang, Evaluating Verifiability in Generative Search Engines (arXiv 2304.09848)