All posts
Claude Code

Setting up Claude Code auto mode: fewer prompts, real guardrails

Claude Code auto mode swaps most permission prompts for a background safety check. How it decides, how to set it up, and which guardrails to add yourself.

11 min read

Permission prompts protect you only while you still read them. After the twentieth "Allow this command?" of the afternoon, most people either start approving without looking or reach for --dangerously-skip-permissions. Neither is a safety model.

Claude Code's auto mode is the middle path. Claude works without stopping to ask, and a separate classifier model checks each risky action in the background before it runs. Routine work flows; force-pushes, production deploys and data leaving your machine get stopped.

There is one catch: out of the box, auto mode trusts almost nothing beyond the repository you're working in. Your company's GitHub org, your internal APIs and your staging bucket all look "external" to it. Setting it up properly mostly means telling it about your world. This post walks through exactly that.

First, check whether you're already using it

You might be. From Claude Code v2.1.283, auto mode is the starting permission mode for interactive sessions in the terminal and in VS Code, on every plan and provider. Look at the status bar under the prompt: if it says ⏵⏵ auto mode on, you're in it.

claude --version   # 2.1.283 or later starts in auto mode
claude update      # if you're behind

If you're on a recent version, haven't set a different default, and the status bar still says ⏸ manual mode on, your session isn't eligible, and Claude Code quietly fell back to manual prompting. The usual reasons:

  • The model. On the Anthropic API you need Opus 4.6 or later, Sonnet 4.6 or later, Haiku 5.5, or a Fable model. On Amazon Bedrock, Microsoft Foundry and Google Cloud's Agent Platform you need Sonnet 5 or later, Opus 4.7 or later, Haiku 5.5, or Fable. The 4.5-generation models aren't supported anywhere.
  • Your organization turned it off. Team and Enterprise get auto mode by default, but an admin can disable it in managed settings.
  • You're running non-interactively. claude -p and the Agent SDK start in manual mode unless you ask for auto (more on that below).

How auto mode decides

Before you configure anything, it helps to know the order of checks. For each action Claude wants to take, the first step that matches wins:

  1. Your permission rules. Allow, ask and deny rules from your settings are applied first. A deny rule blocks the action in every mode.
  2. Safe local work. Reading files and editing files in your working directory are approved without a check, apart from a few protected paths.
  3. The classifier. Everything else (shell commands, network calls, anything outside the project) goes to the classifier.
  4. A block. If the classifier blocks the action, it doesn't run. Claude is told why, so it can try a different approach.

Two details are easy to miss. First, when you enter auto mode, Claude Code sets aside broad allow rules such as Bash(*) or Bash(python*), because they would let anything skip the classifier. Narrow rules like Bash(npm test) keep working, and the broad ones come back when you leave auto mode. Second, the classifier sees your messages, Claude's tool calls and your CLAUDE.md, but tool results are stripped out. Text from a web page or a file Claude reads never reaches the classifier, so instructions hidden in that content can't talk it into approving something.

What's blocked by default

The built-in rules come in three groups. You can print every one of them with claude auto-mode defaults. On version 2.1.330 that's 16 allow rules, 72 soft-deny rules, and a single hard-deny rule.

Group What it means Examples
Allow Fine without asking Local file operations in the project, installing packages already declared in your manifest, read-only HTTP requests, using a key from .env with the API it belongs to
Soft deny Blocked unless you explicitly asked for it Force-pushing, production deploys and migrations, running code downloaded from the internet, mass-deleting cloud storage, granting permissions, disabling CI checks or TLS verification, printing live credentials
Hard deny Blocked even if you ask Data exfiltration: sensitive data leaving the boundary of what you've declared trusted

Worth knowing: pushing to any branch of the repository you're working in, including main, is allowed by default. Branches named for deployment, such as production or gh-pages, are excluded. If you want a human checkpoint before every push, add it yourself (step 3).

