Ant Engineer reverse-engineers Claude code source, revealing the four-layer decision pipeline mechanism of Auto Mode

Gate News, March 25 — Ant Group engineer and Umi.js front-end framework author Chen Cheng reverse-engineered the source code of Claude Code 2.1.81, fully restoring the decision mechanism of Auto Mode. The key finding: each tool invocation passes through four layers of decision-making, and only when the first three layers cannot determine the outcome will an independent AI classifier be called for safety review.

The four layers of the pipeline are: first, checking existing permission rules; if matched, allow directly; second, simulating acceptEdits mode (permission level allowing file edits). If it passes in this mode, it indicates low risk, and the classifier is skipped; third, checking the read-only tool whitelist (Read, Grep, Glob, LSP, WebSearch, etc.), which do not modify any state and are unconditionally allowed; only if none of these conditions are met does it proceed to the fourth layer, sending an API request to Claude Sonnet for safety classification.

Key design details of the classifier include: always using Sonnet instead of Opus, balancing cost and latency; setting temperature to 0 to ensure deterministic output; the classifier is defined as a “safety monitor for autonomous AI programming agents,” protecting against three types of risks (prompt injection, scope creep, unintended harm); the user’s CLAUDE.md configuration file is injected into the classifier context as the basis for judging user intent.

The interception rules cover over 22 categories, including force push, direct push to main branch, downloading and executing external code, production deployment, data leaks, self-modification permissions, creating remote code execution surfaces, credential leaks, etc. Exceptions for allowing include seven types: hardcoded test keys, local file operations within the working directory, read-only GET requests, installing declared dependencies, official toolchain installations, reading configuration credentials sent to target providers, and pushing to the current working branch.

The system also implements a circuit breaker mechanism: after three consecutive rejections or a total of 20 rejections, the system downgrades to manual confirmation; in headless mode, it directly aborts the agent. When the classifier is unavailable, a feature flag controls whether it “fail-closed” (immediately reject) or “fail-open” (downgrade to manual confirmation).

In Auto Mode, prompt injection behavior is finely controlled: injected once every five dialogue rounds, with the first injection in each five-round cycle being the full version (about 800 words, including six instructions such as “execute immediately,” “reduce interruptions,” “action over plan”), and the remaining four being a concise one-line version, balancing context window usage and behavioral stability.

Disclaimer: The information on this page may come from third parties and does not represent the views or opinions of Gate. The content displayed on this page is for reference only and does not constitute any financial, investment, or legal advice. Gate does not guarantee the accuracy or completeness of the information and shall not be liable for any losses arising from the use of this information. Virtual asset investments carry high risks and are subject to significant price volatility. You may lose all of your invested principal. Please fully understand the relevant risks and make prudent decisions based on your own financial situation and risk tolerance. For details, please refer to Disclaimer.

Related Articles

Ethereum Foundation Announces ETH Rangers Project Results: Over $5.8M in Recovered or Frozen Assets

The Ethereum Foundation's ETH Rangers project has successfully completed, funding 17 researchers to enhance public security in the ecosystem. Achievements include recovering $5.8M in assets, identifying over 785 vulnerabilities, and developing several security tools.

GateNews4h ago

Top Crypto VCs See Significant AUM Declines Amid 2025 Market Downturn

During the 2025 crypto market downturn, major venture capital firms saw significant AUM declines, but Haun Ventures grew by 30%. Paradigm and a16z are raising over $4.2 billion for new funds, highlighting varied performances among firms.

GateNews7h ago

BitMine’s quarterly net loss was $3.81 billion, with ETH’s unrealized losses accounting for 99%

BitMine Immersion Technologies filed its financial report with the SEC on April 15, 2026, showing that the company’s quarterly net loss as of February 28 totaled $3.81B, mainly due to unrealized losses from its Ethereum holdings. The company holds about 4.87 million ETH, with an average purchase cost of $3,794 per ETH. Its recent market value exceeded $10.7 billion. The BMNR stock has been upgraded to the New York Stock Exchange, and the current quote is $21.69.

MarketWhisper11h ago

Only 4% of Danes Hold Crypto, Below European Peers Like Norway and Finland, Central Bank Study Shows

A Danish National Bank report shows only 4% of Danes own cryptocurrency, unchanged since 2023 and below other European nations. Most holders invest small amounts, with adoption hindered by cautious banks and risk concerns, mainly among younger, wealthier individuals.

GateNews17h ago

World Silver Institute: Global Silver Market to Face Sixth Consecutive Year of Supply Deficit

The World Silver Institute forecasts a widening supply shortage in the silver market, projecting a 46.3 million ounce deficit by 2026. While demand for silver bars and coins will rise, other sectors will decline, leading to an overall consumption decrease. Despite near-term challenges, a positive outlook for silver remains.

GateNews04-15 13:01

Bitmine Immersion Technologies Reports $3.82B Quarterly Loss Despite Revenue Surge to $11M

Bitmine Immersion Technologies (BMNR) reported a $3.82 billion net loss for Q1 2026, primarily from unrealized digital asset losses. Despite this, it continues to accumulate Ethereum, now holding 4.87 million ETH worth $10.7 billion. Quarterly revenue increased to $11.04 million, mainly from staking rewards.

GateNews04-15 08:05
Comment
0/400
No comments