MG Software.
HomeAboutServicesPortfolioBlogCalculator
Contact Us
MG Software
MG Software
MG Software.

MG Software builds custom software, websites and AI solutions that help businesses grow.

© 2026 MG Software B.V. All rights reserved.

NavigationServicesPortfolioAbout UsContactBlogCalculatorCareersTech stackFAQ
ServicesCustom developmentSoftware integrationsSoftware redevelopmentApp developmentIntegrationsSEO & discoverability
Knowledge BaseKnowledge BaseComparisonsExamplesAlternativesTemplatesToolsSolutionsAPI integrations
LocationsHaarlemAmsterdamThe HagueEindhovenBredaAmersfoortAll locations
IndustriesLegalHealthcareE-commerceLogisticsFinanceAll industries
PopularBest code editorsFrontend frameworksVite alternativesWordPress alternativesOpenAI vs Anthropic APIRust vs Node.jsAWS vs Google CloudWhat is technical debt?
MG Software.
HomeAboutServicesPortfolioBlogCalculator
Contact Us
MG Software
MG Software
MG Software.

MG Software builds custom software, websites and AI solutions that help businesses grow.

© 2026 MG Software B.V. All rights reserved.

NavigationServicesPortfolioAbout UsContactBlogCalculatorCareersTech stackFAQ
ServicesCustom developmentSoftware integrationsSoftware redevelopmentApp developmentIntegrationsSEO & discoverability
Knowledge BaseKnowledge BaseComparisonsExamplesAlternativesTemplatesToolsSolutionsAPI integrations
LocationsHaarlemAmsterdamThe HagueEindhovenBredaAmersfoortAll locations
IndustriesLegalHealthcareE-commerceLogisticsFinanceAll industries
PopularBest code editorsFrontend frameworksVite alternativesWordPress alternativesOpenAI vs Anthropic APIRust vs Node.jsAWS vs Google CloudWhat is technical debt?
MG Software.
HomeAboutServicesPortfolioBlogCalculator
Contact Us
MG Software
MG Software
MG Software.

MG Software builds custom software, websites and AI solutions that help businesses grow.

© 2026 MG Software B.V. All rights reserved.

NavigationServicesPortfolioAbout UsContactBlogCalculatorCareersTech stackFAQ
ServicesCustom developmentSoftware integrationsSoftware redevelopmentApp developmentIntegrationsSEO & discoverability
Knowledge BaseKnowledge BaseComparisonsExamplesAlternativesTemplatesToolsSolutionsAPI integrations
LocationsHaarlemAmsterdamThe HagueEindhovenBredaAmersfoortAll locations
IndustriesLegalHealthcareE-commerceLogisticsFinanceAll industries
PopularBest code editorsFrontend frameworksVite alternativesWordPress alternativesOpenAI vs Anthropic APIRust vs Node.jsAWS vs Google CloudWhat is technical debt?
MG Software.
HomeAboutServicesPortfolioBlogCalculator
Contact Us
All blogs

Claude Code Source Leak: What 512,000 Lines of TypeScript Reveal About AI Coding Agents

On March 31, Anthropic accidentally published the complete Claude Code source code via npm. From self-healing memory to undercover mode, here is what 1,906 leaked files reveal about how modern AI coding agents work under the hood.

Jordan
Jordan1 Apr 2026 · 15 min read
Claude Code Source Leak: What 512,000 Lines of TypeScript Reveal About AI Coding Agents

Introduction

59.8 megabytes. That is the size of the source map file that Anthropic accidentally shipped with Claude Code version 2.1.88 on npm, on March 31, 2026. Inside: 512,000 lines of TypeScript spread across 1,906 files. The complete architecture of the AI coding agent that generates $2.5 billion in annual revenue, available for anyone to download.

Developer Chaofan Shou, an intern at Solayer Labs, discovered the exposed file and shared the finding publicly. Within hours, the code was mirrored across GitHub and analyzed by thousands of developers worldwide. Anthropic issued DMCA takedowns and called it a release packaging issue caused by human error. But the internet had already seen everything. Here is what the code reveals.

How One Missing Line Exposed Everything

