anneheartrecord/claude-code-docs

173 stars · Last commit 2026-08-11

Chapter-by-chapter teardown of a production coding agent — agent loop, context engineering, compaction, permissions, MCP. 13 chapters, Chinese and English.

README preview

[English](./README_EN.md)

# Claude Code 源码解剖

[![License](https://img.shields.io/github/license/anneheartrecord/claude-code-docs?color=green)](./LICENSE)
[![docs-check](https://github.com/anneheartrecord/claude-code-docs/actions/workflows/docs-check.yml/badge.svg)](https://github.com/anneheartrecord/claude-code-docs/actions/workflows/docs-check.yml)
![Docs](https://img.shields.io/badge/docs-13%20articles-blue)
![Language](https://img.shields.io/badge/language-中文%20%7C%20English-orange)
![Lines](https://img.shields.io/badge/analyzed-515K%20lines-red)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen)](./CONTRIBUTING.md)

> 📖 **在线阅读:** https://anneheartrecord.github.io/claude-code-docs/

2026 年 3 月 31日,有人发现 Anthropic 发布在 npm 上的 Claude Code 客户端包里带了 sourcemap 文件。

Sourcemap 是前端构建工具生成的调试辅助文件,记录了编译后代码和原始源码之间的映射关系。正常发布时应该把它排除掉,但 Anthropic 的构建流程里漏了这一步。

于是完整的 TypeScript 源码被反向还原了出来,有51.5 万行代码,2,766 个文件。

**需要明确的是:泄露的只是客户端侧的代码。** Claude Code 是典型的客户端-服务端(Client-Server)分离架构。客户端跑在你的终端里,负责用户交互、工具执行、权限管理、上下文组装。服务端是 Anthropic 的 API,负责模型推理,模型本身和服务端逻辑没有泄露。

View full repository on GitHub →