Disclaimer: This repository is NOT officially published, endorsed, or maintained by Anthropic.
The source code in this repository was obtained from publicly available online sources — specifically, a 57MB source map file (
cli.js.map) shipped inside the@anthropic-ai/claude-codenpm package (v2.1.88). No proprietary systems were breached.All intellectual property rights belong to Anthropic. This repository is provided solely for educational and research purposes — to study the architecture and implementation patterns of a production AI coding agent. Use it at your own risk. The maintainers of this repository claim no ownership over the code and assume no liability for its use.
This repository contains the reconstructed source of Anthropic's Claude Code — a Bun-based terminal coding assistant with a custom Ink UI, a large tool system, MCP integration, plugin loading, and cloud session flows.
Prerequisites: Bun v1.1+
git clone <your-repo-url>
cd <repo-dir>
bun install
bun run build
bun dist/cli.jsCurrent state:
bun installworksbun run buildworks and emitsdist/cli.jsbun run typecheckis not clean yet- Static project documentation lives in
docs/
bun dist/cli.js # Launch interactive REPL
bun dist/cli.js --help # Show all options
bun dist/cli.js --version # Show version
bun dist/cli.js -p "your prompt" # Non-interactive mode (pipe-friendly)
bun dist/cli.js auth login # Authenticate
python3 -m http.server 8080 --directory docs- ~1,900 source files, 512,000+ lines of TypeScript
- Runtime: Bun
- Terminal UI: React + custom forked Ink
- CLI parser: Commander.js
- Layout engine: Pure TypeScript port of Yoga (Meta's flexbox engine)
src/
├── main.tsx # Entrypoint (Commander.js CLI parser)
├── commands.ts # Command registry
├── tools.ts # Tool registry (~40 tools)
├── QueryEngine.ts # LLM query engine (Anthropic API)
├── context.ts # System/user context collection
├── ink/ # Custom Ink fork (terminal React renderer)
├── commands/ # Slash command implementations
├── tools/ # Agent tool implementations
├── components/ # React UI components
├── services/ # API, MCP, OAuth, telemetry
├── screens/ # Full-screen UIs (REPL, Doctor)
├── native-ts/ # Pure TS ports of native modules
│ ├── yoga-layout/ # Flexbox layout engine
│ ├── color-diff/ # Syntax-highlighted diffs
│ └── file-index/ # Fuzzy file search
└── vim/ # Vim mode implementation
Some internal Anthropic features weren't included in the recovered sources or are behind private packages. These are stubbed with no-ops:
- Computer Use (
@ant/computer-use-*) — screen control tools - Chrome Integration (
@ant/claude-for-chrome-mcp) — browser automation - Sandbox Runtime (
@anthropic-ai/sandbox-runtime) — sandboxed execution - TungstenTool, REPLTool — internal-only tools
- Context Collapse — internal compaction feature
The core architecture, standard tool surfaces, MCP support, and the full terminal UI are present in source. The repository is now buildable, but it still needs type cleanup and feature hardening before it can be treated as a stable release.
The build script (build.ts) uses Bun's bundler to:
- Bundle 4,500+ modules into a single
dist/cli.js(~23 MB) - Define
MACRO.*build-time constants (version, feedback channel) - Externalize optional native deps (
sharp,react-devtools-core)
Feature flags from bun:bundle's feature() all return false — internal Anthropic features (voice mode, coordinator mode, etc.) are disabled.
- Static site:
docs/index.html - Project map:
AGENTS.md
This repository is not affiliated with Anthropic in any way. It exists purely as a research and learning resource. All code is the intellectual property of Anthropic. If you are a representative of Anthropic and would like this repository removed, please open an issue and it will be taken down immediately.