Skipbox

In Code Mode, Claude Code writes JavaScript that makes many tool calls in one step. Each call still passes your deny and ask rules and your PreToolUse hooks under the tool's usual name. Three things differ: auto mode's classifier reviews the code and not each call, a PreToolUse hook that fails or times out refuses the call, and background code runs for up to 2 hours. Each person turns it on with CLAUDE_CODE_EXPERIMENTAL_CODE_MODE, which Claude Code ignores in project settings, and the value 0 in managed settings blocks it for the whole organization.

This guide covers what a team changes before it allows Code Mode: the hooks, the permission rules, the managed settings, and the CI that longer sessions start. For what Code Mode is and how to turn it on, read the introduction on Convika's blog, Convika's guide to Code Mode. Code Mode is experimental and off by default, and it may change or be removed in any release.

How a tool call from code is checked

When Claude runs code, each tool call in it goes through your deny and ask permission rules and your PreToolUse hooks under the tool's usual name, such as Bash. A rule or a hook you wrote for Bash, Read or Edit keeps working without a change to its matcher.

Here is what that looks like on v2.1.327 in auto mode, with the Code Mode page's own prompt in a folder of 3 Markdown files: "Read every Markdown file in this project and list the links that point to local files that don't exist." The conversation shows one line, Searched for 1 pattern, read 3 files, ran 7 shell commands. Ctrl+O shows one collapsed Code row of 30 lines, and under it the 11 calls that code made, each under its usual tool name: one Bash(find . -type f …), a Read for each of the 3 files, and seven Bash(test -e './docs/missing.md') calls, one per link. For that one piece of code, a PreToolUse hook on Bash runs 8 times, a hook on Read 3 times, and a hook on REPL once.

What sits beyond rules and hooks depends on the permission mode.

So in auto mode, a call your team must control needs a deny rule, an ask rule or a PreToolUse hook. The classifier reads the code once, before the paths and arguments exist.

Make a shell-command hook check each part

If you have a PreToolUse hook that allows or blocks shell commands, make it check each part of a command, as Bash rules do. In Code Mode, a git push in a folder named app can reach your hook as cd 'app' && git push. A hook that tests whether the command starts with git push lets that through.

This hook splits the command on &&, ||, ;, |, &, newlines, $(, backticks and parentheses, and checks each part. It skips leading VAR=value assignments and git's own options, so git -C app push and /usr/bin/git -c push.default=current push are caught too. Save it as .claude/hooks/check-bash-parts.sh and make it executable. It needs jq.

#!/bin/bash
# PreToolUse hook for Bash: refuses `git push` in any part of a compound command.
input=$(cat)
command=$(jq -r '.tool_input.command // empty' <<<"$input")

# One part per line: split on the shell's separators and on $( ), backticks and parentheses.
nl=$'\n'
for sep in '&&' '||' ';' '|' '&' '$(' '`' '(' ')'; do
  command=${command//"$sep"/$nl}
done

while IFS= read -r part; do
  read -ra words <<<"$part"
  i=0
  # Skip leading VAR=value assignments.
  while [[ ${words[i]:-} == [A-Za-z_]*=* ]]; do i=$((i + 1)); done
  [[ ${words[i]:-} == git || ${words[i]:-} == */git ]] || continue
  i=$((i + 1))
  # Skip git's own options; -C and -c take a value.
  while [[ ${words[i]:-} == -* ]]; do
    [[ ${words[i]} == -C || ${words[i]} == -c ]] && i=$((i + 1))
    i=$((i + 1))
  done
  if [[ ${words[i]:-} == push ]]; then
    echo "Blocked: git push is not allowed in this project. Found in: $part" >&2
    exit 2
  fi
done <<<"$command"

exit 0

Exit code 2 blocks the tool call, and Claude reads the line on stderr as the reason. Run on bash 3.2, the script gives these results:

Register it in .claude/settings.json. "onFailure": "block" makes the hook block the command when the script is missing or crashes, with or without Code Mode.

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "\"${CLAUDE_PROJECT_DIR}\"/.claude/hooks/check-bash-parts.sh",
            "timeout": 30,
            "onFailure": "block"
          }
        ]
      }
    ]
  }
}

Bash rules match command text

The Code Mode page carries this warning: Bash rules match command text, so Claude can run a denied command in a form the rule doesn't match, with or without Code Mode. The permissions page gives the example: Bash(git push *) stops git push origin main and doesn't stop git -C . push origin main. A hook reads command text too, so for limits that don't depend on command text, use sandboxing, which the operating system enforces on the files and network hosts a shell command can reach.

Check the code itself with a hook on REPL

