Claude Code Architecture Overview
What is Claude Code?
Claude Code is a terminal-based AI assistant built by Anthropic. It integrates Claude (Anthropic's LLM) directly into your terminal, allowing natural language interaction with your codebase, file system, and shell commands.
Think of it as: A REPL (Read-Eval-Print Loop) where the "input" is natural language, the "eval" is Claude + tools, and the "output" is code changes, explanations, or terminal output.
High-Level Architecture
┌─────────────────────────────────────────────────────────────────────────────┐
│ USER INTERFACE │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ Terminal │ │ REPL │ │ Bridge │ │ SDK/API │ │
│ │ (TUI) │ │ (Main) │ │ (Remote) │ │ (Headless) │ │
│ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘ │
└─────────┼─────────────────┼─────────────────┼─────────────────┼───────────┘
│ │ │ │
└─────────────────┴────────┬────────┴─────────────────┘
│
┌────────▼────────┐
│ CORE ENGINE │
│ ┌───────────┐ │
│ │ Query │ │
│ │ Engine │ │
│ └─────┬─────┘ │
│ │ │
│ ┌─────▼─────┐ │
│ │ Tool │ │
│ │ System │ │
│ └─────┬─────┘ │
│ │ │
│ ┌─────▼─────┐ │
│ │ Task │ │
│ │ Manager │ │
│ └───────────┘ │
└────────┬────────┘
│
┌────────────────────────────┼────────────────────────────┐
│ │ │
┌──────▼──────┐ ┌─────────▼──────────┐ ┌──────────▼─────────┐
│ STATE │ │ SERVICES │ │ EXTERNAL │
│ ┌────────┐ │ │ ┌──────────────┐ │ │ SYSTEMS │
│ │AppState│ │ │ │ MCP Client │ │ │ ┌──────────┐ │
│ │ Store │ │ │ │ (Servers) │ │ │ │Claude API│ │
│ └────────┘ │ │ └──────────────┘ │ │ └──────────┘ │
│ ┌────────┐ │ │ ┌──────────────┐ │ │ ┌──────────┐ │
│ │ Message│ │ │ │ Analytics │ │ │ │ GitHub │ │
│ │ History│ │ │ └──────────────┘ │ │ └──────────┘ │
│ └────────┘ │ │ ┌──────────────┐ │ │ ┌──────────┐ │
└─────────────┘ │ │ LSP │ │ │ │ File │ │
│ │ (Lang Svcs) │ │ │ │ System │ │
│ └──────────────┘ │ │ └──────────┘ │
└──────────────────┘ └──────────────────┘