Claude Code Sourcemap Learning Notebook banner
dadiaomengmeimei dadiaomengmeimei

Claude Code Sourcemap Learning Notebook

AI community

Description

Reverse-engineering Claude Code's 512K+ lines of TypeScript — architecture, design decisions, and 11 transferable patterns for building AI Agents

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

Claude Code Sourcemap Learning Notebook

[![GitHub](https://img.shields.io/badge/GitHub-dadiaomengmeimei-blue?logo=github)](https://github.com/dadiaomengmeimei/claude-code-sourcemap-learning-notebook) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](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 SystembuildTool() 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

Chapters

# Topic Core Source Files Time
00 Index & Architecture Overview 10min
01 Global Architecture main.tsx, App.tsx, QueryEngine.ts 30min
02 Tool System Tool.ts, tools.ts, GlobTool.ts 45min
03 Permission & Security permissions.ts, filesystem.ts 45min
04 Query Loop & API ⭐ query.ts, `StreamingToo