A team adopts Claude Code on a large monorepo. To "give it the full picture", one developer pipes every tracked file into a single prompt and asks why checkout totals are off by a cent. The run is slow and expensive, and the answer blames a pricing helper from a package nobody has used in a year. A teammate starts Claude in the checkout package, describes the symptom and where to look, and gets a failing test and a fix. Same model, same repo. The difference is what each of them put in the .
The common misconception
"Claude Code reads, or indexes, the whole repository when it starts, so it already knows all my code." It's an easy belief to pick up:
It feels instant. Ask where authentication lives or which test framework you use, and the right file comes back in seconds.
Anthropic's docs say that Claude "sees your whole project". That sentence is about access: files in your directory and its subdirectories, plus files elsewhere with your permission.
Editors index code to make search fast, so it's natural to assume an AI coding tool does the same.
Context windows are big now. With a 1M-token window on most current models, loading everything sounds like a sensible default.
The half-truth: Claude Code can reach every file in the project, and it's good at finding the right ones quickly. But reaching a file and having it in context are different things. A file's contents enter the conversation only when a tool reads them or you paste them in.
What actually happens
What loads before you type
The docs list what's in context before your first prompt:
System instructions, plus your output style if you set one
CLAUDE.md files from the working directory and every directory above it
Auto memory: the first 200 lines or 25KB of MEMORY.md, whichever comes first
MCP tool names and skill descriptions; by default, a tool's full schema and a skill's body load only when used
A git snapshot: the current branch, uncommitted changes and recent commits
Your source files aren't on that list. Even a CLAUDE.md in a subdirectory waits: Claude Code loads it once Claude reads, writes or edits a file in that subdirectory.
The loop: gather context, act, verify
The docs call Claude Code the layer around the model that provides the tools and manages the context the model sees. Each task runs through three blended phases: gather context, take action, verify results. For "fix the failing tests", Claude might run the suite, read the error output, search for the relevant source files, read them, edit them and run the tests again. Each tool result shapes the next step, and a question about your code might need only the first phase.
Search is a tool call
Finding code means calling a tool. Grep, built on ripgrep, returns matching file paths by default and skips gitignored files. Glob finds files by name pattern and returns at most 100 results. On macOS, Linux and WSL, Claude runs the same kind of search with find and grep in its shell. Then the Read tool loads a file, at most 25,000 tokens per call by default, so a large file comes in pages. Every result lands in the context window and stays in the conversation.
Exploration can happen in another context
For broad searches, Claude delegates to the built-in Explore : a read-only agent that works in its own context window and returns a summary, so the file contents stay out of your conversation. Claude picks how thorough it should be: quick, medium or very thorough. With a code intelligence plugin installed, Claude can also ask a language server for a definition or its references instead of reading files to find them.
Each session starts fresh
A new session starts with a fresh context window, without the previous conversation. What Claude found while exploring yesterday is gone unless it's in CLAUDE.md or auto memory. That's why the docs suggest writing down facts that take a few minutes of digging to find: otherwise Claude redoes the digging at the start of every session.
Dumping the repo vs pointing the way
Bash · terminal
# "Give it the full picture": every tracked file in one promptgit ls-files -z | xargs -0 cat | claude -p "Why are checkout totals off by one cent?"
Bash · terminal
# Start where the work is, then name the symptom and a place to lookcd packages/checkoutclaude "Multi-item cart totals are off by one cent. Start in src/pricing/,write a failing test that reproduces it, then fix it."
The first version puts every file into the first message, before Claude has decided what's relevant, and each later request in the run sends it again. The second starts Claude in the package. File access covers that subtree until you grant more, and CLAUDE.md loads from that directory and its ancestors, not from sibling packages. The prompt names the symptom, a starting point and what "fixed" means, which is what the docs recommend.
Claude's content searches respect .gitignore by default, so ignored build output stays out of the results. For generated or vendored code that is checked in, Read deny rules stop Claude from opening those files:
Startup loads CLAUDE.md, auto memory, tool names, skill descriptions and a git snapshot
It looks code up in a prebuilt index
It calls search tools such as Grep and Glob, then reads the hits
More files in the prompt, better answers
Unrelated reads cost tokens and, per the docs, degrade performance
It remembers the code from last session
Each session starts fresh; only CLAUDE.md and auto memory carry over
A big repo needs everything loaded
A big repo needs scoping: start directory, deny rules, Explore, code intelligence
How to apply it in your project
Start Claude where the work isFor a task inside one package or subsystem, launch claude from that directory. It gets that subtree plus its own and its ancestors' CLAUDE.md files. Add --add-dir ../shared when a task needs a sibling.
Point, don't pasteName the symptom, a starting file or directory and what "done" looks like. If you already know the exact file, type @ and its path to include it in your message.
Fence off generated and vendored codeAdd Read deny rules for checked-in build output, generated clients and vendored SDKs. They don't cover a script that opens files by itself, so keep that in mind.
Give it a map that doesn't cost readsInstall a code intelligence plugin for your language, such as /plugin install typescript-lsp@claude-plugins-official, so definitions and references come from a language server.
Write down what it keeps rediscoveringIf Claude spends the start of every session finding the same fact, such as how to run one test file, put that line in CLAUDE.md.
Key takeaways
Claude Code doesn't read your source at startup; it loads CLAUDE.md, auto memory, tool names, skill descriptions and a git snapshot.
It finds code with search tools and reads files on demand, and each read adds to the context window.
Access isn't context: Claude can reach the whole project, but only what it reads is in front of the model.
Scope the work: start in the right directory, point at a place to look and deny reads of generated code.
Each session starts fresh, so write down what Claude would otherwise rediscover every time.
التعليقات (0)