Discover context or load it all
Decide between loading tools, instructions and knowledge up front and discovering them on demand (Skills, tool search, file navigation, just-in-time retrieval) by the system's content size, change rate and query pattern, and defend the choice with its cost and accuracy effects.
Scenario
Two teams in the same company argue in a design review.
The first loads everything at the start of every session: 70 tools, the full engineering handbook, every runbook. "Then the agent never lacks anything." Their agent picks the wrong tool more often each month.
The second loads nothing: their small agent searches for its three tools on every request, and users wait for a lookup that always finds the same three tools.
Both are applying a rule. Neither has looked at their own numbers.
Explanation
Context is a finite resource. As tokens grow, a model's ability to recall what is in the context falls (studies call this context rot, as Anthropic's context engineering article notes), so the goal is the smallest set of high-signal tokens for each step. There are two ways to get there.
Load it up front (monolithic). Put the instructions, tools and knowledge in every request.
- Simple, no extra round trips, and the stable prefix can be cached.
- It pays when the content is small, stable and used on nearly every request. Anthropic's Contextual Retrieval article (2024) suggests a knowledge base under about 200,000 tokens can go in the prompt whole, with prompt caching.
- It costs attention and money when most of it is unused, and it degrades choices: the tool search docs note that tool selection gets worse past roughly 30 to 50 tools.
Discover it progressively. Give Claude light references up front and let it load detail when a task needs it.
- Skills: only each Skill's name and description (about 100 tokens) are always loaded; the SKILL.md body (under 5k tokens) loads when the Skill triggers; bundled files cost nothing until read. The description decides whether a Skill triggers, so it must say what the Skill does and when to use it.
- Tool search: tools marked
defer_loadingstay out of context until Claude searches for them; the docs say it typically cuts definition tokens by over 85% in a large multi-server setup. They suggest it with 10 or more tools, more than 10k tokens of definitions, or falling selection accuracy (check current docs for these thresholds). With fewer than 10 tools, or tools used on every request, standard loading is better. - Just-in-time retrieval and file navigation: the agent keeps identifiers (file paths, stored queries, links) and loads the data with tools when needed. Reading live sources also avoids stale indexes.
The costs of discovery: exploration is slower than precomputed context, each lookup is a step that can miss, and an agent without good tools and guidance wastes context on dead ends.
Hybrid is common. Claude Code puts CLAUDE.md files in context up front and uses glob and grep to find files just in time.
Decide by three properties:
| Property | Load up front when | Discover when |
|---|---|---|
| Size | It fits easily and leaves room | It would crowd the context or the tool list |
| Change rate | It is stable, so a cached prefix holds | It changes often, so live reads stay current |
| Query pattern | Most requests use most of it | Each request uses a small, varying part |
Worked example
An insurer's underwriting assistant. Its context at the start of every request:
House style: 1,200 tokens, used in every answer.
Underwriting guidelines: summary of 1,500 pages, 60,000 tokens; the full guidelines change weekly.
Tools: 85 tools from 6 MCP servers, 48,000 tokens; a typical request uses 3 or 4.
Symptoms: wrong tool calls are rising, answers sometimes follow last month's guideline, and each request pays for 110,000 tokens before the question.
The redesign keeps or moves each part by its properties:
House style: stays in the system prompt. Small, stable, used every time, cached.
Tools: the 5 most used stay loaded; the other 80 get defer_loading behind tool search.
Guidelines: one file per line of business, with an index file listing them. The agent reads the index, then only the sections it needs, from the live files.
What it accepts in return: a search or a file read adds a step to some requests, and the index file must be kept accurate. What it gains: a context a fraction of the size, tool choice among a handful of relevant tools, and guidelines read from the current files.