Skip to content

AnukarOP/claude-code-leaked

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

15 Commits
ย 
ย 
ย 
ย 

Repository files navigation

- CLAUDE CODE SOURCE LEAKED :)

โšก The Complete Anthropic Claude Code CLI Source Code โšก


Claude Code



Follow AnukarOP

TypeScript Bun React
Leaked Lines of Code Files


๐Ÿšจ FULL SOURCE CODE OF ANTHROPIC'S CLAUDE CODE CLI ๐Ÿšจ

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


๐Ÿ”ฅ What Is This?

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.


โญ Why This Matters

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

๐Ÿ“‚ Directory Structure

๐Ÿ“ฆ 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

๐Ÿ—๏ธ Architecture Overview

๐Ÿ› ๏ธ Tool System

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

โšก Command System

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

๐Ÿ”Œ Service Layer

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

๐ŸŒ‰ Bridge System

IDE integration layer for VS Code & JetBrains

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   VS Code /     โ”‚โ—„โ”€โ”€โ”€โ–บโ”‚  Claude Code    โ”‚
โ”‚   JetBrains     โ”‚     โ”‚     CLI         โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚                      โ”‚
         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                    โ”‚
         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
         โ”‚   Bridge Protocol   โ”‚
         โ”‚  - JWT Auth         โ”‚
         โ”‚  - Message Protocol โ”‚
         โ”‚  - Permission CB    โ”‚
         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ”’ Permission System

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

๐Ÿš€ Feature Flags

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
  : null

Notable flags: PROACTIVE, KAIROS, BRIDGE_MODE, DAEMON, VOICE_MODE, AGENT_TRIGGERS, MONITOR_TOOL


๐Ÿ“Š Key Files

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

๐Ÿ’ป Tech Stack


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

๐ŸŽฏ Notable Design Patterns

โšก Parallel Prefetch

// main.tsx โ€” blazing fast startup
startMdmRawRead()      // MDM settings
startKeychainPrefetch() // Keychain reads
// All run in parallel before heavy imports!

๐Ÿ“ฆ Lazy Loading

Heavy modules loaded only when needed:

  • OpenTelemetry
  • gRPC
  • Analytics
  • Feature-gated subsystems

๐Ÿค– Agent Swarms

Multi-agent orchestration via coordinator/ โ€” spawn sub-agents with AgentTool, create teams with TeamCreateTool

โšก Skill System

Reusable workflows in skills/ executed via SkillTool โ€” extensible with custom skills

๐Ÿ”Œ Plugin Architecture

Full plugin system in plugins/ for built-in and third-party extensions


๐Ÿ”— Quick Links

Resource Link
๐Ÿ“‚ Source Code source code/
๐Ÿ”ง Tools source code/tools/
โšก Commands source code/commands/
๐ŸŽจ Components source code/components/
๐ŸŒ‰ Bridge source code/bridge/

โš ๏ธ Disclaimer

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.


โญ Star This Repo!

If you found this useful, please give it a star!

GitHub stars


๐Ÿ” Keywords / Tags

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


About

Fork of instructkr/claude-code | Full source code of Anthropic's Claude Code CLI, the AI coding assistant | 512K+ lines of TypeScript, 40+ AI tools, 50+ commands.

Topics

Resources

Stars

Watchers

Forks

Contributors