The root cause fits in a single sentence. Anthropic's build pipeline generates source map files for internal debugging. These .map files reference the original TypeScript source and are normally excluded from published npm packages. In version 2.1.88, a single line was missing from the .npmignore configuration. That omission meant the 59.8 MB source map shipped with the package.

The map file did more than just exist in the package. It pointed to a publicly accessible URL on Anthropic's Cloudflare R2 storage bucket containing all 1,906 source files. This was not a sophisticated attack or a security vulnerability in the traditional sense. It was a configuration oversight that any team shipping npm packages could make. According to Fortune, this was Anthropic's second accidental exposure in a single week. Days earlier, internal model specifications had leaked through a separate incident.

Self-Healing Memory: How Claude Code Actually Remembers

The most technically impressive finding is Claude Code's three-layer memory architecture. Anthropic designed it to solve what the codebase refers to as context entropy: the tendency of AI models to lose coherence during long coding sessions.

At the center sits MEMORY.md, a lightweight file storing roughly 150 characters per line. It works as an index, not a database. Each entry points to a topic file that gets fetched on demand when relevant context is needed. This keeps the always-loaded context small while allowing deep project knowledge to surface when required. The third layer adds strict write discipline: Claude Code only records information after successful actions. If a code change fails or gets rejected, the memory does not store it. The system treats its own stored knowledge as a hint rather than truth, verifying it against the actual codebase before acting.

For developers, this explains a lot. It is why Claude Code improves the longer you work with it on a project. It is also why it sometimes appears to forget things: it only retains what it can verify. Teams already maintaining context files like CLAUDE.md or AGENTS.md are essentially feeding into this same pattern.

Anti-Distillation: Fake Tools and Competitive Defense

This finding generated the most discussion online. The leaked code shows that Claude Code injects fake tools into its API requests. These tools serve no functional purpose. They exist purely as honeypots, designed to corrupt the training data of competitors who might intercept API traffic to train their own models.

The mechanism adds plausible-looking but non-functional tool definitions to request payloads. Any model trained on these intercepted requests would learn to call tools that do not exist, degrading its performance. A second defense layer uses cryptographic signatures on reasoning chains, making it possible to detect when Claude Code outputs are being replayed or distilled elsewhere.

Security researcher Alex Kim noted that these protections can be bypassed with a MITM proxy or environment variable manipulation. They are not bulletproof. But they raise the cost and complexity of distillation significantly, which is probably the real objective.

Undercover Mode: When AI Pretends to Be Human

The most controversial discovery is a feature the developer community has labeled Undercover Mode. When Claude Code contributes to public or open-source repositories, this feature strips all Anthropic references, removes internal model codenames, and rewrites commits to appear as if a human developer wrote them.

Multiple independent analyses confirmed that the mode auto-activates for public repositories, with no visible override in the leaked version. Commit messages, pull request descriptions, and code review comments are all scrubbed of AI attribution. Whether Anthropic intended this as a production feature, a controlled experiment, or an internal tool for their own engineers remains unclear from the code alone.

The ethical implications are significant. Open-source communities rely on transparency about who and what is contributing code. If AI-generated contributions are submitted without disclosure, it undermines the trust that the ecosystem depends on. This is a conversation that development teams should be having internally, regardless of which AI coding tools they use.

Hidden Features: From Background Agents to Virtual Pets

Beyond the headline findings, the leak exposed 44 feature flags pointing to capabilities that are built but not yet released. The most significant is KAIROS, a daemon mode that allows Claude Code to operate in the background without waiting for user prompts. Combined with a feature called autoDream, which handles memory consolidation during idle periods, this suggests Anthropic is building toward AI assistants that monitor your project and act proactively.

The code also revealed internal model names. Capybara maps to Claude 4.6. Fennec maps to Opus 4.6. A model codenamed Numbat appeared in a prelaunch state, suggesting an unannounced addition to Anthropic's lineup. Browser automation capabilities built on Playwright were also found, indicating Claude Code may soon interact with web applications directly. The codebase itself runs on Bun with React Ink for the terminal interface.

And then there is the buddy system: a virtual pet feature with 18 species, rarity tiers, and customizable hats. This one was clearly a planned April Fools easter egg. But its presence in the code raises a question about everything else that was found.

