- Background
- Tech Stack
- Getting Started
- Usage
- Building
- Project Structure
- How It Works
- Unlocked Slash Commands
- Notes
- Disclaimer
On March 31, 2026, the full source code of Anthropic's Claude Code was leaked via a source map file exposed in their npm registry. The leaked source code contained only the src/ directory -- no build configuration, no dependency manifests, no type definitions for core modules, and no way to compile or run it.
This project reconstructs everything that was missing: package.json, tsconfig.json, build scripts, 185+ stub/type files, compatibility shims for internal-only packages, and a bun:bundle feature-flag runtime. The result is a complete, buildable, and runnable Claude Code terminal application. Internal-only Anthropic features (daemon workers, voice mode, computer-use, etc.) are disabled at build time via feature flags; the core interactive REPL, tool system, and Anthropic API integration remain fully functional.
| Category | Technology |
|---|---|
| Language | TypeScript (strict) |
| Runtime | Bun |
| Terminal UI | React + Ink |
| CLI Parsing | Commander.js (extra-typings) |
| Schema Validation | Zod |
| Protocols | MCP SDK · LSP |
| API | Anthropic SDK |
| Auth | OAuth 2.0 · API Key · macOS Keychain |
Claude Code runs on Bun (v1.1+). If you don't have it:
curl -fsSL https://bun.sh/install | bashbun installYou need an Anthropic API key, or you can use OAuth login (/login in the REPL):
export ANTHROPIC_API_KEY="sk-ant-..."# Launch the interactive REPL
bun run startThat's it -- you should see the Claude Code terminal UI.
# Print version
bun run start -- --version
# Show all CLI flags and subcommands
bun run start -- --help
# One-shot prompt (pipe-friendly, prints response and exits)
bun run start -- --print "explain this codebase"
# Minimal startup (skips hooks, plugins, auto-memory)
bun run start -- --bare
# Pass a system prompt
bun run start -- --system-prompt "You are a Go expert"
# Use a specific model
bun run start -- --model sonnetProduce a single-file bundle:
# Build to dist/cli.js
bun run build
# Run the built artifact
bun dist/cli.js
bun dist/cli.js --help.
├── src/
│ ├── entrypoints/cli.tsx # Process entrypoint
│ ├── main.tsx # Commander CLI setup, REPL launch
│ ├── commands.ts # Slash-command registry
│ ├── tools.ts # Tool registry (Bash, Edit, Read, etc.)
│ ├── Tool.ts # Base tool type definitions
│ ├── query.ts # LLM query engine
│ ├── ink/ # Vendored Ink terminal renderer
│ ├── components/ # React terminal UI components
│ ├── screens/ # Full-screen UIs (REPL, Doctor, Resume)
│ ├── services/ # API client, MCP, analytics, compaction
│ ├── hooks/ # React hooks
│ ├── utils/ # Utility functions
│ ├── types/ # Reconstructed type definitions
│ └── _external/ # Build compatibility layer
│ ├── preload.ts # Runtime MACRO + bun:bundle shim
│ ├── globals.d.ts # MACRO type declarations
│ └── shims/ # Stub packages for private deps
├── scripts/
│ └── build-external.ts # Bun.build() with feature flags + defines
├── package.json
├── tsconfig.json
└── bunfig.toml # Preload config + .md text loader
The original Claude Code source depends on Bun's bun:bundle module for compile-time feature flags and MACRO.* globals for build-time constants. This project provides:
bunfig.toml+preload.ts-- registers a Bun plugin that resolvesimport { feature } from 'bun:bundle'at runtime, and definesMACRO.VERSIONand friends as globals.scripts/build-external.ts-- aBun.build()script that replacesbun:bundlevia a plugin, injectsMACRO.*viadefine, and marks private packages as external. All 90+ internal feature flags are disabled; only a handful of safe flags are enabled.- Stub packages under
src/_external/shims/-- lightweight no-op modules for@ant/*internal packages and native NAPI addons that aren't publicly available. - Reconstructed type files --
src/types/message.ts,src/types/tools.ts, and other high-fanout modules that were missing from the leaked source.
The original Claude Code ships with many slash commands hidden behind internal feature flags that are disabled in external builds. This project has reconstructed and fully unlocked the following commands so they work locally without any flag service:
| Command | Description | Original Gate |
|---|---|---|
/brief |
Toggle brief-only (chat) mode — visible output is sent exclusively via SendUserMessage |
KAIROS / KAIROS_BRIEF |
/buddy |
Summon a virtual companion with deterministic traits generated from a seed PRNG | BUDDY |
/fork |
Spawn a background sub-agent that inherits the full conversation context | FORK_SUBAGENT |
For a comprehensive analysis of all 14 feature-gated commands (including which ones are fully implemented, partially stubbed, or missing), see FEATURE_FLAG_COMMANDS_ANALYSIS.md.
- Features gated behind disabled flags (voice, bridge, daemon, coordinator, assistant/Kairos, etc.) that have not been explicitly unlocked above are not functional.
- The interactive REPL,
--printmode,--help, and the full Commander option surface all work. - Authentication (API key and OAuth), Anthropic API calls, tool execution, MCP server integration, and the Ink-based terminal UI are preserved from the original source.
All original Claude Code source code is the intellectual property of Anthropic, PBC. This repository is based on source code that was unintentionally exposed and is provided here strictly for research, educational, and archival purposes only.
- This project carries no license. No permission is granted to use, modify, distribute, or create derivative works for any commercial purpose.
- This is an independent reconstruction effort and is not affiliated with, endorsed by, or sponsored by Anthropic in any way.
- If you are a representative of Anthropic and would like this repository removed, please open an issue or contact the maintainer (@weikma) directly.