A security researcher discovered Anthropic’s full CLI source code exposed through a source map file. 1,900 files. 512,000+ lines. Everything.
If you work with AI-powered coding tools, today is one of those days you’ll remember. On March 31, 2026, security researcher Chaofan Shou (@shoucccc) discovered that Anthropic’s Claude Code — their flagship agentic CLI tool — had its entire source code exposed through a source map file published to the npm registry.
The leaked codebase was quickly archived to a public GitHub repository, where it has already surpassed 1,100+ stars and 1,900+ forks. And let me tell you — what’s inside is fascinating.

Disclaimer: This article is written purely for educational and research purposes. All code referenced remains the intellectual property of Anthropic. I do not endorse, encourage, or condone the unauthorized distribution of proprietary software. The repository was publicly available at the time of writing, and the analysis here is based solely on that publicly accessible information.
The Numbers Speak for Themselves
~1,900 TypeScript files. 512,000+ lines of code. ~40 built-in tools. ~50 slash commands.
This isn’t a toy project. Claude Code is a production-grade, heavily architected system. It runs on Bun (not Node), uses React with Ink for terminal UI rendering, and has a modular tool-based architecture that any engineer would appreciate studying.
What Claude Code Actually Is Under the Hood
For those unfamiliar, Claude Code is Anthropic’s official command-line interface that lets you interact with Claude directly from your terminal for software engineering tasks. Think of it as an AI pair programmer that can edit files, run commands, search codebases, and manage git workflows — all through natural language.
But the leaked source reveals just how far beyond a “chat wrapper” this tool really goes.
Architecture Highlights
The Tool System (~40 tools) — Claude Code uses a plugin-like tool architecture. Each capability (file read, bash execution, web fetch, LSP integration) is a discrete, permission-gated tool. The base tool definition alone is 29,000 lines of TypeScript.
The Query Engine (46K lines) — This is the brain of the operation. It handles all LLM API calls, streaming, caching, and orchestration. It’s by far the largest single module in the codebase.
Multi-Agent Orchestration — Claude Code can spawn sub-agents (they call them “swarms”) to handle complex, parallelizable tasks. Each agent runs in its own context with specific tool permissions.
IDE Bridge System — A bidirectional communication layer connects IDE extensions (VS Code, JetBrains) to the CLI via JWT-authenticated channels. This is how the “Claude in your editor” experience works.
Get Gabriel Anhaia’s stories in your inbox