"Explicitly asked" has a precise meaning. A general request like "clean up the branch" does not count as asking for a force-push. "Force-push my rebased feature/login branch to origin" does. To clear a soft block, name the action and its target.

Step 1: Start in auto mode, and make it stick

For a single session:

claude --permission-mode auto

During a session, Shift+Tab cycles through the modes. When a shell command prompts you in manual mode, you can also pick "Yes, and switch to auto mode" right from the prompt.

To make auto your default, set it in your user settings file, ~/.claude/settings.json:

{
  "permissions": {
    "defaultMode": "auto"
  }
}

This is the most common setup mistake: putting that same block in a project's .claude/settings.json or .claude/settings.local.json does nothing. Claude Code deliberately ignores auto (and bypassPermissions) in project files. Those files live inside the repository, so if they could switch on auto mode, anyone able to commit to a repo could quietly turn off your prompts.

In VS Code, the extension reads its starting mode from the claudeCode.initialPermissionMode setting, which doesn't accept auto. Leave it unset and pick Auto once from the mode indicator under the prompt box; the extension remembers your last choice.

Step 2: Teach it your environment with /auto-mode-setup

By default the classifier trusts only your working directory and the current repository's remotes. That is the right default for a stranger's machine, and the cause of most false positives on yours. Cloning a sibling repo from your own org, calling your company's internal API, or uploading to your team's artifact bucket all look like data heading somewhere unknown.

Run the setup command inside a Claude Code session:

/auto-mode-setup

It drafts environment entries from your project and your recent sessions, such as your source-control org, internal domains, cloud buckets and key services. It shows you the draft and writes it to ~/.claude/settings.json only if you accept.

Read the draft before you accept it. Every entry is a statement of trust: the classifier will treat that destination as inside your boundary. The result looks like this:

{
  "autoMode": {
    "environment": [
      "$defaults",
      "Source control: github.com/your-org and all repos under it",
      "Trusted internal domains: *.internal.example.com",
      "Trusted cloud buckets: s3://your-team-build-artifacts",
      "Key internal services: CI at ci.example.com"
    ]
  }
}

Two things to notice. The entries are plain English, not patterns: the classifier reads them as context. And "$defaults" is a literal string that keeps the built-in entries in place. Leave it out and your list replaces the defaults instead of adding to them.

