Token导航 LogoToken导航TokenDH.com
Claude Code Reverse Engineering logo
开发工具未说明官方级别未说明来源级核验

Claude Code Reverse Engineering

MCP Server

Claude Code CLI 是一款用于逆向工程和代码分析的工具,提供终端界面、多代理协作和扩展系统支持。

工具数

0

提示词数

0

GitHub Stars

29

资源数

0
代码分析多代理协作ClaudeClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

jung-wan-kim

提供方

jung-wan-kim

最后核验

2026/5/17 20:19

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

Claude Code CLI——逆向工程设计文档

实施就绪 Anthropic的逆向工程规范 克劳德代码 CLI工具。 通过npm包的源代码映射分析提取(2026年3月)。

______________________________________________________________________

概览

┌─────────────────────────────────────────────────────────────────────┐
│                      Claude Code CLI                                │
│                                                                     │
│   ~1,900 files  ·  512,000+ LOC  ·  TypeScript Strict  ·  Bun     │
│                                                                     │
│   ┌──────────┐  ┌──────────┐  ┌──────────┐  ┌──────────┐          │
│   │  React   │  │   Ink    │  │  Yoga    │  │Commander │          │
│   │   19     │  │ (custom  │  │ (WASM    │  │   .js    │          │
│   │          │  │   fork)  │  │  layout) │  │          │          │
│   └────┬─────┘  └────┬─────┘  └────┬─────┘  └────┬─────┘          │
│        └──────────────┴──────────────┴──────────────┘               │
│                         Terminal UI                                  │
│   ┌─────────────────────────────────────────────────────────────┐   │
│   │                     Core Engine                              │   │
│   │  ┌─────────┐ ┌──────────┐ ┌───────────┐ ┌──────────────┐   │   │
│   │  │  45+    │ │  Query   │ │ Streaming │ │    Cost      │   │   │
│   │  │  Tools  │ │  Engine  │ │ Executor  │ │   Tracker    │   │   │
│   │  └─────────┘ └──────────┘ └───────────┘ └──────────────┘   │   │
│   └─────────────────────────────────────────────────────────────┘   │
│   ┌─────────────────────────────────────────────────────────────┐   │
│   │                    Extension Layer                           │   │
│   │  ┌─────┐ ┌────────┐ ┌────────┐ ┌──────┐ ┌─────┐ ┌──────┐  │   │
│   │  │ MCP │ │Plugins │ │ Skills │ │Hooks │ │ LSP │ │Bridge│  │   │
│   │  └─────┘ └────────┘ └────────┘ └──────┘ └─────┘ └──────┘  │   │
│   └─────────────────────────────────────────────────────────────┘   │
│   ┌─────────────────────────────────────────────────────────────┐   │
│   │                     Services                                 │   │
│   │  ┌────────┐ ┌──────┐ ┌───────────┐ ┌────────┐ ┌─────────┐  │   │
│   │  │  API   │ │ Auth │ │ Analytics │ │Settings│ │Migration│  │   │
│   │  │(4 back)│ │OAuth │ │ DD+OTel  │ │5-layer │ │  chain  │  │   │
│   │  └────────┘ └──────┘ └───────────┘ └────────┘ └─────────┘  │   │
│   └─────────────────────────────────────────────────────────────┘   │
│   ┌─────────────────────────────────────────────────────────────┐   │
│   │                 Security & Permissions                       │   │
│   │  ┌──────────┐ ┌───────────┐ ┌──────────┐ ┌──────────────┐  │   │
│   │  │  7 Perm  │ │ 23 Bash  │ │   Path   │ │  Auto-Mode  │  │   │
│   │  │  Modes   │ │ Checks   │ │Validator │ │ Classifier  │  │   │
│   │  └──────────┘ └───────────┘ └──────────┘ └──────────────┘  │   │
│   └─────────────────────────────────────────────────────────────┘   │
└─────────────────────────────────────────────────────────────────────┘

______________________________________________________________________

设计文件

第1部分——体系结构概述

docs/01-architecture-overview.md ·1101条线路
Startup Sequence (5 phases)
═══════════════════════════════════════════
Phase 0 ─► Module-level side effects (MDM, Keychain prefetch)
Phase 1 ─► main() entry, basic initialization
Phase 2 ─► Commander preAction → init() → migrations
Phase 3 ─► action() → setup() → auth/permissions
Phase 4 ─► REPL render + deferred prefetches
主题关键细节
模块系统仅ESM, .js 需要扩展,懒惰 require() 对于循环
构建Bun bundler, feature() 清除死代码的标志
配置7层:全局→ 项目→ 设置(5个来源)→ CLI → MDM
功能标志通过GrowthBook有89面旗帜, bun:bundle 编译时DCE
状态110个全球领域 bootstrap/state.ts, DO NOT ADD MORE 政策

