StartseiteArtikel

Nachdem ich durch die 500.000 Codezeilen gesichtet habe, die aus Claude Code geleakt wurden, habe ich endlich das Geheimnis hinter seiner guten Leistung entdeckt.

爱范儿2026-04-01 18:05
Anthropic ist jetzt OpenAI geworden.

Claude Code is not an AI chat tool with a terminal interface.

This was proven by a mistake made by the engineers at Anthropic.

On March 31st, when releasing Claude Code v2.1.88, they included an internal debug file in the public npm installation package. The file was 59.8 MB in size and contained complete, never - obfuscated TypeScript source code, about 500,000 lines and nearly 1,900 files.

Screenshot of the personal homepage of the engineer who first discovered the source of Claude Code, https://scf.so/

At 4 a.m., an engineer interning at Solayer Labs announced the discovery on X and provided a link to a downloadable archive file. This post eventually reached nearly 10 million views.

Anthropic pulled the version from npm on the same day, but it was too late. The code was mirrored on GitHub, and the associated repository gathered nearly 30,000 stars within a day.

After the code was published on the world's largest open - source platform and immediately received over 80,000 stars, the question was raised: "Is Anthropic more open than OpenAI?" Even Elon Musk participated in the discussion and shared this view with a comment on the sensational discovery.

The leader of Claude Code replied on X: "This is not a security risk related to Bun. No user data was released; it's just a developer error."

This explanation is okay. However, what they didn't mention is that this data leak gives us a first - hand insight into the underlying structure of Claude Code and why it is rated much better by most users than other similar tools.

While you sleep, the model also dreams

This is one of the most discussed aspects of this code discovery. KAIROS, a word that appears more than 150 times in the source codes, comes from Greek and means "the right time".

KAIROS is an unpublished feature, but due to the completion level of the codes, it could be fully released soon. The leader replied on X to a user's question and said that a decision on whether to release this feature had not been made yet.

It represents a "background daemon mode" in which Claude Code automatically processes tasks and integrates memories in the background when we're not using it.

In particular, there is a logic called autoDream: When the user is inactive, the agent performs a "memory integration", combines scattered observations, removes contradictory information, and turns unclear inferences into specific insights.

Put simply: When we sleep, our brains don't completely rest. It automatically organizes our memories, keeps the important ones, and forgets the unimportant ones. If we don't sleep enough, we can't remember well, don't know what to keep, and our work performance drops.

With Claude Code, the probability of errors increases when there are too many conversations and the context length is exceeded. Similar command - line tools like OpenClaw use the compression method, but it's not efficient enough. The optimization of autoDream solves both the problem of limited context length and the problem of information loss during compression.

This is fundamentally different from how most AI tools work today. Most AI tools are passive and only respond when we ask something. Otherwise, they remain silent.

In contrast, KAIROS wants to be active. While we're away, it organizes the state of previous tasks, automatically updates the user role, memories of specific projects, tool preferences, and the main memory file. When we come back, it starts directly from a clean state.

Before this discovery, some users could already experience a similar function in Claude Code. Claude logs daily conversations in each session and "dreams" at night to automatically turn our memories into useful notes.

Claude Code wakes up and shows what it did at night, e.g., updating the user role and the main memory

5 agents, costs like 1

Another aspect that users discuss the most is the fork pattern of sub - agents that share the prompt cache.

When Claude Code creates a sub - agent, it creates an exact copy of the context of the parent agent. Anthropic's API caches this context. So, if 5 agents work in parallel, they consume almost the same token costs as a single agent working sequentially because all 5 copies access the same cache.

In the source code, there are three operating modes for sub - agents: fork (inherits the context of the parent agent and is suitable for parallel branches of a task), teammate (runs in a separate terminal window and communicates via files), worktree (gives each agent its own Git working tree that doesn't interfere with others).

This means that we can use Claude Code to perform different tasks simultaneously: one for security checks, one for redesigning the authentication module, one for writing tests, and one for updating the documentation. Due to Claude Code's internal cache mechanism, the costs can be similar to those of sequentially executing a single task.

Many people find Claude Code difficult to use, probably because they only use it as a single - thread tool instead of understanding it as an agent - scheduling platform.

This is like hiring a team but having them work on a task one after another without fully leveraging the employees' capabilities.

The details in the code

This sequential working mode not only fails to fully utilize the capabilities of multiple agents and save token costs but also affects Claude Code's performance.

Another overlooked function is the file CLAUDE.md. In this source code, some users noticed that Claude Code rereads this file in each round of the conversation when processing our queries.

CLAUDE.md is where we can write the configuration for Claude Code. Our preferences for the code style, decisions about the project architecture, and which actions "should never be performed without my confirmation" can be written here.

Since this file is reloaded in each round of the conversation, it shouldn't be too long. We can configure CLAUDE.md at different levels. For example, ~/.claude/CLAUDE.md is a global rule, ./CLAUDE.md is a cross - project rule, .claude/rules/*.md are modular sub - rules, and CLAUDE.local.md are local private notes.

Besides these design - level discoveries, there are also some unexpected details in the source code.

Some developers noticed that there is a rather large library of regular expressions specifically designed to recognize negative emotions in user input, such as curses, complaints, and frustrated expressions. These are recorded and may be used to improve the user experience or analyze feedback.

The leader of Claude Code explained that this is only used to assess the user experience

Even more interesting is a flag called ANTI_DISTILLATION_CC. When activated, Claude Code inserts a series of false tool definitions into requests to the API. These tools don't exist and are only used to contaminate the data traffic.

If competitors capture the API communication data of Claude Code and try to use it to train their own models, these false data will be mixed in, degrading the quality of the training data.

Another function called "Undercover Mode" proves that Claude Code has now almost become an internal software engineer at Anthropic.

In the source code, there is a system prompt that clearly says: "You are running Claude Code in Undercover Mode... Your commit messages must not contain internal information from Anthropic. Hide your identity."

Specifically: The commit messages must not contain "Claude Code", no "Co - Authored - By: Claude", and no AI attribution. At the same time, the internal codes Capybara, Tengu, and Fennec must not be mentioned in external code repositories.

Anthropic uses this function so that internal engineers can use Claude Code to work on open - source projects without leaving traces in the public commit history.

These AI - generated codes are silently contributed to public repositories. There is already a complete implementation at the source code level, and this logic is explicitly written into the system prompts.

Some users have created a website that contains all the information from this code discovery of Claude Code, including future updates, architectural designs, and interesting details.

Website address: https://www.ccleaks.com/

The website mentions that the complete code of Claude Code contains 8 unpublished features, 26 hidden commands, as well as a large number of build flags and environment variables.

These 8 unpublished features include:

1. Buddy: An AI companion pet

2. Coordinator Mode: The coordinator mode for multiple agents

3. UDS Inbox: The communication between multiple Claude Code conversations

4. KAIROS: A background daemon that automatically...