Context Engineering in a Minute · intermediate
Context in a Minute: Relevant file selection
Relevant file selection means loading only the files needed for the task—so the agent reasons over signal, not the whole repo.
Last verified: 2026-09-06
In one sentence
Relevant file selection is the practice of choosing a small, sufficient set of files for the agent’s working set.
Why it matters
Reading everything feels thorough. It usually makes the model worse: diluted attention, slower loops, and accidental edits in unrelated areas.
How it works
Start from the task:
- name the entrypoint file;
- follow direct imports/callers one hop;
- include the test that encodes the behavior;
- exclude generated dirs, build output, and unrelated packages;
- expand only when verification proves something is missing.
Ask the agent to propose the file list in the plan phase before deep reading.
Example
For a form validation bug: the form component, the validation helper, and the existing test file—not the entire app/ tree.
Agentic coding use
File selection is context engineering in practice. Good selectors outperform bigger context windows filled with junk.
Watch out
Under-selection misses shared utilities and causes repeated broken fixes. If two attempts fail for “cannot find X,” widen by one dependency hop—not by dumping the repo.