Anthropic Leaked Their Own Source Code. Here Is What Got Out and Why It Matters.

April 2, 2026
Anthropic Leaked Their Own Source Code. Here Is What Got Out and Why It Matters.

A missing build config entry shipped 512,000 lines of Claude Code’s internal TypeScript to the public npm registry. No hack, no breach. Just a packaging mistake that the internet will not forget.


On March 31, 2026, Anthropic accidentally published the full internal source code of Claude Code to the public npm registry. Not through a hack. Not through a breach. Through a single missing line in a build configuration file that allowed a debugging artifact to ship alongside a routine package update.

By the time Anthropic noticed and pulled the file, it had been downloaded, mirrored across GitHub, and analyzed by thousands of developers. The code is gone from the registry. It is not gone from the internet.


What Happened

Version 2.1.88 of @anthropic-ai/claude-code was published to the npm registry as part of a routine update. Bundled with it was a .map file, a source map, weighing 59.8 MB. Source maps are debugging tools that map compiled, minified code back to original source files. They are meant to stay internal. They should never ship in a production package.

Chaofan Shou, a researcher at Solayer Labs, found it at 4:23 AM ET and posted on X. Within hours the file had been downloaded widely, the source code had been extracted, and mirrors were appearing across GitHub. Anthropic removed the file and released a clean package version. But the community had already read everything inside.

What was exposed: 1,900 files and 512,000 lines of TypeScript covering the full Claude Code codebase, internal architecture, unreleased features, unreleased model codenames, and internal operational practices that Anthropic had not disclosed publicly.


The Careful Company That Leaked Twice in a Week

Anthropic’s public positioning is built around safety and caution. It is the lab that published a 100-page model specification about responsible AI development, that positions itself as the measured alternative to move-fast AI culture. That brand took a visible hit this week.

The Mythos model specification leak earlier in the week was one thing. An internal philosophical document about how Claude is supposed to think and behave is sensitive, but it is not operational source code. The Claude Code leak is different. This is production software, built and deployed by one of the most closely watched AI companies in the world, now fully readable by every competitor, researcher, and curious developer who downloaded the npm package or found a mirror.

Anthropic’s statement described it as a release of packaging issue caused by human error. That is accurate as far as it goes. But two accidental disclosures in seven days is a pattern that raises legitimate questions about internal release processes, code review, and what else might be sitting one configuration mistake away from public exposure.


What Got Out

The source code exposed far more than just how Claude Code is built. It exposed internal product decisions, operational practices, and a roadmap that Anthropic had not chosen to share publicly.

An Undisclosed Feature for Open-Source Contributions

The most discussed finding was a feature called undercover mode. When Claude Code operates outside Anthropic’s own internal repositories, it is configured to strip any indication that contributions are AI-authored. Commit messages, pull requests, and code comments cannot contain internal model codenames or any signal that an AI wrote them.

This means Anthropic has been using Claude Code to contribute to public open-source projects in a way that is deliberately not attributed to AI. Whether or not that is ethically acceptable is a question the open-source community is now actively debating. Anthropic had not disclosed this practice before the leak made it visible.

A Mechanism to Sabotage Competitors

The code contains an anti-distillation system. When a specific internal flag is active, Claude Code injects fake, non-functional tool definitions into what the model sees. The purpose is to pollute the training data of anyone recording Claude Code’s API traffic to train a competing model. If a competitor captures those sessions and trains on them, their model learns to call tools that do not exist.

This is a legitimate competitive defence from Anthropic’s perspective. It is also the kind of internal engineering decision that companies typically prefer not to advertise.

An Unreleased Product Roadmap

The source contains 44 feature flags covering capabilities that are fully built but not yet shipped to users. These include:

  • KAIROS: An always-on background daemon that watches files, processes memory, and runs autonomously while the developer is idle.
  • COORDINATOR MODE: A single Claude Code instance that can spawn and manage parallel worker agents for complex tasks.
  • ULTRAPLAN: Asynchronous long-horizon planning sessions running remotely in the background for 10 to 30 minutes.
  • BUDDY: A terminal companion pet with 18 species, including capybara.

None of these have been announced. They are now public knowledge, along with the engineering detail behind each one. Competitors have a detailed view of where Anthropic’s product is heading before Anthropic chose to share it.

Unreleased Model Codenames

The source references internal model codenames that do not correspond to any publicly announced release: Capybara, Fennec, and Numbat. The routing logic around these names gives a clearer picture of Anthropic’s near-term model tier strategy than anything the company has officially communicated.

Internal Engineering Admissions

A comment in the code disclosed that auto-compaction failures were generating 250,000 wasted API calls per day before a fix was applied. This is the kind of operational detail that only exists in internal codebases and gives a frank look at the scale of engineering problems that emerge in production AI infrastructure. It was not intended for external audiences.


Why This Matters Beyond the Code

Anthropic framed this as a packaging error with no security impact. On a narrow technical definition, that is correct. No user data was exposed. No model weights leaked. No credentials were compromised.

But source code leaks carry a different kind of impact. What leaked was not just implementation details. It was internal product strategy, undisclosed operational practices, competitive defences, and an engineering roadmap. That information is now permanently available to every competitor, regulator, researcher, and journalist who wants it.

The undercover mode feature in particular is unlikely to go away as a story. Open-source communities place significant weight on transparency around AI-generated contributions. The fact that Anthropic was making such contributions without disclosure, and that the practice only became known through an accidental leak rather than a deliberate announcement, is the kind of revelation that changes how people think about a company.

Once code hits the public npm registry and gets mirrored across GitHub, the situation is not recoverable through a package deletion. The leak is permanent. The only question is how Anthropic responds to what it is revealed.


What It Means for the AI Industry

This incident highlights a problem that extends well beyond Anthropic. AI companies are building increasingly complex production software, shipping it through standard software distribution channels like npm and PyPI, and in many cases the internal release hygiene has not kept pace with the speed of shipping.

Source maps, debug artifacts, internal config files, environment defaults that expose more than intended: these are all standard failure modes in software development. The difference with AI companies is that the code they are shipping contains not just implementation logic but internal strategy, model routing decisions, and operational practices that have significant competitive and reputational weight.

The lesson is not unique to Anthropic. Any organisation shipping AI tooling through public package registries needs to treat each release with the same rigour as a public announcement. Because when a source map ships, it is a public announcement. Just not the one you planned.


Sources

  • VentureBeat: Claude Code’s source code appears to have leaked, here’s what we know
  • CNBC: Anthropic leaks part of Claude Code’s internal source code (March 31, 2026)
  • Fortune: Anthropic leaks its own AI coding tool’s source code in second major security breach
  • Gizmodo: Source Code for Anthropic’s Claude Code Leaks at the Exact Wrong Time
  • Alex Kim’s blog: The Claude Code Source Leak: fake tools, frustration regexes, undercover mode, and more
  • Cybernews: Full source code for Anthropic’s Claude Code leaks
  • Hacker News: The Claude Code Source Leak discussion thread
  • The Information: Anthropic’s Coding Agent Source Code Exposed in Leak
  • Decrypt: Anthropic Accidentally Leaked Claude Code’s Source, The Internet Is Keeping It Forever
  • Smith Stephen: The Careful AI Company Just Leaked Their Own Code. Twice.

Note: This assessment is based on open-source intelligence (OSINT) and publicly available data. No proprietary or confidential information was accessed.

About the author