OneLongTail

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.

system prompt tool definitions history tool resultcompacted result context window every turn addstokens to it one large tool resultgoes past the limit compact it: it fits,room left to work
An illustration of the course’s subject, not a recording.
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

  1. Context is a budget3 lessons
  2. Getting the right information in5 lessons
  3. Keeping it small4 lessons
  4. Context across agents3 lessons
  5. Context and cost3 lessons

Modules · 11 of 18 lessons open, the rest are being built

01Context is a budget3 lessons · 3 open
  1. 01Context rotOpenShow recall falling as the token count grows, and why bigger windows do not fix it.
  2. 02The right altitude for a system promptOpenRewrite a prompt that is either brittle if-else rules or vague wishes into the middle zone.
  3. 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 in5 lessons · 5 open
  1. 04Just-in-time retrievalOpenHold file paths and queries, load content only when needed.
  2. 05Retrieval that citesOpenGround answers in retrieved sources and verify each claim against them.
  3. 06AGENTS.md as a map, not a manualOpenCut a long instruction file into a short index that points to deeper docs.
  4. 07Skills: write the project knowledge down onceOpenMove repeated instructions into a skill the loop loads only when needed. Also in Loop Engineering.
  5. 08The repo as system of recordOpenPut plans and decisions in versioned files, since what the agent cannot reach does not exist.
03Keeping it small4 lessons · 2 open
  1. 09Token-efficient tool resultsComingPaginate, filter and truncate tool output with sensible defaults.
  2. 10Compaction or a context resetOpenChoose between summarising in place and starting a fresh agent with a structured handoff. Also in Loop Engineering.
  3. 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.
  4. 12Memory across sessionsComingDecide what is remembered, where, and how it is corrected.
04Context across agents3 lessons · 1 open
  1. 13Sub-agents: maker, checker, researcherOpenScope sub-agents so their work does not overlap and their reports come back short. Also in Loop Engineering.
  2. 14Scoped handoffsComingPass only the slice of context the next agent needs.
  3. 15Delegation briefsComingWrite what a fresh agent does not know: goal, constraints, done criteria, format.
05Context and cost3 lessons
  1. 16Prompt cachingComingOrder static content first so the prefix is cached, and see the cost and latency drop.
  2. 17Structured outputComingAsk for schema-valid output so the next step can check it.
  3. 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