Lesson 11 / 25

The Context Budget

Treat context as a budget and remove what does not help the current step.

More is not better

Every file, tool result and message uses tokens. As the window fills, cost and latency rise and the model can lose track of early instructions. Good agent design puts in only what the next decision needs.

A limited desk

The context window is a limited workspace. What you put in, in what order, decides the quality of the work.

Three zones: always loaded, loaded on demand, left out.
Figure 4.1 — What stays in context, what loads later, what stays out.

A study desk

A desk piled with every textbook makes it harder to find the page you need. Keeping only today's chapter open makes you faster.

Search, then read

Prefer targeted tools (grep, line ranges) over reading entire large files. Ask for the specific function, not the whole module.

Quick check: What usually happens as the context window fills up?

  • Answers always improve
  • Cost and latency rise and early details may be missed
  • The model restarts
  • Nothing changes
Answer

Cost and latency rise and early details may be missed — More tokens cost more and can dilute attention to earlier instructions.