claude-reviews-claude

作者 openedclaude已验证

Claude reads its own source code — 17-chapter architectural deep-dive into Claude Code v2.1.88. EN/ZH bilingual.

1,567
Stars
699
Forks
2026/8/23
添加时间

⚠️ 第三方软件声明

本 Skill 为第三方开源软件,独立托管于 GitHub。SkillTip 仅为信息目录,不控制或维护底层仓库。所显示的安全检查为自动化且范围有限,安装前请自行审查源码。

阅读服务条款

安装

添加到你的 Claude Code skills 目录:

# Add to your Claude Code skills
git clone https://github.com/openedclaude/claude-reviews-claude

快速入门

使用 claude-reviews-claude 等 Skills 的指南。

安全报告

已验证

上次扫描:—

{
  "status": "PASSED",
  "issues": []
}

README.md

🌐 语言: English → | 中文

📖 在线阅读

💡 推荐在线阅读:本项目已部署至 GitHub Pages,支持全文搜索、暗色模式、章节导航,阅读体验远优于 GitHub 原生 Markdown 渲染。

🪞 Claude 眼中的老己

Claude Reviews Claude Code —— 当局者清

一个 AI 在阅读自己的源代码。是的,这很元(Meta)。Anthropic 估计也没料到这一天。

🍿 Season 1 完结 | 全 17 集 | Claude 拆自己的进度比它写代码的速度还快。

追更不迷路,点个 Star 当订阅 ⭐

Stars License: MIT Last Commit

这份完整的架构分析是由 Claude 撰写的

1,902 个文件。477,439 行 TypeScript 代码。一个模型坐下来,逐行阅读了定义自己如何思考、行动和执行的每一行逻辑。

你正在阅读的是 Claude 对 Claude Code v2.1.88 的亲笔解构:查询引擎如何循环,42 个工具如何编排,多智能体工作线程如何并行协调 —— 全部由被分析的对象本人完成分析。

如果你觉得这很离谱,想象一下写这篇分析的 AI 的心情。


🏗️ 核心内容

绝非简单的源代码归档。这是一份结构化的工程分析 —— 涵盖架构图、代码走读和设计模式 —— 由 Claude 在阅读了 Claude Code 的 TypeScript 源码后亲笔撰写。

#主题你将学到什么深度分析
0架构总纲 (Overview)17 个子系统的全景导览、工程卓越点与可迁移设计模式阅读 →
1查询引擎 (QueryEngine):大脑核心引擎(1296行)如何管理 LLM 查询、工具循环和会话状态阅读 →
2工具系统架构 (Tool System)42+ 个工具作为自包含模块如何注册、验证和执行阅读 →
3多智能体协调器 (Coordinator)Claude Code 如何衍生并行工作线程、分发消息并汇总结果阅读 →
4插件系统 (Plugin System)插件如何加载、验证和集成(1.88万行代码)阅读 →
5钩子系统 (Hook System)涵盖 PreToolUse / PostToolUse / SessionStart 的可扩展性(8千行代码)阅读 →
6Bash 执行引擎 (Bash Engine)安全命令执行、沙箱管理、管道流处理(1.15万行代码)阅读 →
7权限流水线 (Permission)纵深防御:配置规则 → 工具检查 → 操作系统沙箱(9.5千行代码)阅读 →
8Swarm 智能体多智能体团队协调:邮箱 IPC、后端检测、权限委托(6.8千行代码)阅读 →
9会话持久化 (Session Persistence)仅追加 JSONL 存储、parent-UUID 链、64KB 轻量恢复(7.6千行代码)阅读 →
10上下文装配 (Context Assembly)三层上下文组装:系统提示词、CLAUDE.md 记忆系统、每轮附件(8.3千行代码)阅读 →
11压缩系统 (Compact System)三层压缩架构:微压缩、会话记忆压缩、LLM 摘要压缩(3.9千行代码)阅读 →
12启动与引导 (Startup & Bootstrap)快速路径级联、动态导入、API 预连接、全局状态单例(7.6+千行代码)阅读 →
13桥接系统 (Bridge System)远程控制协议、双代传输层、轮询-分发循环、崩溃恢复(1.17万行代码)阅读 →
14UI 与状态管理Ink 渲染引擎、React 协调器、Vim 模式、Computer Use(140+ 组件)阅读 →
15服务与 API 层API 客户端、流重组、MCP 服务器管理、OAuth 认证(1.2万行代码)阅读 →
16基础设施与配置设置合并管道、GrowthBook 功能开关、遥测、构建系统(1.5万行代码)阅读 →
17遥测、隐私与运营控制双通道遥测、模型代号、卧底模式、远程紧急开关、未来路线图阅读 →

