On March 31, 2026, Anthropic's Claude Code source code leaked — again. A 60MB source map file (cli.js.map) was accidentally shipped in npm package v2.1.88, exposing ~1,900 TypeScript files and 512,000 lines of code.
This is the second time this has happened. The first was February 2025.
Instead of just reading the headlines, I did what any curious engineer would do: I read all of it.
What I Found
Claude Code is not what most people think. It's not a simple chat wrapper. It's a full agentic AI runtime with:
- QueryEngine — A conversation loop orchestrator that manages context assembly → API calls → tool execution → response rendering
- 40+ Tools — File operations, shell execution, web search, MCP integration, notebook editing, and more
- Task System — Sub-agent orchestration for parallelizing complex work
-
100+ Slash Commands —
/commit,/review,/security-review,/ultraplan - Bridge System — Remote session control from desktop/mobile via WebSocket
-
Plugin & Skills — User-defined extensions loaded from
.claude/directories - Voice Mode — STT integration with keyword detection
The Architecture
The most interesting part is the tool-call loop. Claude doesn't just generate text — it requests tools, the engine executes them, and results are fed back. This loop can run dozens of iterations for a single user request.
User Input → Context Assembly → API Call → Tool Request → Execute → Feed Back → ... → Final Response
The permission model is layered: some tools auto-approve, others require user confirmation, and some are always denied. This is how Claude Code stays safe while being powerful.
The context budget system is fascinating — it dynamically allocates tokens across system prompt, user context, memories, and tool results based on the current conversation state.
Internal Codenames
The leak revealed internal model codenames:
- Capybara → Claude 4.6 variant
- Fennec → Opus 4.6
- Numbat → Unreleased model
Migration files show the progression: migrateFennecToOpus.ts, migrateSonnet45ToSonnet46.ts — giving us a roadmap of model evolution.
The Memory System
Claude Code has a memdir/ (memory directory) system that persists context across sessions. It scans for relevant memories, manages memory aging, and supports team-shared memory. This is how it "remembers" your codebase.
Why This Matters
If you're building AI agents, this is a masterclass in production architecture:
- Tool abstraction — How to design a flexible tool system
- Context management — How to stay within token limits while being useful
- Permission models — How to make agents safe in production
- State management — Zustand-style store + React for terminal UI
- Sub-agent orchestration — How to parallelize work across agent instances
Full Analysis
I wrote a 770+ line detailed analysis covering all 17 architectural layers:
👉 GitHub: claude-code-analysis
Includes bilingual README (English/中文) and the complete source architecture documentation.
My Take
Anthropic calls this a "packaging error." Maybe. But for the AI engineering community, this is one of the most educational codebases to study. It shows how a well-funded AI lab actually builds production agent infrastructure — not toy demos, but real systems handling millions of users.
The irony? The best documentation for Claude Code wasn't written by Anthropic. It was written by the community, after the code leaked.
Disclaimer: This analysis is based on publicly available information. Claude Code is owned by Anthropic. This is an unofficial community analysis.
Top comments (0)