On March 31, 2026, Anthropic published a version of its Claude Code command line tool that contained the tool's own source code, about 512,000 lines of it. Anthropic called it "a release packaging issue caused by human error, not a security breach," and said no customer data or credentials were exposed. The code was copied widely before Anthropic could pull it back, and it revealed unreleased features, internal codenames and the logic Claude Code uses to defend itself against attacks.
Update, November 2026
- Takedowns narrowed. Anthropic's first copyright takedown request hit a network of about 8,100 GitHub repositories, including copies of Anthropic's own public Claude Code repository. Boris Cherny, Anthropic's head of Claude Code, said this was an accident, and the company narrowed the request to one repository and 96 copies of it, according to TechCrunch. GitHub's public record shows the partial retraction, dated April 1.
- Anthropic's explanation. Paul Smith, Anthropic's chief commercial officer, told Bloomberg the leak came from "process errors" tied to the company's fast release cycle for Claude Code, and that it was not a hack.
- Malware used the leak as bait. Within days, fake "leaked Claude Code" downloads on GitHub were installing the Vidar password stealer and the GhostSocks proxy tool, The Register reported, citing research by the security firm Zscaler.
- No lawsuit found. We found no report of Anthropic filing a lawsuit over copies or rewrites of the leaked code. Its response we could confirm was the takedown requests.
- The IPO. Anthropic filed for an initial public offering on October 26, 2026. CNBC reports it set a price range of $70 to $78 a share and expects to start trading on the Nasdaq under the ticker ANT on November 19, a schedule TechCrunch and Anthropic's roadshow announcement also describe. We found no report that the IPO filing discusses the Claude Code leak.
What happened
Claude Code is distributed through npm, the main public registry where JavaScript developers publish and download software packages. Version 2.1.88 of the package @anthropic-ai/claude-code went out on the morning of March 31 with an extra file inside: cli.js.map, about 60 MB in size.
That file is a source map. A source map is a debugging file that links the compressed code a program ships with back to the original, readable code it was built from. Shipping one in a public package hands out the original code. In this case it held the full, readable TypeScript source of Claude Code. (TypeScript is a version of the JavaScript programming language.)
Security researcher Chaofan Shou noticed the unusually large package and flagged it. Anyone who installed or updated Claude Code through npm that morning received the file automatically.
Anthropic's statement to BleepingComputer was short: "Earlier today, a Claude Code release included some internal source code. No sensitive customer data or credentials were involved or exposed."
Outlets described the scale differently. The Register said the package contained the tool's entire source code. CNBC described it as part of Claude Code's internal source code.
How it happened
Outside analysts have pointed to three gaps. Anthropic has confirmed human error but has not published a detailed account, so treat these as their reading of the evidence.
A bundler setting. A bundler is a tool that combines many code files into a few files ready to ship. Anthropic builds Claude Code with Bun, a JavaScript runtime and bundler that Anthropic acquired in December 2025. Several analysts, including NodeSource, linked the leak to an open Bun bug report, issue #28001, which says Bun still produces source maps even when a project sets development: false. Anthropic has not said this bug caused the leak.
No exclusion rule. npm packages can leave files out in two ways: a files list in package.json that names what to include, or a .npmignore file that names what to exclude. According to analyses such as Layer5's, Claude Code had neither a rule excluding *.map files nor a files list that would have kept the source map out.
No check before publishing. Many teams run npm pack --dry-run, a command that lists exactly what will be published before it goes live. Analysts said no such check caught the jump in package size before the release reached the registry.
What was inside
Researchers counted about 1,906 files and 512,000 lines of TypeScript. These findings come from their write-ups, including Alex Kim's and InfoQ's, not from Anthropic.
KAIROS, an unreleased background agent. KAIROS is referenced more than 150 times in the code. It is described as a program that keeps running between sessions, receives regular "tick" prompts, and can decide on its own to act, for example by watching GitHub for events, sending notifications or starting tasks. The name comes from the Greek word for "the right moment." It had not been announced at the time of the leak, and we found no official announcement of it since.
ULTRAPLAN, remote planning. ULTRAPLAN sends complex planning work to a cloud session running Anthropic's Opus 4.6 model for up to 30 minutes. The local terminal checks in every 3 seconds, and a browser page lets the user watch the plan and approve or reject it before it runs. It was unannounced at the time of the leak. Reports disagree on whether it has shipped since.
Model codenames. According to researchers, Tengu is Claude Code's own codename, Fennec maps to Opus 4.6, and Numbat is an unreleased model. Capybara appears to be a new model family, possibly connected to the "Mythos" model named in other leaks, though write-ups disagree on what it maps to. "Penguin Mode" is the internal name for what users know as Fast Mode. Its server address is /api/claude_code_penguin_mode, and a switch called tengu_penguins_off turns it off.
Undercover Mode. When Anthropic employees use Claude Code on code outside Anthropic's own systems, this mode removes the "Co-Authored-By" credit line from code changes, stops Claude from mentioning unreleased models or internal details, and hides internal codenames. In effect, it makes the tool behave like a regular user's copy when Anthropic staff work in public.
Prompt injection defenses. This drew the most concern from security researchers. A prompt injection is an attempt by hostile content, such as a web page, a file or a code comment, to take over an AI agent's behavior. Claude Code contains logic to detect and resist these attacks, and that logic is now public. "If you know where and how prompt injection defenses are applied, you can more easily find a bypass," Waxell AI wrote. "If you know the system prompts, an attacker doesn't have to guess the preamble anymore to craft content that uses the right language to subvert the model."
The main security concern, then, is not leaked credentials, since none leaked. It is that the design of Claude Code's defenses is now known.
How Anthropic responded
Anthropic sent copyright takedown requests under the Digital Millennium Copyright Act (DMCA) to GitHub the same day. GitHub's public record shows the March 31 notice. By 2 p.m. ET on March 31, Anthropic was working to remove copies from GitHub and other sites. By then the code had already been copied to GitHub, saved to Cloudflare and spread across thousands of repositories. As noted in the update above, the first request swept up about 8,100 repositories before Anthropic narrowed it. The Hacker News reported that the company acknowledged the incident and described it as a packaging error.
Anthropic released a corrected package without the source map. The fix is to keep *.map files out of the published package, which takes one line in .npmignore or the files list. We could not confirm whether the Bun bug report has since been resolved.
What it means
For people who use Claude Code, Anthropic said no customer data, API keys or credentials were exposed. Users' code, keys and accounts were not part of the leak.
What changed is the risk from prompt injection. Teams that run Claude Code on untrusted input, such as web pages, outside files or automated build systems, now face attackers who can read how its defenses work. That does not mean the defenses fail. It means they no longer rely on being secret.
The second risk turned out to be the leak's fame. The fake "leaked source" downloads described in the update above targeted people searching for the code, not Claude Code users. Researchers at Zscaler advised installing developer tools only from official sources.
For the wider software industry, the incident shows how a release can carry more than intended. Build files, debug files and internal documents can travel with any published package, on npm, PyPI or elsewhere, if no step checks what is inside. Each of the three gaps analysts identified could have stopped this leak on its own: one line in .npmignore, a files list, or a dry run before publishing.
What we know and what we do not know
What we know:
- Version 2.1.88 of Claude Code on npm shipped with a source map containing its source code on March 31, 2026.
- Anthropic called it human error, said no customer data or credentials were exposed, and sent takedown requests that it later narrowed.
- Criminals used the leak as bait to spread malware through fake GitHub downloads.
What we do not know:
- Exactly which step in Anthropic's release process failed. Anthropic has not published a detailed account.
- Whether the Bun bug played a part.
- Whether features found in the code, such as KAIROS, will ship.
- Whether Anthropic will take legal action over rewrites of the code. We found none as of November 14, 2026.
Sources
- Claude Code source code accidentally leaked in npm package
- Claude Code Source Leaked via npm Packaging Error, Anthropic Confirms
- Anthropic accidentally exposes Claude Code source code
- Anthropic Accidentally Exposes Claude Code Source via npm Source Map File
- Anthropic Accidentally Leaked Claude Code's Entire Source: Here's What Was Inside
- Anthropic Just Leaked Claude Code's Source. Here's What That Means for Every AI Agent You Run.
- The Claude Code Source Leak: fake tools, frustration regexes, undercover mode, and more
- The Claude Code Source Leak: 512,000 Lines, a Missing .npmignore, and the Fastest-Growing Repo in GitHub History
- Bun issue #28001
- Anthropic leaks part of Claude Code's internal source code
- Anthropic DMCA notice, March 31, 2026
- Anthropic DMCA partial retraction, April 1, 2026
- Anthropic took down thousands of GitHub repos trying to yank its leaked source code, a move the company says was an accident
- Anthropic Cites 'Process Errors' in Accidental Claude Code Source Leak
- Fake Claude Code source downloads actually delivered malware
- Anthropic Claude Code leak
- Anthropic acquires Bun as Claude Code reaches $1B milestone
- Anthropic files S-1 with the SEC for proposed initial public offering
- Anthropic sets IPO price range of $70 to $78, looks to start trading Nov. 19, sources say
- Anthropic sets IPO price range of $70 to $78 per share to reach an implied valuation of $1.404 trillion
- Anthropic launches roadshow for proposed initial public offering



