Context Engineering roadmap

Deciding what goes into the context window, what stays out, and what gets thrown away when it fills. The scarcest resource in any long-running AI system, and the one most teams manage by accident.

Deep dive10 stages129 topics

All roadmaps
0 of 129 done
Essential, don't skip Recommended, skip only with a reason Optional, awareness is enough Course on PracticAI

Short by design - ten sections, and padding it would be dishonest. This matters most for agents and long conversations, where a run goes forty turns deep and the window becomes the binding constraint on everything. If you only build single-turn features, read sections 2, 3 and 9 and skip the rest until you need them.

1

The Core Problem

Why this is a discipline and not just prompt length management. Understanding the failure shape determines every technique that follows.

              2

              Anatomy of the Window

                      3

                      Measuring and Budgeting

                      You cannot manage what you have not measured. Almost no team instruments this, and almost every team is surprised by what they find.

                              4

                              Just-in-Time Retrieval

                              Load when needed rather than preloading what might be needed. The single largest structural improvement available to most systems.

                                      5

                                      Compaction

                                      Making history smaller without losing what the run depends on. Where most long-conversation systems either succeed or quietly break.

                                              6

                                              External State

                                              The model does not need to hold what it can look up. Moving state out of the window is often better than compressing it inside.

                                                      7

                                                      Isolation and Sub-agents

                                                              8

                                                              Tool and Schema Economy

                                                              Tool definitions occupy the window on every single call, forever. They are the most consistently overlooked line item in the budget.

                                                                      9

                                                                      Caching

                                                                              10

                                                                              Failure Modes

                                                                              How to recognise a context problem, which is rarely how it first presents.

                                                                                      Working the budget

                                                                                      When a long-running system starts degrading, work these in order. The instinct to reach for a bigger model or a longer window should come last, not first.

                                                                                      1. Measure what's actually in there. Break the window down by section - system prompt, tool schemas, history, retrieved content, scratchpad. Most teams have never looked, and the answer is usually surprising.
                                                                                      2. Cut what earns nothing. Tool schemas nobody calls, retrieved chunks nobody cites, boilerplate repeated every turn. This is usually the largest single win and it costs nothing.
                                                                                      3. Move state out of the window. Files, a scratchpad, a database. Pass references instead of contents. The model does not need to hold what it can look up.
                                                                                      4. Retrieve late instead of loading early. Fetch when needed rather than preloading everything that might be relevant.
                                                                                      5. Compact the history. Summarise old turns, keep recent ones verbatim, preserve decisions and discard deliberation.
                                                                                      6. Isolate with sub-agents. Give a subtask its own clean window and return only the result.
                                                                                      7. Only now consider a longer window. More room is not better placement, and cost scales with everything you put in it.

                                                                                      Steps two and three usually recover more than the rest combined.

                                                                                      A context window is not storage. Everything in it competes for the model's attention, and adding a marginally relevant document makes the genuinely relevant one harder to use. The discipline is subtraction, not accumulation.