Claude Code Source Code Leak: What the npm Source Map Revealed
Prefer to watch? Watch on YouTube Ā· Subscribe for new builds Ā· Read the transcript
In this video I break down how Anthropic accidentally exposed the full source code of Claude Code through a source map file on npm, what developers found inside, and what it means if you build with AI agents. It's for non-technical builders who want a plain explanation of what happened and why it matters. I recorded this in March 2026, a few hours after the news broke. Tools change fast, so check the current docs before acting on anything here.
What I cover in this video
- 0:00: What happened and how big the leak is
- 0:45: What a source map is, in plain terms
- 2:15: The irony of Undercover Mode
- 3:47: What's inside: 40 tools, Bun, and the plugin architecture
- 5:17: The 46,000-line query engine, sub-agents, and the IDE bridge
- 6:47: Unreleased features: the Buddy pet and KAIROS proactive mode
- 9:06: My take on what this means for OpenClaw builders
- 12:09: The security lesson for all of us
How a source map leaked the whole codebase
Before you ship software, you usually bundle and minify it. That squashes all your readable code into one big compressed file. Think of a book with every space, punctuation mark, and chapter break removed: a computer can still read it, but a person can't.
A source map works like a decoder ring. It maps that compressed file back to the original readable code, which helps developers see which line caused a crash while debugging. The catch is that the source map holds the entire original source as embedded strings, including every file, comment, and internal constant.
Anthropic published Claude Code to npm with a source map included. npm is a public registry, so anyone could download the package and look inside. A security researcher did, and the code is now archived on GitHub (here's the archive). There's a good write-up on Dev.to and a Hacker News thread about it.
The ironic part: the leaked code contains a whole system called Undercover Mode, built to stop Claude from revealing internal code names in Git commits. Then the actual source went out in a map file.
My guess at the cause is a build configuration oversight. Either someone didn't add .map files to the npm ignore file, or Bun's bundler wasn't set to skip source maps for production builds. Bun generates source maps by default unless you turn them off. NDTV reported that this is the second time something like this has happened this year.
What's inside Claude Code
I want to be clear that I'm not telling anyone to dig through proprietary code. The code is already public and news outlets are covering it, so here's what the developer community found:
- Scale: The main entry file alone is almost a megabyte. There are 40 built-in tools and 50 slash commands, plus a custom React-based terminal renderer built with a library called Ink. It all runs on Bun, a faster JavaScript runtime, not Node.
- Tooling system: It uses a plugin architecture. Every capability is its own permission-gated tool: file writing, bash execution, web fetching, LSP integration. The base tool definition alone is 29,000 lines.
- Query engine: This is the brain. It handles model calls, streaming, caching, and orchestration in 46,000 lines of TypeScript.
- Multi-agent orchestration: Claude Code can spawn sub-agents, or swarms, to work in parallel. Each one gets its own context and its own tool permissions.
- IDE bridge: A two-way communication layer connects the VS Code and JetBrains extensions to the CLI over JWT-authenticated channels.
Unreleased features: Buddy and KAIROS
Buddy is a Tamagotchi-style virtual pet. A deterministic random number generator seeded from your user ID gives each person a unique pet. There are six rarity tiers from common to legendary, with species like Pebble Crab, Cloud Ferret, and Crystal Drake. Each pet gets generated stats for debugging, patience, chaos, wisdom, and snark. There's a separate 1% "shiny" chance on top of rarity. Pets appear as ASCII art with idle and reaction animations, and Claude writes each one a personality when it hatches. The code references April 1ā7 as a teaser window and lays out a launch plan for May 2026.
KAIROS is the bigger reveal. It's a persistent, always-on assistant mode. Instead of waiting for you to type, it watches what you're doing and logs observations, decisions, and actions at regular intervals. Periodic "tick" prompts let it decide whether to step in or stay quiet. A 15-second blocking budget means it never interrupts you for more than 15 seconds at a time, and a brief output mode keeps it from flooding your terminal.
What this means for OpenClaw builders
KAIROS is basically what OpenClaw already does with heartbeats and cron jobs. I run this pattern every day: my agent checks in on a schedule, decides whether anything needs my attention, and either helps or stays quiet. Claude Code's sub-agents look a lot like OpenClaw's sub-agent setups too.
I see this as validation. Memory systems, multi-agent setups, heartbeat monitoring, and skill injection are all things Claude Code is building toward. The difference is that Anthropic builds them in a closed, proprietary tool. With OpenClaw you pick your model and your memory system, set up your agents however you want, and nothing leaves your machine unless you choose. Claude Code is powerful, but it's a black box that just had its lid blown off by a build mistake. That says something about the tradeoffs between closed and open tools. For more on this, see my AI agents page.
The security lesson
Security usually fails on the basics, not the advanced stuff. Check your build pipeline, check which files you're actually publishing, and check your npm ignore and Git ignore files. I run weekly security audits on my own OpenClaw setup. When 42,900 OpenClaw instances were found publicly exposed a few weeks earlier, it was the same kind of basic mistake.
If you're a developer, study the architecture without copying anything: the tool system, the permission gating, the sub-agent patterns. Learn how the pieces fit together, not the specific code. You can also hand the public write-ups to your own agent and see what it makes of them.
Key takeaways
- A source map in a public npm package exposed about 1,900 files and 512,000 lines of Claude Code's TypeScript.
- Claude Code is a full production system: 40 permission-gated tools, a 46,000-line query engine, sub-agents, and an IDE bridge.
- Unreleased features include the Buddy virtual pet and KAIROS, an always-on assistant mode.
- KAIROS follows the same heartbeat and cron pattern OpenClaw users already run.
- Check what your build actually publishes. Bun generates source maps by default unless you turn them off.
FAQ
How did the Claude Code source code leak?
Anthropic published its Claude Code npm package with a source map file included. Source maps embed the original source code as strings, and npm is public, so anyone could download the package and read the full source.
What is KAIROS in Claude Code?
KAIROS is an unreleased always-on assistant mode found in the leaked code. It watches what you do, logs observations at regular intervals, and uses tick prompts to decide whether to act or stay quiet. It has a 15-second blocking budget and a brief output mode.
What is the Claude Code Buddy pet?
Buddy is a Tamagotchi-style virtual pet found in the leaked code. Your user ID seeds a unique pet with a rarity tier, stats like debugging and snark, ASCII art animations, and a personality that Claude writes when it hatches.
How can I avoid leaking source maps in my own npm packages?
Check what your build actually publishes. Make sure .map files are excluded in your npm ignore file, and turn off source map generation in production builds, since Bun creates them by default.
Chapters
Transcript
Read the full transcript
0:00Just a few hours ago, Anthropic leaked their entire source code for Claude Code. And I'm going to tell you what this means for us builders, exactly. Their own flagship AI coding tool, all the source code leaked. And when I say entire source code, I mean 19,000 files, 512,000 lines of TypeScript, every tool, every system prompt, every internal feature. This is insane. All of it just sitting there on an NPM for anyone to find. And the way it happened is kind of hilarious. So, I'm going to tell you what went down and this just broke a few hours ago. A security researcher named Shalfin Shal discovered that when Anthropic published their Claude Code package to the NPM registry, they
0:45accidentally included something called a source map file. Now, if you're not a developer, let me explain what this means in simple terms. When you build software, you write the code in a clean, readable format before you ship it to users. You usually bundle it, minify it. So, this means you compress everything down into one big file that's really hard for humans to read. It's like taking a book and removing all the spaces and punctuation and chapter breaks. The computer can still read the file, but a person looking at it would have no clue what's going on. So, basically a source map is a decoder ring. It maps out the compressed mess back to the original readable code. Developers use source maps for debugging. So, when something crashes, they can see exactly which line the
1:30original code caused the problem. Here's the thing. The source map file literally contains the entire original source code embedded inside as strings. Every file, every comment, every internal constant, everything. So, Anthropic shipped their source map file inside an NPM package and the NPM is a public registry. So, anyone can download it. Anyone can look inside. A security researcher did and now the entire internet is going insane. So, basically Claude Code is now open source. Claude Code's proprietary source code, everyone on the internet now has access to it. So, the irony here is incredible because inside the leaked code, there's literally an entire system
2:15called undercover mode specifically designed to prevent Anthropic's internal information from leaking. How does this happen? They built a whole subsystem to stop their AI from accidentally revealing internal code names in Git commits. And then they shipped the actual source code in a map file that was probably generated by Claude itself. Real quick, before we keep going, if you're watching this and you want to actually build with some of these tools, not just watch videos about them, then you're going to want to check out our community down below, Shipping School. We have a full Claude Code course, a full Open Claude course, and four live bootcamps every single week where we actually help you get set up from scratch. Like actually set this thing
3:00up, not just watch a tutorial and figure it out by yourself. And we also provide one-on-one coaching, so you can book a call with me, we can share screens, and I can help you get Claude Code or Open Claude running on your machine. That's it, no fluff. I built this community because watching YouTube's only gets you so far. We launched it just 3 days ago and we have over 55 members. You need people around you who are actually building, people who hold you accountable, and coaches who can help you when you get stuck. I'll put the link in the description down below. Get in now before the price goes up. So, you can't make this up. This literally just happened hours ago and everyone's going insane. But I'm going to talk about what's actually inside and what this means for us. Does it affect us at all? Here's my two cents. Because, you know, the interesting part is, you know, I
3:47want to be clear and, you know, I'm not endorsing people to go through like proprietary code, but the cat's out of the bag. This has happened. It can't You can't go back. You know, it's already on GitHub with over 1,100 stars and 1,900 forks. Multiple news outlets are covering it. So, I'm going to break down what the developer community has found because some of it is pretty fascinating. The first thing is is the scale. You know, Claude Code is not a toy project. The main entry file alone is nearly a megabyte. So, that's one file. The entire code base has 40 built-in tools, 50 {slash} commands, a custom React-based terminal renderer using a library called Ink, and it all runs on Bun, not Node. Bun is a faster
4:32JavaScript runtime, so they're not using a standard tools for most that most developers use, basically. You know, they built this thing for speed from the ground up. The second thing is the tooling system. Claude Code uses what they call a plugin architecture where every capability is a discrete, permission-gated tool. So, file rating is a tool. Bash execution is another tool. Web fetching, a tool. LSP integration, another tool. Each one has its own permission system that controls what it can and cannot do. The base tool definition alone is 29,000 lines of code. And there about 40 of these tools. So, you can start to see why this 512,000
5:17lines total is insane. The third thing is, this is the big one out of all of it, is the query engine. This is the brain of Claude Code. It handles all the AI model calls, the streaming, the caching, the orchestration. It's 400 It's 46,000 lines of TypeScript by itself. That's bigger than most entire applications. This is where all the real intelligence coordination happens. The fourth thing is the multi-agent orchestration. Claude Code can spawn what they call sub-agents or swarms to handle complex tasks in parallel. Each agent runs its own context with a specific tool permission. Does this sound familiar? So, that's basically what Open Claude does with sub-agents and cron jobs, but Claude Code has it built in directly into the core. The
6:02fifth thing is there's an IDE bridge system. You know, it's a bidirectional communication layer that connects VS Code and JetBrains extensions to the CLI using JWT-authenticated channels. This is how Claude and your editor experience works. It's not a simple plugin, it's a full two-way communication bridge. Here's where it gets more interesting. The leaked code revealed some features that Anthropic hasn't announced yet and those are the ones that have the developer community going crazy. There's a full virtual pet system called Buddy. I didn't know how to process this, but I'm not making it up. Claude Code has a Tamagotchi-style companion pet built into it. It uses a
6:47deterministic random number generator seeded from your user ID. So, every person gets a unique pet, okay? There are six rarity tiers from common all the way to legendary. Species names like Pebble Crab and Cloud Ferret and Crystal Drake and Cosmo. Each pet gets a procedurally generated stats including categories like debugging, patience, chaos, wisdom, and snark. Interesting. There's even 1% shiny chance completely independent of rarity. So, a shiny legendary Nibblux has a 0.01% chance of being rolled. The pets is next year import prompt as a ASCII
7:33art with idle animations and reaction animations. This is interesting. And it has its own personality generated by Claude when you hatch it. The Claude references April 1st through the 7th as a teaser window with a full launch plan for May 2026. This is generally one of the most creative things I've seen as a developer tool being put out by a huge major company. It's like they put an Easter egg inside a professional coding tool and I actually love it. But the bigger reveal here is something called Kairos. This is the persistent, always-running assistant mode where Claude doesn't wait for you to type. It watches what you're doing. It logs the observations, decisions, and actions
8:19throughout the day on regular intervals. And then it receives tick prompts that let it decide whether to act proactively or stay quiet. There's a 15-second blocking budget, so it never interrupts you for more than 15 seconds at a time. And when it is active, it uses a special brief output mode designed for a persistent assistant that shouldn't flood your terminal. If that sounds familiar to you, that's because it's basically what Open Claude already does with heartbeats and cron jobs. I literally run this pattern every single day. My agent checks in on a schedule, decides if there's anything worth bringing to my attention, and either helps or stays quiet. Anthropic built the same thing into Claude Code, which tells me we're on the right track with
9:06how we think about AI agents. Now, I'm going to give you my honest take on what this actually means for us because it is important. I mean, neat news that breaks like this. How does it affect us actually, right? First, the leak itself. This is an embarrassing mistake for Anthropic. Whether they intended to do this or not, I don't know. But a build configuration oversight, someone forgot to add a {dot} map to their NPM ignore file, or they didn't configure Bun's bundler to skip source map generation for production builds. I don't know, but Bun generates source maps by default unless you explicitly turn them off. That's it. That's the whole vulnerability. And the NDTV is reporting this actually the second time this has happened in the year. So, there's a
9:52pattern going on. What I think is more important than this embarrassment is what the leak reveals about the state of AI coding tools is generally impressive. Anthropic has poured serious engineering into Claude Code. This is not a wrapper around an API. This is a full production grade development environment with multi-agent orchestration, persistent memory, proactive assistance, IDE integration, and apparently a virtual pet system. I think that's cool. The bar for AI coding tools is really high, right? For those of us in the Open Claude world system, I actually see this as validation more than anything. The pattern we use every day with Open Claude, like the memory systems, the multi-agent setups, the heartbeat monitoring, the skill injection, Claude
10:38Code is building toward the same architecture. They just do it with a closed proprietary way. We do it with an open customizable way. Which would rather you Which would you rather choose? So, that is a fundamental difference of the two, right? And with Open Claude, you control everything. You know, you pick your model. You pick your memory system. You configure your agents however you want with your own data. Nothing leaves your machine unless you want it to. If you're struggling to keep up with content, what I'm about to save you about 40 days worth of work. [music] I built something called Content Machine. It's 10 AI agents that run on the Open Claude orchestration, and they handle everything. Scripts, [music] thumbnails, X posts, blogs, outreach, clips, newsletters, all of it. So, I went from 1,000 subscribers to 4,000
11:24subscribers on YouTube in 7 days using this exact system. Every single morning, I wake up, [music] and the content's already done. I spend maybe 15, 20 minutes reviewing and approving them, and I move on with my day. It works for any niche, fitness, finance, real estate, marketing, whatever you're building, and it is 100% completely customizable to your use case. So, you get the mission control dashboard, all of the cron jobs, everything I've built over the last 40 days [music] helping me gain more and more people to subscribe and join the community. So, you plug in your own thing, and it molds it to you. It learns how you talk, and it writes so it doesn't sound like AI slop. $97 one time. It's not a subscription. I'll put the link down
12:09below, and you'll thank me later. Claude Code is powerful, but it's literally a black box that just had its own lid blown off because of a build mistake. And that tells you something about the tradeoffs of using closed tools versus open ones. The other thing I want to point out is the security angle. Anthropic built an entire undercover mode to prevent their AI from leaking internal information, and then they leaked their own source code through a basic DevOps oversight. This is a reminder for every single one of us that security is not just about fancy stuff. It's about the basics. Check your build pipeline. Check what files you're actually publishing. Check your NPM ignore. Check your Git ignore. The simplest mistakes cause the biggest problems. I run my own security checks
12:56on my Open Claude setup. Weekly audits. I've talked about this before, and it's not because I'm paranoid. It's because I've seen what happens when you don't run these audits. So, when 42,900 Open Claude instances were found publicly exposed a few weeks back, that was the same kind of basic mistake people do not check in on. So, what you should do with this information, like today, what are you going to do? Honestly, if you're a developer, go look at the leaked code. Don't steal anything, but study the architecture. The tool system design, the permission gating, the multi-agent spawning patterns. These are generally well-engineered solutions that you can learn from. Study the structure, how things go together, not the specifics. Apply those patterns to your own project. So, if you're an Open Claude user, understand that the commercial
13:42tools they're building toward are some things you already have. You're ahead of the curve. Keep building, keep experimenting, keep pushing your agent setup further. Don't just be happy with settling. You know, the features that Anthropic is hiding behind feature flags, you already have running in production today. And if you're Anthropic, maybe double-check your NPM ignore file next time. I don't know. Just saying, but whatever. I'll put all the links to the source, not the source code, but the source of information to like the GitHub repo, X posts, Reddit posts of what people are saying so you can get a little bit more insight. Um you know, the GitHub repo where the source was archived, the Hacker News thread, and the dev.to announcement. Go see it for yourself. It's really
14:27insightful. Give it to your Open Claude agent. See what it thinks. That's just a fun experiment you should try. If you want to learn how to build your own AI agent setup that you have full control over where you don't have to worry about a company accidentally leaking your workflows or changing your pricing or removing features, you got to check out the community. We just hit 177 members after 18 days of launch, and we do six live calls every single week from content creation calls, getting your first customers to build labs to beginner calls to Open Claude specific calls. And we're actually building things. We're not just sitting there watching courses and chatting back and forth. The whole goal is to help you take the next step in your AI journey. I'll put the link to it down below. And if you haven't subscribed to the channel already, we drop AI breaking news, Open
15:14Claude use cases, and all things that have to do with building and building in public. So, hit subscribe, hit the notification bell, and we'll see you in the next video. Be blessed.
Ready to start building with AI?
Join the Shipping Skool community free. Paid members get live bootcamp calls every week and weekly-updated courses.
Join Shipping SkoolKeep reading
What Can You Build with Claude Fable 5.2? Hardware, Games, Costs
People are using Claude Fable 5.2 to design circuit boards, build browser games from one prompt and render Blender films, but it cost more than Opus 5.5 in every side-by-side I found. I keep Opus 5.5 as my daily driver and run Fable on High for long, 3D and CAD jobs.
PHP2Shell Vulnerability: What Happened and How to Patch PHP
PHP2Shell is two critical bugs in PHP itself, rated 9.2. They let someone who isn't logged in run their own code on your server. To fix it, update PHP to 8.5.12, 8.4.27, 8.3.36 or 8.2.35 and restart every PHP worker. If you deploy on Railway, also rotate every environment variable.
Claude 1M Token Context Window: What It Means for AI Agents
Anthropic made the 1 million token context window generally available for Claude Opus 4.6 and Sonnet 4.6, with no long context price premium and no beta header. For OpenClaw agents and Claude Code, that means far fewer compaction events and longer sessions where nothing important gets forgotten.
