Anthropic has confirmed that the complete source code of its Claude Code CLI tool was accidentally exposed through a packaging error in its npm distribution, leaking approximately 512,000 lines of TypeScript code to the public. The incident, which occurred on March 31, 2026, was first identified by Chaofan Shou, a security researcher and intern at blockchain security firm Fuzzland, who posted a direct link to a publicly accessible Cloudflare R2 storage bucket on X (formerly Twitter).
How the Leak Happened
The exposure stemmed from version 2.1.88 of the package @anthropic-ai/claude-code, which included a 59.8 MB JavaScript source map file. This file—normally used to map minified production code back to original TypeScript sources during debugging—contained a link to a ZIP archive stored in Anthropic's own Cloudflare R2 bucket, which was publicly readable without authentication. No hacking was required; the file was simply there. The root cause was traced to the Bun bundler, which generates source maps by default. The release pipeline did not include a build step to exclude or disable this debugging artifact. Anthropic acknowledged that adding the appropriate entries to .npmignore or the files field in package.json could have prevented the leak.
What Was Exposed: Internal Architecture and Hidden Features
The leaked source code, consisting of roughly 1,900 TypeScript files, provides a comprehensive view into how Anthropic builds a production-grade AI coding assistant. It includes tool execution logic, permission architecture, memory system, telemetry, system prompts, and feature flags. Among the findings: the telemetry system scans user prompts for profanity as a frustration signal but does not log full conversations or code. A “stealth mode” instructs the AI to strip internal codenames and project details from Git commits and pull requests. More intriguingly, several unreleased features were hidden behind feature flags: KAIROS is described as an always-on background daemon that monitors files, logs events, and runs a memory consolidation process called “dreaming” during idle periods; BUDDY is a terminal pet with 18 species (including capybaras) and attributes such as DEBUGGING, PATIENCE, and CHAOS; COORDINATOR MODE allows a single agent to spawn and manage parallel worker agents; and ULTRAPLAN schedules remote multi-agent planning sessions of 10 to 30 minutes.
Second Occurrence in 13 Months Raises Red Flags
This is not the first time Anthropic has leaked Claude Code source code via a source map error. An almost identical incident occurred in February 2025 with an earlier version of the tool. The recurrence within roughly 13 months—combined with another major leak just five days earlier (on March 26, 2026) when a misconfigured content management system exposed about 3,000 internal documents detailing the unreleased “Claude Mythos” model—has drawn sharp criticism of Anthropic's deployment practices. The company told Venture Beat that no sensitive customer data, credentials, or model weights were compromised, and that measures are being taken to prevent future incidents.
Community Response and Security Advisory
Within hours of the disclosure, mirrored repositories appeared on GitHub, some accumulating tens of thousands of stars before Anthropic issued DMCA takedown notices. Community members began extracting telemetry data, toggling hidden feature flags, and writing “clean-room” reimplementations in Python and Rust to avoid copyright issues. Separately, the March 31 leak coincided with an npm supply chain attack on the axios package active between 00:21 and 03:29 UTC. Anthropic advised developers who installed or updated Claude Code via npm during that window to audit their dependencies and rotate credentials, and recommended preferring the official native installer over npm going forward.
Despite Anthropic's swift removal of the exposed package, archived copies and mirrors continue to circulate online. While no user data or core Claude models were impacted, the incident has given competitors a detailed blueprint for building AI coding assistants comparable to Claude Code.