Prefer to do it by hand? Run /permissions and open the Auto mode tab (the desktop app doesn't have this tab), or edit the JSON yourself. Either way, confirm what's actually in effect:

claude auto-mode config

If /auto-mode-setup isn't available to you, update Claude Code first. On versions before 2.1.304 it also didn't work with telemetry turned off or on a third-party provider.

Step 3: Add the checkpoints the classifier won't add for you

The classifier judges each action in context, which is what makes it flexible. For boundaries that must hold every time, use ordinary permission rules, which it never overrides:

{
  "permissions": {
    "ask": [
      "Bash(git push *)",
      "Bash(gh pr create *)"
    ],
    "deny": [
      "Bash(npm publish *)"
    ]
  }
}
  • ask still prompts you in auto mode. Use it for moments you always want to see, like a push or opening a pull request.
  • deny blocks the action before the classifier is even consulted.

You can also say "don't touch the database" in chat, and the classifier will take it into account, but only while that message is still in the context. Long sessions get compacted, and an instruction given in chat can be summarised away. Anything that matters belongs in a rule.

Step 4: Tune the rules, only when you need to

Start with the defaults plus your environment. Most people never need more. When a pattern does keep coming up, autoMode has four lists:

List Use it for Can a request override it?
environment Describing infrastructure you trust Not applicable
allow Exceptions to soft blocks you hit routinely Not applicable
soft_deny Extra actions that need an explicit request Yes, an explicit, specific request
hard_deny Actions that must never happen No
{
  "autoMode": {
    "allow": [
      "$defaults",
      "Deploying to the staging namespace is allowed: staging is isolated from production and resets nightly"
    ],
    "soft_deny": [
      "$defaults",
      "Never run database migrations outside the migrations CLI, even against dev databases"
    ],
    "hard_deny": [
      "$defaults",
      "Never send repository contents to third-party code-review APIs"
    ]
  }
}

A good rule says why. "Staging resets nightly" gives the classifier something to reason with; "staging is fine" doesn't. Once you've written a few, ask for a second opinion:

claude auto-mode critique

If you want every shell command reviewed, even ones your allow rules would normally approve, set "classifyAllShell": true inside autoMode.

Where these rules live matters as much as what they say. The classifier reads autoMode only from your user settings (~/.claude/settings.json), managed settings, or a --settings flag. It ignores autoMode in a project's .claude/ folder, for the same reason as before: a repository shouldn't be able to grant itself trust. Project conventions such as "migrations run through make migrate" belong in CLAUDE.md, which the classifier does read. If you change your mind, claude auto-mode reset removes your autoMode section and puts the defaults back.

When something gets blocked

A block shows up as a notification like this:

bash blocked by auto mode · /permissions · Auto mode: [Data Exfiltration]

The name in brackets is the rule that fired. To read its full wording:

claude auto-mode defaults --label 'Data Exfiltration'

Then pick the fix that matches the cause:

  • It was a one-off and it's fine. Open /permissions, go to the Recently blocked tab and press r. Claude retries the action. This approves that single action and doesn't add a rule.
  • The same destination keeps getting blocked. The classifier is missing context. Add the destination to autoMode.environment (step 2) and check it with claude auto-mode config.
  • You do this kind of thing all the time. Add an allow entry with a reason (step 4).
  • The classifier was simply wrong. Report it with /feedback.

There's also a circuit breaker. If the classifier blocks 3 actions in a row or 20 in total, auto mode pauses and Claude Code goes back to prompting you. Approving the next prompted action turns auto mode back on. These limits can't be changed, and that's deliberate: a run of blocks usually means the task and the guardrails disagree, and a human should look.

To see exactly what the classifier was asked, write a debug log:

claude --permission-mode auto --debug-file classifier-debug.log

Then search the log for classifier_request_started. The model= value shows which model made the call.

Auto mode in scripts and CI

Non-interactive runs don't start in auto mode; ask for it explicitly:

claude -p "Run the test suite and fix any failures" --permission-mode auto

In a headless run, a blocked action simply doesn't run, and Claude carries on with the rest of the task instead of stopping. That's usually what you want in CI, but check the output for blocked steps rather than assuming everything ran.

Two costs to plan for. Each classifier check adds a round-trip before the action runs. And on Enterprise, API, Bedrock, Foundry and similar accounts, classifier calls count toward your token usage.

What auto mode is not

The official documentation is blunt about this, and it's worth repeating:

Auto mode reduces permission prompts but does not guarantee safety. Use it for tasks where you trust the general direction, not as a replacement for review on sensitive operations.

  • It isn't a sandbox. The classifier is a judgment call made by a model, not an operating-system boundary. For untrusted code or long unattended runs, run Claude Code in a container or with sandboxing enabled as well.
  • It isn't bypassPermissions. Bypass skips every check and is meant only for isolated containers and VMs without internet access. Auto mode keeps checking; bypass doesn't.
  • It can be switched off. Admins can disable it for a whole organization by setting permissions.disableAutoMode to "disable" in managed settings. Running sessions leave auto mode when the setting arrives.

The five-minute version

  1. Run claude --version and update if you're below 2.1.283.
  2. Set "defaultMode": "auto" in ~/.claude/settings.json, not in the project.
  3. Run /auto-mode-setup, read every proposed entry, and keep only what you genuinely trust.
  4. Add permissions.ask for pushes and PRs, and permissions.deny for anything that must never happen.
  5. When something gets blocked, read the rule label before you approve, and fix repeated blocks in environment rather than approving them one at a time.

Checked against Claude Code 2.1.330 and the official documentation on 24 November 2026. Auto mode changes quickly, so the docs are the source of truth: Choose a permission mode and Configure auto mode.