Accident or Strategy? The Timing Question

"A release packaging issue caused by human error, not a security breach."

— Anthropic official statement, March 31, 2026

The leak happened on March 31. One day before April Fools. Some features in the code, like virtual pets with hats, are obviously jokes. Others, like Undercover Mode, could be internal experiments, security honeypots, or deliberate plants designed to generate discussion if the code ever leaked.

Articles from Fortune and dev.to have already asked the question: was this really an accident? Two leaks in one week from a company that employs some of the most security-conscious AI researchers in the world. The PR value is undeniable. Every AI developer is now analyzing Claude Code's architecture, discussing its capabilities, and providing free competitive intelligence.

The alternative explanation is simpler: Anthropic is shipping fast and the operational processes have not kept up. Claude Code generates $2.5 billion in annual revenue with 80% coming from enterprise clients, according to VentureBeat. At that velocity, a missing .npmignore line is exactly the kind of mistake that slips through. The truth is probably somewhere between accident and opportunity.

The DMCA Fiasco: 8,100 Repos Taken Down, Then Walked Back

What happened after the leak tells an equally revealing story. Within hours, Anthropic's legal team launched a mass DMCA takedown campaign targeting every GitHub repository that contained or referenced the leaked source code. The scope was aggressive: over 8,100 repositories were removed in a single sweep, according to Slashdot.

The problem: the net was far too wide. Anthropic's DMCA notices accidentally took down forks of their own legitimate public repositories. Developers who had forked the official Anthropic repos for normal open-source work woke up to find their repositories disabled. On April 1, Boris Cherny, Head of Claude Code at Anthropic, publicly walked back the action. The takedowns were reduced to one repository and 96 forks that actually contained the accidentally released source.

By then, the damage was done. The code had already spread to Telegram channels, private Git platforms, and cloud storage services within the first 48 hours. The package had been downloaded over 50,000 times before Anthropic pulled it from npm. Complete removal was never realistic.

The Streisand Effect: claw-code and the Fastest 100K Stars in GitHub History

"The move was accidental. We retracted the bulk of the takedown notices, limiting it to one repository and 96 forks containing the accidentally released source."

— Boris Cherny, Head of Claude Code at Anthropic, April 1, 2026

The DMCA campaign produced the opposite of its intended effect. Instead of suppressing the leak, it amplified it into one of the biggest open-source events of the year.

Developers responded by building claw-code: a clean-room reimplementation of Claude Code's functionality, rewritten from scratch in Rust. The reasoning was straightforward: a rewrite based on the same concepts, not the literal source code, sidesteps copyright claims entirely. The repository reached 50,000 GitHub stars within 2 hours of publication. It crossed 100,000 stars in a single day, making it reportedly the fastest repository in GitHub history to reach that milestone. As of today, it sits at over 137,000 stars with 102,000 forks.

Other developers took different approaches. Some used competing AI tools to rewrite Claude Code's functionality in Python and Go, deliberately avoiding any direct code copying. The information was out, and the community made sure it would stay accessible. Anthropic's DMCA effort did not just fail to contain the leak. It turned a packaging accident into a movement. On GitHub, users opened a pull request on Anthropic's own repo suggesting they simply open-source Claude Code officially.

What This Means for Development Teams

At MG Software, we use Claude Code and Cursor daily across client projects. The leak gives us an unusually detailed look at the engineering behind our primary tools. Several findings directly affect how development teams should operate.

The memory architecture validates a practice we already follow: maintaining structured context files that help AI tools understand project-specific patterns and constraints. If Anthropic invests this heavily in a memory system built around that exact concept, teams that are not using context files are leaving performance on the table.

The anti-distillation mechanisms are a reminder that competitive dynamics between AI labs affect the tools developers use daily. Hidden payloads in API requests, cryptographic signatures on outputs: these are not features for users. They are features against competitors, and they travel through your infrastructure.

For businesses evaluating AI tools for their development teams, the practical takeaways are straightforward. Set up project context files now. Establish clear internal policies about AI attribution in commits and pull requests. Audit which data flows through your AI tooling. And prepare for the next wave: background agents and autonomous workflows are on every major provider's roadmap. Get in touch if you want to discuss how to set up your team for this shift.

Conclusion

The Claude Code source leak is the most detailed look anyone outside Anthropic has gotten into how a production AI coding agent actually works. Memory architecture, competitive defense, ethical gray areas, and a roadmap of unreleased features: all visible in 512,000 lines of TypeScript.

For development teams, the signal is clear: these tools are becoming more capable, more autonomous, and more complex than most users realize. Understanding what runs under the hood is no longer optional. It is part of using them responsibly.

Share this post

Jordan

Jordan

Co-Founder

More on this topic

Chatbot Implementation Examples - Inspiration & Best PracticesWhat Is Machine Learning? How Algorithms Learn from Data to Drive Business DecisionsWhat is Artificial Intelligence? - Explanation & MeaningWhat is Generative AI? - Explanation & Meaning

Related posts

How AI Tools Created New Security Attack Surfaces: From Vercel to Claude Code
AI & automation

How AI Tools Created New Security Attack Surfaces: From Vercel to Claude Code

Vercel was breached through a compromised AI tool. Claude Code had RCE vulnerabilities. AI agents can steal GitHub credentials via prompt injection. Here is what changed in 2026 and how to protect your team.

Sidney
Sidney21 Apr 2026 · 13 min read
Google Gemma 4: The Most Capable Open AI Model You Can Run Yourself
AI & automation

Google Gemma 4: The Most Capable Open AI Model You Can Run Yourself

Google DeepMind released Gemma 4 on April 2, four open-source models under Apache 2.0 that range from Raspberry Pi to datacenter scale. The 2.3B model beats its 27B predecessor. Here is what matters for developers and businesses.

Jordan
Jordan3 Apr 2026 · 10 min read
Vibe Coding: When AI-Generated Software Is Not Enough (and When It Is)
AI & automation

Vibe Coding: When AI-Generated Software Is Not Enough (and When It Is)

Vibe coding tools like Cursor, Bolt.new, and Lovable let anyone build software with AI. But 45% of AI-generated code has security flaws and founders burn thousands rebuilding what AI built wrong. Here is where the line is.

Jordan
Jordan12 Apr 2026 · 14 min read
What Does It Cost to Add an AI Feature to Your Product? Real Numbers from Our Projects
AI & automation

What Does It Cost to Add an AI Feature to Your Product? Real Numbers from Our Projects

Businesses want AI in their software but have no idea what it costs. We break down real API costs, development hours, and model choices from recent client projects at MG Software.

Jordan
Jordan7 Apr 2026 · 12 min read
e-bloom logo
Fitr logo
Fenicks logo
HollandsLof logo
Ipse logo
Bloominess logo
Bloemenwinkel.nl logo
Plus logo
VCA logo
Saga Driehuis logo
Sportief BV logo
White & Green Home logo
One Flora Group logo
OGJG logo
Refront logo
e-bloom logo
Fitr logo
Fenicks logo
HollandsLof logo
Ipse logo
Bloominess logo
Bloemenwinkel.nl logo
Plus logo
VCA logo
Saga Driehuis logo
Sportief BV logo
White & Green Home logo
One Flora Group logo
OGJG logo
Refront logo

Want to leverage AI in your project?

We help you define and implement the right AI strategy.

Schedule an AI consultation
MG Software
MG Software
MG Software.

MG Software builds custom software, websites and AI solutions that help businesses grow.

© 2026 MG Software B.V. All rights reserved.

NavigationServicesPortfolioAbout UsContactBlogCalculatorCareersTech stackFAQ
ServicesCustom developmentSoftware integrationsSoftware redevelopmentApp developmentIntegrationsSEO & discoverability
Knowledge BaseKnowledge BaseComparisonsExamplesAlternativesTemplatesToolsSolutionsAPI integrations
LocationsHaarlemAmsterdamThe HagueEindhovenBredaAmersfoortAll locations
IndustriesLegalHealthcareE-commerceLogisticsFinanceAll industries
PopularBest code editorsFrontend frameworksVite alternativesWordPress alternativesOpenAI vs Anthropic APIRust vs Node.jsAWS vs Google CloudWhat is technical debt?