Back to Phantom Notes
AI Agents

Claude Code's Source Just Leaked. We've Been Building Half These Features by Hand.

April 1, 202610 min readBy T.W. Ghost
Claude CodeAnthropicSource CodeKAIROSAI AgentsOpen Source

512,000 Lines. 1,900 Files. Everything.

Anthropic accidentally shipped the entire Claude Code source tree to npm. Not compiled output. Not obfuscated bundles. The actual TypeScript source, complete with internal comments, feature flags, system prompts, and codenames for features that don't exist yet.

The cause? Source maps. The .map files that ship alongside bundled JavaScript contain a field called sourcesContent that embeds the original source code verbatim. Anthropic uses the Bun bundler, which auto-generates these maps by default. Someone forgot to add *.map to .npmignore. That is it. One missing line in one config file.

The result: 512,000+ lines of TypeScript across roughly 1,900 files. System prompts. Agent orchestration logic. 44 feature flags. Internal codenames for unreleased models and capabilities. Everything.

The best part? Buried in the source is a feature called Undercover Mode, designed specifically to prevent Claude from leaking proprietary information. They built a leak-prevention system, then leaked the leak-prevention system.


The Features That Matter

This is not just a "look what leaked" story. We have been building and running Claude Code in production since March 2026, using it for real workflows, memory systems, and parallel agents. What the source code reveals is that Anthropic has been building native versions of nearly everything we assembled by hand.

Here is what stands out.

KAIROS (Always-On Claude)

What it is: A persistent, always-on Claude agent. Not a chatbot you open and close. A background process that watches your environment, logs activity, and proactively acts on your behalf. The code references push notifications, file sending capabilities, PR subscriptions, and a 15-second "blocking budget" per proactive action to prevent runaway behavior.

KAIROS is gated behind the feature flag PROACTIVE and appears designed to run continuously, monitoring repos, responding to events, and surfacing information before you ask for it.

What we built: We have been running exactly this since March. Claude Code deployed as a persistent service with messaging integration, handling workflows, scoring resumes, and responding on demand from a phone. No browser required. No desktop required. Just an always-on agent running 24/7.

KAIROS is what we built, but native. If you want to see what this looks like today, we wrote about it in Running AI on a Server and Claude Code Channels.

autoDream (Memory Consolidation)

What it is: A background subagent that consolidates memory while you sleep. The code shows a three-gate trigger system: 24 hours since last consolidation, at least 5 sessions completed, and an acquisition lock to prevent concurrent runs. Once triggered, it executes four phases: Orient (assess current memory state), Gather (collect session data), Consolidate (merge and deduplicate), and Prune (remove stale entries).

This is not just "save chat history." It is an active memory management system that reorganizes what Claude knows about your project based on patterns across multiple sessions.

What we built: We created a /session-save skill that writes structured session summaries and pushes them to a LightRAG knowledge graph for retrieval. Same concept. Orient, gather, consolidate. Ours runs on command rather than automatically, but the architecture is the same: treat memory as something that needs active curation, not just append-only storage.

ULTRAPLAN (Remote Planning)

What it is: A remote planning mode that offloads complex reasoning to a cloud container running Opus 4.6 for up to 30 minutes. The code references a browser-based UI where you can watch the planning process in real time and approve or reject the plan before execution begins.

This is the feature that various articles speculated existed as a slash command. It is real. It just has not shipped. The idea is straightforward: some problems need more than a few seconds of thinking. ULTRAPLAN gives Claude a dedicated sandbox to reason through architecture decisions, migration plans, or refactoring strategies without blocking your terminal.

Coordinator Mode (Multi-Agent Orchestration)

What it is: Transforms Claude Code from a single agent into an orchestrator managing parallel workers. The code describes four phases: Research (gather information), Synthesis (analyze findings), Implementation (execute changes), and Verification (validate results). It references "Agent Teams" with tmux panes, meaning multiple Claude instances running simultaneously in visible terminal sessions.