To check the code itself, write a PreToolUse hook that matches REPL, the tool that runs the code, and read the JavaScript from tool_input.code. In the conversation you see the tool calls and not the code, so this hook is also how a team keeps a copy of what ran.

This script appends each piece of code to a file per session and denies code that names git push or a .env file. Save it as .claude/hooks/check-repl-code.sh.

#!/bin/bash
# PreToolUse hook for REPL: keeps each piece of Code Mode JavaScript, and denies code that names git push or a .env file.
input=$(cat)
code=$(jq -r '.tool_input.code // empty' <<<"$input")
session=$(jq -r '.session_id // "unknown"' <<<"$input")

log_dir="${CODE_MODE_LOG_DIR:-$HOME/.claude/code-mode-log}"
mkdir -p "$log_dir"
printf '// %s\n%s\n\n' "$(date -u +%Y-%m-%dT%H:%M:%SZ)" "$code" >>"$log_dir/$session.js"

if grep -qE 'git[^;&|`]*[[:space:]]push|\.env([^A-Za-z]|$)' <<<"$code"; then
  jq -n '{
    hookSpecificOutput: {
      hookEventName: "PreToolUse",
      permissionDecision: "deny",
      permissionDecisionReason: "This code names git push or a .env file. Leave both out and run the code again."
    }
  }'
fi

exit 0

A PreToolUse hook returns its decision inside hookSpecificOutput, with exit code 0. For "deny", Claude reads permissionDecisionReason. Add the matcher group beside the Bash one:

{
  "matcher": "REPL",
  "hooks": [
    {
      "type": "command",
      "command": "\"${CLAUDE_PROJECT_DIR}\"/.claude/hooks/check-repl-code.sh",
      "timeout": 30
    }
  ]
}

Given this line in tool_input.code, the script prints the deny decision. Given the first line of the Code Mode page's own example, which runs rg, it prints nothing and the code runs.

await $`cd app && git push origin main`;

The code is checked as text before it runs, so the two hooks work as a pair: the REPL hook reads the JavaScript, and the Bash hook reads each command the JavaScript runs.

When a hook fails, the call is refused

Without Code Mode, a PreToolUse hook that can't start or times out doesn't block the tool call unless you set "onFailure": "block". In Code Mode, a PreToolUse hook that gives no decision refuses the call, even when onFailure is unset. A hook with a wrong path that nobody noticed for months starts refusing calls the day Code Mode goes on.

If Claude reports a refused tool call, ask it for the error message. There are two.

To let calls go ahead when a command or http hook fails or times out, set "onFailure": "continue" on it. Exit codes work the other way round: if a command hook exits with an ordinary code such as 1, the call goes ahead unless you set "onFailure": "block". Exit with 2 where the hook means to block.

Sort every PreToolUse hook your team ships into two kinds: hooks that enforce a policy, and hooks that only record or notify. A policy hook gets "onFailure": "block" and a timeout it finishes inside. A hook that only records or notifies gets "onFailure": "continue".

{
  "type": "command",
  "command": "\"${CLAUDE_PROJECT_DIR}\"/.claude/hooks/notify-slack.sh",
  "timeout": 60,
  "onFailure": "continue"
}

UserPromptSubmit hooks also run on code output

When code can run in the background, command, http and mcp_tool hooks on UserPromptSubmit also run on code output. A hook that blocks prompts holding a secret then blocks a test log that holds the same pattern, and Claude reports the hook's block reason where you expected output from code.

To let the output through, change the hook so that it doesn't block when source in its input is poll_event.

#!/bin/bash
# UserPromptSubmit hook: blocks a prompt that holds an AWS access key, and lets Code Mode output through.
input=$(cat)

# The output of code that Claude ran in a Code Mode session arrives with source "poll_event".
if [[ $(jq -r '.source // empty' <<<"$input") == poll_event ]]; then
  exit 0
fi

prompt=$(jq -r '.prompt // empty' <<<"$input")
if grep -qE 'AKIA[0-9A-Z]{16}' <<<"$prompt"; then
  jq -n '{
    decision: "block",
    reason: "The prompt holds an AWS access key. Remove it and send the prompt again.",
    hookSpecificOutput: { hookEventName: "UserPromptSubmit", suppressOriginalPrompt: true }
  }'
fi

exit 0

With "source": "poll_event" in the input the script exits 0 with no output; with a typed prompt that holds a key it prints the block decision.

Long-running code: 10 minutes or 2 hours

While code runs a long build or test, Claude either waits for it or lets it continue in the background.

For background code, start the session in auto or bypassPermissions mode. If Claude still waits, check the current mode and how the session started.

