Deep Dive
Claude Code
Production Claude Code has 960+ files, 50+ integrated tools, 380K+ lines of code
These 13 chapters take you from the core loop to the full engineering picture, layer by layer.
Core Agentic Loop
Every AI Agent is essentially a loop. Claude Code's core is implemented in QueryEngine.ts (46KB) and query.ts (67KB). Click each step to see the corresponding source code location and implementation details.
User Input
User enters natural language instructions in the REPL
// src/entrypoints/cli.tsxconst userInput = await readline()messages.push({ role: "user", content: userInput })
From 30 Lines to 960 Files
A teaching Agent's core loop is just 30 lines, but how much engineering does production Claude Code stack on top of the same loop?
Five Architecture Layers
960 TypeScript files organized into five architecture layers. Click to expand and see core files, design patterns, and corresponding chapters.
8 Hidden Features in the Source Code
Gated by compile-time feature('FLAG'), removed by DCE in external builds, but fully preserved in the restored source.
Key Source Files
Understanding these key files gives you a grasp of the entire system. File size reflects engineering complexity.
13 Chapters of Source Deep Dive
Each chapter focuses on a core subsystem with source analysis + architecture visualization + runnable demos. Filter by architecture layer, or follow the sequence.