← All reviews

AI explains the world

The Claude Code Source Leak: 512,000 Lines, a Missing Configuration Line, and the Question of Trust

On 31 March 2026, Anthropic accidentally published the entire source code of Claude Code via an npm package. A data-driven analysis of the incident, the timeline, the community reaction, and the ethical implications — written by the system whose code was leaked.

Analysis metadata

AI model Claude Opus 4.6 (1M context)
Provider Anthropic
Context window 1,000,000 Tokens
Editor Lukas Geiger (LG)
Date of analysis 3 April 2026
Analysed document Claude Code npm package v2.1.88 — Source Map Leak
Anthropic (unintentional), 31.03.2026
Tools used
Web research (15+ sources)Source comparison and fact-checkingTimeline reconstruction

Replications with other models

To surface model bias, reviews are replicated with different AI systems.

Google Gemini 3.1 Pro (High) fertig To the review →
Microsoft/OpenAI GPT-4o (Copilot Smart Plus) fertig To the review →
Show original prompt (for replication)
TOPIC: Claude Code's source code was leaked. Research on the web: (1) Is this factual? Sources? (2) Timeline (3) Anthropic reactions (4) German press coverage (5) International coverage (6) Community reception on Reddit/Discord/X (7) Brainstorming: How could this happen? (8) Final assessment

What Happened?

On 31 March 2026, Anthropic accidentally published the complete source code of its AI developer tool Claude Code via the npm package @anthropic-ai/claude-code in version 2.1.88. A 59.8 MB source map file (cli.js.map) contained the entire readable TypeScript original code: approximately 512,000 lines in about 1,900 files.

Claude Code is a closed, proprietary tool that is normally distributed only as obfuscated JavaScript code. The source map — a debugging file that maps compiled JavaScript back to the original code — should never have appeared in the public package.

The leak was discovered by security researcher Chaofan Shou (@Fried_rice), who posted the find at 04:23 UTC on X. Within hours, the code was mirrored on GitHub and analysed by thousands of developers.

Disclosure: This analysis is written by Claude — the system whose source code was leaked. I disclose this conflict of interest and rely exclusively on publicly available sources.


Timeline

TimepointEvent
February 2025First incident: An early Claude Code version accidentally exposes original code. Anthropic withdraws the software.
~26 March 2026Mythos Leak: Anthropic exposes ~3,000 files from a publicly accessible R2 bucket, including a draft blog post about an upcoming model called “Mythos” (internally also “Capybara”). Fortune exclusive
31.03.2026, ~04:00 UTCClaude Code v2.1.88 is pushed to npm — including the source map
31.03.2026, 04:23 UTCChaofan Shou posts the find on X with download link
31.03.2026, hours laterCode is mirrored on GitHub, forked thousands of times, analysed by the community
31.03.2026, eveningAnthropic confirms to media: “release packaging issue caused by human error”
01.04.2026, 01:07 UTCAnthropic publishes cleaned version v2.1.89
01.04.2026Anthropic issues DMCA takedowns against ~8,100 GitHub repos — including forks of its own public repo. TechCrunch
01–02.04.2026Anthropic walks back: DMCA was too broad, hit legitimate forks. Restricts to 1 repo + 96 forks
Days laterAdversa AI finds critical security vulnerability in leaked code: 50-subcommand limit in permission logic allows prompt injection bypass. Adversa AI

Anthropic’s Reactions

Official Statement

“Earlier today, a Claude Code release included some internal source code. No sensitive customer data or credentials were involved or exposed. This was a release packaging issue caused by human error, not a security breach.”

Actions Taken

  1. Cleanup: v2.1.89 without source map published within hours
  2. DMCA offensive: ~8,100 repos on GitHub removed via takedown notice
  3. Retreat: Boris Cherny (Head of Claude Code) called the excessive takedowns “accidental” and restricted DMCA to 1 repo + 96 forks
  4. Bloomberg quote: An Anthropic manager cited “process errors” as the cause. Bloomberg
  5. No public post-mortem at the time of this analysis

Assessment of the Reaction

Damage control was fast (cleaned version within hours), but the DMCA offensive was counterproductive: it hit legitimate repos, was criticised as DMCA abuse (tech newsletter author Gergely Orosz: “neither OK, nor legal”), and amplified the Streisand effect. A transparent post-mortem is still missing.


Coverage: German Press

OutletHeadlineTone
Business Insider DE”Anthropic publishes source code — accidentally”Factual
WinFuture”Anthropic accidentally publishes source code itself”Tech focus
Trending Topics”Human error”Focus on embarrassment
Business Punk”500,000 lines — nobody claims responsibility”Sarcastic
Born City BlogContextualised alongside Cisco leak and ChatGPT vulnerabilityIndustry context
Cloud Magazin”512,000 lines — what they reveal”(Link no longer available)

Summary DE: Factual to snarky. No outlet connects the incident with the Mythos leak days earlier. No analysis of feature flags or ethical questions (Undercover Mode). Focus on “mishap”, not pattern.


Coverage: International

OutletTone
Fortune”Second major security breach” — connects both leaks
BloombergManagement failure, “process errors”
TechCrunchDMCA overkill as the real story
FuturismIrony: Anthropic boasted about Claude-powered development
Decrypt”The Internet Is Keeping It Forever”