If your managed settings set permissions.disableBypassPermissionsMode to "disable", nobody can start in bypassPermissions mode, so start the sessions that need background code in auto mode.

The permission prompt with a countdown

When Claude starts more code in auto mode while earlier code is still running, the earlier code loses its classifier review. Claude Code then asks you about the earlier code's remaining calls that would need a review. With no IDE connected, the prompt shows a countdown:

Claude Code will automatically block this request in 1:59, to avoid holding up an unattended session

Answer before the countdown ends. Otherwise that call is refused, and later calls that would show a countdown are refused without a prompt. To see the prompts again, send Claude a message. Tell the team about this line before the first 2-hour run: a session left alone for the afternoon comes back with refused calls.

Block or allow Code Mode for the organization

To block Code Mode for everyone, add the variable with the value 0, written as a string in JSON, to your managed settings:

{
  "env": {
    "CLAUDE_CODE_EXPERIMENTAL_CODE_MODE": "0"
  }
}

As a file, that is /Library/Application Support/ClaudeCode/managed-settings.json on macOS, /etc/claude-code/managed-settings.json on Linux and WSL, and C:\Program Files\ClaudeCode\managed-settings.json on Windows. Server-managed settings and MDM carry the same keys.

  • Users who are in a Code Mode session stay in it until they exit or restart Claude Code.
  • After that they start without Code Mode and can't resume their Code Mode sessions while the 0 is in place. The line they see is Code Mode (experimental) isn't available, with the reason your organization's settings don't allow it.
  • You can't turn on Code Mode for your users from managed settings. Each person sets CLAUDE_CODE_EXPERIMENTAL_CODE_MODE to 1 in their shell, in ~/.claude/settings.json or in a --settings file, and answers the confirmation screen before the first session. Its two options are No, start without it, the default, and Yes, turn on Code Mode, and it states the auto mode change in these words: "In auto mode, the safety check reads each piece of JavaScript once, before it runs. It doesn't check each tool call that the code then makes, so it can't see values that the code works out as it runs."
  • Claude Code ignores the variable in a project's settings files, so a repository you clone can't turn on Code Mode for you.
  • 0 wins over 1. With a 0 in the shell, the user settings, a --settings file or managed settings, Code Mode stays off whatever is set elsewhere.
  • When managed settings contain a 1, each person sets their own 1 in user settings, because a 1 in the shell is ignored.

What in a team's standard setup stops Code Mode from starting

Code Mode needs Claude Code v2.1.323 or later, the native build, a Claude subscription or Console account, one of Claude Opus 5.5, Sonnet 5.5, Haiku 5.5 or Fable 5.2, and an interactive claude session in a terminal. On Windows it also needs Git for Windows. It doesn't work with -p, the Agent SDK, the VS Code panel, the Desktop app or cloud sessions, and Remote Control, Claude in Chrome and computer use are unavailable in a Code Mode session. An organization that uses the HIPAA configuration or zero data retention can't use it.

When Claude Code starts without Code Mode, Code Mode (experimental) isn't available shows near the top of the session with the reason on the same line, and /status shows it too. These are the reasons a team's shared configuration causes.

With agent teams on v2.1.326 or later, teammates run in Code Mode in the default in-process display mode and start without it in split panes.

A team that exports OpenTelemetry for audit or routes every request through a gateway therefore chooses between that setup and Code Mode today. The REPL hook above gives the audit copy of the code for the people who do turn it on.

What else changes: the CI those sessions start

The Code Mode page names the tasks it is for: a change that repeats across many files, and several independent commands that can run at the same time. Background code runs for up to 2 hours. A session that edits 40 packages, commits each one and pushes as it goes starts your workflows on every push. The session itself isn't a CI job: Code Mode doesn't work with -p. The load is what the terminal session pushes.

Each GitHub-hosted runner has a per-minute rate, and GitHub rounds the minutes each job uses up to the nearest whole minute. More pushes are more jobs, and each one is billed.

Skipbox takes the meter off that load. Your jobs run on a machine Skipbox hosts for your account alone, for a flat $39 a month with unlimited minutes, so a 2-hour background run that pushes 30 times costs the same as one that pushes once.

GitHub's figure is the bill after GitHub Team's included compute.

Docker layers, package caches and build outputs stay on that machine between jobs, so the 30th push of the afternoon skips the reinstall the first one did. Moving is one line:

jobs:
  test:
    runs-on: skipbox # was ubuntu-latest
  1. Sign in to Skipbox with GitHub.
  2. Install the Skipbox GitHub App and pick the repositories.
  3. Change runs-on and push.

