01 / 20 Overview Source Review · March 2026

Claude Code is 513K lines of TypeScript.

The complete source for Anthropic's AI coding agent — the CLI, desktop app, VS Code & JetBrains extensions, and claude.ai/code. Runs on Bun (not Node), renders with a custom React-for-terminal fork, talks to 4 cloud providers.

1,902
Source files — TypeScript & TSX
43
Built-in tools — plus feature-gated experimentals
84
Slash commands — /help to /ultraplan
170+
Env variables — control every aspect

Technology Stack

RT
Bun Runtime
feature() gates for compile-time dead code elimination between internal/external builds. 26 flags strip ANT-only code.
UI
Ink — React for the Terminal
Heavily customized fork with Yoga WASM flexbox engine, custom React reconciler, double-buffered ANSI rendering. 389 component files.
ST
Zustand + React Context
150+ field Bootstrap State (global singleton) + App State (Zustand store with immer). Two-layer architecture.
API
Anthropic SDK — 4 Providers
First-party, AWS Bedrock (STS), Google Vertex (GoogleAuth), Azure Foundry (AD). Same model, different infrastructure.
SB
macOS Native Sandbox
@anthropic-ai/sandbox-runtime — network domain allowlist, filesystem restrictions. Policy-controlled.
MCP
6 MCP Transports
stdio, SSE, HTTP, WebSocket, SDK Control, In-Process — 24 integration files in services/mcp/.

Directory Map

main.tsx 4,683 lines query/ loop tools/ 43 tools services/api/ client ink/ renderer components/ 144 hooks/ 85 state/ Zustand memdir/ memory services/compact/ context skills/ 19 bundled utils/swarm/ teams bridge/ IDE/remote commands/ 84 utils/permissions/ 5 layers services/mcp/ 24 files buddy/ companion vim/ full vim mode voice/ voice input

Key Numbers

2,000+

Source files

43

Built-in tools

100+

CLI commands

39

Service modules

85

React hooks

144

UI components

24

MCP files

564

Utility files