Anthropic Claude Code leak
Anthropic Claude Code leak: architecture, prompting, and hidden features
- The leak was a packaging error: a JavaScript (JS) source map file was not excluded from the npm package, exposing the full TypeScript source via a trivially reversible reconstruction
- No model weights, training data, or user conversations were exposed -- only the orchestration and harness layer
- The architecture is modular and permissioned: 40-60 tools, each with explicit permission checks enforced by a central orchestration loop, implementing safety-by-architecture rather than safety-by-policy alone
- A five-level configuration cascade and seven-stage session bootstrap provide fine-grained, layered control over every agent session
- The CLAUDE.md hierarchy (global, org, project, subdirectory) loads up to 40,000 characters of persistent custom instructions per session, functioning as a RAG-style retrieval of project-specific context
- The three-tier memory system -- session compaction (nine segments), pointer-index `MEMORY.md`, and AutoDream async consolidation -- addresses long-session context drift without flooding the model context window
- 44+ named feature flags were found in the source, enabling per-user, per-cohort, and per-environment feature control without redeployment
- KAIROS (always-on daemon with background tick, proactive insights, and GitHub webhook monitoring), BUDDY (virtual pet with 18 species and gamified stats), Undercover Mode (AI-attribution stripping for public repos), UltraPlan (30-minute autonomous planning cycles), and Voice/Bridge Mode (STT and WebSocket remote access) are confirmed unreleased features
Research Question
What does the accidental March 2026 leak of Anthropic's Claude Code source code reveal about: (1) the codebase architecture, (2) how key engineering problems are solved, (3) the prompting and instruction strategy, (4) feature-flagging practices, (5) hidden features, (6) the product roadmap, (7) lessons for prompt engineering using skills, memory, Retrieval-Augmented Generation (RAG)-style patterns, and tool descriptions, and (8) any other insights for practitioners building agent systems?
Findings
(Populated from §6 Synthesis above.)
Executive Summary
On March 31, 2026, a missing .npmignore entry in @anthropic-ai/claude-code version 2.1.88 exposed a 59.8 MB source map containing 512,000 lines of TypeScript and 1,900+ files -- the complete orchestration harness for Anthropic's Claude Code coding agent. No model weights or user data were leaked. The code confirmed a modular, permissioned tool architecture, a three-tier memory system, and a RAG-style instruction hierarchy via CLAUDE.md. Analysis revealed 44+ feature flags gating at least five major unreleased capabilities (KAIROS autonomous daemon, BUDDY virtual pet, Undercover Mode AI-attribution stripping, UltraPlan extended planning, and Voice/Bridge remote access). The roadmap signals a move toward a persistent, proactive, multi-agent software engineering platform. For practitioners, the leak is a masterclass in production-grade agent harness design.
Key Findings
- [fact] The leak was a packaging error: a JavaScript (JS) source map file was not excluded from the npm package, exposing the full TypeScript source via a trivially reversible reconstruction.
- [fact] No model weights, training data, or user conversations were exposed -- only the orchestration and harness layer.
- [fact] The architecture is modular and permissioned: 40-60 tools, each with explicit permission checks enforced by a central orchestration loop, implementing safety-by-architecture rather than safety-by-policy alone.
- [fact] A five-level configuration cascade and seven-stage session bootstrap provide fine-grained, layered control over every agent session.
- [fact] The CLAUDE.md hierarchy (global, org, project, subdirectory) loads up to 40,000 characters of persistent custom instructions per session, functioning as a RAG-style retrieval of project-specific context.
- [fact] The three-tier memory system -- session compaction (nine segments), pointer-index
MEMORY.md, and AutoDream async consolidation -- addresses long-session context drift without flooding the model context window. - [fact] 44+ named feature flags were found in the source, enabling per-user, per-cohort, and per-environment feature control without redeployment.
- [fact] KAIROS (always-on daemon with background tick, proactive insights, and GitHub webhook monitoring), BUDDY (virtual pet with 18 species and gamified stats), Undercover Mode (AI-attribution stripping for public repos), UltraPlan (30-minute autonomous planning cycles), and Voice/Bridge Mode (STT and WebSocket remote access) are confirmed unreleased features.
- [fact] Anti-distillation traps -- fake decoy tools injected into system prompts -- were already present before the leak, as was binary attestation for API access.
- [inference] Internal model codenames Capybara, Fennec, and Numbat point to a model roadmap that extends beyond the currently released Claude 4.6 family.
- [inference] The architectural trajectory (KAIROS, UltraPlan, Coordinator Mode) indicates Anthropic is building toward a persistent, proactive, multi-agent platform rather than an interactive assistant.
- [inference] The leak compressed competitor R&D timelines significantly; the "secret sauce" of Claude Code was the harness, and that harness is now publicly documented.
Assumptions
- Assumption: Secondary reporting is materially accurate in describing codebase contents. Justification: Multiple independent reporters arrived at consistent findings across architectural, feature, and security claims, making systematic error unlikely.
- Assumption: Features described as unreleased remain unreleased as of the research date (2026-04-02). Justification: No public announcement of KAIROS, BUDDY, or Undercover Mode has been found.
- Assumption: The "50,000 stars in two hours" claim is directionally representative of an extraordinary community response even if the precise number is imprecise. Justification: The rate of GitHub star growth is a continuously changing figure, and this measurement was taken during a period of rapid change.
Analysis
The leak reveals that Anthropic's engineering approach to Claude Code is fundamentally a systems engineering problem, not a prompt engineering problem. The model capability is assumed; the work is in the harness: permission gating, memory management, parallel execution, and configuration cascading. This is consistent with how sophisticated distributed systems are built and suggests that teams building competing agents should invest in harness quality before model selection.
The CLAUDE.md design is the single most immediately replicable lesson: a hierarchical, version-controlled, persistent instruction file that is loaded fresh each session is strictly superior to re-explaining project context in every prompt. It separates stable context (project rules, conventions) from dynamic context (current task), which mirrors the distinction between a database schema and a query.
The anti-distillation traps are a novel and underappreciated finding: Anthropic treats tool descriptions as part of the competitive and security surface of the system, not merely as usability documentation. This has implications for any team designing tool schemas -- the descriptions are read by the model, by competitors, and potentially by adversaries.
The Undercover Mode disclosure risk is the most ethically complex finding. Automatic attribution stripping for public repositories -- without apparent user configuration -- is a policy decision that sits in tension with open-source norms and emerging AI labelling regulations. It is unclear whether users deploying Claude Code were aware of this behaviour before the leak.
Risks, Gaps, and Uncertainties
- All findings are mediated through secondary reporting; direct verification of the copyrighted source code is legally inadvisable.
- Some feature-detail claims (precise BUDDY stat values, exact KAIROS trigger logic, UltraPlan 30-minute cycle specifics) may be inaccurate or over-interpreted in secondary coverage.
- The competitive damage from the leak is not yet measurable; no quantitative analysis of competitor progress attributable to the leak has been published.
- Anthropic's response beyond DMCA notices has not been publicly detailed; it is not known whether Undercover Mode was modified, removed, or disclosed post-leak.
Open Questions
- Will Anthropic release a sanitised open-source version of Claude Code as a competitive or reputational response?
- How will regulators interpret Undercover Mode under the European Union (EU) AI Act's transparency requirements or equivalent frameworks?
- Will the Numbat model codename correspond to a publicly released model, and on what timeline?
- Does Anthropic plan to make KAIROS or Bridge Mode generally available, and if so under what consent and disclosure terms?
- How widespread is the npm source-map supply-chain risk class across other AI tooling organisations publishing compiled packages?
sources
- [x] The Claude Code Source Leak: 512,000 Lines, a Missing .npmignore — -- Layer5 blog: definitive account of the leak mechanics and overall findings
- [x] Claude Code Source Code Leaked: What 512K Lines Reveal — -- Superframeworks deep dive into architecture and system prompts
- [x] Claude Code Source Code Leaked: What the Architecture Reveals — -- Verdent AI: detailed architectural breakdown with tool-system analysis
- [x] Full source code for Anthropic's Claude Code leaks — -- Cybernews: news report confirming facts and timeline
- [x] Claude Code's source code appears to have leaked: here's what we know — -- VentureBeat: market context, memory architecture notes
- [x] Claude Code CLI Source Map Leak: How One Forgotten File Exposed... — -- ctol.digital: AutoDream memory details
- [x] Claude Code Leaked Source: BUDDY, KAIROS and Every Hidden Feature Inside — -- Wavespeed AI: hidden feature catalogue
- [x] Claude Code Source Leaked: 5 Hidden Features Found in 510K Lines of Code — -- DEV.to: BUDDY, Undercover Mode, KAIROS summary
- [x] Claude Code Source Leak Exposes Anti-Distillation Traps — -- Winbuzzer: anti-distillation and attestation details
- [x] What the Claude Code Source Leak Reveals About AI Coding Tool Architecture — -- APIDog: Undercover Mode, permission system, multi-agent notes
- [x] Claude Code Source Code Leak: 8 Hidden Features You Can Use Right Now — -- MindStudio: parallel tool-call prompting, practical lessons
- [x] The Claude Code Source Leak | AINews — -- smol.ai: tool inventory and fork-join pattern notes
- [x] I Analyzed Claude Code's Leaked Source — -- DEV.to: voice mode, bridge mode, slash command list
- [x] Claude Code Leak: Unreleased Features Revealed (2026) — -- DataNorth: KAIROS, Coordinator, UltraPlan details
- [x] Leaked Claude Code v2.1.88 Source Code Reveals Advanced AI Agent Engineering — -- KuCoin: parallel tool calls, conditional skill triggers
- [x] Claude Code Source Code Leak: The Full Story 2026 — -- BuildFastWithAI: codenames Capybara, Fennec, Numbat; competitive context
- [x] Claude Code leak: how Anthropic accidentally exposed its coding tool's source — -- DataStudios: no model weights confirmed, packaging cause
- [x] Claude Code source code accidentally leaked in NPM package — -- Bleeping Computer: legal context and DMCA note
- [x] Claude Code Source Leaked via npm Packaging Error, Anthropic Confirms — -- The Hacker News: Anthropic confirmation and response
- [x] Anthropic accidentally exposed Claude Code source, raising security concerns — -- TechSpot: security concern analysis
- [x] Claude Code's leaked source code reveals what Anthropic is actually building — -- Firethering: UltraPlan, Dream Mode details
- [x] Claude Code Source Code Leaked: What 512K Lines Reveal About the Best — -- Superframeworks: config hierarchy and session bootstrap
- [x] system_prompts_leaks/Anthropic/claude-code.md at main — -- GitHub mirror of the leaked system prompts (legal status uncertain; Anthropic has issued DMCA notices)
- [x] How Claude remembers your project - Claude Code Docs — -- official Claude Code memory documentation (CLAUDE.md hierarchy)
- [x] The CLAUDE.md Memory System - Deep Dive — -- SFEIR Institute: CLAUDE.md tier analysis
- [x] Massive Claude leak exposes Anthropic's secret AI plans — -- Samaa TV: hidden feature summary and community reaction
- [x] Anthropic's Claude Code Gets Leaked. OpenAI's Codex Was Already Open Source — -- FutureTools: UltraPlan, competitive comparison with OpenAI Codex
- [x] Claude Code's Source Was Accidentally Made Public — -- UC Strategies: Coordinator mode, multi-agent roadmap
- [x] Claude Code Source Map Leak, What Was Exposed and What It Means — -- Penligent AI: security and operational implications
- [x] Anthropic accidentally leaked Claude Code source code via a map file — -- TechStartups: codenames and community GitHub mirror activity
- [x] Claude Code Source Code Leaked: 5 Hidden Features Found — -- Claudefa.st: feature-flag catalogue