1. Conduid
  2. Agents
  3. Claude Code Docs
MCP server · Agents

Claude Code Docs

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

52Fair

Scored 2 hours ago · breakdown

About Claude Code Docs

Claude Code Docs is an MCP server published by anneheartrecord in the Agents category: chapter-by-chapter teardown of a production coding agent — agent loop, context engineering, compaction, permissions, MCP. 13 chapters, Chinese and English.

The repository has 177 stars and 26 forks, with the last commit 2 months ago. Recent commit activity is the strongest signal that reported issues will get attention.

Install

From source
git clone https://github.com/anneheartrecord/claude-code-docs

This server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.

Ask AI

✦

Ask AI about Claude Code Docs

Powered by Claude · Grounded in docs

I know everything about Claude Code Docs. Ask me about installation, configuration, usage, or troubleshooting.

Security checks

Static checks derived from the repository just now. Heuristics on the source, not an audit.

  • ✓README presentThe repository ships documentation.
  • ✓License declaredUsable under a stated license.
  • !Tests presentNo tests found. Behaviour changes may go unnoticed between versions.
  • !Dependencies pinnedNo lockfile. Installs can pull different code over time.

2 checks have not been run yet.

Releases

v1.1.0v1.1.0 — cross-link repair, LICENSE, and CI · 11 Aug 2026First maintenance release since the initial publication. No chapter conclusions changed; this fixes defects and puts the repo on a footing where the next content update can be verified automatically. Fixed All 56 chapter cross-links 404'd…

README

English

Claude Code 源码解剖

License docs-check Docs Language Lines PRs Welcome

📖 在线阅读: 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,负责模型推理,模型本身和服务端逻辑没有泄露。

但客户端的这部分代码已经足够有价值了。因为 Agent 产品的核心竞争力不只在模型调用侧,也在于怎么通过设计 Agent 将模型的能力安全、高效、稳定地释放出来。

有意思的是,从 git 历史看,这份代码本身很可能就是 AI 写的:20 个 commit 全部来自同一个账号 claude-code-best,其中三个带着 Co-Authored-By: Claude Opus 4.6。51.5 万行代码一次编译零报错。AI 把功能写得挑不出毛病,却栽在一个基础的发布配置细节上。

这个仓库做了什么

我用 Claude Code 对这份源码做了系统化的技术分析,逐模块拆解,写了 13 篇技术文档,中英双语。

从架构设计到 Agent 循环的六阶段实现,从三层消息压缩体系到权限校验系统,从五层记忆加载到工具的执行流水线。

同时从 82 个 feature flag 里挖出了 Anthropic 还没发布的未来功能蓝图:Kairos 自主运行模式、Context Collapse 上下文折叠、Voice Mode 语音交互。

最后几篇是我自己的思考:这份代码到底值不值钱、AI Coding 时代工程师怎么做 Code Review、以及从源码里能看到 Claude 封号机制的哪些线索。

目标读者: 正在做 Agent 产品的工程师、对 AI Agent 架构感兴趣的开发者、想了解顶级 Agent 系统如何工程化落地的技术人,非技术背景的同学也能从中了解到 Agent 产品的运作方式和行业趋势。

文档目录

概览篇

文档 内容
01-架构总览 整体架构、技术栈、核心文件、一次请求的完整旅程
02-源码泄露的价值之争 产物 vs Harness 能力,两派观点分析,代码是快照能力是动态的

核心模块篇

文档 内容
03-Agent 循环 六阶段 ReAct 循环、AsyncGenerator 设计、状态管理、思维链保留
04-上下文工程 System Prompt 构建、CLAUDE.md 加载、分层优先级、预取缓存、Prompt Cache 优化
05-消息压缩系统 三层压缩:微压缩、Session Memory、Full Compact,熔断器、递归保护
06-权限系统 三模式权限、YOLO 分类器、42 条拦截规则、文件沙箱、Dangerous Rule Stripping
07-记忆管理 五层记忆加载、@include 指令、MEMORY.md 管理、Session Memory
08-工具与 Skill 系统 40+ 工具注册、执行流水线、Pre/Post Hook、Skill fork 机制
09-MCP 集成 六种传输协议、OAuth、七种配置作用域

前瞻篇

文档 内容
10-未来功能蓝图 82 个 feature flag 解析、Kairos 自主模式、Context Collapse、语音模式
11-AI Coding 时代的 Code Review 个人/团队/CICD 三层 Review 范式、Review Agent 设想
12-从权限系统学 Agent 安全设计 三层防御体系拆解、L0-L4 安全成熟度模型、落地建议
13-啃完源码之后的一些发现 AI 工程化短板、生产事故、Claude 封号机制分析

上手复现

被还原出来的源码仓库可以直接跑:

git clone https://github.com/anthropics/claude-code.git
cd claude-code

bun install
bun run build
# ✓ Bundled 5344 modules in 554ms
#   cli.js  25.89 MB

bun run dev --version
# 2.1.888 (Claude Code)

关键数据

指标 数据
代码总量 515,498 行 TypeScript/TSX
文件数 2,766
构建产物 25.89 MB,5,344 模块
内置工具 40+
Feature Flag 82 个
权限拦截规则 42 条硬编码危险模式
消息压缩阈值 上下文窗口 - 13,000 token
npm 依赖 583 个包

版本覆盖范围

源码解读一定会过时,所以这里把「分析基于哪个快照」写清楚,而不是让读者去猜。

项 值
源码快照 2026-03-31 的 sourcemap 还原产物
该构建自报版本 2.1.888
章节内容最近复核 2026-04-24(v1.0.0)
仓库最近维护 2026-08-11(v1.1.0,链接与工具链,未改章节结论)

上游改动导致某章描述失效,请开 版本漂移 issue。这是本仓库最欢迎的一类 issue。

参与贡献

最有价值的贡献不是加内容,是指出哪里写错了。事实纠错优先级最高,issue 7 天内首次回应。

  • 纠错与提议:见 贡献指南(事实纠错必须带证据)
  • 变更记录:见 CHANGELOG.md
  • 本地自检:python3 scripts/check_links.py && python3 scripts/check_bilingual.py

License

MIT,覆盖本仓库的原创内容:13 篇分析、插图、站点配置与 scripts/。

本仓库不再分发 Claude Code 源码本身;引用的代码片段、商标归属与准确性声明见 NOTICE.md。

README fetched from the repository just now. The original is authoritative.

Questions

About Claude Code Docs

How do I install Claude Code Docs?

No package has been published for this server, so install it from source: clone the repository and follow its README.

Is Claude Code Docs safe to use with an AI agent?

Its trust score is 52 out of 100 (fair). It passes 2 of the 4 static security checks run so far; the failures are listed above. It has no ConduID identity yet, so agent calls to it are not receipted.

Is Claude Code Docs still maintained?

Yes — the latest release is v1.1.0 (11 Aug 2026), and the last commit was 2 months ago. The repository has 177 stars and 3 open issues.