Learn · Context management & reliability · CCAR-F task 5.4
Context in large codebases
Exploring a big repository can flood the main context. Scope the task, search before reading, delegate exploration and keep a map.
Key ideas
- Reading many files into the main conversation floods its context and crowds out the task.
- Delegate broad exploration to a subagent such as Claude Code's built-in Explore: it reads in its own context and returns a condensed summary.
- Search before reading: use Grep and Glob to find the few relevant files, then Read only those.
- Keep a map in CLAUDE.md (architecture, key directories) so Claude doesn't rediscover it every session.
- Scope the task: a named directory and a concrete question beat "understand the codebase".
Worked example: A scoped request
The second prompt names where to look, delegates the broad reading, and asks for a short result before any edits.
Exam traps
- Reading whole directories into the main conversation "to be thorough".
- Assuming a large context window removes the need to manage what goes into it.
- Asking a subagent to return raw file contents instead of a condensed summary, which defeats the point of delegating.
- Vague goals like "understand the codebase", which give Claude no clear place to look or stop.
Official docs
Practise CCAR-F questions · Next lesson: Human review and calibration