Free Intensive Nov 21–22Free 2-day hands-on Vibecoding Intensive on Nov 21–22 at 16:00 MSK (Sat–Sun) · Live Cohort 3 starts Nov 23Join Free →Cohort 3 (Nov 23)

Claude Code Gets a Mode That Writes One JS Script Instead of a Chain of Tool Calls

Claude Code has an experimental Code Mode. Instead of calling tools one at a time, the agent writes a complete JavaScript script. The script runs commands in parallel, passes the output of one call into the next, and returns only the needed fields to the context rather than raw JSON. The model takes fewer turns, and the context stays lean. It is enabled with one variable in settings.json, but the mode is still in beta.

AI-processed from TG: @tips_ai (Tips AI / IT & AI); edited by Hamidun News
Claude Code Gets a Mode That Writes One JS Script Instead of a Chain of Tool Calls
Source: TG: @tips_ai (Tips AI / IT & AI). Collage: Hamidun News.
Listen to article
Article Fact Sheet & Key Figures
ParameterDetails
Primary sourceTG: @tips_ai (Tips AI / IT & AI) ↗
Editor-in-Chief
Enablingset CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 in the env block of settings.json
Key metric #2Claude in Chrome, computer use, and Remote Control are not available in beta
Key metric #3The idea is similar to the implementation in Pi, but Claude Code's version is simpler

Anyone who has spent long stretches working with coding agents has seen this pattern. The agent calls one tool, gets a long response, "thinks," calls a second tool, gets another wall of data, and so on. Each step costs time and tokens, and the context gradually fills with raw output, of which maybe a couple of lines are actually needed. Claude Code has added an experimental mode that tries to fix this.

What Code Mode is

Several versions ago, Claude Code added an experimental tool-calling mode called Code Mode. The standard approach works like this: the model calls one tool, looks at the result, reasons about it, and only then calls the next tool. In Code Mode, the agent writes a complete JavaScript script at once, and that script carries out the entire chain in a single pass.

Think of it this way. You ask an assistant to gather data from three sources. In standard mode, they call you after each source: "Here's what I found, what next?" In Code Mode, they receive the task, go through all three sources themselves, pick out what matters, and bring back a short summary.

According to the author of the Tips AI channel, the approach resembles the implementation already in Pi, only simpler. Both aim for the same thing: reduce the number of model turns and keep tool noise out of the context.

What the script can do

The description of the mode points to three practical capabilities.

First, commands can run in parallel. If the agent needs to read several files or run several independent checks, it doesn't have to do them strictly one after another, one turn per step.

Second, the result of one call is passed to the next without an extra model turn. If the second command depends on the output of the first, the script inserts the data itself. The model is not invoked at that point, and no tokens are spent on intermediate reasoning.

Third, the script filters the output. It returns to the model's context only the few fields that are actually needed, not the entire raw JSON. If a tool produces a huge response but you need two fields, the rest never enters the context. This matters: the cleaner the context, the less likely the model is to get distracted by irrelevant details, and the longer the session stays productive.

How to enable it and what you give up

The mode is enabled through settings.json. Add the variable CLAUDE_CODE_EXPERIMENTAL_CODE_MODE with the value "1" in the env block. It looks like this: { "env": { "CLAUDE_CODE_EXPERIMENTAL_CODE_MODE": "1" } }.

There are limitations. The mode is still in beta, and Claude in Chrome, computer use, and Remote Control are not available in it. If your workflow depends on browser control, screen interaction, or remote session management, you will need to leave Code Mode off. For tasks centered on files, terminal commands, and APIs, these limitations may not matter.

It is also worth noting what the original note does not include. The author provides no concrete measurements of token or time savings, so you will need to evaluate the benefit yourself. In addition, when the agent writes a script in one go, it makes decisions in advance, without intermediate checks. If a task requires careful correction after each step, step-by-step mode may be more reliable.

What to do with this

For developers, the takeaway is practical. If you run Claude Code on tasks with many repetitive calls, such as log analysis, data collection from several places, or bulk checks, consider enabling Code Mode on a separate branch or in a test project and comparing the results with standard mode. Look at the number of turns, token consumption, and how clean the context remains by the end of the session.

For those building their own agents, this is another signal about direction. Instead of forcing the model to call tools one at a time and parse their responses manually, more and more designs have the model write a small orchestrator script. It executes the routine work and returns only the result to the context. Code Mode in Claude Code is still in beta, but the direction is clear, and it is worth watching.

Story

Key Questions Answered

What Code Mode is?

Several versions ago, Claude Code added an experimental tool-calling mode called Code Mode. The standard approach works like this: the model calls one tool, looks at the result, reasons about it, and only then calls the next tool. In Code Mode, the agent writes a complete JavaScript script at once, and that script carries out the entire chain in a single pass. Think of it this way. You ask an assistant to gather data from three sources.

What the script can do?

The description of the mode points to three practical capabilities. First, commands can run in parallel. If the agent needs to read several files or run several independent checks, it doesn't have to do them strictly one after another, one turn per step. Second, the result of one call is passed to the next without an extra model turn. If the second command depends on the output of the first, the script inserts the data itself.

How to enable it and what you give up?

The mode is enabled through settings.json. Add the variable CLAUDE_CODE_EXPERIMENTAL_CODE_MODE with the value "1" in the env block. It looks like this: { "env": { "CLAUDE_CODE_EXPERIMENTAL_CODE_MODE": "1" } }. There are limitations. The mode is still in beta, and Claude in Chrome, computer use, and Remote Control are not available in it. If your workflow depends on browser control, screen interaction, or remote session management, you will need to leave Code Mode off.

ZK
Zhemal Khamidun — CPO at Alpina Digital, product manager of AlpinaGPT. Building AI products since 2019. Hamidun News is a pet project that grew into a production aggregator with 6,000+ readers.
✦ Hands-On AI Engineering · Hamidun Academy

Build & Ship Production AI Agents Without Boilerplate Code

Start your free 72-hour trial at Hamidun Academy (academy.hamidun.com) — interactive lessons on Claude Code & Cursor, live Tech Radar, and production agent templates.

Start 72h Free Trial →Vibe-Coding Intensive
What do you think?
Loading comments…