Skip to content
Flows
Tier 1 · Claude Code internals Claude Code internals · fetched 2026-07-02

Claude Code Orange Book

A book-length analysis ('Orange Book') dissecting Anthropic's AI engineering decisions from the 510,000 lines / 1,902 TypeScript files that shipped inside an npm package. Chapters cover the agent loop, context compaction, the hook system, and sub-agents - the concepts, not just the code.

View source on GitHub

Key takeaways

  • 01

    Agent loop, compaction, hooks, and sub-agents each get chapter-level treatment

  • 02

    Frames every mechanism as an engineering decision with trade-offs

  • 03

    Best source for architecture diagrams' underlying concepts

Flows built on this research

From the archive

Verbatim excerpts mined from our local archive of this repository — the prompts, schemas, and patterns worth stealing.

Insight

The Orange Book's framing: decisions over code

This book is not a source code reading journal. It dissects the design decisions behind Claude Code. Why does search use grep instead of a vector database? Why does the memory system only store preferences, not code? Why does Auto mode run a second AI for safety reviews? Why Bun over Node.js?

Every choice has a reason. Those reasons are more valuable than the code itself, because they are transferable.

Chapters include: The Tool System: 4 Primitives, 59 Tools · The Memory System: Remember Preferences, Forget Code · Search: Why grep Beats RAG · Multi-Agent Architecture: Run Like a Company · The Harness Engineering Playbook.

The chapter titles alone are a design philosophy: grep over RAG, preferences over code in memory, and a second AI as a safety reviewer.

README.md