Chapter 7: Context

Just-in-time retrieval

Also called Just-in-time context, Agentic search

Keeping lightweight pointers, such as file paths and search patterns, and loading what they point to only when it is needed. The agent searches, reads twenty lines and moves on, and never holds the whole repo in view.

You pay only for what the task touches. And what it reads is current, whereas a file loaded an hour ago may have changed since. The price is more tool calls, and an agent that searches for the wrong word may not learn what it missed.

Say it to your agent

“Don't read the whole of src/. Run rg -n "SESSION_TTL" src, open only those lines with 20 lines either side, and tell me the value on disk right now. If the search finds nothing, say so. Don't guess.”

The workshop

Name a word, or describe what you mean in everyday language.