Claude Code Source Code Analysis

mellosouls1 pts0 comments

Claude Code's Entire Source Code Got Leaked via a Sourcemap in npm, Let's Talk About it — Kuber Mehtaᨒ MindDump

Search<br>Search

Dark modeLight modeBlogs<br>AI

AI Can Hang Up Now, It Still Takes the Abuse<br>Anthropic Wrote 244 Pages About an AI Model That's "Too Dangerous To Release". I Read It So You Don't Have To<br>Claude Code's Entire Source Code Got Leaked via a Sourcemap in npm, Let's Talk About it<br>DeepSeek vs. ChatGPT - The AI Chess Showdown That Broke the Internet<br>DeepSeek's Plan for AGI is the Costco Hot Dog<br>Generative AI and the Copyright System - The Legal Gray Area<br>How Google Gemini 2.0 Caught Up in the AI Race<br>How People use ChatGPT and Why You Should Care<br>I Got Early Access to Manus AI - Let's Talk About it!<br>OpenAI CEO Draws Line Between 'Regular Cute' and 'Gay Cute' for AI Models<br>OpenAI vs DeepSeek - The Battle for AI Dominance and the Meaning of "Open"<br>Roblox Released the Biggest AI World Model in Gaming. Everyone Hates It.<br>Roy Lee’s Interview Coder: Cheating or a Wake Up Call?<br>The AI Models Race to The Bottom in 2025<br>Turn this into Ghibli - How OpenAI commited the largest identity theft in the entire history of art

Gaming

Undertale Genocide - How to Make the Player Feel Bad For Their Choices

Post-Extended

How to Statistically Never Lose in Wordle Again<br>I Read Sam Bhagwat's AI Agents Bible So You Don't Have To (But Probably Should)

Projects

AsianMOM: A WebGPU-Powered AI That Roasts You Like an Asian Mother<br>How I Made DOOM Run Inside a GitHub Readme<br>How I Managed To Get Doom In A QR Code<br>How I Managed To Make HTML Game Compression So Much Better<br>How I Spent Three Nights Solving Listen Labs Berghain Challenge<br>Tackling AI-Generated Spam in LinkedIn Comments with ORCUS AI

Reflections

Ageusia<br>Clawdbot will be dead in a month<br>I'm Scared About Biological Computing<br>Prompting People<br>The Bubble is Not What You Think

Social-Media

Hello World<br>r/Place - The Internet's Greatest Communal Art Experiment<br>Studying the Twitter Algorithm and Virality

Technology

I Used a Firefox Based Browser for a Week and I Hated it<br>QR Codes and Malware - The Hidden Dangers in 2025<br>Why I Switched to the Nothing Phone 3a Pro and Can’t Stop Talking About It<br>Why Using Machine Learning for Stock Market isn't a Great Idea

Tutorials

Character Conversions with AI - Wan 2.2 Animate

Claude Code's Entire Source Code Got Leaked via a Sourcemap in npm, Let's Talk About it<br>by Kuber MehtaMar 31, 202617 min read<br>AI<br>ChatGPT<br>Social-Media<br>Artificial-Intelligence<br>GenerativeAI<br>Internet<br>OpenAI<br>Claude<br>Anthropic

Earlier today (March 31st, 2026) - Chaofan Shou on X discovered something that Anthropic probably didn’t want the world to see: the entire source code of Claude Code, Anthropic’s official AI coding CLI, was sitting in plain sight on the npm registry via a sourcemap file bundled into the published package.

I’ve maintained a backup of that code on GitHub here but that’s not the fun part

Let’s dive deep into what’s in it, how the leak happened and most importantly, the things we now know that were never meant to be public.

How Did This Even Happen?

This is the part that honestly made me go “…really?”

When you publish a JavaScript/TypeScript package to npm, the build toolchain often generates source map files (.map files). These files are a bridge between the minified/bundled production code and the original source, they exist so that when something crashes in production the stack trace can point you to the actual line of code in the original file, not some unintelligible line 1, column 48293 of a minified blob.

But the fun part is source maps contain the original source code . The actual, literal, raw source code, embedded as strings inside a JSON file.

The structure of a .map file looks something like this:

"version": 3,<br>"sources": ["../src/main.tsx", "../src/tools/BashTool.ts", "..."],<br>"sourcesContent": ["// The ENTIRE original source code of each file", "..."],<br>"mappings": "AAAA,SAAS,OAAO..."<br>That sourcesContent array? That’s everything.<br>Every file. Every comment. Every internal constant. Every system prompt. All of it, sitting right there in a JSON file that npm happily serves to anyone who runs npm pack or even just browses the package contents.

This is not a novel attack vector. It’s happened before and honestly it’ll happen again.

The mistake is almost always the same: someone forgets to add *.map to their .npmignore or doesn’t configure their bundler to skip source map generation for production builds. With Bun’s bundler (which Claude Code uses), source maps are generated by default unless you explicitly turn them off.

The funniest part is, there’s an entire system called “Undercover Mode” specifically designed to prevent Anthropic’s internal information from leaking.

They built a whole subsystem to stop their AI from accidentally revealing internal codenames in git commits… and then shipped the entire source in a .map file, likely by Claude.

What’s Claude Under The Hood?

If you’ve been living under a rock, Claude...

code source claude entire file anthropic

Related Articles