Skip to content

基础设施层概览

基础设施层涵盖 Claude Code 的底层支撑系统:入口点、迁移、内存目录、插件/技能、任务、Schema、服务器和远程会话。

架构位置

┌──────────────────────────────────────────┐
│  UI Layer      (components, hooks, ink)  │
├──────────────────────────────────────────┤
│  Commands      (70~100+ user commands)   │
├──────────────────────────────────────────┤
│  Services      (compact, analytics, MCP) │
├──────────────────────────────────────────┤
│  Core Engine   (QueryEngine, Tools)      │
├──────────────────────────────────────────┤
│  ► Infrastructure (本层)                 │
│    ┌──────────┬───────────┬────────────┐ │
│    │ CLI 入口  │ 迁移系统   │ 内存目录   │ │
│    ├──────────┼───────────┼────────────┤ │
│    │ 插件/技能 │ 任务系统   │ Schema    │ │
│    ├──────────┼───────────┼────────────┤ │
│    │ 服务器    │ 远程会话   │ 协调器     │ │
│    └──────────┴───────────┴────────────┘ │
└──────────────────────────────────────────┘

子系统概览

子系统目录文件数核心职责
CLI 入口点entrypoints/, cli/~15程序启动、参数解析、模式分发
迁移系统migrations/11设置格式升级、模型更名
内存目录memdir/8MEMORY.md 索引、记忆类型、检索
插件与技能plugins/, skills/6扩展注册、技能加载、市场
任务系统tasks/9后台任务、调度、持久化
Schemaschemas/1Hooks Zod 验证(仅 hooks.ts)
服务器server/3Direct-connect 本地服务器
远程会话remote/4CCR 远程会话管理
协调器coordinator/1多 Agent 编排