DocsQuick StartAI News
AI NewsClaude Code source code leak shocks the AI community
Industry News

Claude Code source code leak shocks the AI community

2026-04-01
Claude Code source code leak shocks the AI community

Anthropic’s flagship coding assistant, Claude Code, suffered a leak of 510,000 lines of source code due to an npm packaging error. Its internal architecture and unreleased features were fully exposed, sparking heated discussion among developers worldwide.

Claude Code Source Code Accidentally Leaked and Spreading Across the Web

Illustration related to the Claude Code source code leak

On March 31, AI unicorn Anthropic suffered a major information security incident. During the release of its flagship programming tool Claude Code on npm, a configuration error caused a source map file of about 57MB to be published, resulting in the full exposure of over 1,900 TypeScript files and more than 512,000 lines of source code.

The incident was first discovered and disclosed on the X platform by Chaofan Shou, an intern researcher at Web3 security company FuzzLand. Within just a few hours, the leaked source code was archived across multiple GitHub repositories, receiving over 14,000 stars and more than 9,000 forks—sparking widespread attention and discussion in the developer community.

Details of the Leak: Full Architecture and Hidden Features Exposed

Technical analysis shows that Claude Code’s terminal interface is built with the React + Ink framework and runs in the Bun environment. Internally, it contains:

  • Over 40 independent tool modules, covering file system access, Bash execution, LSP protocol integration, and multi-agent control;
  • A core inference module named QueryEngine.ts, containing over 46,000 lines of code, responsible for “chain-of-thought” scheduling and token control;
  • Coordinator and bridge modules that enable multi-agent collaboration and integration with IDEs such as VS Code and JetBrains.

Even more noteworthy, the code reveals a large number of undisclosed experimental features:

  1. Kairos Mode: A background daemon resembling a persistent assistant, supporting scheduled tasks and integrated conversation memory—described as a “24-hour online AI steward.”
  2. Buddy System: An electronic pet system within the terminal, featuring 18 AI companion species, rarity levels, and personalized “soul descriptions.”
  3. autoDream Engine: Allows Claude to “dream,” generating long-term memory by integrating recent dialogues and task outcomes in the background.
  4. Undercover Mode: Intended for Anthropic internal staff, designed to conceal AI traces in commit histories.

Screenshot of a cloned Claude Code repository on GitHub

A Simple Mistake That Triggered a Serious Warning

Industry analysts largely attribute the incident to an .npmignore configuration oversight. In production releases, source map files should have been excluded, but this mistake caused the complete mapping file to be published—making every source file path and code segment easily extractable. One security researcher noted, “This type of mistake is explicitly warned against on the first page of most beginner tutorials.”

Although the incident did not involve Claude’s model weights or user data, its system prompts, tool scheduling logic, and internal security architecture were fully exposed. Several industry experts believe the leak will significantly lower technical barriers for AI agent engineering and may accelerate competition in the open-source ecosystem.

Industry Reactions: Disaster or Catalyst?

The developer community is divided over the leak. Some view it as an epic PR disaster that will severely damage Anthropic’s corporate reputation and supply-chain security; others argue that this “involuntary open-sourcing” may, in fact, accelerate innovation across the AI coding assistant sector.

“From a technical perspective, the code demonstrates Anthropic’s engineering depth, while also showing that the industry still needs to invest far more in software supply-chain security,” said one security expert in an interview.

As of publication, Anthropic has not issued an official statement regarding the incident. However, the affected versions have been urgently removed from the npm official page, and the repercussions continue to unfold.


Editor’s Note: From an “AI-safety-first” company to a global controversy sparked by a simple error, the Claude Code leak not only unveils the prototype of an “ideal AI assistant” but also reminds the entire industry once again—behind the rapid iteration of AI engineering, security remains its most fragile weak point.

Related Articles

View All

Contact Us

We usually reply quickly during business hours

Scan WeChat

Support: Hub Assistant

WeChat ID: