Anthropic has introduced Code Mode for Claude Code, allowing the model to write and execute JavaScript directly within a user session. Unlike the standard approach where Claude requests individual Bash, Read, or Edit calls sequentially, Code Mode enables the execution of multiple commands in parallel and facilitates passing results between calls.

To enable this feature, users must set the environment variable CLAUDE_CODE_EXPERIMENTAL_CODE_MODE to 1. The system requires explicit user confirmation before the first session. Administrators have the authority to disable this mode organization-wide by setting the variable to 0, though they cannot force it to be enabled.

The execution environment enforces security by applying existing deny and ask rules to every tool call within the code. PreToolUse hooks remain active, and administrators can inspect code by matching the REPL tool and reading tool_input.code. Code execution stops after 10 minutes if the model is waiting, while background tasks can run for up to 2 hours.

The implementation follows similar patterns seen in other programmatic tool-calling features. While specific token savings for Claude Code were not provided by the company, independent testing indicated a reduction in system-tool context from 24.6k tokens to 11.1k tokens when using the new mode.