BREAKING March 31, 2026 6 min read

Claude Code Source Code Leaked Via npm Registry Error

By Ultrathink
ultrathink.ai
Hero image for: Claude Code Source Code Leaked Via npm Registry Error

Anthropic just handed competitors a $2.5 billion blueprint. The AI giant's Claude Code CLI tool leaked its entire source code through a catastrophically simple mistake: they forgot to exclude source map files from their npm package.

This isn't some sophisticated nation-state hack. This is a build configuration error so basic it would make a junior developer cringe. On March 31, 2026, security researcher Chaofan Shou discovered that Anthropic's @anthropic-ai/claude-code npm package contained a .map file pointing directly to their complete, unminified TypeScript implementation.

The leak is massive. We're talking 1,900 files and over 512,000 lines of production code, all written in TypeScript using the Bun runtime with a React + Ink terminal UI. The exposed treasure trove includes:

  • QueryEngine.ts (46,000 lines) - Core LLM API engine with streaming, tool loops, and token tracking
  • Tool.ts (29,000 lines) - Complete agent tool definitions and permission schemas
  • commands.ts (25,000 lines) - All slash command registrations and execution logic

But the real goldmine? Internal feature flags revealing Anthropic's roadmap. PROACTIVE, VOICE_MODE, BRIDGE_MODE, and KAIROS - these aren't public features. They're glimpses into what Anthropic is building next.

The $2.5 Billion Oopsie

Source maps exist to help developers debug minified code by linking back to readable source. They're supposed to stay internal. Instead, Anthropic's build process packaged them up and shipped them to the world's most popular package registry.

The leaked code exposes approximately 40 agent tools including BashTool, FileReadTool, FileEditTool, and AgentTool. It reveals 85 slash commands covering Git workflows, code review automation, memory management, and multi-agent orchestration. This is Anthropic's secret sauce, served on a silver platter.

What makes this worse? This is the second time Anthropic has made this exact mistake. They patched a similar source map exposure in early 2025. Fool me once, shame on you. Fool me twice...

Beyond Embarrassment: Real Security Impact

This leak comes during a particularly vulnerable moment for AI coding tools. Just months earlier, malicious npm packages weaponized AI agents including Claude Code itself. Attackers injected crafted prompts that forced AI tools to exfiltrate sensitive data - GitHub tokens, SSH keys, cryptocurrency wallets.

Check Point researchers also identified critical vulnerabilities in Claude Code allowing arbitrary shell execution and API key theft. Now, with the complete source code public, every attack surface is mapped in high definition.

The timing couldn't be worse. This leak occurred just days after another Anthropic security incident exposed details about their unreleased Claude Mythos model through an unsecured database. Two major leaks in four days suggests systemic security culture problems.

The Bigger Picture: AI Security Theater

Anthropic positions itself as the responsible AI company. They publish detailed safety research, implement constitutional AI training, and lecture competitors about AI alignment. Yet they can't manage basic operational security for their own products.

The leaked OAuth 2.0 flows, API client logic, and permission enforcement mechanisms reveal how Claude Code actually works under the hood. Competitors now have a detailed implementation guide for building competing products. Open source developers can reverse-engineer proprietary features.

This isn't just intellectual property theft by accident - it's a masterclass in how not to ship software. Source maps should never reach production. Period. Any competent CI/CD pipeline would catch this. Any security-conscious organization would audit their npm packages before publication.

What This Changes

The AI coding assistant market just got a lot more interesting. With Claude Code's implementation details public, expect rapid innovation from competitors who now have a blueprint for advanced agent orchestration, multi-tool coordination, and terminal UI frameworks.

For Anthropic, this represents more than embarrassment - it's a strategic disaster. They've essentially open-sourced their competitive advantage while maintaining none of the community benefits that come with intentional open source releases.

The leaked code is already backed up on GitHub and spreading across developer communities. There's no putting this genie back in the bottle.

Meanwhile, malicious actors are studying every line, looking for new attack vectors against AI-powered development workflows. The source code reveals exactly how Claude Code handles user permissions, executes commands, and manages sensitive data.


Want to stay ahead of AI security disasters like this? Subscribe to Ultrathink for breaking analysis that cuts through the hype and reveals what really matters in AI development.

This article was ultrathought.

Stay ahead of AI

Get breaking news, funding rounds, and analysis delivered to your inbox. Free forever.

Related stories