Bootstrap edge
Start with the CLI bootstrap to understand mode routing and fast paths.
src/entrypoints/cli.tsxsrc/main.tsx
Project Architecture
The most useful mental model is layered: bootstrap, interactive surface, query runtime, extension surface, policy state, and remote capabilities.
The source snapshot shows a platform-style application rather than a small chat CLI. The key architectural move is separation of concerns: bootstrap and mode routing live in one layer, the REPL and app state in another, query and tool orchestration in another, and permissions/auth/extensibility as cross-cutting layers.
Draw.io-style overview
Diagram views
The primary runtime stack from bootstrap through query and tools.
Source anchors
Start with the CLI bootstrap to understand mode routing and fast paths.
src/entrypoints/cli.tsxsrc/main.tsxInput normalization is the transition from user intent to runtime work.
src/utils/processUserInput/processUserInput.tsThe query loop and tool runtime are the system center of gravity.
src/query.tssrc/services/tools/toolOrchestration.tsFast-path entrypoints decide whether Claude Code behaves like a full interactive CLI, a headless engine, a bridge process, or an MCP server.
The REPL and supporting UI state render conversation history, task status, tool output, permissions, and remote controls.
User input is normalized, streamed through query orchestration, and converted into ordered, concurrency-aware tool execution.
Commands, skills, plugins, MCP servers, and LSP integrations are all loaded into the same runtime surface and filtered by policy.
A deep settings and permission system governs what the runtime is allowed to do, how it authenticates, and how sessions resume safely.
Claude Code can act as a remote-control target, manage remote sessions, sync team memory, and expose itself over MCP.
System boundary
Claude Code starts as a local process, but the architecture leaves room for remote control, bridge mode, and MCP exposure.
Design principle
Commands, skills, plugins, tools, MCP resources, and settings are composed into the active runtime rather than hard-coded into one mode.
Reading hint
The architecture becomes much easier once you track a single user turn across UI, query, permissions, tools, and persistence.