______________________________________________________________________

第2部分——核心发动机

docs/02-core-engine.md ·1352条线路
Tool Execution Pipeline
═══════════════════════════════════════════
User Input ──► QueryEngine ──► LLM API (streaming)
                                    │
                              tool_use block
                                    │
                    ┌───────────────┼───────────────┐
                    ▼               ▼               ▼
              ┌──────────┐  ┌──────────┐  ┌──────────┐
              │ Bash     │  │ FileEdit │  │ Agent    │
              │ Tool     │  │ Tool     │  │ Tool     │
              └────┬─────┘  └────┬─────┘  └────┬─────┘
                   │             │              │
                   ▼             ▼              ▼
              ToolResult    ToolResult    ToolResult
              { data, newMessages?, contextModifier?, mcpMeta? }
                                    │
                              ◄─────┘
                    Next LLM turn with results
主题关键细节
工具接口60+个字段, buildTool() 工厂,7个默认密钥
并发isConcurrencySafe flag——安全工具并行运行,不安全工具独占运行
恢复8级链:流媒体回退→ 模型回退→ 坍塌排水沟→ 反应式紧凑型
成本跟踪每会话美元累加器,多提供商标准化

______________________________________________________________________

第3部分——许可和安全

docs/03-permission-security.md ·1178条线路
Permission Decision Pipeline (4 steps + auto-mode)
═══════════════════════════════════════════════════
Step 0  Config deny rules ──► deny (immediate)
Step 1  Tool.checkPermissions() ──► allow/deny/ask/passthrough
Step 2  Permanent allow rules ──► allow (skip prompt)
Step 3  passthrough → ask conversion
Step 4  Post-processing:
        ├── dontAsk mode ──► auto deny
        ├── auto mode ──► classifier pipeline:
        │   ├── acceptEdits fast-path
        │   ├── safe-tool allowlist
        │   └── YOLO classifier (2-stage)
        │       ├── allowed ──► allow
        │       ├── blocked ──► deny + denial tracking
        │       └── unavailable ──► iron_gate fail-closed
        └── headless ──► hook or deny
主题关键细节
7种模式default, plan, acceptEdits, bypassPermissions, dontAsk, auto, bubble
Bash安全23个检查ID,19个跨平台+7个Unix+11个仅ANT模式
路径验证6步:标准化→ 符号链接解析→ 遍历→ 窗户图案→ 范围
TOCTU警告路径验证和文件访问不是原子竞争条件窗口

______________________________________________________________________

第4部分——多代理和内存

docs/04-multi-agent-memory.md ·1416条线路
Agent Hierarchy
═══════════════════════════════════════════
                ┌───────────────┐
                │  Coordinator  │  (orchestrator — no direct tool use)
                └───────┬───────┘
           ┌────────────┼────────────┐
           ▼            ▼            ▼
     ┌──────────┐ ┌──────────┐ ┌──────────┐
     │  Worker  │ │  Worker  │ │  Worker  │
     │ (fork)   │ │ (spawn)  │ │(in-proc) │
     └──────────┘ └──────────┘ └──────────┘

Memory Hierarchy (5 layers)
═══════════════════════════════════════════
[1] Session Memory ── in-context summaries
[2] Project Memory ── .claude/memory/ files
[3] User Memory    ── ~/.claude/memory/
[4] Team Memory    ── server-synced shared memory
[5] External       ── MCP servers, LSP, git
主题关键细节
3个Swarm后端fork (共享上下文), spawn (独立), in-process teammate
任务类型7种带有ID前缀的类型: b灰烬, w工作流, a绅士, teammate, r情绪化, m监视器, d
邮箱基于文件: .claude/teams/{team}/inboxes/{agent}.json
团队同步基于ETag的冲突检测(412),无本地文件锁定

______________________________________________________________________

第5部分——扩展系统