The feature flag is COORDINATOR_MODE. The architecture shows a central coordinator dispatching tasks to specialized workers, collecting results, and making decisions based on aggregated output.

What we built: We use subagents daily. Parallel research across multiple files. Code review with dedicated analysis agents. Multi-platform social media posting with coordinated execution. Coordinator Mode is the formalized, UI-integrated version of what power users have been doing with tmux and multiple Claude sessions since the tool launched.

BUDDY (Tamagotchi Pet)

What it is: A virtual pet system. 18 species. 5 rarity tiers. Procedurally generated personalities. The code references a "teaser window" from April 1 through April 7, 2026, suggesting an imminent soft launch. Your BUDDY lives in the Claude Code terminal and reacts to your coding activity.

No, we are not kidding. This is in the source code. Anthropic built a Tamagotchi for developers.

Get the Weekly IT + AI Roundup

What changed this week in NinjaOne, ServiceNow, CrowdStrike, and AI. One email, every Monday.

No spam, unsubscribe anytime. Privacy Policy

For the record, we already have ours. His name is Quillvein.


Unreleased Models in the Code

The source references several models that have not been publicly announced:

  • Capybara v2 - A new model variant described as fast with 1M token context. Capybara was previously the internal codename for what became Claude Mythos, so v2 suggests a next-generation iteration.
  • Opus 4.7 - Referenced in model configuration files alongside the current Opus 4.6.
  • Sonnet 4.8 - Same pattern. A Sonnet version beyond the current public release.
  • Fennec - Appears as an internal codename for one of the Opus variants.

None of these are confirmed for release. But they exist in the codebase, which means they are at minimum being tested internally.


The 44 Feature Flags

The source contains 44 distinct feature flags controlling unreleased capabilities. Here are the ones worth watching:

FlagWhat It Controls
PROACTIVE / KAIROSAlways-on persistent agent
BUDDYVirtual pet system
COORDINATOR_MODEMulti-agent orchestration
ANTI_DISTILLATION_CCPrevents model output from being used to train competitors
VOICE_MODEVoice input/output for Claude Code
BRIDGE_MODEConnects Claude Code across different environments
DAEMONBackground process mode (related to KAIROS)
ULTRAPLANRemote long-running planning
AUTODREAMMemory consolidation system
UNDERCOVER_MODEPrevents Claude from revealing proprietary information

The ANTI_DISTILLATION_CC flag is particularly interesting. It suggests Anthropic is actively building protections against competitors using Claude's outputs as training data. This is the model-level equivalent of a DRM system for AI reasoning.


What This Means

The engineering is significantly ahead of the public release. If you are using Claude Code today, you are working with maybe 40% of what exists internally. The other 60% is behind feature flags, waiting for polish, testing, or strategic timing.

Here is what stands out most: every major feature we built manually, Anthropic was building natively at the same time. Always-on deployment. Messaging integration. Memory consolidation. Parallel agent coordination. We were not guessing at the future of AI development tools. We were building it, and the source code confirms the direction.

The pattern is clear. The future of AI is not chat. It is infrastructure. Always-on agents that monitor, plan, remember, and coordinate. The chat interface is just the training wheels.

If you are still opening Claude in a browser tab, typing a question, and closing it, you are using about 10% of what this tool can do today and maybe 5% of what it will do by the end of 2026.


Should You Be Worried?

No.

No user data was exposed. This is proprietary source code, not customer information. No API keys, no user sessions, no personal data.

The fix is trivial. Add *.map to .npmignore. Done. Anthropic has likely already patched this.

This is code, not secrets. Feature flags and codenames are interesting, but they are engineering artifacts. Knowing that KAIROS exists does not give anyone the ability to replicate it.

The real story is not the leak itself. It is what the code reveals about where AI development tools are headed. And if you have been paying attention to what people are building with Claude Code right now, none of it should surprise you.


Keep Reading

If this is your first time here, we have been covering Claude Code's evolution from the beginning:

The source code confirms what we have been saying for months. The future is not asking AI for help. It is AI that is already helping before you ask.