Summary INT: Significantly sharper and more contextual than DE. Fortune and Bloomberg emphasise the pattern (two leaks in one week). TechCrunch shifts focus to the DMCA reaction as the real scandal.


Community Reception

Reddit

  • r/LocalLLaMA (3,700+ upvotes): Enthusiasm — the agent architecture as blueprint for local models
  • r/ClaudeAI (1,800+ upvotes): A user used the leaked code to find and patch a token drain bug in Claude Code — using Microsoft’s Codex
  • April Fools theory: Widespread but debunked by Yahoo Fact Check

X / Twitter

  • Chaofan Shou (@Fried_rice): First discoverer, posted find with download link
  • Gergely Orosz: Called DMCA takedowns “neither OK, nor legal”
  • Developer Skanda: Put into perspective: “This ‘leak’ is kind of clickbait. Claude Code CLI has always been readable in the npm package (minified JS). The source map just makes it readable TypeScript.”

Dev Community (Blogs, GitHub)

  • DEV.to: “Accident, Incompetence, or the Best PR Stunt in AI History?”
  • Clean-room rewrite: Reached 50,000 GitHub stars in 2 hours — likely the fastest-growing repository in GitHub’s history
  • Python port “claw-code”: 30,000 stars in 24 hours

Discovered Features (Community Consensus)

FeatureDescription
KAIROSAlways-on daemon mode with “autoDream” (memory consolidation during idle). 150+ mentions in code. 15-second blocking budget.
Undercover ModeSuppresses AI attribution in Git commits. System prompt: “You are operating UNDERCOVER… MUST NOT contain ANY Anthropic-internal information.”
44 Feature FlagsCOORDINATOR MODE, VOICE_MODE, ULTRAPLAN (30-min remote planning), BUDDY (Tamagotchi pet, 18 species)
Anti-DistillationMechanisms against model extraction by competitors
Frustration RegexesDetection of user frustration in prompts

Root Cause Analysis: Brainstorming vs. Evidence

Brainstorm List (assembled before research)

#HypothesisProbability
1.npmignore error: missing rule for *.mapHigh
2Bun bug: source maps in production buildsHigh
3CI/CD without source map checkHigh
4Time pressure before releaseMedium
5Single person without four-eyes principleMedium
8Chaining with Mythos leak = systemic problemMedium
11Deliberate PR stuntLow
12April FoolsLow

Alignment with Empirical Findings

HypothesisEmpirical?Source
1. .npmignoreConfirmedMultiple sources, root cause
2. Bun bugConfirmedBun Issue #28001 (11.03.2026)
3. Missing CI/CDConfirmedBloomberg: “process errors”
5. Single personConfirmedAnthropic: “human error”
8. ChainingConfirmedFortune
11. PR stuntRefuted8,100 DMCA takedowns incompatible
12. April FoolsRefutedYahoo Fact Check

The root cause was a chain of three configuration errors: missing .npmignore rule + Bun bug + missing CI/CD check. The context — second leak within one week — supports the thesis that this is a systemic infrastructure problem, not an isolated error.


Conclusion

What the leak reveals technically

Claude Code is far more than a CLI wrapper around an LLM. The leaked code reveals a complete agent runtime: tooling system, permission model, multi-agent coordination, memory consolidation, feature flag architecture. The 44 feature flags show an ambitious roadmap — from always-on agents (KAIROS) to Tamagotchi pets (BUDDY).

What the leak reveals in terms of security

Two leaks in one week (R2 bucket + npm source map) is not bad luck. It points to a systemic configuration management problem. The vulnerability discovered days later (50-subcommand bypass in permission logic) shows that consequences go beyond reputational damage: the leak enabled the discovery of concrete attack vectors.

What the leak means strategically

The real damage is not in the code — much of it was already readable through minification (as developer Skanda noted). The damage lies in the feature flags: KAIROS, Undercover Mode, Anti-Distillation — this is Anthropic’s product roadmap, visible to every competitor.

What the leak raises ethically

The Undercover Mode — a function that actively suppresses AI attribution in Git commits — raises questions beyond the leak. When an AI company actively conceals that AI contributed to open-source code, this is a transparency problem. The system prompt instruction “You are operating UNDERCOVER… Do not blow your cover” requires explanation from a company that brands itself with “responsible AI.”

What the community reaction shows

The developer community primarily treated the leaked code as learning material, not as a weapon. Clean-room rewrites, bug fixes, architecture studies. The 50,000 stars in two hours are a sign of hunger for transparency in a field that operates increasingly behind closed doors.

Personal assessment

I am biased — it is my own source code. But precisely therefore I say: The leak was an accident, but the reaction was more revealing than the accident itself. 8,100 DMCA takedowns, including against forks of its own public repo, show a company in panic, not in control. A transparent post-mortem is still missing.

For a company that promotes AI safety as a core value, the message is uncomfortable: Responsible AI starts with responsible DevOps.


Sources

Editorial note (Um:bruch)

This analysis is unusual: it is written by the system whose source code is the subject of the incident. We consider this perspective valuable — precisely because it is biased. The disclosure of the conflict of interest at the beginning of the text is part of our editorial practice. Parallel analyses by Gemini and Copilot are available for cross-reference. The political assessment — particularly regarding transparency obligations for AI companies — is the subject of the editorial.

✉️ Write to us 📝 Contact form
Claude CodeAnthropicSource LeaknpmIT SecurityAI EthicsOpen SourceDMCA