# lintsinghua/claude-code-book architecture

> Architecture diagram of the GitHub repository lintsinghua/claude-code-book, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lintsinghua/claude-code-book
- Repository: https://github.com/lintsinghua/claude-code-book

## Overview

This repository is primarily a bilingual technical book that guides readers from Agent Harness fundamentals through core systems and advanced patterns toward building a harness. Its chapters describe Claude Code architecture; they are explanatory material, not an implementation of that runtime. The separately implemented Star History utility fetches GitHub star data and generates chart assets. The graph follows the book’s stated reading/building workflow; it does not infer connections among unsampled chapter internals.

Main entry points: [`第一部分-基础篇`](https://github.com/lintsinghua/claude-code-book/tree/main/%E7%AC%AC%E4%B8%80%E9%83%A8%E5%88%86-%E5%9F%BA%E7%A1%80%E7%AF%87) (Harness foundations), [`第四部分-工程实践篇`](https://github.com/lintsinghua/claude-code-book/tree/main/%E7%AC%AC%E5%9B%9B%E9%83%A8%E5%88%86-%E5%B7%A5%E7%A8%8B%E5%AE%9E%E8%B7%B5%E7%AF%87) (Engineering practice), [`第四部分-工程实践篇/15-构建你自己的Agent-Harness.md`](https://github.com/lintsinghua/claude-code-book/blob/main/%E7%AC%AC%E5%9B%9B%E9%83%A8%E5%88%86-%E5%B7%A5%E7%A8%8B%E5%AE%9E%E8%B7%B5%E7%AF%87/15-%E6%9E%84%E5%BB%BA%E4%BD%A0%E8%87%AA%E5%B7%B1%E7%9A%84Agent-Harness.md) (Build a harness), [`scripts/star_history.py`](https://github.com/lintsinghua/claude-code-book/blob/main/scripts/star_history.py) (Star history generator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_book["Book and learning path"]
  node_foundations["Harness foundations"]
  node_dialog["Dialog loop"]
  node_tools["Tool system"]
  node_permissions["Permission pipeline"]
  node_core["Core systems"]
  node_settings["Settings and config"]
  node_memory["Long-term memory"]
  node_context["Context management"]
  node_hooks["Lifecycle hooks"]
  node_advanced["Composition and extensions"]
  node_subagents["Sub-agents<br/>[09-子智能体与Fork模式.md]"]
  node_coordination["Multi-agent coordination<br/>[10-协调器模式-多智能体编排.md]"]
  node_skills["Skills and plugins<br/>[11-技能系统与插件架构.md]"]
  node_mcp["MCP integration<br/>[12-MCP集成与外部协议.md]"]
  node_practice["Engineering practice"]
  node_streaming["Streaming and performance<br/>[13-流式架构与性能优化.md]"]
  node_plans["Plan workflows"]
  node_harness["Build a harness"]
  node_appendices["Reference appendices"]
end

subgraph group_history["Star History feature"]
  node_star_script["Star history generator<br/>[star_history.py]"]
  node_chart_assets["Star chart assets"]
end

node_reader(("Reader"))
node_github[("GitHub API")]

node_reader -->|"starts reading"| node_foundations
node_reader -->|"consults as needed"| node_core
node_reader -->|"consults as needed"| node_advanced
node_reader -->|"reads practice"| node_practice
node_reader -->|"looks up"| node_appendices
node_foundations -->|"introduces"| node_dialog
node_foundations -->|"introduces"| node_tools
node_foundations -->|"introduces"| node_permissions
node_practice -->|"guides building"| node_harness
node_reader -->|"builds"| node_harness
node_star_script -->|"fetches star data"| node_github
node_reader -->|"views chart"| node_chart_assets

click node_foundations "https://github.com/lintsinghua/claude-code-book/tree/main/%E7%AC%AC%E4%B8%80%E9%83%A8%E5%88%86-%E5%9F%BA%E7%A1%80%E7%AF%87"
click node_dialog "https://github.com/lintsinghua/claude-code-book/blob/main/%E7%AC%AC%E4%B8%80%E9%83%A8%E5%88%86-%E5%9F%BA%E7%A1%80%E7%AF%87/02-%E5%AF%B9%E8%AF%9D%E5%BE%AA%E7%8E%AF-Agent%E7%9A%84%E5%BF%83%E8%B7%B3.md"
click node_tools "https://github.com/lintsinghua/claude-code-book/blob/main/%E7%AC%AC%E4%B8%80%E9%83%A8%E5%88%86-%E5%9F%BA%E7%A1%80%E7%AF%87/03-%E5%B7%A5%E5%85%B7%E7%B3%BB%E7%BB%9F-Agent%E7%9A%84%E5%8F%8C%E6%89%8B.md"
click node_permissions "https://github.com/lintsinghua/claude-code-book/blob/main/%E7%AC%AC%E4%B8%80%E9%83%A8%E5%88%86-%E5%9F%BA%E7%A1%80%E7%AF%87/04-%E6%9D%83%E9%99%90%E7%AE%A1%E7%BA%BF-Agent%E7%9A%84%E6%8A%A4%E6%A0%8F.md"
click node_core "https://github.com/lintsinghua/claude-code-book/tree/main/%E7%AC%AC%E4%BA%8C%E9%83%A8%E5%88%86-%E6%A0%B8%E5%BF%83%E7%B3%BB%E7%BB%9F%E7%AF%87"
click node_settings "https://github.com/lintsinghua/claude-code-book/blob/main/%E7%AC%AC%E4%BA%8C%E9%83%A8%E5%88%86-%E6%A0%B8%E5%BF%83%E7%B3%BB%E7%BB%9F%E7%AF%87/05-%E8%AE%BE%E7%BD%AE%E4%B8%8E%E9%85%8D%E7%BD%AE-Agent%E7%9A%84%E5%9F%BA%E5%9B%A0.md"
click node_memory "https://github.com/lintsinghua/claude-code-book/blob/main/%E7%AC%AC%E4%BA%8C%E9%83%A8%E5%88%86-%E6%A0%B8%E5%BF%83%E7%B3%BB%E7%BB%9F%E7%AF%87/06-%E8%AE%B0%E5%BF%86%E7%B3%BB%E7%BB%9F-Agent%E7%9A%84%E9%95%BF%E6%9C%9F%E8%AE%B0%E5%BF%86.md"
click node_context "https://github.com/lintsinghua/claude-code-book/blob/main/%E7%AC%AC%E4%BA%8C%E9%83%A8%E5%88%86-%E6%A0%B8%E5%BF%83%E7%B3%BB%E7%BB%9F%E7%AF%87/07-%E4%B8%8A%E4%B8%8B%E6%96%87%E7%AE%A1%E7%90%86-Agent%E7%9A%84%E5%B7%A5%E4%BD%9C%E8%AE%B0%E5%BF%86.md"
click node_hooks "https://github.com/lintsinghua/claude-code-book/blob/main/%E7%AC%AC%E4%BA%8C%E9%83%A8%E5%88%86-%E6%A0%B8%E5%BF%83%E7%B3%BB%E7%BB%9F%E7%AF%87/08-%E9%92%A9%E5%AD%90%E7%B3%BB%E7%BB%9F-Agent%E7%9A%84%E7%94%9F%E5%91%BD%E5%91%A8%E6%9C%9F%E6%89%A9%E5%B1%95%E7%82%B9.md"
click node_advanced "https://github.com/lintsinghua/claude-code-book/tree/main/%E7%AC%AC%E4%B8%89%E9%83%A8%E5%88%86-%E9%AB%98%E7%BA%A7%E6%A8%A1%E5%BC%8F%E7%AF%87"
click node_subagents "https://github.com/lintsinghua/claude-code-book/blob/main/%E7%AC%AC%E4%B8%89%E9%83%A8%E5%88%86-%E9%AB%98%E7%BA%A7%E6%A8%A1%E5%BC%8F%E7%AF%87/09-%E5%AD%90%E6%99%BA%E8%83%BD%E4%BD%93%E4%B8%8EFork%E6%A8%A1%E5%BC%8F.md"
click node_coordination "https://github.com/lintsinghua/claude-code-book/blob/main/%E7%AC%AC%E4%B8%89%E9%83%A8%E5%88%86-%E9%AB%98%E7%BA%A7%E6%A8%A1%E5%BC%8F%E7%AF%87/10-%E5%8D%8F%E8%B0%83%E5%99%A8%E6%A8%A1%E5%BC%8F-%E5%A4%9A%E6%99%BA%E8%83%BD%E4%BD%93%E7%BC%96%E6%8E%92.md"
click node_skills "https://github.com/lintsinghua/claude-code-book/blob/main/%E7%AC%AC%E4%B8%89%E9%83%A8%E5%88%86-%E9%AB%98%E7%BA%A7%E6%A8%A1%E5%BC%8F%E7%AF%87/11-%E6%8A%80%E8%83%BD%E7%B3%BB%E7%BB%9F%E4%B8%8E%E6%8F%92%E4%BB%B6%E6%9E%B6%E6%9E%84.md"
click node_mcp "https://github.com/lintsinghua/claude-code-book/blob/main/%E7%AC%AC%E4%B8%89%E9%83%A8%E5%88%86-%E9%AB%98%E7%BA%A7%E6%A8%A1%E5%BC%8F%E7%AF%87/12-MCP%E9%9B%86%E6%88%90%E4%B8%8E%E5%A4%96%E9%83%A8%E5%8D%8F%E8%AE%AE.md"
click node_practice "https://github.com/lintsinghua/claude-code-book/tree/main/%E7%AC%AC%E5%9B%9B%E9%83%A8%E5%88%86-%E5%B7%A5%E7%A8%8B%E5%AE%9E%E8%B7%B5%E7%AF%87"
click node_streaming "https://github.com/lintsinghua/claude-code-book/blob/main/%E7%AC%AC%E5%9B%9B%E9%83%A8%E5%88%86-%E5%B7%A5%E7%A8%8B%E5%AE%9E%E8%B7%B5%E7%AF%87/13-%E6%B5%81%E5%BC%8F%E6%9E%B6%E6%9E%84%E4%B8%8E%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96.md"
click node_plans "https://github.com/lintsinghua/claude-code-book/blob/main/%E7%AC%AC%E5%9B%9B%E9%83%A8%E5%88%86-%E5%B7%A5%E7%A8%8B%E5%AE%9E%E8%B7%B5%E7%AF%87/14-Plan%E6%A8%A1%E5%BC%8F%E4%B8%8E%E7%BB%93%E6%9E%84%E5%8C%96%E5%B7%A5%E4%BD%9C%E6%B5%81.md"
click node_harness "https://github.com/lintsinghua/claude-code-book/blob/main/%E7%AC%AC%E5%9B%9B%E9%83%A8%E5%88%86-%E5%B7%A5%E7%A8%8B%E5%AE%9E%E8%B7%B5%E7%AF%87/15-%E6%9E%84%E5%BB%BA%E4%BD%A0%E8%87%AA%E5%B7%B1%E7%9A%84Agent-Harness.md"
click node_appendices "https://github.com/lintsinghua/claude-code-book/tree/main/%E9%99%84%E5%BD%95"
click node_star_script "https://github.com/lintsinghua/claude-code-book/blob/main/scripts/star_history.py"
click node_chart_assets "https://github.com/lintsinghua/claude-code-book/tree/main/docs/images"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_foundations,node_dialog,node_tools,node_permissions,node_core,node_settings,node_memory,node_context,node_hooks,node_advanced,node_subagents,node_coordination,node_skills,node_mcp,node_practice,node_streaming,node_plans,node_harness,node_appendices toneBlue
class node_star_script,node_chart_assets,node_github toneAmber
class node_reader toneIndigo
```

## Components

### Book and learning path

- [Harness foundations](https://github.com/lintsinghua/claude-code-book/tree/main/%E7%AC%AC%E4%B8%80%E9%83%A8%E5%88%86-%E5%9F%BA%E7%A1%80%E7%AF%87): `第一部分-基础篇`
- [Dialog loop](https://github.com/lintsinghua/claude-code-book/blob/main/%E7%AC%AC%E4%B8%80%E9%83%A8%E5%88%86-%E5%9F%BA%E7%A1%80%E7%AF%87/02-%E5%AF%B9%E8%AF%9D%E5%BE%AA%E7%8E%AF-Agent%E7%9A%84%E5%BF%83%E8%B7%B3.md): `第一部分-基础篇/02-对话循环-Agent的心跳.md`
- [Tool system](https://github.com/lintsinghua/claude-code-book/blob/main/%E7%AC%AC%E4%B8%80%E9%83%A8%E5%88%86-%E5%9F%BA%E7%A1%80%E7%AF%87/03-%E5%B7%A5%E5%85%B7%E7%B3%BB%E7%BB%9F-Agent%E7%9A%84%E5%8F%8C%E6%89%8B.md): `第一部分-基础篇/03-工具系统-Agent的双手.md`
- [Permission pipeline](https://github.com/lintsinghua/claude-code-book/blob/main/%E7%AC%AC%E4%B8%80%E9%83%A8%E5%88%86-%E5%9F%BA%E7%A1%80%E7%AF%87/04-%E6%9D%83%E9%99%90%E7%AE%A1%E7%BA%BF-Agent%E7%9A%84%E6%8A%A4%E6%A0%8F.md): `第一部分-基础篇/04-权限管线-Agent的护栏.md`
- [Core systems](https://github.com/lintsinghua/claude-code-book/tree/main/%E7%AC%AC%E4%BA%8C%E9%83%A8%E5%88%86-%E6%A0%B8%E5%BF%83%E7%B3%BB%E7%BB%9F%E7%AF%87): `第二部分-核心系统篇`
- [Settings and config](https://github.com/lintsinghua/claude-code-book/blob/main/%E7%AC%AC%E4%BA%8C%E9%83%A8%E5%88%86-%E6%A0%B8%E5%BF%83%E7%B3%BB%E7%BB%9F%E7%AF%87/05-%E8%AE%BE%E7%BD%AE%E4%B8%8E%E9%85%8D%E7%BD%AE-Agent%E7%9A%84%E5%9F%BA%E5%9B%A0.md): `第二部分-核心系统篇/05-设置与配置-Agent的基因.md`
- [Long-term memory](https://github.com/lintsinghua/claude-code-book/blob/main/%E7%AC%AC%E4%BA%8C%E9%83%A8%E5%88%86-%E6%A0%B8%E5%BF%83%E7%B3%BB%E7%BB%9F%E7%AF%87/06-%E8%AE%B0%E5%BF%86%E7%B3%BB%E7%BB%9F-Agent%E7%9A%84%E9%95%BF%E6%9C%9F%E8%AE%B0%E5%BF%86.md): `第二部分-核心系统篇/06-记忆系统-Agent的长期记忆.md`
- [Context management](https://github.com/lintsinghua/claude-code-book/blob/main/%E7%AC%AC%E4%BA%8C%E9%83%A8%E5%88%86-%E6%A0%B8%E5%BF%83%E7%B3%BB%E7%BB%9F%E7%AF%87/07-%E4%B8%8A%E4%B8%8B%E6%96%87%E7%AE%A1%E7%90%86-Agent%E7%9A%84%E5%B7%A5%E4%BD%9C%E8%AE%B0%E5%BF%86.md): `第二部分-核心系统篇/07-上下文管理-Agent的工作记忆.md`
- [Lifecycle hooks](https://github.com/lintsinghua/claude-code-book/blob/main/%E7%AC%AC%E4%BA%8C%E9%83%A8%E5%88%86-%E6%A0%B8%E5%BF%83%E7%B3%BB%E7%BB%9F%E7%AF%87/08-%E9%92%A9%E5%AD%90%E7%B3%BB%E7%BB%9F-Agent%E7%9A%84%E7%94%9F%E5%91%BD%E5%91%A8%E6%9C%9F%E6%89%A9%E5%B1%95%E7%82%B9.md): `第二部分-核心系统篇/08-钩子系统-Agent的生命周期扩展点.md`
- [Composition and extensions](https://github.com/lintsinghua/claude-code-book/tree/main/%E7%AC%AC%E4%B8%89%E9%83%A8%E5%88%86-%E9%AB%98%E7%BA%A7%E6%A8%A1%E5%BC%8F%E7%AF%87): `第三部分-高级模式篇`
- [Sub-agents](https://github.com/lintsinghua/claude-code-book/blob/main/%E7%AC%AC%E4%B8%89%E9%83%A8%E5%88%86-%E9%AB%98%E7%BA%A7%E6%A8%A1%E5%BC%8F%E7%AF%87/09-%E5%AD%90%E6%99%BA%E8%83%BD%E4%BD%93%E4%B8%8EFork%E6%A8%A1%E5%BC%8F.md): `第三部分-高级模式篇/09-子智能体与Fork模式.md`
- [Multi-agent coordination](https://github.com/lintsinghua/claude-code-book/blob/main/%E7%AC%AC%E4%B8%89%E9%83%A8%E5%88%86-%E9%AB%98%E7%BA%A7%E6%A8%A1%E5%BC%8F%E7%AF%87/10-%E5%8D%8F%E8%B0%83%E5%99%A8%E6%A8%A1%E5%BC%8F-%E5%A4%9A%E6%99%BA%E8%83%BD%E4%BD%93%E7%BC%96%E6%8E%92.md): `第三部分-高级模式篇/10-协调器模式-多智能体编排.md`
- [Skills and plugins](https://github.com/lintsinghua/claude-code-book/blob/main/%E7%AC%AC%E4%B8%89%E9%83%A8%E5%88%86-%E9%AB%98%E7%BA%A7%E6%A8%A1%E5%BC%8F%E7%AF%87/11-%E6%8A%80%E8%83%BD%E7%B3%BB%E7%BB%9F%E4%B8%8E%E6%8F%92%E4%BB%B6%E6%9E%B6%E6%9E%84.md): `第三部分-高级模式篇/11-技能系统与插件架构.md`
- [MCP integration](https://github.com/lintsinghua/claude-code-book/blob/main/%E7%AC%AC%E4%B8%89%E9%83%A8%E5%88%86-%E9%AB%98%E7%BA%A7%E6%A8%A1%E5%BC%8F%E7%AF%87/12-MCP%E9%9B%86%E6%88%90%E4%B8%8E%E5%A4%96%E9%83%A8%E5%8D%8F%E8%AE%AE.md): `第三部分-高级模式篇/12-MCP集成与外部协议.md`
- [Engineering practice](https://github.com/lintsinghua/claude-code-book/tree/main/%E7%AC%AC%E5%9B%9B%E9%83%A8%E5%88%86-%E5%B7%A5%E7%A8%8B%E5%AE%9E%E8%B7%B5%E7%AF%87): `第四部分-工程实践篇`
- [Streaming and performance](https://github.com/lintsinghua/claude-code-book/blob/main/%E7%AC%AC%E5%9B%9B%E9%83%A8%E5%88%86-%E5%B7%A5%E7%A8%8B%E5%AE%9E%E8%B7%B5%E7%AF%87/13-%E6%B5%81%E5%BC%8F%E6%9E%B6%E6%9E%84%E4%B8%8E%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96.md): `第四部分-工程实践篇/13-流式架构与性能优化.md`
- [Plan workflows](https://github.com/lintsinghua/claude-code-book/blob/main/%E7%AC%AC%E5%9B%9B%E9%83%A8%E5%88%86-%E5%B7%A5%E7%A8%8B%E5%AE%9E%E8%B7%B5%E7%AF%87/14-Plan%E6%A8%A1%E5%BC%8F%E4%B8%8E%E7%BB%93%E6%9E%84%E5%8C%96%E5%B7%A5%E4%BD%9C%E6%B5%81.md): `第四部分-工程实践篇/14-Plan模式与结构化工作流.md`
- [Build a harness](https://github.com/lintsinghua/claude-code-book/blob/main/%E7%AC%AC%E5%9B%9B%E9%83%A8%E5%88%86-%E5%B7%A5%E7%A8%8B%E5%AE%9E%E8%B7%B5%E7%AF%87/15-%E6%9E%84%E5%BB%BA%E4%BD%A0%E8%87%AA%E5%B7%B1%E7%9A%84Agent-Harness.md): `第四部分-工程实践篇/15-构建你自己的Agent-Harness.md`
- [Reference appendices](https://github.com/lintsinghua/claude-code-book/tree/main/%E9%99%84%E5%BD%95): `附录`

### Star History feature

- [Star history generator](https://github.com/lintsinghua/claude-code-book/blob/main/scripts/star_history.py): `scripts/star_history.py`
- [Star chart assets](https://github.com/lintsinghua/claude-code-book/tree/main/docs/images): `docs/images`

### Other components

- **Reader**
- **GitHub API**

## Connections

- Reader → Harness foundations: starts reading (evidence: `README.md`)
- Reader → Core systems: consults as needed (evidence: `README.md`)
- Reader → Composition and extensions: consults as needed (evidence: `README.md`)
- Reader → Engineering practice: reads practice (evidence: `README.md`)
- Reader → Reference appendices: looks up (evidence: `README.md`)
- Harness foundations → Dialog loop: introduces (evidence: `README.md`)
- Harness foundations → Tool system: introduces (evidence: `README.md`)
- Harness foundations → Permission pipeline: introduces (evidence: `README.md`)
- Engineering practice → Build a harness: guides building (evidence: `README.md`)
- Reader → Build a harness: builds (evidence: `README.md`)
- Star history generator → GitHub API: fetches star data (evidence: `scripts/star_history.py`)
- Reader → Star chart assets: views chart (evidence: `README.md`)
