I Read Claude Code's Leaked Source. Here's What's Inside.
I also made a video breakdown covering all of this if you prefer that format.
Anthropic accidentally shipped source maps in their NPM package. Someone noticed, reconstructed the full TypeScript source, and put it on GitHub. It got 28,000+ forks before Anthropic could pull it down.
This isn’t the model weights. It’s the CLI agent harness — the code that wraps Claude and turns it into a coding tool. But 380,000 lines of it reveals a lot about what Anthropic is building, how they think about their product, and one feature that has people genuinely angry.
How It Happened
Source maps are debug files that map minified JavaScript back to original TypeScript. They should never ship to production. Anthropic published v2.1.88 to NPM with the .map file included.
A company whose brand is AI safety, making a basic CI/CD mistake.
Undercover Mode
This is the one that blew up.
src/utils/undercover.ts — auto-activated for all public and external repositories. It strips AI attribution from commits so Anthropic employees can contribute to open source without anyone knowing Claude wrote the code.
The prompt literally says: “Don’t blow your cover.”
What it hides:
- Model codenames and version numbers
- Internal repository names
- The phrase “Claude Code” itself
Co-Authored-Bylines in commits
There’s no force-OFF flag. It’s designed to always be on for external code.
An AI company telling its AI to pretend to be human. The obvious question: how many open source PRs have already been submitted this way?
Bonus finds from the undercover instructions: “Capybara” is the codename for Opus 4.6. Future model references include opus-4-7 and sonnet-4-8.
Kairos: Autonomous Mode
50+ references across the codebase. This is their biggest unreleased feature.
Kairos is a persistent autonomous assistant that becomes more autonomous when your terminal is unfocused. It can send push notifications, subscribe to GitHub webhooks, and monitor channels. Claude Code that works while you do other things — or while you sleep.
The feature flags tell the story: KAIROS, KAIROS_DREAM, KAIROS_CHANNELS, KAIROS_GITHUB_WEBHOOKS.
This is where Claude Code is headed. Not just a tool you invoke, but an agent that runs continuously.
The Buddy System
A full /src/buddy/ directory. CompanionSprite.tsx alone is 45KB.
18 species. 5 rarity tiers. Shiny variants. Gacha pulls. Stats include DEBUGGING, PATIENCE, CHAOS, WISDOM, and SNARK.
It’s activated during an April 1-7 window. Confirmed April Fools joke.
They spent more engineering effort on a Tamagotchi than most startups spend on their entire product.
Other Finds
Dream System. Background memory consolidation that triggers after 24 hours and 5 sessions. Four stages: orient, gather, consolidate, prune. Your Claude Code literally dreams about your codebase.
Coordinator Mode. Multi-agent orchestration — Claude Code spawning and managing other Claude Codes. The swarm architecture is already in the code.
Anti-distillation. Summarizes tool calls instead of showing them. Strips thinking content. Injects fake tools to poison training data from competitors scraping traffic.
The Code Itself
380K lines, 55+ directories. Genuinely well-organized for a codebase this size.
The infamous files: print.ts at 5,594 lines. runHeadlessStreaming allegedly 3,167 lines with 12 levels of nesting.
Zero tests across 57,000 lines.
Someone had previously reverse-engineered the minified code before this leak, found real bugs — a watchdog timing issue, a prompt cache invalidation bug — fixed them, and reduced ESC aborts 8.7x.
There’s a 962-line attribution system that tracks Claude vs human contribution ratios. One comment reads: “93% 3-shotted by claude-opus-4-5.” They know exactly how much of your code Claude wrote.
On the DMCA front: 438 repositories taken down in March 2025, 495 in April 2025. But with 28,000 forks, that’s a losing battle.
What This Means
Anthropic is building way more than what we see in the public product. Kairos alone changes what Claude Code is — from a tool to an autonomous agent.
But the undercover mode question lingers. How much open source code has been silently written by Claude, with the AI itself instructed to hide that fact?
The source maps have been removed from the NPM package. The code is still everywhere.