The 512,000-Line Slip: Anatomy of a Packaging Disaster

On March 31, 2026, the artificial intelligence industry—and the $380 billion giant Anthropic—received a jarring reminder that sophisticated agentic logic is still tethered to the mundane rigor of software packaging. Security researcher Chaofan Shou of Solayer Labs discovered that version 2.1.88 of @anthropic-ai/claude-code, the flagship CLI tool for Claude, had been published to the npm registry with its internal soul exposed. The leak was massive: 512,000 lines of unminified TypeScript source code and 59.8 MB of source maps that transformed a compiled binary back into a readable, proprietary roadmap.
This was not the result of a zero-day exploit or a state-sponsored breach. Instead, it was an operational failure of the highest order—a “packaging error” in a company that generates an estimated $2.5 billion in annual recurring revenue. For a few hours, the “agentic harness” that allows Claude to interact with file systems and execute terminal commands was available for anyone to download. Despite Anthropic’s rapid response and DMCA takedown notices, the repository was mirrored across GitHub, amassing more than 41,500 forks and providing a permanent record of Anthropic’s internal engineering debt and future product strategy.
Technical Deep Dive: How the Bun Bundler and .npmignore Failed

Technical Root Cause Analysis
The exposure was triggered by the intersection of a known runtime bug and a lack of CI/CD safety nets. In late 2024, Anthropic migrated its build process to the Bun runtime. However, Bun version #28001 suffers from a critical bug where the development: false setting in the bundler is ignored. This causes source maps to be generated even for production builds. The reproduction of this bug is trivial—it takes only three files and a dozen lines of code to see a sourceMappingURL comment appended to a production output, yet it remained open on Bun‘s issue tracker for weeks prior to the incident.
Because of this bug, the cli.js.map file was created during the build. This file utilized the sourcesContent field, which effectively inlines the entire unminified TypeScript source tree into a single JSON payload. The secondary failure point was the .npmignore file, which lacked an entry for *.map files. Furthermore, Anthropic’s package.json did not utilize a files whitelist—a standard security practice that ensures only specific binaries are included in the npm tarball. The leak was further compounded by a reference within the source map to a ZIP archive hosted on an Anthropic-owned Cloudflare R2 storage bucket, providing a massive secondary path for data exposure. Anthropic eventually confirmed that while proprietary logic was lost, no customer data or API credentials were included in the cli.js.map payload.
The incident highlights the dangers of “vibe coding”—a term coined by Andrej Karpathy to describe the practice of delegating code generation to AI and accepting the output with minimal manual review. When Anthropic’s lead developer previously stated that 100% of his contributions were written by Claude Code, he likely didn’t realize the tool would neglect the tedious, non-creative task of verifying the npm pack output. A simple npm pack –dry-run in a CI pipeline would have revealed the 59.8 MB source map immediately.
The Hidden Roadmap: KAIROS, ULTRAPLAN, and Agentic Ambitions