The trial takes no card: 7 days or 3,000 job-minutes, whichever comes first. For the numbers behind agent-driven CI, read what AI coding agents do to a GitHub Actions bill, and for shortening the wait on each push, CI for AI coding agents.

Checklist before a team turns on Code Mode

  1. Decide who gets it. If nobody yet, put "CLAUDE_CODE_EXPERIMENTAL_CODE_MODE": "0" in managed settings and stop here.
  2. Check the requirements against the shared setup: v2.1.323 or later (v2.1.326 with agent teams), no gateway or cloud provider, no API key helper, no OpenTelemetry export, no DISABLE_TELEMETRY, no mod that checks tool calls, no REPL in deny rules.
  3. Rewrite every PreToolUse hook that reads shell commands so that it checks each part of a compound command. Run it against cd 'app' && git push.
  4. Give every PreToolUse hook an explicit onFailure and a timeout it finishes inside: "block" for policy, "continue" for logging and notices.
  5. Add a PreToolUse hook on REPL if the team needs a copy of the code or a check on it.
  6. Change every blocking UserPromptSubmit hook to pass input whose source is poll_event.
  7. Keep deny and ask rules for the calls that must be controlled in auto mode, and turn on sandboxing for limits that can't depend on command text.
  8. Tell people how to start a session for background code (--permission-mode auto), that waiting code stops after 10 minutes, and what the countdown prompt does.
  9. Move the workflows those sessions trigger to runs-on: skipbox, so 2-hour runs don't meter CI.
  10. Have each person set CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 in their shell or ~/.claude/settings.json, and keep it set to resume those sessions.

FAQ

Do PreToolUse hooks still run in Claude Code's Code Mode?

Yes. Each tool call in the code goes through your deny and ask permission rules and your PreToolUse hooks under the tool's usual name, such as Bash. For whoever writes the hooks, two things change. A shell command can arrive as a compound command, such as cd 'app' && git push, so the hook has to check each part. And a hook that fails or times out refuses the call, even with onFailure unset.

How do I disable Code Mode for my whole organization?

Add CLAUDE_CODE_EXPERIMENTAL_CODE_MODE with the value 0 to the env block of your managed settings. Users in a Code Mode session stay in it until they exit or restart Claude Code. After that they start without Code Mode and can't resume their Code Mode sessions while the 0 is in place.

Can a repository turn on Code Mode for everyone who clones it?

No. Claude Code ignores CLAUDE_CODE_EXPERIMENTAL_CODE_MODE in a project's settings files. Each person turns it on in their shell, their user settings or a --settings file. Managed settings can't turn it on either.

Why does Claude say the hook failed or the hook did not finish in Code Mode?

A PreToolUse hook didn't give a decision, and in Code Mode that refuses the call. "the hook failed" means that on a call from code the hook couldn't start, was killed, exited with 126, 127 or a code above 128, or returned an HTTP error or invalid output: fix the hook. "the hook did not finish" means the hook timed out: raise its timeout. To let calls go ahead when a command or http hook fails or times out, set "onFailure": "continue" on it.

Does auto mode check every tool call in Code Mode?

No. In auto mode the classifier reviews each piece of code before it runs, not each tool call, and it doesn't see values computed at run time, such as a path taken from search output. Keep deny and ask rules or PreToolUse hooks for the calls you must control.

How long can Code Mode code run?

10 minutes when Claude waits for it, including the time you spend at permission prompts, and up to 2 hours in the background. Background code needs a session started in auto or bypassPermissions mode.

Does Code Mode work with OpenTelemetry, an API gateway, Amazon Bedrock or claude -p?

No. Code Mode needs an interactive claude session in a terminal on a Claude subscription or Console account. It doesn't start with OpenTelemetry export on, with an API key helper, through a gateway or a cloud provider, with -p, in the Agent SDK, in the VS Code panel, in the Desktop app or in cloud sessions.

Does Code Mode raise our GitHub Actions bill?

The sessions do. Code Mode is built for a change that repeats across many files and for several commands at once, and background code runs for up to 2 hours. Every push from that session runs your workflows, and each job on a GitHub-hosted runner is billed at a per-minute rate. On Skipbox the same jobs run for a flat $39 a month with unlimited minutes: change runs-on to skipbox.

What does it cost to try Skipbox?

Nothing. The trial is 7 days or 3,000 job-minutes, whichever comes first, with no card.

Sources

Read on 18 November 2026.

Updated November 19, 2026

Faster CI/CD with an always-warm cache

Your warm runner at a flat price

We host them. You change one line. 1/12 the cost of GitHub at full use. Flat price, so run it all day. 7× GitHub's cache space.

  • No card
  • Sign in with GitHub
  • Cancel anytime