← Back to stories Close-up of colorful programming code displayed on a monitor screen.
Photo by Myburgh Roux on Pexels
虎嗅 2026-04-01

Claude Code major leak exposes a production-grade agent harness — not just source code

Leak in npm reveals more than a mistake

Security researcher Chaofan Shou discovered a sourcemap file hidden inside the Claude Code npm package, and it has been reported that the file allowed reconstruction of the package’s complete source tree. Reportedly the dump contained some 1,906 files and about 512,000 lines of code; within hours mirrors had appeared on GitHub and the repository had attracted thousands of stars and forks. How did a production bundle ship with debug artifacts still attached? The immediate answer is human error, but the bigger story is what those files reveal: a detailed, production-quality agent harness design that many in the industry have been searching for.

What the harness shows — and why it matters

An agent harness is the software that surrounds a large language model and turns it into a usable system — the “car” to the model’s “engine.” Anthropic has long argued that models alone are insufficient and that harness design — context engineering, minimal viable tool sets, sub-agent isolation — is the real product. The leaked code reportedly documents those principles in practice: hard caps on token lengths to avoid “context rot,” splitting system prompts into cacheable and session-specific halves, writing bulky tool outputs to disk and passing file paths instead of stuffing logs into the context window, and a three-stage automatic compression strategy to prevent “context anxiety.”

Practical engineering details exposed

The dump also shows how Claude Code manages tool complexity: a deferred-loading approach so most of its 50+ tools don’t appear in context until explicitly searched for, a ToolSearch that is always loaded so the model can discover utilities, and per-tool metadata controlling parallelism, filesystem effects, and result sizing. Tool invocation must pass five gates — input checks, permission logic, rule matching, hooks, and either classifier or user confirmation — and it has been reported that the system runs speculative classifier checks in parallel to avoid perceptible user delays. Sub-agents are used as throwaway workers (synchronous, asynchronous, isolated worktree, or cross-machine) so only conclusions—not noisy histories—re-enter the main context. It has also been reported that BigQuery analysis found thousands of sessions where automatic compaction repeatedly failed, wasting roughly 250,000 API calls per day, prompting an automatic stop-after-three-failures rule.

Broader implications and regulatory backdrop

Beyond the embarrassment of leaked internal protections — the package even contained an “Undercover Mode” meant to scrub Anthropic’s internal identifiers — the incident lowers the bar for other teams to copy a mature agent architecture. That has dual consequences: it could accelerate useful tooling across startups and labs, but it also spreads attack surface and operational patterns that adversaries could misuse. In an era of intense debate over AI export controls and tighter scrutiny of advanced-model tooling by regulators in the US and EU, such a leak may invite fresh questions about how commercial AI safety designs are shared and protected. It has been reported that Anthropic has not yet publicly commented on the leak.

AI
View original source →