You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A buildable and runnable source project reconstructed from the @anthropic-ai/claude-code@2.1.88 npm package (with cli.js.map). Runtime is Bun. Zero modifications to any original src/ or vendor/ files.
The leaked source code cannot run directly — it is missing build configs, type stubs, native module shims, and resource files. This repository fills those gaps with ~90 new files while keeping the original 1,884 source files untouched.
Architecture & Internals Documentation
Deep dive into Claude Code's architecture, implementation details, and core mechanisms:
# macOS / Linux
curl -fsSL https://bun.sh/install | bash
# macOS (Homebrew)
brew install bun
# Windows (PowerShell)
powershell -c "irm bun.sh/install.ps1 | iex"
2. Install dependencies
bun install
3. Configure environment
cp .env.example .env
# Edit .env and set your ANTHROPIC_API_KEY
4. Run
# Interactive TUI mode
bun run dev
# Headless mode (single prompt)
bun run dev -- -p "hello" --output-format text
# Check version
bun run dev -- --version
# => 2.1.88-local (Claude Code)
All changes are additive new files — zero modifications to existing source files.
Root Config Files (9 files)
File
Purpose
package.json
Dependencies, scripts (dev/start/build/typecheck)
tsconfig.json
TypeScript config with bun:bundle path alias
bunfig.toml
Bun preload config
preload.ts
Bun plugin polyfilling bun:bundle feature flags at runtime
bootstrap-entry.ts
Sets globalThis.MACRO with env overrides, imports CLI
config/features.ts
Single source of truth for feature flag set & plugin factory
scripts/build.ts
Bun build script with externals list & MACRO defines
.env.example
Environment variable template
src/stubs/bun-bundle.d.ts
TypeScript type declaration for bun:bundle
Shim Packages (7 packages, 16 files)
Local file: protocol packages replacing missing Anthropic-internal and native modules:
Package
Strategy
@ant/claude-for-chrome-mcp
MCP server stub with tool catalog
@ant/computer-use-mcp
Full type system + session flow shim (22 tools)
@ant/computer-use-swift
297-line stub, partially functional on macOS
@ant/computer-use-input
Input API stub with platform detection
color-diff-napi
Re-exports from src/native-ts/ TypeScript port
modifiers-napi
Re-exports from vendor/ TS binding
url-handler-napi
Re-exports from vendor/ TS binding
SDK & Type Stubs (4 files)
File
Purpose
src/entrypoints/sdk/coreTypes.generated.ts
SDK message types
src/entrypoints/sdk/runtimeTypes.ts
SDK runtime types (15 types)
src/entrypoints/sdk/settingsTypes.generated.ts
SDK settings type
src/entrypoints/sdk/toolTypes.ts
SDK tool definition type
Tool Stubs (6 files)
File
Strategy
src/tools/TungstenTool/TungstenTool.ts
Disabled tool (isEnabled=false)
src/tools/TungstenTool/TungstenLiveMonitor.tsx
Null React component
src/tools/WorkflowTool/constants.ts
Tool name constant
src/tools/REPLTool/REPLTool.ts
null export (feature-gated)
src/tools/SuggestBackgroundPRTool/
null export (feature-gated)
src/tools/VerifyPlanExecutionTool/
null export (feature-gated)
Feature-Gated Service Stubs (7 files)
No-op implementations for features behind compile-time flags:
File
Gating Flag
src/services/compact/cachedMicrocompact.ts
CACHED_MICROCOMPACT
src/services/compact/snipCompact.ts
HISTORY_SNIP
src/services/compact/snipProjection.ts
HISTORY_SNIP
src/services/contextCollapse/index.ts
CONTEXT_COLLAPSE
src/services/contextCollapse/operations.ts
CONTEXT_COLLAPSE
src/services/contextCollapse/persist.ts
CONTEXT_COLLAPSE
src/localRecoveryCli.ts
Standalone recovery CLI
Component & Command Stubs (6 files)
File
Purpose
src/components/agents/SnapshotUpdateDialog.tsx
Null React component
src/assistant/AssistantSessionChooser.tsx
Null React component
src/commands/assistant/assistant.ts
Empty assistant command
src/commands/assistant/index.ts
Re-export barrel
src/commands/agents-platform/index.ts
Empty command array
src/utils/protectedNamespace.ts
Returns false
Other Resource Files (7 files)
File
Purpose
src/ink/devtools.ts
Empty module (fire-and-forget import)
src/ink/global.d.ts
Empty ambient declaration
src/types/connectorText.ts
Connector text block types
src/utils/filePersistence/types.ts
File persistence constants & interfaces
src/utils/ultraplan/prompt.txt
Planning prompt resource
src/utils/permissions/yolo-classifier-prompts/
3 classifier prompt files
Skill Files (29 files)
Directory
Content
src/skills/bundled/claude-api/
26 files — API usage examples (Python, Go, Java, etc.)
src/skills/bundled/verify/
3 files — Verification skill
Known Limitations
Native modules (audio-capture, image-processor) have no original Rust/C++ source; shims provide graceful fallbacks
Feature-flagged features (VOICE_MODE, BRIDGE_MODE, COORDINATOR_MODE, etc.) are disabled by default; enabling them may require additional stubs
No test files — the original bundle did not include tests
Anthropic-internal features (USER_TYPE === 'ant') are empty stubs (REPLTool, agents-platform, etc.)
Commander v12 — downgraded from v14 for multi-char short flag compatibility (-d2e)
Disclaimer
This repository is based on the Claude Code source code leaked from the Anthropic npm registry on 2026-03-31. All original source code is copyrighted by Anthropic. For learning and research purposes only.
About
A buildable and runnable source project reconstructed from the @anthropic-ai/claude-code@2.1.88 npm package (with cli.js.map). Runtime is Bun. Zero modifications to any original src/ or vendor/ files.