What the agent sees at start
Claude Code does not load the whole repository into context up front. Instead it:
- Reads
CLAUDE.md from the root (and nested folders) — this is the first thing in context.
- Respects
.gitignore — node_modules, .next, dist and so on are not indexed.
- Samples the structure: looks at the file tree, opens what's relevant to your request as needed (lazy reading).
So in a giant monorepo the agent doesn't drown: it pulls files in on demand for the task.
Asking about architecture
A good first request in an unfamiliar project:
Describe the architecture: where the entry point is, how layers are organized, where the business logic and DB access live. Name the key files.
The agent walks the tree, opens entry points, configs, the DB schema, and gives you a map. Then drill down into specific modules.
Reading multiple files at once
You can explicitly direct attention:
Read src/auth/*.ts and explain how the login flow works from route to session.
The agent opens all matches and traces the call chain across files — something autocompletion cannot do.
Narrowing scope: include / exclude
When the repo is large or has noisy directories, limit the scope:
claude --include "src/**" --exclude "**/*.test.ts" --exclude "legacy/**"
--include — allowlist of paths where the agent may work and read.
--exclude — blocklist: generated code, vendored deps, legacy you must not touch.
This both speeds things up and reduces the risk of the agent editing the wrong thing.
Large repositories in practice
- Ask about the high-level structure first, then drill down — don't ask "read the whole project".
- Name concrete paths and modules in the request — this sharply cuts unnecessary reading.
- Keep an up-to-date
CLAUDE.md with a project map (next lesson): the agent orients without re-scanning.
.gitignore is your friend: if build artifacts and caches are in it, the agent won't touch them.
Why this matters
Model context is finite. The more precisely you direct reading (paths, include/exclude, CLAUDE.md), the more budget remains for the task itself rather than wandering through files. Managing the agent's attention is a key skill in large codebases.