Inside Code Mode: 16 tools become three

Claude Code’s new Code Mode is meant to stop the tool list from piling up, and one developer looked at the API requests his own Claude Code sent to see whether it does. In a normal session, each request carried a list of 16 tools. In Code Mode there were three: REPL, Poll and advisor. In a post on Medium he explains what he found, argues that Code Mode leaves one cost in place, and offers a small library that carries the same idea over to command-line tools.
How Code Mode works
Code Mode arrived as an experimental opt-in in Claude Code 2.1.323 on November 12. Normally Claude asks for tools such as Bash, Read or Edit one at a time and reads each result before deciding what to do next. Every skill and MCP server you add puts another entry in the list sent with each request. In Code Mode, Claude writes JavaScript that makes the calls, and Claude Code runs that code in your session.
The author found that the core built-in tools sit inside the REPL tool’s description as short code signatures. Any other tool is found through a method called searchTools, and the model then writes the code that calls it. The REPL keeps running for the whole session, so its state carries over from one call to the next until the session restarts. Intermediate output, such as a file list, stays inside the script; only what the script returns goes into the conversation.
Code Mode is off by default, and Anthropic’s documentation warns that it may change or be removed in any release. You start Claude Code with CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 claude and confirm a prompt. It needs version 2.1.323 or later, the native build, an interactive terminal session and one of four models: Opus 5.5, Sonnet 5.5, Haiku 5.5 or Fable 5.2.
The cost Code Mode leaves
The author’s argument is that Code Mode cuts the trips back to the model, but every command a script runs still starts its own process. His own tools have many commands. One of them, aos, lets an agent drive a computer: windows, mouse, screenshots, files. It has more than 60 operations, and each call means starting a process, waiting for the answer and only then starting the next one. “So invoking a CLI is a cost,” he writes.
His fix is CLI CodeMode, a library that a tool’s developer adds to the tool. You register every command with a description, and the tool gains a new code command. The agent writes one program in a small subset of JavaScript that the library runs itself, without Node.js or Bun. The tool checks the program with code check and then runs all the steps inside one process. Go is the main version; the Rust, Python and TypeScript versions are experimental and run the same engine compiled to WebAssembly.
His test was a question to ctx-optimize, his tool that maps a codebase so an agent doesn’t have to search through files. The question took seven calls. Done the normal way, it took 3 to 7 trips to the model, seven processes and 28,273 bytes of output. Code Mode needed one trip but still seven processes. With his library he reports one trip, one process, 169 bytes back and 137 ms of CPU time against 164 to 167 ms.
Our analysis
What we checked
On November 23 we reran the author’s seven-call question on ctx-optimize, 30 times for each approach, on one Linux arm64 machine, and read the library’s code. We did not run Claude Code itself. In its place we used a script that starts the same seven processes and returns only a summary.
The source lists the small output only under his library, but most of that saving comes from scripting itself. Our seven-process script returned 505 bytes. The library’s single program returned 749 bytes, because it pretty-prints its JSON. Seven separate calls returned 13,680 bytes. What the library adds on its own is fewer processes.
That gain was small on our machine. One program took a median 380.2 ms against 401.9 ms for seven separate calls, 5.4% less, and the ranges of the runs overlapped. Starting the tool took about 3.6 ms, against 62 to 79 ms for a real query. Six fewer starts roughly add up to that gap, though that is our inference from two separate measurements.
The pre-run check also catches less than the author’s description suggests. We wrote eight broken programs. code check rejected three before they ran and passed five that then failed while running, including one with an unknown flag, one asking about a symbol that doesn’t exist and one stuck in an endless loop. We tested only version 0.6.2 of the library.
Up next
Claude’s misuse checks now run on your own storage
Eligible businesses on Claude can now keep prompts in their own cloud storage, and Anthropic’s automated checks still scan them for misuse without keeping a copy, in public beta. Would you trust Claude with work data if it stays in your own storage?
Related stories
- Claude Code’s Code Mode runs tool calls as JavaScript
- Claude Code 2.1.323 lets Claude call tools via JavaScript
- Synapse indexes your codebase locally and feeds it to Claude over MCP
- Introducing Claude Subagent Install Manager
- Claude Soul: a learning system for Claude Code
- Claude Code stops wiping .env files
Comments
No comments yet. Be the first.
Join the conversation
Sign in to leave a comment. It appears after moderation.

