Silly Mistake Causes Anthropic to Leak Claude Code Source

Quick Summary
A basic npm configuration error led to Anthropic's flagship Claude Code having its entire logic and system prompts exposed. While the Rust version "Claw-code" is making waves on GitHub with over 100k stars, enthusiasts are flocking to the 'hidden' and extremely peculiar features like virtual pets right in the terminal. Could this be Anthropic's way of showcasing its power ahead of its IPO?
Anthropic accidentally or intentionally exposed the entire source code of Claude Code due to a basic configuration error during npm packaging. Over 512,000 lines of TypeScript, nearly 1,900 files, and even unannounced features suddenly became public worldwide, but what's more notable is that it happened exactly one day before April Fools' Day .
A Silly Mistake from a Billion-Dollar Company
The leak did not come from hackers or external attacks but was entirely due to an internal error, as Anthropic accidentally left out the cli.js.map file, weighing approximately 59.8 MB, in the npm package during release. This .map file contains sourcesContent — which is typically used for debugging — but it stored the entire original source code in plain text, making it readable by anyone.
As a result, the entire architectural logic, system prompts, and secret features of Claude Code were completely exposed. However, what surprised many even more was that this error persisted for 20 days without being detected, despite Anthropic being the company behind the Bun runtime, which is directly related to this packaging error.
Claw-code: A Rust Rewrite Emerges in Hours
While Anthropic was sending DMCA requests to GitHub to remove copies, developer Sigrid Jin did what everyone expected: read the entire leaked source code and rewrite a completely new version in Rust. This further proves that powerful AI tools are truly dangerous only when they fall into the hands of those who know how to fully exploit them.
The important legal point is that this project used a clean-room rewrite technique — meaning it was re-implemented based on observed behavioral specifications rather than directly copying the original code, so theoretically, it does not infringe on Anthropic's copyright. In terms of performance, Rust promises to be significantly faster than the original version running on Bun. At the time of writing, this repo had garnered 108k stars, an extremely rapid number on GitHub. Claw-code repo link https://github.com/instructkr/claw-code

Unannounced Features of Claude Code
The most interesting part of the leak was not the technical architecture but the secret features within.

Although many features were leaked, the three names most discussed by the community are Buddy System, KAIROS, and ULTRAPLAN.
Virtual Pet Buddy System
This is a Tamagotchi-style virtual pet system right in the terminal, featuring 18 different species with stats like "Debugging" and "Chaos," and even a 1% chance of dropping rare Shiny items. Notably, the source code explicitly states the testing period for this feature as April 1st to April 7th, 2026, coinciding with April Fools' Day.
KAIROS Autonomous Mode
This is an always-on assistant mode capable of autonomously performing tasks without user commands, which, if released, would be a significant advancement compared to how Claude Code currently operates.
ULTRAPLAN Extended Thinking Time
This feature allows offloading complex planning tasks to the cloud with a "thinking" time of up to 30 minutes, designed for problems requiring deep reasoning.
Real Accident or Anthropic's April Fools' PR Campaign?
The timing of the incident has raised considerable skepticism. Some arguments support the deliberate PR hypothesis: the Buddy System feature was scheduled for testing precisely on April 1st; the 'leak' inadvertently helped Anthropic showcase impressive technical capabilities and shift its image from a 'rigid company with third parties' to a 'talented victim' in the eyes of the community; and the fact that a company owning Bun made an error related to Bun itself for 20 days without detection sounds too incredible to be true.
However, there are also counterarguments: sourcemap errors in npm are not uncommon, even for large companies, and having code cloned tens of thousands of times on GitHub is not something a company preparing for an IPO would want to happen. Anthropic has not yet confirmed or denied anything beyond the DMCA requests.
Whether a genuine accident or a calculated scenario, the Claude Code source code has provided one of the rarest insights into building a real-world agentic AI system — its architecture, system prompts, file organization, and even unreleased features. If you are interested in building AI agents, the claw-code repo is still available and is one of the most worthwhile unofficial AI documents to read this year.



