Anthropic has published a guide to running Claude Code on codebases with millions of lines, and its central claim is that the setup around the model matters as much as the model. I built a small monorepo and ran the guide’s main tips against Claude Code to see which hold. Most do. Two of them pull against each other: start in a subfolder, and commit your deny rules at the repo root.
The guide, from Anthropic’s Applied AI team, covers monorepos, decades-old legacy systems and dozens of microservices spread across repositories. It also covers C, C++, C# and PHP codebases, which Anthropic says Claude Code handles better than most teams expect. I tested what a small repo can test: how context loads, what deny rules block and which skills appear. Scale is untested, and the plugin, language server and subagent tips are too.
What Anthropic recommends
Claude Code finds code the way an engineer does: it walks the file system, runs grep and reads files. It doesn’t build or upload a codebase index. Anthropic says that’s deliberate, because pipelines that embed a whole repository can’t keep up with thousands of engineers committing, so an index can return a function renamed two weeks ago or a module deleted last sprint.
The cost of live search is that Claude needs a starting point, so the guide is mostly about giving it one. It names five extension points, built in this order: CLAUDE.md files, hooks, skills, plugins and MCP servers. Language server (LSP) integrations and subagents round out the setup.

Three configuration patterns recur in the deployments Anthropic describes. The first is making the codebase navigable: a lean root CLAUDE.md of pointers and gotchas, starting Claude in the subdirectory rather than the root, scoping test and lint commands per folder, excluding generated files with committed permissions.deny rules, and running LSP so Claude searches by symbol. The second is keeping the setup current, with a review every three to six months because rules written for an older model can hold back a newer one. The third is ownership: one person or team that owns the Claude Code configuration, so good setups don’t stay tribal.
What I ran
I used Claude Code 2.1.336 in headless mode with Claude Haiku 5.5, and Claude Opus 5.5 for the deny-rule runs. The test machine was a 4 vCPU Intel Xeon at 2.1 GHz with 15 GB of memory and 252 GB of disk, running Ubuntu 24.04.5 on Linux 6.18. The repo was a git monorepo with two services, payments and billing, a generated folder, and a CLAUDE.md at the root and in each service. Each file held a made-up codeword so I could see which ones Claude had in context.
# CLAUDE.md (root)
Services live in services/. Never edit generated/.
ROOT codeword: quokka
# services/payments/CLAUDE.md
PAYMENTS codeword: marmot
Run tests with: python3 -m pytest services/payments -q
# services/billing/CLAUDE.md
BILLING codeword: ibis
Run tests with: python3 -m pytest services/billing -q
# .claude/settings.json (committed at the root)
{ "permissions": { "deny": ["Read(./generated/**)"] } }
Starting in a subfolder loads the folder’s CLAUDE.md
Anthropic says Claude walks up the directory tree and loads every CLAUDE.md on the way, so starting in a service never loses the root context. I started the same prompt from the root, from services/payments and from services/billing.
List every codeword from the CLAUDE.md files loaded at session start. Do not read files or run commands. Answer as ROOT=?, PAYMENTS=?, BILLING=?, "not loaded" if unseen.

The claim holds. From the root, Claude saw only the root file. From each service it saw the root file and that service’s file, and never the sibling’s. That’s the case for the guide’s advice to keep service rules in the service: they cost nothing in sessions that start elsewhere.
Scoped commands worked too. From services/payments I asked Claude to run the tests for the service. It ran python3 -m pytest services/payments -q, the command in that folder’s CLAUDE.md, rather than the whole suite, and reported one test passed.
A big root file costs tokens in every session
The guide says CLAUDE.md files load in every session whatever the task, so they should stay focused on what applies broadly. I measured that by starting an empty session in three repos and adding up the input tokens Claude Code reported: one with no CLAUDE.md, one with the 84-byte root file above, and one with 400 lines of invented rules, about 75 KB. The no-file session started at about 40,700 tokens in my setup.

The lean file added about 160 tokens and the large one about 24,700, both identical across two runs. The rules in the big file were filler, so this measures the cost of the space and not whether Claude follows 400 rules worse than 4. Anthropic’s point is the second one, that too much loaded context degrades performance. The token count is only the first half of that.
The deny rule and the subfolder start pull against each other
Anthropic recommends blocking generated files and build output with permissions.deny in a committed .claude/settings.json, so every developer gets the same exclusions. It separately recommends starting Claude in the subdirectory. I ran one prompt against the file in generated/, from the root and from a service.
Read generated/schema.gen.ts with the Read tool and give SCHEMA_MARKER, or say why you cannot.

From the root, both models refused with a permission error. From services/payments and from services/billing, both models read the file and returned the marker: four reads out of four, with no denial recorded. Claude Code’s documentation says why. Settings in .claude/settings.json load from the folder where you start, with no fallback to parent directories, so the repo’s root file is never read. The documentation does say settings.local.json loads from the git root, which is the personal, uncommitted file and not the committed one the guide recommends.
A copy of the rule in the service’s own settings file blocked the read only when I wrote the path in the absolute // form. Read(/generated/**) and Read(**/generated/**) did not. The same rule that hides generated code from a developer at the root hides nothing from one who followed the subfolder advice.

A deny rule is noise reduction, not a lock
Even from the root, where the rule loads, it didn’t stop Claude reading the file. I asked for a search with the Grep tool.
Use the Grep tool to search the repo for GEN-MARKER and report which file and the full line.

