Skip to content

Phase 4: Extension & Advanced (Chapters 14-20)

Tasks

CH14: Context & System Prompt

  • [x] CH14-CN: 第14章 - 上下文构建与系统提示
  • [x] CH14-EN: Chapter 14 - Context Construction & System Prompt
  • Acceptance: Reader understands how the system prompt is assembled and how context stays within limits
  • Done: Covered getUserContext/getSystemContext memoized assembly (Git snapshot, CLAUDE.md loading, current date), full five-layer CLAUDE.md hierarchy (Managed/User/Project/Local/AutoMem) with directory traversal and @include directive, getSystemPrompt builder with static/dynamic boundary for Prompt Cache optimization, seven static sections and systemPromptSection registry for dynamic sections, memdir Auto Memory system with MEMORY.md index and path resolution, and three context compression strategies (Auto Compact with circuit breaker, Micro Compact with Cached MC cache_edits variant, Time-Based Micro Compact). Both CN (~4800 words) and EN (~4700 words) files written with Mermaid diagrams.

CH15: MCP Integration

  • [x] CH15-CN: 第15章 - MCP 协议集成
  • [x] CH15-EN: Chapter 15 - MCP Protocol Integration
  • Acceptance: Reader can explain how external MCP servers extend Claude Code's capabilities
  • Done: Covered config scopes, five transport types, connectToServer lifecycle, MCPTool wrapper, naming convention, OAuth auth flow, and MCP Resources. Both CN (~3800 words) and EN (~3700 words) files written.

CH16: Sub-Agent & Multi-Agent

  • [x] CH16-CN: 第16章 - 子 Agent 与多 Agent 协作
  • [x] CH16-EN: Chapter 16 - Sub-Agent & Multi-Agent Coordination
  • Acceptance: Reader understands the full multi-agent architecture and permission delegation model
  • Done: Covered AgentTool entry point, runAgent.ts complete lifecycle, createSubagentContext isolation model, Coordinator mode with task-notification protocol, Swarm architecture with three backends (tmux/iTerm2/in-process) and auto-detection, seven task types including LocalAgentTask and InProcessTeammateTask state management, leaderPermissionBridge permission escalation protocol, fork sub-agents with context inheritance and cache-sharing, agent-level MCP injection, and token optimization strategies. Both CN (~4500 words) and EN (~4600 words) files written.

CH17: Skills & Plugin System

  • [x] CH17-CN: 第17章 - Skills 与插件系统
  • [x] CH17-EN: Chapter 17 - Skills & Plugin System
  • Acceptance: Reader can create a custom skill and understands the plugin architecture
  • Done: Covered loadSkillsDir file discovery and frontmatter parsing, paths conditional activation via gitignore-syntax matching, bundledSkills built-in set, SkillTool two-mode execution (inline prompt injection vs. full agent delegation), plugin identifier system and installation lifecycle, settings-first idempotent install pattern, and O_EXCL|O_NOFOLLOW symlink-attack guard. Both CN (~2982 Chinese chars) and EN (~3761 words) files written with Mermaid plugin lifecycle diagram.

CH18: Services Layer

  • [x] CH18-CN: 第18章 - 服务层:API、分析与 LSP
  • [x] CH18-EN: Chapter 18 - Services Layer: API, Analytics & LSP
  • Acceptance: Reader has a map of all service modules and their responsibilities
  • Done: Covered all services/ subdirectories. api/: multi-provider client factory (Bedrock/Vertex/Foundry/direct), withRetry AsyncGenerator with differentiated 529 handling and Opus fallback, context overflow self-repair, and usage tracking. analytics/: zero-dependency queue-then-sink architecture, never-typed privacy guardrail, GrowthBook feature flags with two read semantics, and Datadog batched upload. lsp/: four-layer stack, lazy server startup, plugin-sourced config, and LSPDiagnosticRegistry injection mechanism. oauth/: complete PKCE flow, local callback listener, token refresh optimization. Brief coverage of SessionMemory (forked subagent extraction), autoDream (three-gate consolidation), and cross-references to compact/mcp/plugins chapters. Both CN (~3400 words) and EN (~3500 words) files written with Mermaid architecture diagram.

CH19: Settings, Configuration & Hooks

  • [x] CH19-CN: 第19章 - 配置系统与 Hooks 机制
  • [x] CH19-EN: Chapter 19 - Settings, Configuration & Hooks
  • Acceptance: Reader understands the full configuration hierarchy and can implement a custom hook
  • Done: Covered six-layer configuration hierarchy with settingsMergeCustomizer deep-merge strategy, SettingsSchema fields tour, all major hook event types with input formats, four hook command types (command/prompt/agent/http), exit code protocol table (including exit-2 model injection), complete worked example PostToolUse notification hook, security implications (Trust Dialog, allowManagedHooksOnly), and keybindings.json with 17 context zones and ~70 actions. Both CN (~657 lines) and EN (~669 lines) files written.

CH20: Peripheral Features & Utilities

  • [x] CH20-CN: 第20章 - 周边功能与工具集
  • [x] CH20-EN: Chapter 20 - Peripheral Features & Utilities
  • Acceptance: Reader has a reference map for all peripheral features
  • Done: Covered Bridge system (JWT auth, trusted device, session management, poll-based transport), CLI transports (SSE/WebSocket/Hybrid), Remote/CCR integration, Direct Connect Unix socket server, Vim mode state machine with operator system, Migrations framework, Utils subdirectory map (bash/permissions/swarm/settings/model/telemetry), and miscellaneous modules (Buddy, voice, outputStyles). Both CN (~483 lines) and EN (~488 lines/3423 words) files written with Mermaid Bridge architecture diagram.

Notes

  • CH14 and CH18 can run in parallel (both depend on CH05)
  • CH15 depends on CH06; CH16 depends on CH05 + CH06
  • CH17 and CH19 can run in parallel (depend on CH08/CH03)
  • CH20 is independent (only needs CH01)

Built for learners who want to read Claude Code like a real system.