0Pricing
Claude Architect · Lesson

Incremental Investigation Pattern

Grep entry points, Read files, Grep usages, Read consumers.

Why Investigate Incrementally

When Claude Code lands in an unfamiliar codebase, dumping every file into context is wasteful and unreliable. Large blobs trigger lost-in-the-middle: the model attends to the start and end of context far more than the middle, so facts buried in a giant paste get missed.

The Incremental Investigation Pattern solves this. Instead of loading everything, Claude follows a deliberate chain that widens understanding one verified step at a time, pulling only the files that matter.

The Four-Step Chain

The canonical loop for built-in tools is:

  • Grep entry points — search file contents to locate where a feature begins.
  • Read files — load the matched files to understand the definition.
  • Grep usages — search for everywhere that symbol is referenced.
  • Read consumers — open the call sites to see how it is actually used.

Each step narrows the search space using evidence from the previous step. You never guess which files matter — the codebase tells you.

# Conceptual flow with Claude Code built-in tools
# 1) Grep -> find entry points
# 2) Read  -> the matched definition files
# 3) Grep -> usages of the symbol
# 4) Read  -> the consumer / call-site files

All lessons in this course

  1. How Many Tools Per Agent
  2. tool_choice: auto / any / forced
  3. Claude Code Built-in Tools
  4. Incremental Investigation Pattern
← Back to Claude Architect