Configure auto mode changedauto-mode-config
Nearest release: v2.1.240, published 3 hours before this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
Recorded here
Lines+55added
Lines−1removed
From line
17
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits26to this page, all time
### Review and save the draft
The whole hunk
from line 17, old and new numbered
/
from line 17
1717* [Add a human checkpoint](#add-a-human-checkpoint) for pushes and pull requests with `permissions.ask`
1818* [Choose where to set rules](#where-the-classifier-reads-configuration) across CLAUDE.md, user settings, and managed settings
1919* [Define trusted infrastructure](#define-trusted-infrastructure) with `autoMode.environment`
20* [Generate environment entries](#generate-environment-entries) with `/auto-mode-setup`
2021* [Override the block and allow rules](#override-the-block-and-allow-rules) when the defaults don't fit your pipeline
2122* [Route all shell commands through the classifier](#route-all-shell-commands-through-the-classifier) with `autoMode.classifyAllShell`
2223* [Inspect your effective config](#inspect-the-defaults-and-your-effective-config) with the `claude auto-mode` subcommands
from line 155
154155
155156You don't need to fill everything in at once. A reasonable rollout: start with the defaults and add your source control org and key internal services, which resolves the most common false positives like pushing to your own repos. Add trusted domains and cloud buckets next. Fill the rest as blocks come up.
156157
158<h2 id="generate-environment-entries">
159 Generate environment entries with `/auto-mode-setup`
160</h2>
161
162Run `/auto-mode-setup` to have Claude Code draft `autoMode.environment` entries, and sometimes [rule entries](#override-the-block-and-allow-rules) too, from your project and your recent sessions in it. If you accept the draft, Claude Code writes it to `~/.claude/settings.json`.
163
164<Note>
165 `/auto-mode-setup` requires a Pro, Max, or Team plan and Claude Code v2.1.228 or later. On native Windows it requires v2.1.233 or later. You can't run it in [Claude Code on the web](/docs/en/claude-code-on-the-web). It also needs [feature-flag fetching](/docs/en/env-vars#features-that-need-feature-flag-fetching), so you can't run it in a session where you've turned flag fetching off.
166</Note>
167
168<h3 id="what-auto-mode-setup-reads">
169 What `/auto-mode-setup` reads
170</h3>
171
172If `~/.claude/settings.json` already holds `autoMode` entries, Claude Code starts by asking whether to add to your environment list or replace it, and keeps the rules you wrote either way. Claude Code then asks how you use this project and offers two optional scans before it scans anything. In the scan, Claude Code always reads these sources:
173
174* This project's `CLAUDE.md`, `README.md`, config files, and git remotes
175* Your `autoMode` and `permissions.allow` settings
176* The hosts, buckets, and command names from the commands Claude ran in your recent sessions in this project, never your messages
177
178The two optional scans add one source each:
179
180* The first word of each command in your shell history
181* The remote hosts and names of the repositories under your home directory
182
183### Review and save the draft
184
185Claude Code scans in the background, then shows you the draft. You accept or discard it as a whole, so edit `~/.claude/settings.json` afterwards to adjust single entries. When you accept, Claude Code writes the draft and reconciles it with the settings you already have:
186
187* Claude Code writes the `environment` list without `"$defaults"`, because the draft spells out the built-in entries it left unchanged
188* Claude Code includes `"$defaults"` in each of the `allow`, `soft_deny`, and `hard_deny` lists the draft adds entries to, unless you already wrote an `allow` list without it, so the [built-in rules](#override-the-block-and-allow-rules) you haven't replaced stay in effect
189* After saving, Claude Code offers to remove `permissions.allow` rules in `~/.claude/settings.json` that auto mode ignores, such as `Bash(*)`, or that auto-approve destructive commands
190
191Then run `claude auto-mode config` to [see the effective result](#inspect-the-defaults-and-your-effective-config).
192
193<h3 id="turn-off-auto-mode-setup">
194 Turn off `/auto-mode-setup`
195</h3>
196
197Once auto mode has blocked several actions and you still have no `autoMode.environment` entries, Claude Code shows a dialog titled "Teach auto mode about your environment?" at the end of a turn and offers to run `/auto-mode-setup` for you. To stop the offer but keep the command, select **Don't show again** in that dialog.
198
199To turn off both the command and the offer, add this [`skillOverrides`](/docs/en/skills#override-skill-visibility-from-settings) entry to `~/.claude/settings.json`:
200
201```json theme={null}
202{
203 "skillOverrides": {
204 "auto-mode-setup": "off"
205 }
206}
207```
208
209`/auto-mode-setup` is a built-in command rather than a [bundled skill](/docs/en/skills#bundled-skills), so this `skillOverrides` entry still applies to it, but [`disableBundledSkills`](/docs/en/settings-reference#disablebundledskills) doesn't turn it off.
210
157211## Override the block and allow rules
158212
159213Three additional fields let you replace the classifier's built-in rule lists:
from line 365
311365
312366### Fix repeated denials
313367
314Repeated denials for the same destination usually mean the classifier is missing context. Add that destination to `autoMode.environment`, then run `claude auto-mode config` to confirm it took effect.
368Repeated denials for the same destination usually mean the classifier is missing context. Add that destination to `autoMode.environment`, or [run `/auto-mode-setup`](#generate-environment-entries) to have Claude Code draft the entries, then run `claude auto-mode config` to confirm the change took effect.
315369
316370To react to denials programmatically, use the [`PermissionDenied` hook](/docs/en/hooks#permissiondenied).
317371
No line in this hunk matches that.