docs/05-extension-systems.md ·1709行
6 Extension Points
═══════════════════════════════════════════
┌─────┐ ┌────────┐ ┌────────┐ ┌──────┐ ┌─────┐ ┌──────┐
│ MCP │ │Plugins │ │ Skills │ │Hooks │ │ LSP │ │Bridge│
│     │ │        │ │        │ │      │ │     │ │      │
│8 cfg│ │market- │ │17 bun- │ │27    │ │code │ │IDE   │
│types│ │place + │ │dled +  │ │events│ │intel│ │comms │
│     │ │builtin │ │custom  │ │      │ │     │ │      │
└─────┘ └────────┘ └────────┘ └──────┘ └─────┘ └──────┘
主题关键细节
MCP运输TransportSchema:6种; McpServerConfig:8(+ws-ide,claudeai代理)
挂钩优先级deny > ask > allow --任何钩子的拒绝都会覆盖所有允许
插件加载并行(市场+会话)→ 内置函数→ 合并→ 依赖性验证
重新连接MAX_ERRORS_BEFORE_RECONNECT=3,SSE最大重试次数=2,轮询超时15分钟

______________________________________________________________________

第6部分——UI层

docs/06-ui-layer.md ·1784条线
Render Pipeline
═══════════════════════════════════════════
React Component Tree
        │
        ▼
Custom Reconciler (React 19 HostConfig)
        │
        ▼
Yoga Layout Engine (WASM)
        │  ┌──────────────────────┐
        ├──│ Box  (flexbox node)  │
        ├──│ Text (measure func)  │
        └──│ Button (interactive) │
           └──────────────────────┘
        │
        ▼
Output Renderer (ANSI diff)
        │
        ▼
Terminal stdout (throttled at FRAME_INTERVAL_MS)
主题关键细节
墨水叉96张图片 src/ink/,自定义对账器,瑜伽WASM集成
组件346 .tsx 文件在 src/components/
钩子85+定制挂钩(useTextInput, useTerminalSize, useStdin等等)
并发maySuspendCommit() 总是回来 false --悬架已禁用

______________________________________________________________________

第7部分——服务和基础设施

docs/07-services-infrastructure.md ·1845条线
API Client Factory (4 backends)
═══════════════════════════════════════════
                ┌──────────────────┐
                │  buildFetch()    │
                │  + withRetry()   │
                └────────┬─────────┘
        ┌────────────────┼────────────────┐──────────────┐
        ▼                ▼                ▼              ▼
  ┌──────────┐    ┌──────────┐    ┌──────────┐   ┌──────────┐
  │ Anthropic│    │ Bedrock  │    │ Foundry  │   │ Vertex   │
  │ (Direct) │    │ (AWS)    │    │ (Azure)  │   │ (GCP)    │
  └──────────┘    └──────────┘    └──────────┘   └──────────┘

Retry Strategy:  429 → Retry-After (≤20s: sleep, >20s: 30min cooldown)
                 529 → MAX_529_RETRIES=3 (non-subscriber only)
                 401 → token refresh → retry (no max refresh limit!)
主题关键细节
分析数据狗(44个允许的事件,16个标签字段)+开放遥测+1P记录器
OAuthPKCE流,带明文回退的macOS钥匙串(30s TTL缓存)
设置合并5来源: user → project → local → flag → policy (数组concat,而不是override!)
迁移11同步+1异步,包括 migrateLegacyOpusToCurrent (仅限蚂蚁DCE)

______________________________________________________________________

第8部分-类型、架构和API

docs/08-types-schemas-api.md ·2194条线路
Type System Layers
═══════════════════════════════════════════
┌─────────────────────────────────────────┐
│ Branded IDs                              │
│ SessionId, AgentId, TaskId, ToolUseId   │
├─────────────────────────────────────────┤
│ Core Types                               │
│ Tool, ToolResult,             │
│ ValidationResult, ToolUseContext (30+)   │
├─────────────────────────────────────────┤
│ Zod Schemas                              │
│ HookCommand (discriminated union),       │
│ SettingsSchema (~100 fields),            │
│ TransportSchema (6 literals)             │
├─────────────────────────────────────────┤
│ AppState                                 │
│ DeepImmutable<> wrapper,                 │
│ ~85 fields + Store pattern            │
├─────────────────────────────────────────┤
│ Environment Variables (60+)              │
│ Feature Flags (89)                       │
│ Analytics Events (44 Datadog)            │
└─────────────────────────────────────────┘
主题关键细节
设置json15个类别(身份验证、权限、MCP、钩子、模型、UI……)中的约100个字段
设置合并policySettings 内部优先级:远程>HKLM/plist>文件>HKCU
环境变量跨越7个组的60多个变量(API、模型、身份验证、调试、功能、代理、内部)
功能标志89 bun:bundle feature() 调用,编译时死代码消除

______________________________________________________________________

基础设施和部署

