CodeDocs Vault

1. Purpose, Problem, and Tech Stack

What this is

The tree at /workspaces/src/ is the source of Claude Code, Anthropic's official CLI coding agent. It is referenced by name in the canonical system prompt (constants/prompts.ts:452):

You are Claude Code, Anthropic's official CLI for Claude.

And externally:

It is distributed as a terminal application with three primary shapes:

  1. Interactive TUI (React + Ink) — the default claude invocation. Entry entrypoints/cli.tsxmain.tsxcomponents/App.tsx.
  2. Headless / print / SDK mode — programmable use via the Claude Agent SDK. Entry entrypoints/sdk/ + QueryEngine.ts. Emits SDKMessage events.
  3. Remote / bridge / daemon modes — claude remote-control, claude daemon, claude ps|logs|attach|kill, claude environment-runner, claude self-hosted-runner. These turn the CLI into a long-lived session server that can execute work dispatched by Anthropic's CCR (Claude Code Remote) backend or a daemon supervisor (entrypoints/cli.tsx:100-246).

Problem solved

Claude Code turns an LLM into a general-purpose software engineering agent that can:

Target users: software engineers and engineering teams. The product has explicit accommodations for Anthropic-internal users (USER_TYPE === 'ant' branches everywhere) plus the external 1P SKU.

Languages and runtime

Core dependencies (evident in the code)

Dependency Why
@anthropic-ai/sdk Direct SDK usage for streaming Messages API (services/api/claude.ts, QueryEngine.ts:2).
@modelcontextprotocol/sdk MCP client and server transports (services/mcp/).
zod (v4) All tool input schemas; SDK public types (entrypoints/sdk/coreSchemas.ts).
ink + react TUI render.
lodash-es Functional helpers (QueryEngine.ts:4).
strip-ansi Sanitizing shell output before emitting (QueryEngine.ts:21).
commander (implicit from --bare note at cli.tsx:281-285) Option parsing for the main CLI path.

Why these choices (as far as one can tell from the code)

Size snapshot

Repo is a single flat src/ with ~329 files in utils/ alone. Notable sizes:

You could implement a minimal clone in a fraction of this size. The weight is in production concerns: retries, cache optimization, permission modes, fleet rollouts, telemetry, multi-surface persistence.