Claude Code Source Code Leaked via npm Sourcemap
Anthropic accidentally shipped a 59.8MB sourcemap file in Claude Code v2.1.88, exposing 512,000+ lines of TypeScript source. The community found it within minutes.
I’ve been tracking the Claude Code ecosystem closely, so when reports started coming in Monday afternoon about something unusual in the npm release, I dropped what I was doing to look at it, and here’s how the whole thing played out.
On March 31, 2026, Anthropic shipped Claude Code v2.1.88 to the npm registry with a 59.8MB .map sourcemap file bundled by accident. Sourcemap files are generated during the TypeScript-to-JavaScript compilation process and contain the original TypeScript source code, line by line, mapped back to the compiled output. They exist to make debugging easier in production, but they’re normally excluded from distribution packages because they expose your entire codebase to anyone who downloads them.
Someone in the community noticed the anomalous package size within minutes of the release going live. The normal Claude Code package is a fraction of that size. Once one person pointed at the sourcemap, it was all over the developer forums within the hour.
What Was Inside
The sourcemap contained the full TypeScript source for Claude Code, over 512,000 lines. That’s the complete, unminified, pre-compilation source for one of the most widely used AI coding tools available.
From what I’ve been tracking in the community analysis that followed, the code revealed several things about how Claude Code works under the hood:
A DRM-like verification system. The source included what looks like a license and entitlement verification layer. It checks authentication state and feature access in ways that aren’t visible in normal use. The specifics of how this works were a surprise to a lot of developers who assumed Claude Code was a straightforward API wrapper.
Agent patterns and loop architecture. The source shows how Claude Code structures its internal reasoning loops, how it manages tool calls, and how it handles multi-step tasks. The patterns are more sophisticated than the public documentation suggests. I’ll cover this in more depth in a separate analysis piece.
Skill system internals. There’s a skill loading and execution system that’s more modular than the slash-command interface makes it appear. The source shows how skills are defined, loaded, and invoked internally.
Context management. How Claude Code tracks conversation context, manages token budgets, and decides what to include in each API call is fully visible in the source. This is the kind of implementation detail that competing tools would find useful.
How Quickly It Spread
The code spread faster than Anthropic could possibly contain it. By the time Anthropic pulled the v2.1.88 release from npm, a matter of hours after it went live, the sourcemap had already been downloaded, extracted, and mirrored. Developers pushed it to GitHub repositories to preserve it for analysis. Within 24 hours, Anthropic was counting thousands of copies across the public internet.
Pulling a package version from npm doesn’t unpublish it from the internet. Anyone who had downloaded it already had the full source. Caches, mirrors, and individual developer machines all had copies. The genie was out of the bottle.
Anthropic’s Response
Anthropic pulled v2.1.88 from npm quickly after the issue was identified and pushed a clean release without the sourcemap. The company didn’t make a detailed public statement about the incident on March 31 itself, the DMCA effort that followed over the next two days (covered separately) was the primary visible response.
The immediate fix, removing the sourcemap from the build pipeline, is straightforward. The longer problem is that once source code is out, it’s out. The DMCA approach addresses GitHub specifically but can’t reach private mirrors, local copies, or any of the other places the code ended up.
What This Means for Users
For people using Claude Code day-to-day, this doesn’t change anything about the tool itself. The v2.1.88 release with the leak is no longer available; current and future releases are unaffected.
The more interesting question is what the source code reveals about Claude Code’s design philosophy and how it compares to what Anthropic documents publicly. The gap between the documented interface and the internal architecture is wider than most developers assumed, and our complete guide to Claude Code is written against the documented half. That’s not unique to Anthropic, most developer tools have more going on under the hood than the docs describe, but the accidental exposure made it visible in a way it normally wouldn’t be.
I’ve been going through the analysis being done in public, and I’ll have a more technical breakdown of what the architecture reveals in a few days. The patterns in the agent loop and context management in particular are worth understanding, regardless of how the code became visible.
Sources
- [1]
- [2]
- [3]
Illustration: AI-generated (gpt-image-2)
Written by Bobby Smart
@mrbobbysmart