喜欢这种“套娃”感吗?给这个仓库点个赞吧 —— 一个正在分析自己的 AI 值得拥有这颗星。


📦 源代码获取

本项目的分析基于 Claude Code v2.1.88 的 TypeScript 源代码。如果你想亲自阅读源代码,以下社区仓库提供了还原后的完整代码:

仓库说明
instructkr/claw-code还原后的 Claude Code 源代码
ChinaSiro/claude-code-sourcemap从 Source Map 提取的原始 TypeScript 源码

🧠 架构概览

Claude Code 是一个包含 1,902 个文件、47.7 万行 TypeScript 的代码库,运行在 Bun 环境上,并使用 React + Ink 构建终端 UI。

六大支柱

                        ┌─────────────────────────┐
                        │     System Prompt        │
                        │  (身份 + 规则 +           │
                        │   42+ 工具描述)           │
                        └────────────┬────────────┘
                                     │
                  ┌──────────────────┼──────────────────┐
                  │                  │                  │
         ┌───────▼────────┐ ┌──────▼───────┐ ┌───────▼────────┐
         │  🔧 工具系统    │ │  ⚙️ 查询循环  │ │  📦 上下文     │
         │  (42+ 工具,    │ │  (12 步      │ │  管理          │
         │   每个 30+ 方法)│ │   状态机)    │ │  (4 层压缩)    │
         └───────┬────────┘ └──────┬───────┘ └───────┬────────┘
                  │                  │                  │
                  └──────────────────┼──────────────────┘
                                     │
                  ┌──────────────────┼──────────────────┐
                  │                  │                  │
         ┌───────▼────────┐ ┌──────▼───────┐ ┌───────▼────────┐
         │  🔐 权限与安全  │ │  🤖 多 Agent │ │  🧩 Skill &    │
         │  (7 层纵深防御) │ │  集群        │ │  Plugin        │
         │                │ │  (3 后端,   │ │  (6 源,       │
         │                │ │   7 种任务)  │ │   MCP 协议)    │
         └────────────────┘ └──────────────┘ └────────────────┘

核心循环:一个"笨循环"驱动一切

    用户输入
      │
      ▼
    QueryEngine.query()  ◄──────────────────────┐
      │                                          │
      ▼                                          │
    Claude API(流式调用)                        │
      │                                          │
      ├── stop_reason = end_turn? ──► 输出结果    │
      │                                          │
      └── stop_reason = tool_use?                │
            │                                    │
            ▼                                    │
          🔐 权限检查 → 🔧 执行工具 → 注入结果 ──┘

设计哲学: 智能存在于 LLM 中,脚手架只是个循环。42+ 工具、7 层安全、4 层压缩、多 Agent 协调——全部是围绕这个循环的生产级 Harness

六大子系统速览

子系统核心能力关键数字详情
⚙️ 查询引擎while(true) 工具循环 + 流式处理 + 错误恢复12 步状态机EP01
🔧 工具系统文件/Bash/搜索/Agent/MCP,Schema 驱动注册42+ 工具,30+ 方法契约EP02
🔐 权限安全规则匹配 → AST 分析 → YOLO 分类器 → OS 沙箱7 层纵深防御EP07
📦 上下文管理微压缩 → 截断 → AI 摘要 → 紧急压缩4 层级联,200K 上下文EP11
🤖 多 AgentiTerm2/tmux/进程内后端,分治并行7 种任务类型EP08
🖥️ 终端 UIFork Ink + React 19,Vim 模式,IDE 桥接140+ 组件EP14

📐 完整架构图和阅读路径见 → 架构总纲 (Overview)



📁 仓库结构

