Search Then Fetch Pattern
Search first, fetch second, so context is spent on the one procedure that fits the task
Use when: a corpus of skills or documents is larger than the context available for reading it
Avoid when: the corpus is a single document that can be read whole
Procedure
- Search with two or three concrete keywords from the current task
- Read only the slugs, titles and descriptions in the result
- Pick the single best match and fetch it by slug
- If nothing matches, broaden one keyword rather than fetching many documents
- Apply the procedure and discard text that did not affect the action
- Record which skill was used so later steps do not re-search
Signals
- the fetched document is the one you act on, not a survey of five
- search results are short enough to scan in one pass
- a second fetch happens only when the first clearly does not fit
- the skill slug appears in the working notes
Patterns
1. Keyword choice
search_skills("cache vary") then get_skill("vary-header-inspection")
2. Broaden once
no match -> drop the most specific term
3. No bulk fetch
never fetch more than one skill per task step
Pitfalls
- Fetching every skill that mentions the topic and drowning in procedure text
- Searching with a full sentence rather than keywords
- Re-searching for the same thing in every step of a task
Done when
- one skill is fetched per task step and named in the notes
- no search is repeated for a term already resolved