{"slug": "claude-code-2-1-323-ships-code-mode-batch-tool-calls-in-javascript", "title": "Claude Code 2.1.323 Ships Code Mode: Batch Tool Calls in JavaScript", "summary": "Anthropic released Claude Code v2.1.323 on November 12 with an opt-in experimental feature called Code Mode, in which Claude writes a single JavaScript program that orchestrates all tool calls in one pass instead of issuing them turn by turn; it is enabled with the environment variable CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1. Anthropic's Code Mode documentation contains no token-saving figure, and the \"37% fewer tokens\" claim circulating on developer feeds came from a separate 2025 Anthropic API experiment in which Claude wrote Python in an API sandbox, dropping from 43,588 to 27,297 tokens on complex research tasks. The release also ships three security fixes: \"Don't Ask Again\" no longer writes approved commands containing secrets to settings.local.json, deny and ask rules now catch commands run through sudo and env wrappers, and --permission-mode auto falls back to Manual when auto is unavailable.", "body_md": "Claude Code v2.1.323 landed on November 12 with an experimental feature called Code Mode: instead of issuing tool calls one at a time and waiting for each result, Claude writes a JavaScript program that runs all the calls in a single pass. It is opt-in, it takes one environment variable to enable, and the “37% fewer tokens” figure circulating on developer feeds this week has nothing to do with this feature.\n\n## What Code Mode Changes\n\nThe existing behavior is a turn-by-turn loop. Claude calls Bash, waits for the result, calls Read, waits, calls Edit, waits. Each tool call costs a model turn. On a task touching eight files across two packages, that overhead adds up.\n\nCode Mode flips the model. Claude writes a JavaScript program that orchestrates all the tool calls — with loops, conditionals, and parallel execution — and Claude Code runs it as a single unit. The model gets one consolidated result back instead of eight separate ones.\n\nThe permission system is unchanged. Every call in the generated script still passes through your deny and ask rules and any PreToolUse hooks you have configured. In auto permission mode, the entire JavaScript program is reviewed before execution begins, not each call individually. The UI still shows individual tool outputs — edit diffs, bash output — not raw JavaScript.\n\nClaude Code uses `node:vm` running in Bun for execution. Codex uses v8, OpenCode has a custom interpreter, Pi uses QuickJS. The concept is not new, but this is Anthropic’s first implementation of it in [Claude Code](https://github.com/anthropics/claude-code/releases/tag/v2.1.323).\n\n## How to Enable Code Mode\n\n```\nCLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 claude\n```\n\nThat is the entire setup. You need v2.1.323 or later — run `claude --version` to confirm. Code Mode is opt-in and explicitly experimental. Anthropic is still measuring whether it improves real-world task completion rates. Organizations can turn it off at the org level.\n\n## The 37% Figure Is From a Different Experiment\n\nPosts on X cited “37% fewer tokens” as the Code Mode headline within days of the release. The number is real — it comes from a 2025 Anthropic API article about a separate experiment in which Claude wrote Python in an API sandbox. That experiment measured a drop from 43,588 to 27,297 tokens on complex research tasks. Code Mode is a conceptually similar idea applied to a different product in a different context.\n\nAnthropic’s Code Mode documentation contains no token-saving figure. [The viral figure was incorrectly attached to Code Mode](https://i10x.ai/news/claude-code-code-mode-javascript-tool-calls). Enable it, test it on your own workflows, and measure your own results rather than backfilling a number that was never claimed for this feature.\n\n## Three Security Fixes That Are the Real Urgency\n\nCode Mode gets the attention, but three security fixes in 2.1.323 have more immediate consequences for most users.\n\n**“Don’t Ask Again” no longer saves secrets to disk.** Before this release, selecting “Yes, and don’t ask again” saved the approved command — including any inline credentials — to `settings.local.json`, a file that routinely lands in git repositories. Rules that look like they contain secrets, or that would write to a git-tracked settings file, are now session-only. This was a real exposure. If you have ever used “don’t ask again” on a command containing an API key or password, [audit your committed settings files now](https://neomanex.com/news/claude-code-2-1-323-dont-ask-again-stops-saving-secrets-sandbox-fixes).\n\n**Bash sandbox sudo and env bypass closed.** Deny and ask rules previously missed commands run through `sudo`, `env`, and similar wrappers. `sandbox.excludedCommands` could also let unlisted commands escape the sandbox, and the sandbox itself could switch off mid-session. All three vectors are fixed.\n\n**Auto permission mode now falls back to Manual.** `--permission-mode auto` previously fell through to a more permissive mode when auto was unavailable. It now falls back to Manual, which asks before acting. The [sandboxing architecture documentation](https://anthropic.com/engineering/claude-code-sandboxing) has the full breakdown of how permission tiers work.\n\n## Gateway Users: Check Your Context Window Config\n\nClaude Code now assumes a 1M-token context window for any model ID it does not recognize, up from 200K. If you route Claude Code through a gateway using a custom model name, and that model has a smaller actual context, sessions will fail every turn once the context fills. Set this before rolling out 2.1.323 to gateway environments:\n\n```\nCLAUDE_CODE_DISABLE_1M_CONTEXT=1\n```\n\nCode Mode is experimental today. If Anthropic’s internal measurements show real improvement in task completion, it will likely become default in a future release. The security fixes apply to everyone right now. Update, audit your committed settings files for exposed credentials, and verify your gateway model’s context configuration before this week is out. Full details are in the [complete changelog breakdown for unattended runs](https://www.aidonenow.com/blog/claude-code-2-1-323-what-changed-for-unattended-runs-progress-heartbeat-auto-mode-fallback-1m-context-code-mode).", "url": "https://wpnews.pro/news/claude-code-2-1-323-ships-code-mode-batch-tool-calls-in-javascript", "canonical_source": "https://byteiota.com/claude-code-2-1-323-code-mode-javascript-tool-calls/", "published_at": "2026-11-15 18:15:42+00:00", "updated_at": "2026-11-15 18:53:57.043862+00:00", "lang": "en", "topics": ["ai-tools", "ai-agents", "developer-tools", "ai-safety"], "entities": ["Anthropic", "Claude Code", "Code Mode", "Bun", "node:vm", "Codex", "OpenCode", "QuickJS"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/claude-code-2-1-323-ships-code-mode-batch-tool-calls-in-javascript", "markdown": "https://wpnews.pro/news/claude-code-2-1-323-ships-code-mode-batch-tool-calls-in-javascript.md", "text": "https://wpnews.pro/news/claude-code-2-1-323-ships-code-mode-batch-tool-calls-in-javascript.txt", "jsonld": "https://wpnews.pro/news/claude-code-2-1-323-ships-code-mode-batch-tool-calls-in-javascript.jsonld"}}