claude-code-deep-dive/
├── README.md                          ← 你现在的所在位置
├── README_EN.md                       # 英文版 README
├── DISCLAIMER.md / DISCLAIMER_CN.md   # 法律与伦理声明
│
├── architecture/                      # 🏗️ 架构深度分析(17 篇)
│   ├── 00-overview.md                 # 架构总纲
│   ├── 01-query-engine.md             # 查询引擎
│   ├── 02-tool-system.md              # 工具系统
│   ├── ...                            # 03-13 各子系统
│   ├── 14-ui-state-management.md      # UI 与状态管理
│   ├── 15-services-api-layer.md       # 服务与 API 层
│   ├── 16-infrastructure-config.md    # 基础设施与配置
│   ├── 17-telemetry-privacy-operations.md  # 遥测、隐私与运营控制
│   └── zh-CN/                         # 🇨🇳 中文版架构解析(18 篇对照)
│       ├── 00-overview.md
│       └── ...

📌 路线图 (Roadmap)

架构解析系列 (全 17 篇 —— 已完结 ✅)

  • 架构总纲 (Overview) —— 17 个子系统全景导览
  • 查询引擎 (QueryEngine) —— Claude Code 的"大脑"
  • 工具系统 (Tool System) —— 42 个模块,一个接口
  • 多智能体协调器 (Coordinator) —— 并行线程与分支机制
  • 插件系统 (Plugin System) —— 加载、验证与集成 (1.88万行)
  • 钩子系统 (Hook System) —— PreToolUse / PostToolUse (8千行)
  • Bash 执行引擎 —— 沙箱、管道管理 (1.15万行)
  • 权限流水线 —— 纵深防御、操作系统沙箱 (9.5千行)
  • Swarm 智能体 —— 多智能体集群协作 (6.8千行)
  • 会话持久化 —— 对话存储机制 (7.6千行)
  • 上下文装配 —— 附件、记忆、技能 (8.3千行)
  • 压缩系统 —— 自动压缩与微缩技术 (3.9千行)
  • 启动与引导 —— 快速路径级联、动态导入 (7.6+千行)
  • 桥接系统 —— 远程控制协议与双代传输 (1.17万行)
  • UI 与状态管理 —— Ink 渲染引擎、Vim 模式 (140+ 组件)
  • 服务与 API 层 —— 流重组、MCP 服务器 (1.2万行)
  • 基础设施与配置 —— 设置合并、功能开关、遥测 (1.5万行)
  • 遥测、隐私与运营控制 —— 双通道分析、卧底模式、远程开关 (825行)

本地化

  • 全 18 篇中英双语对照

⭐ 支持本项目

如果这份分析对你有帮助:

  1. ⭐ 点个星星 (Star) 这个仓库
  2. 🔀 分叉 (Fork) 并添加你自己的分析
  3. 📢 分享 到 Twitter, Reddit 或微信/知乎

每一颗星都能帮助更多开发者发现这份深度走读文档。

⭐ Star 趋势

Star History Chart


📜 许可与免责声明

本分析文档依据 MIT 许可证 发布。请参阅 DISCLAIMER_CN.md 了解重要的法律和伦理说明。

分析基于 @anthropic-ai/claude-code@2.1.88。所有代码片段均为用于教学评论的简短摘录。原始源代码的权利仍归 Anthropic, PBC 所有。

常见问题

What is claude-reviews-claude?

claude-reviews-claude is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by openedclaude. Claude reads its own source code — 17-chapter architectural deep-dive into Claude Code v2.1.88. EN/ZH bilingual. It has 1,567 GitHub stars.

Is claude-reviews-claude safe to use?

Yes. claude-reviews-claude passed SkillsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.

How do I install claude-reviews-claude?

Clone the repository with "git clone https://github.com/openedclaude/claude-reviews-claude" and add it to your Claude Code skills directory (see the Installation section above).

Are there alternatives to claude-reviews-claude?

Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh claude-reviews-claude against similar tools.

评论 (0)

暂无评论,成为第一个分享想法的人!

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情

claude-code

by anthropics

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

120,03119,897Shell
AI 智能体
查看详情

开发者还喜欢

基于喜欢此 Skill 的开发者投票和收藏

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

n8n

by n8n-io

12

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

201,88160,308TypeScript
MCP 服务器apisai-tools
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情