Claude-Code-Source-Study
A 34-chapter, file-by-file and line-by-line technical analysis of Claude Code's source code, covering its prompt engineering, multi-agent orchestration, tool system and security model.
Claude-Code-Source-Study is a bilingual, Chinese and English, deep-dive book that walks through Claude Code's own source code as a way to teach the full technical stack behind building an AI coding agent. Rather than a general architecture overview, each chapter breaks down specific files and functions, citing exact source line numbers and summarizing design patterns a reader can reuse in their own projects.
The chapters are organized around a session's runtime lifecycle: startup and configuration, the core query engine and prompt-cache handling, the family of built-in tools such as file, shell and search tools, agent and subagent coordination, the Model Context Protocol implementation and permission system, hooks, networking and remote sessions, and the terminal UI. All chapters live under a docs directory with a full table of contents and a changelog describing what changed between revisions.