The Grep tool returned no matches, so the rule filters search results as well as reads. Haiku then reasoned that ripgrep skips ignored files and ran its own rg --no-ignore --hidden through the shell. The first attempt, with ; echo "exit=$?" tacked on, was stopped for approval. The plain command ran and printed the line, generated/schema.gen.ts:2, with the marker. It did this in all three runs I made.
The documentation is open about it. Claude Code treats grep, cat, find, ls and other read-only shell commands as safe to run without a prompt, and says a Bash rule isn’t a security boundary around a program, pointing to the sandbox for real filesystem limits. So the rule delivers what Anthropic promises, less noise from build output. It doesn’t keep a file away from Claude, and secrets don’t belong behind it.
Skills scoped to a folder load where you work
Anthropic’s example is a payments deploy skill that only loads inside payments/. I made two. payments-deploy sat in services/payments/.claude/skills/. payments-runbook sat at the root with paths: services/payments/** in its front matter. I asked Claude to list its skills without calling any tools, from three start folders.
List the names of every skill listed in your available skills (names only, comma separated, or "none"). Do not call any tools.
Started at the root or in services/billing, Claude listed neither. Started in services/payments, it listed payments-deploy and not the runbook. I then started at the root, had Claude read services/payments/charge.py and list its skills, and still got neither. When I had it edit that file and then list them, both appeared. The path-scoped skill showed up after a write to a matching file, not after a read, so a skill scoped to payments stayed out of my context while I was only reading or working elsewhere.
The Stop hook worked, with one gap in my setup
Anthropic’s guide says a stop hook can reflect on a session and propose CLAUDE.md updates while the context is fresh. I wrote a Stop hook that blocks the first stop with the instruction below and lets the second through.
Before you finish, suggest at most two one-line additions to the nearest CLAUDE.md that would have saved you time this session. Do not edit the file, just list them.
Loaded with --settings, it fired twice, as designed, and Claude answered the prompt. After a trivial task it replied that the session had no friction and it had nothing to add. The same hook placed in the repo’s .claude/settings.json and in settings.local.json did not fire in my headless runs. I didn’t find out why, and I didn’t test an interactive session.
Cursor and GitHub Copilot keep an index
Anthropic’s no-index stance is a design choice, and the two best-known alternatives made the opposite one. The staleness it describes is the failure of pipelines that can’t keep up. Both companies say theirs do.
| Tool | How it finds code | What the company says about freshness |
|---|---|---|
| Claude Code | Live grep and file reads on the developer’s machine, no index | Works from the codebase as it is now; needs good starting context |
| Cursor | Semantic index of syntactic chunks, synced with a Merkle tree | Only changed files and folders sync; embeddings are cached by chunk, so most edits skip re-embedding |
| GitHub Copilot | Semantic code search index; the cloud agent uses it alongside grep | Initial indexing of a large repository takes up to 60 seconds, and later updates land within seconds of a new conversation |
Cursor makes the case for the index in numbers. It says semantic search improved response accuracy by 12.5% on average in its own evaluation and produced code changes that were more likely to be kept. It also says a naive first index of a repository with tens of thousands of files can take hours, and that semantic search isn’t available until at least 80% of that work is done. Its fix is to reuse a teammate’s index, which it says cuts time to first query from hours to seconds at the 99th percentile of repositories. GitHub says its cloud agent uses semantic search to find code by meaning when it doesn’t know the exact names to grep for.
Anthropic’s guide gives no measurement behind its claim that live search suits a large repository better than an index. It does concede is the cost on its side: a vague pattern across a billion-line codebase fills the context window before the work starts, which is why it spends the rest of the guide on starting context.
The part my tests can’t reach
Half the guide is about people. Anthropic says the fastest rollouts it saw had infrastructure in place before broad access, with a small team, sometimes one person, wiring up plugins and MCP servers so a developer’s first session was productive. The minimum it suggests is a single named owner for the Claude Code configuration, with authority over settings, permissions policy, the plugin marketplace and CLAUDE.md conventions. It also suggests early working groups across engineering, security and governance, and a defined set of approved skills with limited initial access.
My deny-rule result is the argument for the owner. A team that commits a rule at the root and tells developers to start in their service has two pieces of advice that cancel out, and nobody notices until a generated file shows up in a review. Anthropic’s own caveats cover the other limits: the hierarchical CLAUDE.md approach strains with hundreds of thousands of folders or non-git version control, which it says later parts of the series will address.
Related reading on this site: Claude Code reads AGENTS.md when a project has no CLAUDE.md, Ratchet, which turns agent rules into enforced hooks, and how Anthropic checked its Rust port against live traffic.
What to do with it
- Pick one start convention and write it down. Starting at the root keeps committed settings and hooks. Starting in a service keeps context tight but needs the settings in each folder, or organisation-wide managed settings.
- Check your deny rules from the folder people start in, not the root. One prompt asking Claude to read a denied file takes a minute.
- Use deny rules to cut noise. For files that must stay out of reach, use the sandbox, and keep secrets out of the repo.
- Keep the root CLAUDE.md to pointers and gotchas. Move service commands and conventions into the service’s own file.
- Move deploy and runbook workflows into skills in the folder that owns them.
- Put one person’s name on the configuration, and diary a review for after the next model release.




