Claude Code CLI leaked source repository with a TypeScript/Bun-based terminal toolset for interacting with Claude, including a large codebase structure, tool system, and command framework. Provides setup with Bun and Node, environment variable ANTHROPIC_API_KEY, and various run scripts.
Collecting history — the radar snapshots this repo daily. The trend line appears after 3 days of data (1 so far).
What it is
Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands. This repository contains leaked source code for the Claude Code CLI.
How it works
The project uses a tool system where each tool (e.g., BashTool, FileReadTool, WebFetchTool, LSPTool, etc.) implements its own input schema, permission model, and execution logic. A command system exposes user-facing slash commands (e.g., /commit, /review, /config, /memory). The core architecture includes a QueryEngine for LLM API calls, a bridge system to IDEs, a permission system to gate tool invocations, and feature flags for conditional code paths. It supports parallel prefetch on startup, lazy loading of heavy modules, and an agent swarm pattern for multi-agent coordination. Key files include QueryEngine.ts, Tool.ts, commands.ts, and main.tsx.
Getting started
Prerequisites
- Bun v1.3+ (the project's runtime)
- Node.js v18+ (for npm package installation)
- An Anthropic API key (set as
ANTHROPIC_API_KEYenvironment variable)
Install & Run
# 1. Install Bun (if not already installed)
curl -fsSL https://bun.sh/install | bash
source ~/.bash_profile # or restart your terminal
# 2. Install dependencies
npm install --legacy-peer-deps
# 3. Run Claude Code
bun run start
# Or with arguments:
bun run start -- --help
bun run start -- --version
bun run start -- -p "Hello Claude"
Available Scripts
| Script | Description |
|--------|-------------|
| bun run start | Run Claude Code CLI |
| bun run dev | Run with hot-reloading (--watch) |
| bun run build | Bundle for production |
| bun run typecheck | Run TypeScript type checking |
Environment Variables
| Variable | Description |
|----------|-------------|
| ANTHROPIC_API_KEY | Your Anthropic API key (required to use Claude) |
| FEATURE_FLAGS | Comma-separated list of feature flags to enable (e.g., KAIROS,VOICE_MODE) |
Notes
- Some modules from the original source were not included in the leak (Anthropic-internal
@ant/*packages, some tools). These have been replaced with stubs that export no-ops. - The
bun:bundlefeature flag system is shimmed via a Bun plugin atplugins/bunBundleDev.ts. All flags default tofalseunless enabled viaFEATURE_FLAGS. - The
MACRO.*build-time constants are defined inbunfig.tomland injected by Bun's--definesystem.
Recent releases
- Releases: none
Traction
- Stars: 2122
- Forks: 2731
- Open issues: 3
Notable design patterns
- Parallel Prefetch to reduce startup time
- Lazy Loading of heavy modules
- Agent Swarms for multi-agent coordination
- Skill System with reusable workflows
- Plugin Architecture for extensibility
Tech stack
- Runtime: Bun
- Language: TypeScript (strict)
- Terminal UI: React + Ink
- CLI Parsing: Commander.js
- Schema Validation: Zod v4
- Code Search: ripgrep via GrepTool
- Protocols: MCP SDK, LSP
- API: Anthropic SDK
- Auth: OAuth 2.0, JWT, macOS Keychain






