dadiaomengmeimei/claude-code-sourcemap-learning-notebook
165 stars · Last commit 2026-04-02
Reverse-engineering Claude Code's 512K+ lines of TypeScript — architecture, design decisions, and 11 transferable patterns for building AI Agents
README preview
# Claude Code Sourcemap Learning Notebook [](https://github.com/dadiaomengmeimei/claude-code-sourcemap-learning-notebook) [](LICENSE) > 🌐 [中文版 / Chinese Version](README_CN.md) **Reverse-engineering Claude Code's 512K+ lines of TypeScript — extracting the architecture, design decisions, and 11 transferable patterns that make a production AI Agent work.** Not just a code walkthrough. An architectural analysis that explains *why* each design choice was made, with alternatives compared. ## What You'll Learn - 🔄 **Query Loop** — Streaming tool execution, read-write lock concurrency, 3-layer AbortController cascade - 🛠️ **Tool System** — `buildTool()` factory + Zod schema as prompt, 40+ tools with 18+ feature flags - 🔒 **5-Layer Security** — Permission rules → mode → tool checks → path safety → macOS Seatbelt sandbox - 🤖 **Multi-Agent** — Coordinator orchestration, default isolation with explicit sharing, cache-friendly forking - 🔌 **MCP & Skills** — 3-layer skill architecture, bundled skill lazy extraction, `/simplify` 3-agent parallel review - 🧠 **Prompt Engineering** — 7 categories with 40+ prompt files, static/dynamic separation for cache optimization - 🎙️ **Voice & Buddy** — Record-first-connect-later latency elimination, deterministic generation