YouTube Summaries

← All summaries

Claude Code source-map leak: internals and unreleased features

2026-04-02 Thu ⏱ 29 min forrestknight

Claude Code's full source leaked because its npm package accidentally shipped a source map (a .map JSON containing the original unminified TypeScript, plus a pointer to a zip on Anthropic's own R2 bucket), discovered by Chaofan Shou. Forrest walks through what the ~390k lines of real code reveal: internal model code names, the query-engine core, and a pile of unreleased features — Kairos (always-on background assistant), the dream memory-consolidation system, coordinator mode (Claude as manager of parallel worker agents), ultra plan (30-minute remote planning in the cloud), anti-distillation fake tools, and comedic details like "undercover mode" and 187 spinner verbs — while Anthropic DMCAs every mirror and quietly ends inference subsidization on Max plans.

How the leak happened

  • Chaofan Shou noticed the npm package included the .map source-map file — effectively the entire original TypeScript source, downloadable via a zip on Anthropic's R2 storage.
  • Anthropic is DMCA-taking-down every GitHub mirror. Forrest notes the irony that if the code is AI-generated (as Anthropic claims Claude Code largely is), US law says AI-generated work can't be copyrighted, weakening the DMCA standing — but he's not eager to test that against YouTube's claimant-friendly system.
  • One reaction repo (core features ported from the leak to Python overnight, then being rewritten in Rust) became reportedly the fastest repo ever to 100k GitHub stars.
  • Cause: Bun (which Anthropic acquired) bundles Claude Code and its source-map defaults are confusing/buggy (docs say "none" by default, behavior says "linked"; a 3-week-old bug serves source maps in production). But Bun creator Jarred Sumner says that bug only affects Bun's frontend dev server, not a TUI app; Boris Cherny confirms it was plain developer error — a missing *.map entry in .npmignore that nobody caught in review.

What's in the codebase

  • ~390k actual lines of code (the 512k figure includes comments/blanks).
  • Code names: Tengu = Claude Code itself (1,500+ occurrences); Fennec = Opus 4.6; Capybara = Mythos (a distinct Claude 4.6-class model, not Opus or Sonnet); Numbat = an unknown unreleased model gated to internal user types.
  • Architecture entry points: queryEngine.ts is the brain — owns the whole query lifecycle and session state, LLM API calls, streaming, tool-call loops, thinking mode, retry logic; then the query.ts module and tools.ts (the full tool system, including internal-only tools).
  • Permission modes include default, auto, bypass, and one called "yolo" which — counterintuitively — denies everything.

Unreleased features

  • Undercover mode: activates only for Anthropic employees (user type "ant") when contributing to public OSS repos — instructs Claude to never reveal it's an AI, never mention code names, unreleased model numbers, internal repos, Slack channels, or Claude Code at all; always on, can't be disabled. Known only because the anti-leak system itself leaked.
  • Kairos (Greek: "the right/critical moment"): an always-on persistent assistant that watches your project, keeps daily logs, and receives periodic "tick" prompts to decide act-or-stay-quiet. A 15-second rule defers anything that would block your current workflow longer than that. Has exclusive tools (e.g. send-user-file), push notifications, and a special "brief" ultra-concise output mode so it doesn't flood the terminal.
  • Dream system (/dream, possibly quietly released already): background memory-consolidation engine running as a forked subagent. Three gates must pass — 24h since last dream, 5+ sessions since last dream, a consolidation lock against concurrent dreams. Prompt: "You are performing a dream — a reflective pass over your memory files. Synthesize what you've learned recently into durable, well-organized memories so future sessions can orient quickly."
  • Coordinator mode: turns Claude Code into an orchestrator of parallel worker agents (you manage the manager). Prompt highlights: "parallelism is your superpower", launch independent workers concurrently, fan out research across angles, multiple tool calls per message. Includes prompting tips for the manager — bad worker prompts are context-free ones like "fix the bug we discussed" since workers can't see the manager's conversation. (Similar to Warp's Oz.)
  • Ultra plan: offloads complex planning to a remote cloud container session running Opus 4.6 for up to 30 minutes; terminal polls every 3 seconds; a browser UI lets you watch and approve/reject; on approval a sentinel value "teleports" the plan back to the local terminal. Forrest's aside: plan mode is slept on — planning first yields markedly better code.
  • Anti-distillation: when enabled, Claude Code injects fake tool definitions into API requests to poison the data of competitors recording traffic to distill Claude's harness behavior. Made comedic by then leaking the entire real harness source.

Silly finds

  • Buddy system: a Tamagotchi-style companion teaser scheduled April 1–7, 2026 — 18 animated buddies across five rarity tiers with stats for debugging, patience, chaos, wisdom, snark.
  • "Penguin" is the internal code name for fast mode (penguin-themed throughout).
  • 187 spinner verbs ("fermenting", "forging", "discombobulating"...); a 25-swear-word filter for random 4-char IDs; and swearing at Claude Code logs your prompt as negative sentiment in internal analytics, used to improve the product.
  • Someone opened a PR (generated with Claude Code) adding the entire leaked source to Anthropic's own official claude-code repo; it was closed, then deleted.

Broader take

  • Competitively the leak means little: people don't pay for Claude Max for the harness, they pay for subsidized inference (~$2,000 worth for $100–200/month) — and that subsidy is quietly ending, with users hitting limits fast even on 20x plans, without transparent communication. Forrest's biggest complaint: Anthropic's PR is lawyer-driven rather than dev-to-dev, and they "never want to listen."