Anthropic 为 Claude Code 添加代码模式:Claude 现在能将工具调用链式化为 JavaScript
Anthropic Adds Code Mode to Claude Code: Claude Now Chains Tool Calls in JavaScript
Anthropic 在 Claude Code 中添加了代码模式,Claude 现在能将多个工具调用链式化为 JavaScript 一步完成。
同一件事另外 1 家也报道了
各家口径不同:Claude Code发布说明版本为2.1.323,并提到新增功能如Code Mode、类型检查和多项错误修复;MarkTechPost则专注于Claude Code中添加代码模式以将工具调用链式化为JavaScript。
- Claude Code releases··首发
- MarkTechPost··+5 天·当前阅读
Anthropic 为 Claude Code 添加代码模式:Claude 现在能将工具调用链式化为 JavaScript
新增信息:Anthropic使Claude能够一步将多个工具调用链式化为JavaScript。
按发布时间排列 · 事件后续出现时自动追加 · 由模型根据各家标题与摘要比对
Anthropic has added Code Mode to Claude Code as an experimental, opt-in feature. Claude Code Code Mode is a mode in which Claude writes JavaScript that makes several tool calls in 1 step. It shipped in Claude Code v2.1.323 last week. For developers, it changes how the agent spends round-trips on multi-step work. You can check the deployment options and specs here through our GPULeaderboard.com chrome extension.
TL;DR
- Works with: It works with Claude Opus 5.5, Sonnet 5.5, Haiku 5.5 and Fable 5.2.
- Runs on: An interactive terminal session on the native build, v2.1.323 or later. Windows needs Git for Windows. Anthropic API or Claude subscription only.
- Performance: Anthropic publishes no benchmark or token-saving figure for Code Mode.
- Best: Background code can run for up to 2 hours while you keep talking to Claude.
- Worst: Code that Claude waits on stops after 10 minutes. No Bedrock, Google Cloud, Foundry,
-p, Agent SDK, VS Code or Desktop. - Bottom line: Best: related tool calls run as 1 program. Worst: narrow availability and coarser auto-mode review.
What is Code Mode in Claude Code?
Without Code Mode, Claude requests each Bash, Read or Edit call directly. It reads every result before choosing the next step. With Code Mode, Claude writes a piece of JavaScript, and Claude Code runs it in your session.
According to the docs, one piece of code can run commands in parallel. It can feed one result into the next call. It can also return only the output Claude needs to read.
Anthropic’s example raises a retry limit. The code finds the file, edits it and runs the tests:
Copy CodeCopiedUse a different Browser
const files = await $`rg -l "function retryPolicy" src`.text();
const target = files.trim().split("\n")[0];
await edit(target, "maxAttempts: 3", "maxAttempts: 5");
({ edited: target, tests: $`npm test -- retryPolicy`.nothrow() });In the conversation, you see the tool calls, such as the diff. You do not see the code by default. Press Ctrl+O to open the transcript viewer and expand a collapsed Code row.
How do you turn on Code Mode?
Set CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 in your shell, or in the env block of ~/.claude/settings.json. Before the first session, Claude Code asks you to confirm. Select “Yes, turn on Code Mode”.
Claude Code then restarts and shows ‘Code Mode (experimental) is on’.
A Code Mode session resumes only with the variable still set to 1. Setting 0 anywhere turns it off, even if 1 is set elsewhere. Admins can block it org-wide with a 0 in managed settings. They cannot force it on.
When should developers use Code Mode?
Anthropic recommends it for tasks with many related tool calls:
- A change that repeats across many files
- A search whose results need filtering before Claude reads them
- Several independent commands that can run at the same time
How does Code Mode handle permissions and long-running code?
Each tool call inside the code still passes your deny and ask rules. It also passes PreToolUse hooks under the tool’s usual name, such as Bash.
Review differs by permission mode:
- Auto mode: a classifier reviews each piece of code, not each tool call. It cannot see values computed at run time, such as a path from search output.
- Other modes: code starts without review, and you are prompted per tool call as usual.
Hook authors should check each part of a command. A git push can arrive as cd 'app' && git push. To inspect the code itself, match the REPL tool and read tool_input.code.
If Claude waits, the code stops after 10 minutes, including time at permission prompts. In the background, it can run for up to 2 hours while you keep chatting. Background runs need a session started in auto or bypassPermissions mode.
What are the requirements and limitations?
- Version: v2.1.323 or later; v2.1.326 or later with agent teams
- Account: Claude subscription or Console account. Not available through gateways, Amazon Bedrock, Claude Platform on AWS, Google Cloud, or Microsoft Foundry
- Organization: no HIPAA configuration or zero data retention
- Surface: interactive terminal only. No
-p, Agent SDK, VS Code panel, Desktop app or cloud sessions - Blocked settings: API key helper, OpenTelemetry export or
DISABLE_TELEMETRY - Unavailable features: Remote Control, Claude in Chrome and computer use
How does Code Mode compare with other code-first tool calling?
Cloudflare coined ‘Code Mode’ on September 26, 2025. Its Agents SDK turns MCP schemas into a TypeScript API that runs in V8 isolates.
Anthropic then published code execution with MCP. In one example, token use fell from 150,000 to 2,000, a 98.7% saving. Its API feature, Programmatic Tool Calling, uses Python. It cut average usage from 43,588 to 27,297 tokens on complex research tasks.
Claude Code’s version applies the pattern to the CLI’s own tools. The docs give no token figure. One independent test reported system-tool context of 11.1k tokens with Code Mode versus 24.6k without. Treat that as a single third-party measurement.
| Feature | Claude Code Code Mode | Claude API Programmatic Tool Calling | Cloudflare Code Mode | Standard tool calling |
|---|---|---|---|---|
| Where it runs | Claude Code CLI, your session (docs) | Code execution tool, Claude API (Anthropic) | Agents SDK, V8 isolates (Cloudflare) | Any tool-use API |
| Language Claude writes | JavaScript | Python | TypeScript | None (JSON calls) |
| Tools it orchestrates | Built-in tools (Bash, Read, Edit) | Developer-defined tools | MCP servers as TypeScript APIs | Any |
| Status | Experimental, off by default | Launched Nov 2025 | Worker Loader API in closed beta | GA |
| Published token figure | Not disclosed | 43,588 to 27,297 avg (37%) | Not disclosed in launch post | Baseline |
| Max run time | 10 min waiting, 2 hr background | Not disclosed | Not disclosed | Per call |
| Cloud providers | Anthropic API only | Not on Bedrock or Google Cloud (docs) | Cloudflare Workers | Broad |
Key Takeaways
- Claude writes JavaScript that chains Bash, Read and Edit calls in 1 step.
- Opt in with
CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1on v2.1.323 or later. - Background code runs up to 2 hours; waiting code stops at 10 minutes.
- Auto mode reviews the code, not each tool call.
- Terminal and Anthropic API only: no Bedrock, Google Cloud, SDK or IDE panel.
Check out the Code Mode documentation and the Claude Code changelog. You can check the deployment options and specs here through our GPULeaderboard.com chrome extension.
Also, feel free to follow us on Twitter and don’t forget to join our 150k+ML SubReddit and Subscribe to our Newsletter. Wait! are you on telegram? now you can join us on telegram as well.
Need to partner with us for promoting your GitHub Repo OR Hugging Face Page OR Product Release OR Webinar etc.? Connect with us
The post Anthropic Adds Code Mode to Claude Code: Claude Now Chains Tool Calls in JavaScript appeared first on MarkTechPost.
来源: MarkTechPost · marktechpost.com