- Published on
Claude Code's Code Mode: AI Writes JavaScript to Handle Multiple Tool Calls at Once
"Why does the AI have to go back and forth ten times just to check ten files?"
If you've used Claude Code for any serious workflow, you've felt this friction. One tool call, wait for the result, make the next call, wait again β the loop adds up fast in both time and tokens.
On November 12, 2026, Claude Code v2.1.323 quietly introduced Code Mode β an experimental feature that changes how the AI approaches multi-step work.
What Code Mode Actually Does
Here's the standard Claude Code workflow:
- The model calls one tool
- Gets back the result
- Decides whether to call the next tool
- Repeats
Code Mode inverts this. Instead of one-at-a-time calls, the model writes a JavaScript script that batches multiple tool calls together. Claude Code then runs that script in your session. The whole sequence executes as a single unit rather than a chain of back-and-forth exchanges.
A useful analogy:
Standard mode: An errand runner who goes to the store, buys one item, comes back and asks what to get next, then heads out again.
Code Mode: An errand runner who gets the full shopping list upfront, plans the whole trip, and returns with everything in one go.
How to Enable It and What You'll See
Code Mode is off by default. Currently it only works in terminal sessions connected directly to the Anthropic API.
Once active, you'll notice a Code row appearing in Claude Code's output. Press Ctrl+O to expand it and read the JavaScript the model wrote β every tool call, in order, fully visible. No black box.
Permissions Still Apply
Running things in batch doesn't bypass safety controls. In Auto mode, a classifier reviews the JavaScript before it runs. Your existing deny and ask permission rules, plus any PreToolUse hooks you've configured, apply to the individual tool calls executed inside the script β the same as if each call had been made separately.
So if you've set "ask before deleting files," that prompt still fires even when the delete call is embedded inside a larger script.
Practical Use Cases
Large codebase analysis
Need to scan dozens of files for a pattern? Code Mode handles all the reads in a single script instead of a repeated loop.
Bulk data tasks
Fetching from multiple APIs, comparing results, batch-converting files β all wrapped in one script execution.
Test environment setup
Checking env variables, verifying dependencies, and creating temp files can all be bundled into a single pre-run script.
Important Caveats
Anthropic is explicit about this: Code Mode is experimental and can be changed or removed without notice. It's not production-ready.
Also worth clearing up a number floating around online: the "37% token savings" figure comes from Anthropic's separate Programmatic Tool Calling research, not from Code Mode. Actual savings vary significantly by task type.
An EdTech CEO Perspective
Running an education platform means dealing with a lot of repetitive, high-volume operations: processing learning data, batch-updating content, analyzing student activity logs. These are exactly the kinds of workflows that benefit from batching.
If Code Mode stabilizes, it could meaningfully improve efficiency for these tasks. But right now, experimental means experimental. I'd test it on small, contained operations first β and always read the generated JavaScript before trusting it with anything important.
The real shift here is conceptual: AI is now writing the automation script, not just executing your instructions step by step. That's a bigger change in how we think about AI tools than it might appear.
Tips
- Start small: Try Code Mode on tasks involving 5 or fewer files before scaling up. Build the habit of reading what it generates.
- Always use Ctrl+O: Don't let it run as a black box. Reading the generated code is the most important part of using Code Mode safely.
- Pre-configure ask permissions: For any sensitive operation (file deletion, external API calls), set
askpermissions so Code Mode still prompts you mid-script. - Current limitation: Only works in direct Anthropic API terminal sessions β not Claude.ai or other integrations.
Sources: