The AI coding assistant that powers millions of developers worldwide
Leaked via npm source map exposure on March 31, 2026
๐ Browse Source โข ๐ง Architecture โข ๐ ๏ธ Tools โข โก Commands โข ๐ Tech Stack
This repository contains the COMPLETE leaked source code of Anthropic's Claude Code โ the revolutionary AI-powered CLI that lets developers interact with Claude AI directly from their terminal.
On March 31, 2026, A security researcher discovered that Claude Code's full TypeScript source was accidentally exposed via a .map file in the npm package:
๐ฆ "Claude code source code has been leaked via a map file in their npm registry!"
The source map pointed to unobfuscated TypeScript files hosted on Anthropic's R2 storage โ making the entire codebase publicly downloadable.
| Feature | Details |
|---|---|
| ๐ค AI Agent Architecture | See exactly how Claude Code's agentic system works |
| ๐ง 40+ AI Tools | File editing, web search, code execution, and more |
| ๐ฌ 50+ Commands | Full slash command implementation |
| ๐ MCP Protocol | Model Context Protocol integration |
| ๐ IDE Bridge | VS Code & JetBrains integration code |
| ๐ง Multi-Agent System | Agent swarm orchestration |
| ๐ค Voice Mode | Voice input implementation |
| ๐ 512,000+ Lines | Production-grade TypeScript |
๐ฆ source code/
โโโ ๐ main.tsx # CLI entrypoint
โโโ ๐ commands.ts # Command registry
โโโ ๐ง tools.ts # Tool registry
โโโ ๐ค QueryEngine.ts # LLM query engine (46K lines!)
โโโ ๐ cost-tracker.ts # Token cost tracking
โ
โโโ ๐ commands/ # 50+ slash commands
โโโ ๐ tools/ # 40+ AI agent tools
โโโ ๐ components/ # 140+ React/Ink UI components
โโโ ๐ services/ # API, MCP, OAuth, LSP integrations
โโโ ๐ bridge/ # IDE communication layer
โโโ ๐ coordinator/ # Multi-agent orchestration
โโโ ๐ plugins/ # Plugin system
โโโ ๐ skills/ # Skill system
โโโ ๐ voice/ # Voice input
โโโ ๐ vim/ # Vim mode
โโโ ๐ ... and 20+ more directories
Every capability Claude Code has is implemented as a modular tool
| Tool | Description | Category |
|---|---|---|
๐ฅ๏ธ BashTool |
Shell command execution | System |
๐ FileReadTool |
Read files, images, PDFs, notebooks | Files |
โ๏ธ FileWriteTool |
Create and overwrite files | Files |
๐ง FileEditTool |
Partial file modification | Files |
๐ GlobTool |
File pattern matching | Search |
๐ GrepTool |
Content search (ripgrep) | Search |
๐ WebFetchTool |
Fetch URL content | Web |
๐ WebSearchTool |
Web search | Web |
๐ค AgentTool |
Spawn sub-agents | Agents |
โก SkillTool |
Execute skills | Skills |
๐ MCPTool |
MCP server integration | Protocol |
๐ก LSPTool |
Language Server Protocol | Protocol |
๐ NotebookEditTool |
Jupyter notebook editing | Files |
๐ TaskCreateTool |
Task management | Tasks |
๐ฅ TeamCreateTool |
Team agent management | Agents |
๐บ๏ธ EnterPlanModeTool |
Planning mode | Modes |
๐ณ EnterWorktreeTool |
Git worktree isolation | Git |
โฐ CronCreateTool |
Scheduled triggers | Automation |
๐ฏ SyntheticOutputTool |
Structured output | Output |
50+ slash commands for power users
| Command | Description |
|---|---|
/commit |
๐ Create git commits with AI-generated messages |
/review |
๐ AI-powered code review |
/compact |
๐ฆ Compress conversation context |
/mcp |
๐ MCP server management |
/config |
โ๏ธ Settings management |
/doctor |
๐ฅ Environment diagnostics |
/login / /logout |
๐ Authentication |
/memory |
๐ง Persistent memory management |
/skills |
โก Skill management |
/tasks |
๐ Task management |
/vim |
โจ๏ธ Vim mode toggle |
/diff |
๐ View changes |
/cost |
๐ฐ Check usage cost |
/theme |
๐จ Change theme |
/pr_comments |
๐ฌ View PR comments |
/resume |
โฎ๏ธ Restore previous session |
/share |
๐ Share session |
/desktop |
๐ฅ๏ธ Desktop app handoff |
External integrations and core services
| Service | Description |
|---|---|
๐ api/ |
Anthropic API client & bootstrap |
๐ mcp/ |
Model Context Protocol integration |
๐ oauth/ |
OAuth 2.0 authentication |
๐ก lsp/ |
Language Server Protocol |
๐ analytics/ |
Feature flags (GrowthBook) |
๐ plugins/ |
Plugin loader |
๐ฆ compact/ |
Context compression |
๐ง extractMemories/ |
Auto memory extraction |
๐ฅ teamMemorySync/ |
Team memory sync |
IDE integration layer for VS Code & JetBrains
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ VS Code / โโโโโโบโ Claude Code โ
โ JetBrains โ โ CLI โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ โ
โโโโโโโโโโโโฌโโโโโโโโโโโโ
โ
โโโโโโโโโโโโผโโโโโโโโโโโ
โ Bridge Protocol โ
โ - JWT Auth โ
โ - Message Protocol โ
โ - Permission CB โ
โโโโโโโโโโโโโโโโโโโโโโโ
Security-first design with granular permissions
Checks permissions on every tool invocation:
- โ
default- Ask for approval - ๐
plan- Plan mode restrictions - โก
auto- Automatic approval - ๐
bypassPermissions- Skip checks
Dead code elimination via Bun's bun:bundle:
import { feature } from 'bun:bundle'
// Inactive code is completely stripped at build time
const voiceCommand = feature('VOICE_MODE')
? require('./commands/voice/index.js').default
: nullNotable flags: PROACTIVE, KAIROS, BRIDGE_MODE, DAEMON, VOICE_MODE, AGENT_TRIGGERS, MONITOR_TOOL
| File | Lines | Description |
|---|---|---|
๐ง QueryEngine.ts |
~46,000 | Core LLM engine - streaming, tool loops, retry logic |
๐ง Tool.ts |
~29,000 | Tool interfaces & permission models |
๐ commands.ts |
~25,000 | Command registry & execution |
๐ main.tsx |
- | CLI entrypoint with parallel prefetch |
Bun |
TypeScript |
React |
Zod |
| Category | Technology |
|---|---|
| โก Runtime | Bun - Ultra-fast JavaScript runtime |
| ๐ Language | TypeScript (strict mode) |
| ๐ฅ๏ธ Terminal UI | React + Ink |
| ๐ง CLI Parsing | Commander.js |
| โ Validation | Zod v4 |
| ๐ Code Search | ripgrep |
| ๐ Protocols | MCP SDK, LSP |
| ๐ค API | Anthropic SDK |
| ๐ Telemetry | OpenTelemetry + gRPC |
| ๐ฉ Feature Flags | GrowthBook |
| ๐ Auth | OAuth 2.0, JWT, macOS Keychain |
// main.tsx โ blazing fast startup
startMdmRawRead() // MDM settings
startKeychainPrefetch() // Keychain reads
// All run in parallel before heavy imports!Heavy modules loaded only when needed:
- OpenTelemetry
- gRPC
- Analytics
- Feature-gated subsystems
Multi-agent orchestration via coordinator/ โ spawn sub-agents with AgentTool, create teams with TeamCreateTool
Reusable workflows in skills/ executed via SkillTool โ extensible with custom skills
Full plugin system in plugins/ for built-in and third-party extensions
| Resource | Link |
|---|---|
| ๐ Source Code | source code/ |
| ๐ง Tools | source code/tools/ |
| โก Commands | source code/commands/ |
| ๐จ Components | source code/components/ |
| ๐ Bridge | source code/bridge/ |
This repository is for educational and security research purposes only.
The original Claude Code source is the property of Anthropic. This repository is NOT affiliated with, endorsed by, or maintained by Anthropic.
If you found this useful, please give it a star!
claude anthropic claude-code ai artificial-intelligence llm large-language-model cli command-line typescript bun react ink terminal ai-coding ai-assistant code-assistant developer-tools source-code leaked security-research mcp model-context-protocol agent ai-agent multi-agent