Core Workflow/Context & Navigation
★ OverviewIntermediate13 min

How Claude Code Reads and Uses Your Entire Codebase as Context

Claude Code does not simply open files one at a time -- it actively explores your entire project using a suite of built-in navigation tools. This guide explains exactly how Claude indexes your codebase through Glob, Grep, Read, and Bash, how the context window is managed and compacted, and how you can structure your project to help Claude work faster and more accurately.

Quick Reference

  • Claude Code has no pre-built index -- it explores your project on demand using Glob, Grep, Read, and Bash
  • Glob finds files by pattern (e.g., **/*.tsx) and is the fastest way to discover project structure
  • Grep searches file contents using ripgrep under the hood -- supports regex and file-type filters
  • Read loads specific files into the context window with optional line-range limits
  • Bash runs shell commands like ls, wc, or tree to gather structural information
  • The context window has a finite token budget -- every file read consumes part of it
  • Use /compact to summarize the current conversation and free up context space
  • CLAUDE.md at the repo root gives Claude persistent project knowledge without using conversation tokens
  • Smaller, well-named files are easier for Claude to navigate than large monolithic files
  • Claude reads files lazily -- it only loads what it needs to answer your current request

How Claude Code Explores Your Project

When you start a Claude Code session and ask a question about your codebase, Claude does not have your entire project pre-loaded. Instead, it dynamically explores your project using a set of built-in navigation tools. This is fundamentally different from how traditional IDEs work -- there is no background indexer building a symbol table. Claude reads what it needs, when it needs it.

This on-demand approach has a major advantage: Claude can work with projects of any size without an upfront indexing cost. But it also means that how your project is organized directly impacts how quickly and accurately Claude can find what it needs.

No hidden magic

Every file Claude reads, every search it runs, and every command it executes is visible in your conversation. You can watch exactly how Claude navigates your project and learn to guide it more effectively.