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
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.
- Nov 2, 2026Karpathy builds a YouTube clone with 6454 videos from Hacker News recommendations in two hours
- Nov 2, 2026Karpathy used Claude to build HackerTube from 6,454 videos recommended on Hacker News
- Nov 2, 2026Arca gives AI agents finance tasks lasting up to 10 days, but leaves the trades to humans
- Nov 2, 2026Anthropic needs to grow revenue 32% a year to cover $850 billion in contracts
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
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.
The AI world, distilled — once a week
Seven stories that actually mattered, hand-picked. No noise, no reposts, no press releases.
Done! Check your inbox for a confirmation.