Anthropic: Leaked Claude Code Source Reveals a Sophisticated Agent Architecture

On March 31, 2026, a sourcemap turned up in the Claude Code npm package, exposing a large snapshot of the client code. The analysis shows that inside, it is no longer a simple CLI but a terminal platform with a React UI, subagent orchestration, memory, background modes and very strict restrictions on Bash. The author's main conclusion: the code is strongly written, though the system has clearly grown bloated.

AI-processed from Habr AI; edited by Hamidun News
Anthropic: Leaked Claude Code Source Reveals a Sophisticated Agent Architecture
Source: Habr AI. Collage: Hamidun News.
Listen to article
Article Fact Sheet & Key Figures
ParameterDetails
Primary sourceHabr AI ↗
Editor-in-Chief
Key metric #1Subagents can run synchronously or in the background
Key metric #2Workers have a separate tool pool and permission mode
Key metric #3Worktree isolation is built directly into the execution path

The March 31, 2026 leak of the Claude Code source turned out to matter more than the leak itself: it showed how Anthropic builds its AI assistant from the inside. The code makes clear that this is no longer a terminal chatbot but a heavy product platform with memory, agents and many operating modes.

No longer just a CLI

The leaked archive turned out not to be a tidy git repository but a large snapshot reconstructed from a sourcemap in the npm package. Some modules, configs and internal layers are missing, so conclusions should be drawn with caution. Even so, the main point is visible: Claude Code long ago outgrew the image of a "chat in the terminal." The author of the analysis describes it as a system that hides a daemon, bridge modes, background sessions, worktree isolation, a self-hosted runner and separate launch paths for different scenarios.

Startup engineering is an important detail. Simple commands do not drag the whole runtime along: heavy parts load dynamically, and fast paths such as the version check try to start with almost no extra imports. For a CLI of this scale, that is not cosmetic but a requirement for a live product under real load. It is no surprise that the author compares Claude Code not to a utility but to a "small operating system for a single terminal."

"A small operating system for a single terminal."

Architecture and restrictions

Internally, Claude Code is closer to a terminal application built on React and Ink than to a minimalist console tool. A huge `main.tsx` handles initialization, mode selection, the system prompt, feature flags, UI launch, session recovery and tool access. On top of that sits a REPL screen with modals, IDE integration, MCP connections, plugins and additional modes.

The key idea is not a single "main model" but orchestration: the product coordinates subagents, contexts, permissions and the lifecycle of tasks.

  • Subagents can run synchronously or in the background
  • Workers have a separate tool pool and permission mode
  • Worktree isolation is built directly into the execution path
  • The system can parallelize read-only and safe tool calls

The paranoia in the Bash layer stands out. The code was clearly written by people who had already seen LLMs break the shell through substitutions, heredocs, odd whitespace or dangerous prefixes such as `sudo` and `env`. The restrictions are therefore not decorative: calls are split into concurrency-safe and unsafe, there is separate logic for cancelling neighboring tool calls, result buffering, and handling of scenarios such as `user_interrupted` or `sibling_error`. Even the Explore agent is barred in advance from writing and editing, leaving it only reading, search and analysis.

Hidden product modes

The most interesting part of the leak is not any specific file but the traces of product strategy. Flags and hidden lines of development keep surfacing in the code: KAIROS, PROACTIVE, ULTRAPLAN, TEAMMEM, BUDDY, BRIDGE_MODE, a remote backend and other modes. This does not mean every feature is already available to all users, but it shows the direction. Anthropic is building not just an interface to a model but a bundle of a local client, remote environments, memory, internal experiments and dedicated UX scenarios.

Three things stand out in particular. First, `autoDream`, a mechanism for background memory consolidation through a separate subagent with a lock file and hard limits. Second, Undercover Mode, in which the product is deliberately taught not to reveal internal model names, project names or even its own presence in public repositories. Third, Buddy, a terminal companion with ASCII sprites and speech bubbles. Taken together it looks odd in places, but very product-minded: security, memory, hidden modes, remote scenarios and touches of personality live side by side.

What it means

The leak analysis showed something simple: Anthropic's Claude Code is no longer a wrapper over an API but a large, heavy and in places overloaded product stack. The code cannot be called a model of elegance, but it looks mature where it really matters: startup, orchestration, access restrictions and long-running scenarios.

For the AI tools market, this is a signal that the next round of competition will be fought not only on model quality but on the quality of the whole surrounding platform.

Story

Key Questions Answered

What are the key details on No longer just a CLI?

The leaked archive turned out not to be a tidy git repository but a large snapshot reconstructed from a sourcemap in the npm package. Some modules, configs and internal layers are missing, so conclusions should be drawn with caution. Even so, the main point is visible: Claude Code long ago outgrew the image of a "chat in the terminal." The author of the analysis describes it as a system that hides a daemon, bridge modes, background sessions, worktree isolation, a self-hosted runner and separate launch paths for different scenarios. Startup engineering is an important detail

What are the key details on Architecture and restrictions?

Internally, Claude Code is closer to a terminal application built on React and Ink than to a minimalist console tool. A huge `main.tsx` handles initialization, mode selection, the system prompt, feature flags, UI launch, session recovery and tool access. On top of that sits a REPL screen with modals, IDE integration, MCP connections, plugins and additional modes. The key idea is not a single "main model" but orchestration: the product coordinates subagents, contexts, permissions and the lifecycle of tasks. Subagents can run synchronously or in the background Workers have a

What are the key details on Hidden product modes?

The most interesting part of the leak is not any specific file but the traces of product strategy. Flags and hidden lines of development keep surfacing in the code: KAIROS, PROACTIVE, ULTRAPLAN, TEAMMEM, BUDDY, BRIDGE_MODE, a remote backend and other modes. This does not mean every feature is already available to all users, but it shows the direction. Anthropic is building not just an interface to a model but a bundle of a local client, remote environments, memory, internal experiments and dedicated UX scenarios. Three things stand out in particular. First, `autoDream`, a m

ZK
Zhemal Khamidun — CPO at Alpina Digital, product manager of AlpinaGPT. Building AI products since 2019. Hamidun News is a pet project that grew into a production aggregator with 6,000+ readers.
✦ Hands-On AI Engineering · Hamidun Academy

Build & Ship Production AI Agents Without Boilerplate Code

Start your free 72-hour trial at Hamidun Academy (academy.hamidun.com) — interactive lessons on Claude Code & Cursor, live Tech Radar, and production agent templates.

Start 72h Free Trial →Vibe-Coding Intensive
What do you think?
Loading comments…