Back to blog
Claude CodeIALaravel

Claude Code 2.1.323 adds Code Mode for chained tool calls

Code Mode lets Claude Code write JavaScript to coordinate multiple tool calls in a single execution.

By Isma4 min read

Fewer turns for repetitive work

Tasks that involve searching, filtering results, editing several files, and running tests can become slow with the usual agent loop. The agent calls one tool, reads its output, decides what to do next, and repeats. Code Mode changes that pattern by having Claude write JavaScript that coordinates several tool calls in one execution.

This is not about turning Claude Code into a general-purpose automation platform. It is about letting the agent chain related operations, pass one result into the next call, and run independent work in parallel. The model can then receive a smaller, more relevant result instead of a large unfiltered stream of command output.

Where it fits in a Laravel project

Large Laravel applications have plenty of work that matches this model. It can help locate repeated configuration across modules, inspect which tests cover a set of routes, or find class usage before preparing a change. Rather than asking for search results one step at a time, Code Mode can coordinate the searches, narrow down the relevant files, and prepare an edit alongside the related tests.

It does not replace reading the diff or understanding the application architecture. If a change affects policies, queues, migrations, or external integrations, I still want to decide what changes and why. Its value is reducing mechanical exploration and coordination work, not outsourcing technical judgment.

It also makes sense in a homelab

A homelab usually ends up with inventories, containers, services, and configuration files spread across several machines. Code Mode is useful when there are independent checks to run: collecting status, finding references in configuration files, or comparing the output of several commands. If something needs changing, permission rules should still remain the boundary between an inspection and an action.

Code Mode does not hide what is happening. The conversation still shows tool calls and their effects, including the diff produced by an edit. The JavaScript Claude wrote is available through the transcript viewer with Ctrl+O.

Enabling it

Code Mode is experimental and disabled by default. It requires Claude Code 2.1.323 or later, an interactive terminal session, and a compatible account. On macOS, Linux, or WSL, I can try it by starting Claude Code with this environment variable:

CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 claude

It can also be enabled for new sessions in user-level settings. Claude Code ignores this variable in project settings files, so a cloned repository cannot enable Code Mode on its own.

{
  "env": {
    "CLAUDE_CODE_EXPERIMENTAL_CODE_MODE": "1"
  }
}

That configuration belongs in ~/.claude/settings.json. On the first run, Claude Code asks for confirmation and restarts with Code Mode enabled. To resume that session later, the variable must remain set to 1 when using claude --continue or claude --resume.

Permissions, hooks, and the important detail

Every tool call made from Claude’s code still goes through deny and ask permission rules as well as PreToolUse hooks. Existing matchers for tools such as Bash do not need to be rewritten just because Code Mode is enabled. If I need to inspect the JavaScript itself before it runs, the documentation says a PreToolUse hook can match the REPL tool and read tool_input.code.

There is an important difference in auto mode. The classifier reviews the code block before execution, rather than reviewing every individual tool call inside it. Since some values are computed while the code runs, strict controls should remain in rules or hooks for operations that need them.

The fine print

This is not a universal upgrade for every Claude Code session. Code Mode does not work with -p, the Agent SDK, the VS Code panel, Claude Desktop, or cloud sessions. It is also unavailable through gateways, Amazon Bedrock, Claude Platform on AWS, Google Cloud Agent Platform, and Microsoft Foundry.

Sessions started in Code Mode can only be resumed from the terminal with Code Mode still enabled. Remote Control, Claude in Chrome, and computer use are not available, and the session cannot be moved to the Desktop app. Those limitations are understandable for an experimental feature, but they matter before making it part of a daily workflow.

Long-running code needs attention too. When code waits in the foreground, it stops after ten minutes, including time spent answering permission prompts. It can run in the background under specific permission-mode conditions, but that does not make long or risky tasks suitable for unattended execution.

For Laravel code reviews or homelab checks, Code Mode looks useful when the work consists of many small, related tool calls. For sensitive changes, destructive operations, or architecture decisions, clear boundaries, permissions, and final review still matter more. The point is not uncontrolled autonomy; it is removing unnecessary turns within an existing control framework.


Release 2.1.323 source · Official Code Mode documentation

Newsletter

What I learn coding with AI, every two weeks in your inbox.

Real numbers, mistakes included. No spam, unsubscribe in one click.

No spam, unsubscribe in one click. I only use your email to send you this and the newsletter. More in the privacy policy.