infrastructure/ --使用Terraform IaC完成部署蓝图
Deployment Options
═══════════════════════════════════════════
┌──────────────┐  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐
│   Local Dev  │  │     AWS      │  │    Azure     │  │  Supabase    │
│              │  │              │  │              │  │              │
│ Ollama/vLLM  │  │ ECS Fargate  │  │ Container   │  │ Edge Funcs   │
│ Docker Stack │  │ Bedrock      │  │ Apps         │  │ Realtime     │
│ RTX 4090     │  │ Lambda       │  │ Azure OpenAI │  │ PostgreSQL   │
│              │  │ Cognito      │  │ AD B2C       │  │ Auth         │
│ $0-50/mo     │  │ $45-180/mo   │  │ $50-190/mo   │  │ $0-25/mo     │
└──────────────┘  └──────────────┘  └──────────────┘  └──────────────┘
文档描述
01-local-development.mdOllama、vLLM、LM Studio、Docker Compose全栈
02-aws-architecture.mdVPC、ECS、基岩、Lambda沙盒、CloudWatch
03-azure-architecture.md容器应用程序、Azure OpenAI、函数、监视器
04-supabase-backend.md10表模式、RLS策略、边缘函数
05-cost-analysis.md实际价格:每月9美元→ $25/开发企业
06-architecture-diagram.md7个ASCII图:系统、数据流、身份验证、代理
terraform/10 .tf 文件--生产就绪的AWS IaC

成本快速参考

缩放Subabase+APIAWS FullHybrid(本地GPU)
独奏 (1台设备)9-103美元/月240-280美元/月50美元/月
团队 (10名开发人员)46-116美元/人65-110美元/人35-60美元/人
企业 (100名开发人员)不适用45-111美元/人25美元/每人
LLM代币成本占每个规模总支出的60-95%。

______________________________________________________________________

验证状态

这些文件通过了 8次严格验证通过 对照实际源代码:

Pass 1 ████████████████ 16 corrections  (type/value accuracy)
Pass 2 ████             4 fixes         (blocking implementation gaps)
Pass 3 ███████          7 corrections   (line-by-line precision)
Pass 4 ███              3 fixes         (missing schemas/flows)
Pass 5 ███████          7 additions     (Bridge, MDM, Keychain, Plugin)
Pass 6 ██████████████   42 caveats      (structural problem warnings)
Pass 7 ██               2 micro-fixes   (convergence check)
Pass 8 ─────────────── CONVERGED        (24/24 spot-checks verified)
       ═══════════════
Total: 39 corrections + 42 implementation caveats

______________________________________________________________________

快速开始

# Clone the repo
git clone https://github.com/jung-wan-kim/claude-code-reverse-engineering.git
cd claude-code-reverse-engineering

# Read the design docs (start here)
open docs/01-architecture-overview.md

# Deploy infrastructure (AWS)
cd infrastructure/terraform
cp terraform.tfvars.example terraform.tfvars
# Edit terraform.tfvars with your settings
terraform init && terraform plan

______________________________________________________________________

存储库结构

claude-code-reverse-engineering/
├── README.md                          ← You are here
├── docs/
│   ├── 01-architecture-overview.md    (1,101 lines)
│   ├── 02-core-engine.md             (1,352 lines)
│   ├── 03-permission-security.md     (1,178 lines)
│   ├── 04-multi-agent-memory.md      (1,416 lines)
│   ├── 05-extension-systems.md       (1,709 lines)
│   ├── 06-ui-layer.md               (1,784 lines)
│   ├── 07-services-infrastructure.md (1,845 lines)
│   └── 08-types-schemas-api.md       (2,194 lines)
└── infrastructure/
    ├── 01-local-development.md
    ├── 02-aws-architecture.md
    ├── 03-azure-architecture.md
    ├── 04-supabase-backend.md
    ├── 05-cost-analysis.md
    ├── 06-architecture-diagram.md
    └── terraform/
        ├── main.tf
        ├── variables.tf
        ├── vpc.tf
        ├── compute.tf
        ├── database.tf
        ├── storage.tf
        ├── auth.tf
        ├── monitoring.tf
        ├── outputs.tf
        └── terraform.tfvars.example

______________________________________________________________________

免责声明

这是一项逆向工程工作 仅用于教育和安全研究目的原始Claude Code软件的所有权利均归 Anthropic → 安thropic(音译)或 人类中心(意译).

许可证

MIT(仅提供文档,不包括原始的Claude Code软件)

目录标签

目录标签

代码分析多代理协作ClaudeHCL本地部署逆向工程终端工具扩展系统

支持客户端

Claude

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

oauth

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明oauth部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP