Back to blog

Execution Systems

Anthropic Accidentally Shipped Its Own Source Code to npm

9 min read · Published March 31, 2026 · Updated March 31, 2026

By CogLab Editorial Team · Reviewed by Knyckolas Sutherland

On March 31, Anthropic published version 2.1.88 of the @anthropic-ai/claude-code package to the public npm registry. The package bundled a 59.8 megabyte JavaScript source map that was supposed to be internal. Within a few hours, the source map had been unpacked, and the full TypeScript source of Claude Code was reading in GitHub repositories all over the internet.

The total was about five hundred thousand lines of code across nineteen hundred TypeScript files. That is not a snippet. It is the whole client-side agent harness. Tool routing, memory management, context compaction, safety handlers, plugin loaders. The thing that wraps the model and makes it useful.

Every serious AI builder spent the rest of the day reading it. The code is clean. The architecture is opinionated. There is an unshipped feature flag called KAIROS that describes an autonomous daemon mode where Claude Code runs in the background and initiates actions on its own. There are default prompts and system messages you could analyze. There is a skills system with a very specific way of loading and scoping capabilities.

Garry Tan, the president of Y Combinator, spent most of the next week writing about what he had read. His conclusion was that the code confirmed a thesis he had been developing for months. The thing that makes an AI coding assistant feel like magic is not the model. It is the harness. The model is the same model Anthropic ships to everyone. The harness is what turns it into a useful coworker.

Why aren't we talking about this as the biggest AI story of the quarter? Because the press has been covering it as a security story, which it is not really. Anthropic has confirmed that no model weights and no customer data were exposed. The risk is in what the code reveals about Anthropic's architecture, not in any leaked secrets. But the architecture reveal is enormous.

For operators, the Claude Code code base is a free education in how to build a production AI agent. Every team that is currently trying to build an internal coding assistant, a research agent, or a customer-support agent now has a reference implementation they can study. That is a once-in-a-decade gift.

If you lead an engineering team, the practical move this week is to have someone on your team read the architecture papers and the blog posts that are now being written about the leaked code. Not the code itself, which carries legal risk. The analysis of the code, which is fair game, and which captures the genuinely portable design decisions.

The pattern that Tan and others highlighted is the thin-harness, fat-skills design. Claude Code keeps the model-invoking harness small. Two hundred lines of actual model-runner. Everything else is skill files, which are markdown documents that teach the model how to do a specific task. The skills are where the cleverness lives. The harness is intentionally simple.

This is the opposite of how most teams build AI products today. The common pattern is a fat harness with dozens of tool definitions, a handful of hardcoded prompts, and a god-agent that tries to do everything. That works for demos. It breaks under production load because the harness gets too heavy, the prompts get contaminated, and the god-agent loses track of what it was doing.

The leaked Claude Code shows the alternative at scale. Every capability is a skill file. The model reads the relevant skill file when it needs that capability. The harness just manages the file reads, the context window, and the safety rails. When Anthropic wants to add a new capability, they write a new markdown file. They do not extend the harness.

If your team is building anything AI-heavy and you have not recently looked at your own architecture, this is the week to do it. Ask whether your prompts are contaminated with every possible instruction. Ask whether your tool list is so long the model loses track. Ask whether your harness is growing faster than your skill library. If the answers suggest a fat-harness shape, the leaked Claude Code is telling you there is a cleaner way.

Anthropic's response to the leak was to scramble. That is understandable. Their engineering team spent the next week building better npm packaging guards, revising their publish pipeline, and explaining to customers what was and was not at risk. The larger effect is that a huge swath of the AI engineering community just got a better reference for how to build agents than any textbook has produced. That is not something Anthropic can take back, and on net, the industry is probably better for the accident.

Frequently Asked

What exactly was leaked?

The full client-side TypeScript source of Claude Code, about 500,000 lines across 1,900 files, shipped as a source map inside an npm package. No model weights. No customer data. No API keys. What leaked was the architecture of the agent harness and its skill loading system.

Is it legal to read the leaked code?

This is a legal gray area that depends on your jurisdiction and how you came across it. The safer move is to read the many analyses and blog posts that summarize the architecture rather than cloning the code yourself. The analyses capture the portable design lessons without the direct-copy risk.

What is the thin-harness, fat-skills pattern?

An architecture where the core AI runner is kept small and simple, and most of the capability lives in external skill files, typically markdown, that the model loads on demand. It scales better than a fat-harness approach because adding a capability does not require changing the core runner.

Sources

Related Articles

Services

Explore AI Coaching Programs

Solutions

Browse AI Systems by Team

Resources

Use Implementation Templates