Tutorial Summary: From User to Source-Level Researcher

Congratulations on finishing this tutorial set. This page reviews what you learned and where to go deeper.


What you have mastered

Chapter 1: Global overview

Chapter 2: Architecture design

Chapter 3: Core engine

Chapter 4: Tool system

Chapter 5: Hidden capabilities

Chapter 6: Engineering practices


Core architecture diagram (compact)

User input (keyboard / voice / Bridge)
         │
    Ink TUI layer (React components)
         │
    query.ts main loop
         │
    ┌────┴────────────────────┐
    │  Anthropic API          │
    │  (claude.ts, 122KB)     │
    └────┬────────────────────┘
         │
    Tool dispatch layer
         │
    ┌────┴──────────────────────────────────────────────────┐
    │  BashTool │ FileEditTool │ AgentTool │ MCPTool │ ... │
    └───────────────────────────────────────────────────────┘
         │
    Hooks system (intercept any stage)
         │
    sessionStorage (JSONL persistence)
         │
    Services layer (compact/analytics/lsp/mcp/...)

Suggested deep-dive paths

Path A: AI Agent architecture

  1. Read src/query.ts (main loop, ~820 lines)
  2. Understand src/tools/AgentTool/AgentTool.ts (recursive sub-agent execution)
  3. Study src/coordinator/coordinatorMode.ts (multi-agent orchestration)
  4. Compare with AutoGPT / LangGraph / CrewAI

Path B: terminal UI engineering

  1. Read core components under src/components/ (REPL/PermissionRequest/InputBox)
  2. Understand pure-function state machine design in src/vim/
  3. Study how Ink renders React in terminal
  4. Compare with tui-rs (Rust) and bubbletea (Go)

Path C: feature release engineering

  1. Study src/services/analytics/growthbook.ts (full GrowthBook SDK configuration)
  2. Understand src/services/api/withRetry.ts (multi-layer backoff strategy)
  3. Study telemetry event types in metadata.ts (31KB, 100+ event types)
  4. Compare with LaunchDarkly / Statsig

Path D: AI safety engineering

  1. Study permission system under src/utils/permissions/
  2. Understand src/utils/hooks/ssrfGuard.ts (SSRF protection)
  3. Study BASH_CLASSIFIER (command safety classifier for Auto mode)
  4. Extend to prompt injection attack/defense patterns

Most valuable docs to reread

DocWhy it matters
ch03-core-engine/02-query-loop.mdexplains how Claude "thinks" operationally
ch04-tools/03-permission-system.mdcore of the safety model
ch05-advanced/01-kairos.mdfull blueprint of persistent AI
ch05-advanced/02-coordinator.mdmulti-agent system design principles
ch06-engineering/01-three-layer-gates.mdtop-tier release engineering model

One-sentence conclusion

Claude Code is an AI Agent operating system: React+Ink render the terminal UI, query.ts drives 53 tools, three-layer gates control 50+ capabilities, and the full internal shape is significantly richer than the external build.