AI CompendiumA public chart of the language
Home / Retrieval & Memory / Just-in-Time Retrieval
Retrieval & Memory

Just-in-Time Retrieval

Fetch what the task needs when it needs it, not everything in advance.

Definition

Holding pointers, summaries and search tools in context, and letting the agent retrieve the full material only at the moment it is required — the alternative to preloading everything that might be relevant.

It is the agentic version of the retrieval argument, and it depends on cheap, reliable lookup existing: a filesystem with grep, a search tool, a catalogued corpus. Where lookup is expensive or unreliable, preloading still wins.

The dependency worth being explicit about is retrieval quality: this pattern assumes lookup is cheap and reliable, and it degrades badly when it is not. Agents that guess at a search query and miss have no fallback, where a preloaded corpus at least guarantees presence.

How people use it
A large reference document.
"Keep the table of contents in context and the sections on disk. It will pull the two sections it needs instead of the whole thing."
Worked example

An index instead of an appendix

A fifty-page reference document the agent occasionally needs.

Keep the structure and section headings in context. The agent fetches the two sections relevant to the task and the window stays small — where pasting the whole document would spend most of the budget on material this task does not use.

Sources
Related terms