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.
- Dec 2, 2026Ai2 Releases MolmoWeb2 Web Agents: 27B Model Solves 75.3% of Tasks
- Dec 2, 202650 AI Models Beat 62 Teams at 'Zakovat': 48.3% Correct Answers vs 39.8%
- Dec 2, 2026Claude Fable 5.2 ran 1,000 agents for eight days and built an operating system
- Dec 2, 2026Amazon Releases Ergo Open Weights for Coding: 1.1 Trillion Parameters and 2,200 Tokens per Second
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.
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.
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.
Free 2-Day Vibecoding & AI Agents Intensive
Day 1: the autonomous Hermes + DeepSeek AI agent — vibecoding and development on par with Claude Code / Codex / Gemini. Led by Jemal Hamidun, Head of AI at Alpina Digital and academic supervisor at MIPT. Right after you register with our bot Nika: the recording + 11 materials from the previous intensive.
Daily 60-sec AI Voice Brief + Weekly Production AI Agent Playbook
Listen to a 60-second AI news brief every morning and get a weekly hands-on playbook for shipping AI agents to production — tools, MCP servers and patterns that work. Curated by Jemal Hamidun, Head of AI at Alpina Digital.