Beyond the technical blunder, the 512,000 lines of code revealed 44 hidden feature flags that act as a crystal ball for Anthropic’s 2026 roadmap. The most significant revelation is KAIROS, an undisclosed “always-on” background daemon. KAIROS represents a shift from reactive chatbots to proactive agents; it is designed to monitor a developer’s context autonomously, intervening with a 15-second blocking budget per cycle to avoid disrupting the active workflow. It includes unreleased tools like PushNotification and SubscribePR, signaling a future where Claude manages the entire lifecycle of a pull request while the developer sleeps.
Another major discovery was ULTRAPLAN, a feature that offloads complex reasoning to a remote Opus 4.6 session. This mode allows Claude to “think” for up to 30 minutes on a high-compute remote server before “teleporting” a finalized execution plan back to the local terminal. This is supported by Coordinator Mode, a multi-agent orchestrator system that utilizes parallel workers and “scratchpads” to synthesize results from multiple Claude instances simultaneously. The internal codenames found in the code also confirm the model hierarchy for the coming year:
- Capybara: The internal name for Mythos, a next-frontier model featuring a 1-million token context window and recursive self-correction.
- Fennec: The designation for Opus 4.6.
- Tengu: The overarching internal project name for the Claude Code system.
- Opus 4.7 and Sonnet 4.8: Confirmed via internal version strings as being in active development.
“The Buddy System”: Engineering Culture in the Terminal
Amidst the high-stakes agentic logic, the leak provided a whimsical look at Anthropic’s internal culture: the Buddy system. Revealed via the /buddy command, this “Tamagotchi-style” pet companion lives in the terminal, hatching an ASCII art sprite based on the user’s ID hash. The feature was clearly intended for an April Fools’ release, as evidenced by the salt friend-2026-401 found in the code.
The Buddy system features 18 distinct species, including duck, capybara, dragon, ghost, axolotl, and the legendary chonk. It utilizes a gacha-style rarity mechanic with a 1% shiny drop rate and a variety of “hats” including crown, wizard, propeller, and tinyduck. The pets possess RPG-like stats that respond to the developer’s activity: DEBUGGING, PATIENCE, CHAOS, WISDOM, and SNARK. Most tellingly, the code revealed that developers used hex-encoding for species names, such as 0x6475636b for duck, to bypass Anthropic’s own internal build scanners which presumably flagged certain animal names as potential internal codename collisions. The system relies on the Mulberry32 tiny seeded PRNG to ensure the pets are picked deterministically.
The Memory Architecture and the “Dream” Subagent
The leaked code exposed a sophisticated three-layer memory architecture designed to solve “context entropy.” At the base is the MEMORY.md file, which serves as a lightweight index of pointers rather than raw facts. Actual project knowledge is stored in topic-specific files that are fetched on demand. The most innovative component is the Dream (or autoDream) subagent—a background process that periodically consolidates and optimizes this memory.
The Dream process follows a “three-gate trigger”: it only activates if 24 hours have passed since the last consolidation, at least 5 sessions have occurred, and the consolidation lock is free. Once triggered, it moves through four phases: Orient (contextualizing), Gather (collecting observations), Consolidate (merging facts), and Prune (capping memory at 200 lines or 25KB). To maintain high-speed interactivity, the system often accepts “stale” data via functions like getFeatureValue_CACHED_MAY_BE_STALE(), demonstrating that for Anthropic, latency is a primary engineering constraint.
Internal Secrecy and the Irony of “Undercover Mode”
The leak’s most delicious irony lies in Undercover Mode, defined in undercover.ts. This system was built to allow Anthropic employees to contribute AI-written code to public repositories without being identified as employees or AI users. It automatically activates unless a repository remote matches an internal allowlist, and it injects a highly specific system prompt to enforce secrecy.
“You are operating UNDERCOVER… Your commit messages MUST NOT contain ANY Anthropic-internal information. Never include Co-Authored-By lines or mention being an AI.”
This mode is part of a larger paranoid security suite revealed in the source. This includes Anti-distillation mode (ANTI_DISTILLATION_CC), which injects fake tool definitions into API traffic to poison the data of any competitor attempting to “train” their models on Claude‘s behavior. Additionally, the NATIVE_CLIENT_ATTESTATION system allows the Bun runtime to overwrite a cch=00000 placeholder with a cryptographic hash, proving the request originated from a legitimate, unmodified Claude Code binary and not a third-party script.
“Unhinged” Engineering: Peek Behind the $380B Curtain
The analysis of the 512,000 lines of code painted a picture of a “chaos-driven” environment. The Claude Code source was plagued by technical debt: the main.tsx file is exactly 803,924 bytes (nearly 1MB) and contains 4,683 lines of code. Researchers found over 460 eslint-disable comments, suggesting that the “vibe coding” philosophy often bypasses standard type safety and linting rules. The function writeFileSyncAndFlush_DEPRECATED() was found to be called over 50 times in production code, highlighting a prioritize-velocity-over-purity mindset.
The human element of this debt was visible in the comments. At mcp/client.ts line 589, an engineer named “Ollie” admitted in a comment that they were shipping code they weren’t even sure was necessary. The most pragmatic—and cynical—discovery was a frustration detection regex (wtf|ffs|shit) used for sentiment analysis. This regex triggers telemetry when a user swears at the tool, helping Anthropic measure exactly how much their model is frustrating the developer community. The code also revealed a YOLO classifier (TRANSCRIPT_CLASSIFIER), a fast ML-based permission system that auto-approves tool calls without asking the user if the conversation context suggests high trust.
The Aftermath: Weaponization and Supply Chain Risk
Threat actors weaponized the leak with terrifying speed. Within 24 hours of the npm disclosure on March 31, 2026, malicious GitHub repositories appeared at the top of search results for “Claude Code download.” These actors pivoted from an existing AI-themed campaign that had been active since February 2026 and had impersonated over 25 software brands. They lured developers with trojanized 7z archives like ClaudeCode_x64.7z, which contained a Rust-compiled dropper named TradeAI.exe.
This dropper delivered a double-payload: Vidar stealer, which harvested credentials and crypto wallets, and GhostSocks proxy, which turned the developer’s machine into a residential proxy. The malware utilized XOR-encrypted strings with keys like cryptify_keyd3d or xnasff3wcedj to hide its C&C infrastructure. The incident coincided with a broader supply chain cascade, including a compromise of the axios package and vulnerabilities in the Trivy scanner and LiteLLM, creating a period of extreme instability for the global software ecosystem.
The VibeGuard Solution: Hardening the Publish Boundary
In the wake of the leak, research from Kennesaw State University introduced VibeGuard, a security gate framework designed specifically for vibe-coded projects. VibeGuard targets five categories of vulnerability: Source Code Exposure (maps/artifacts), Configuration Drift (ignored rules), Hardcoded Secrets, Supply Chain Risk (unpinned dependencies), and Artifact Hygiene (debug logs). In controlled experiments, the tool achieved 100% recall and 89.47% precision, proving that automated scanning at the publish boundary could have prevented the Claude leak entirely.
The researchers noted that current security ownership for Claude Code is surprisingly concentrated, with the Safeguards logic header explicitly naming individuals David Forsythe and Kyla Guru. VibeGuard advocates for moving this security boundary from individual “safeguards” reviews to an automated “pre-publish” gate that inspects the npm tarball content rather than just the code logic.
Conclusion: Lessons for the Agentic Era
The Claude Code incident will be remembered as the definitive case study of the “vibe coding” era’s pitfalls. It was a packaging error, not a logic bug, proving that even the most advanced autonomous agents like KAIROS cannot save a product from basic operational neglect. As Anthropic moves toward the highly ambitious goals of ULTRAPLAN and Coordinator Mode, the need for old-school engineering discipline has never been clearer. The lesson for the industry is stark: if you build the plane in flight, make sure someone is actually checking the manifest before you take off. The future of AI tools is agentic, but the security of those tools remains rooted in the mundane rigor of the release process.

