πŸ”“ Claude Code Source Leaked β€” 512K Lines of Agent Engineering, Free

The full source of Anthropic’s Claude Code CLI leaked through an npm map file 3 weeks ago. 512,000+ lines of production TypeScript. Public now.

A rare look inside how a billion-dollar AI agent is actually engineered β€” not a tutorial, the real thing.

1,900 files. 512K+ lines of TypeScript. 40+ tools. 50+ slash commands. An MCP server.
Prompt engineers, this is your Rosetta Stone. Agent builders, this is your textbook.

leaked-march-31-2026 Β· public-domain Β· 0/63 on VT Β· read-only study


claude-code/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main.tsx           # Entrypoint β€” Commander + React + Ink
β”‚   β”œβ”€β”€ QueryEngine.ts     # Core LLM API caller (~46K lines)
β”‚   β”œβ”€β”€ tools/             # 40+ agent tool implementations
β”‚   β”œβ”€β”€ commands/          # 50+ slash commands
β”‚   β”œβ”€β”€ bridges/           # VS Code Β· Cursor Β· JetBrains
β”‚   β”œβ”€β”€ prompts/           # πŸ† THE SYSTEM PROMPTS
β”‚   β”œβ”€β”€ hooks/             # React hooks incl. permission checks
β”‚   └── mcp-server/        # Installable MCP integration
└── SKILL.md               # How the codebase works

πŸ† Why This Is Actually Interesting

:brain: The prompts/ folder β€” the literal system prompts Anthropic ships. How Claude Code is told to behave, sequenced, and constrained. You won’t find this level of production prompt engineering on Medium or YouTube β€” ever.

:hammer_and_wrench: The tool system β€” every tool Claude Code uses (BashTool, FileEditTool, search_source, etc.) with its own schema, permission model, and execution logic. Blueprint for anyone building their own agent.

:bridge_at_night: The bridges β€” real integration code for VS Code, Cursor, and JetBrains. Shows exactly how a CLI agent hooks into IDEs.

:scroll: The SKILL.md at the repo root β€” Anthropic’s own internal guide for how the codebase is organized. Reading this first = instant orientation.

:electric_plug: Runnable MCP server β€” the repo ships claude-code-explorer-mcp on npm. Use Claude Desktop or Cursor to explore the leaked Claude source. Meta loop.

βš™οΈ The Tech Stack

TypeScript (strict) Β· Bun Β· React Β· Ink Β· MCP SDK Β· ~1,900 files

Published: 2026-03-31 (made public domain by an Anthropic employee after discovery)
How it got out: the published npm package included a .map file pointing to the full unobfuscated TypeScript source in Anthropic’s R2 storage bucket. @Fried_rice caught it. Anthropic then released it officially.

πŸ“₯ Grab It
Source Link Status
Repo (main) github.com/tjcrims0nx/claude-code Re-assembled, browsable
Backup branch backup branch Original unmodified source
ZIP mirror Google Drive 9.48 MB
VirusTotal 0 / 63 detections Clean

:light_bulb: The repo is mirror-at-your-own-risk. Clone it locally if you plan to study it β€” GitHub DMCA’d copies can vanish overnight.

πŸ§ͺ What You Can Actually Do With It

:open_book: Read it β€” it’s TypeScript, strict mode, well-commented. You’ll learn more in an afternoon than six months of agent-building tutorials.

:fork_and_knife: Fork it β€” for personal study, for research papers, for your own experiments.

:magnifying_glass_tilted_left: Prompt-mine it β€” extract the system prompts and study how Anthropic phrases constraints, priorities, and tool-use instructions.

:puzzle_piece: Plug it in β€” run the included MCP server, point Claude Desktop or Cursor at the source, ask it to explain its own architecture.

:prohibited: What you shouldn’t do β€” repackage it as a commercial product, strip the attribution, or publish a β€œrebranded Claude Code.” That’s how mirrors get nuked fast.


:high_voltage: Quick Hits

Want Do
:bullseye: Browse the source Gittea repo
:floppy_disk: Download ZIP Drive mirror
:microscope: Verify clean VirusTotal 0/63
:blue_book: Start here Read SKILL.md β†’ src/main.tsx β†’ prompts/
:hourglass_not_done: Archive it local git clone before any DMCA

You’re not β€œdownloading a leak.” You’re sitting in the cockpit of an AI agent that shipped to millions. Read the manuals.

17 Likes