Blog

Claude Code settings and auto mode: what goes in which file

Most advice about Claude Code's settings.json is a list of keys to paste in. The more useful question is which file a key goes in, because that decides who it applies to and, for a few important keys, whether it is honoured at all.

That matters more now than it used to. Since v2.1.283, auto mode is the starting permission mode for interactive terminal and VS Code sessions, on every plan and provider. A classifier reviews actions instead of you, and most of what people used to configure by hand, the long allow list above all, has a different job.

This is the second of three posts on configuring a coding agent. The first, CLAUDE.md and AGENTS.md: the dos and don'ts, covers the instruction files.

Everything here is checked against the Claude Code docs as they stood at the start of December 2026. This area changes quickly, so treat version numbers as a snapshot.

Four files, one order

Settings live in up to four places:

  • User, ~/.claude/settings.json: yours, on every project.
  • Project, .claude/settings.json: committed, shared with everyone who clones the repository.
  • Local, .claude/settings.local.json: yours, in this one project, not committed.
  • Managed: deployed by an organization, and not overridable.

When they disagree, the order is managed, then JSON passed with --settings when you start claude, then local, then project, then user. Lists are the exception: they merge. An allow rule in your user file and another in the project file both apply.

Two practical points before any keys. The files are strict JSON, so a // comment or a trailing comma is a syntax error. An interactive session flags a broken file as a Settings Error at startup and offers to carry on without it; a -p run just skips it. Adding the schema line gets you validation and completion in any editor that supports JSON schema, which catches that before Claude Code does:

{
  "$schema": "https://json.schemastore.org/claude-code-settings.json"
}

Some keys only count in your own file

This is the part that saves the most confusion. A project file is something a repository hands to you, so Claude Code refuses to let it grant itself trust:

  • permissions.defaultMode set to "auto" or "bypassPermissions" has no effect from the project or local file. Set it in ~/.claude/settings.json.
  • The whole autoMode block is ignored in project and local files. The docs give the reason plainly: both files live in the repository directory, so a checked-in repo or a build step could otherwise inject its own allow rules.

Committed allow rules get a softer version of the same treatment: they apply only after each person accepts the workspace trust dialog for the folder, while deny and ask rules apply straight away.

So if a setting appears to do nothing, check which file it is in before you check anything else.

The split I'd use:

  • Project file: what is true for anyone working on this codebase. Allow rules for its own test and lint commands, deny rules, hooks the team relies on.
  • User file: taste and trust. The starting mode, the autoMode block, the model, attribution.
  • Local file: experiments, and anything specific to one machine.

A user file to start from

{
  "$schema": "https://json.schemastore.org/claude-code-settings.json",
  "permissions": {
    "defaultMode": "auto"
  },
  "attribution": {
    "commit": "",
    "pr": "",
    "sessionUrl": false
  },
  "cleanupPeriodDays": 90
}

defaultMode is only needed if you want something other than the built-in default, or want to pin it against that default changing. The desktop app reads the same files and adds a mode selector under the prompt box. A mode you pick there is remembered per folder, but a new session can still start in the defaultMode from your user file, so check the selector before your first message.

attribution controls the Co-Authored-By trailer on commits, the line added to pull request descriptions, and the session link. Empty strings and "sessionUrl": false hide them. The older includeCoAuthoredBy key has been deprecated since v2.0.62. It is still read, which is why it lingers: my own user file had it when I checked for this post. There is a trap in the replacement, too. "attribution": false is the short way to hide everything, but it needs v2.1.281 or later, and an earlier version rejects the value and skips the entire settings file. If more than one version reads the file, use the longer form above.

cleanupPeriodDays is how long session transcripts and other application data are kept before a background sweep deletes them. The default is 30. If you go back to old sessions to see why something was done, raise it.

What I'd leave out is as useful as what goes in. model and effortLevel are better left unset unless you have a reason. Unset, Claude Code uses your account's default model, and a pinned value quietly keeps you on last quarter's choice.

A project file, and what allow rules are for now

Permission rules come in three lists, checked in a fixed order: deny, then ask, then allow. The first match wins, and a more specific rule does not beat a broader one in an earlier list.

For a Symfony project that runs in Docker, as this site does, a project file might be:

{
  "permissions": {
    "allow": [
      "Bash(docker compose exec php vendor/bin/phpunit *)",
      "Bash(docker compose exec php vendor/bin/phpstan *)"
    ]
  }
}

Each rule names the command inside Docker too. A rule that stops at the runner approves whatever comes after it.

In manual mode, the allow list is how you stop being asked about the same command forty times a day. In auto mode its job is narrower. Reads and edits inside the working directory already run without a prompt, and everything else goes to the classifier, so an allow rule now means "skip the classifier for this". That is worth having for the handful of commands you run constantly, and not much else.

Two things follow. Keep the rules narrow, because broad ones are dropped the moment a session enters auto mode: Bash(*) and PowerShell(*), wildcarded interpreters such as Bash(python*), package-manager run commands and Agent allow rules all go, and come back when you leave. And remember that a rule which skips the classifier skips it for everything the pattern matches, including an argument you didn't anticipate. If that worries you, autoMode.classifyAllShell suspends your Bash and PowerShell allow rules while auto mode is active, at the cost of a wait on every shell command.

How auto mode decides

Each action goes through the same steps, and the first one that applies wins:

  1. Your own deny, ask and allow rules, with a few exceptions such as writes to protected paths.
  2. Read-only actions and file edits in the working directory, which are approved.
  3. Everything else goes to the classifier.

The classifier is a second model. The docs list what it is given: your messages, your CLAUDE.md, and the tool calls Claude is about to make, apart from read-only lookups. The contents of files and web pages are not on that list, so text in them that tells the agent to do something has no direct way to argue its case to the reviewer. A separate server-side check also scans incoming tool results and flags suspicious content before Claude reads it. Some sessions now get a server-side review in place of Claude Code's own classifier requests, and there file edits wait for the review too.

Out of the box it blocks, among a long list: downloading and executing code, sending sensitive data to external endpoints, production deploys and migrations, force pushes, git reset --hard and the other commands that discard uncommitted work, irreversibly destroying files that existed before the session, and merging a pull request no human has approved.

It allows local file operations, installing dependencies your manifests already declare, read-only HTTP requests, and one that surprises people: pushing to any branch of the repository you're working in, including the default branch. The exception is a non-default branch whose name marks it as a deploy target, such as production or gh-pages.

Putting a checkpoint back

If you want to see pushes and pull requests before they happen, the docs' recipe is two ask rules, which are evaluated before the classifier:

{
  "permissions": {
    "ask": ["Bash(git push *)", "Bash(gh pr create *)"]
  }
}

They match commands that begin with git push or gh pr create, so a push written as git -C <dir> push slips past them. A hook that reads the full command closes that gap.

You can also just say it. "Don't push until I've reviewed" in the conversation is treated as a boundary, and the classifier blocks matching actions until you lift it. The catch is that boundaries are re-read from the transcript rather than stored, so one can be lost when a long session is compacted. Three places last longer:

  • CLAUDE.md, which the classifier reads alongside Claude.
  • An ask rule, for "show me first".
  • A deny rule, for "never".

Approvals work the same way in reverse, and wording matters. "You can force-push" may not clear a block. Naming the branch does.

Telling it what you trust

By default the classifier trusts the working directory and the current repository's configured remotes. Everything else is external. For a solo developer that default is usually right. For a team, the autoMode.environment list in your user or managed settings is where you describe the rest, in prose:

{
  "autoMode": {
    "environment": [
      "$defaults",
      "Source control: github.example.com/acme-corp and all repos under it",
      "Trusted internal domains: *.corp.example.com"
    ]
  }
}

Keep the literal "$defaults" entry, or you replace the built-in list instead of adding to it. claude auto-mode defaults prints the built-in rules, and claude auto-mode config prints what you have ended up with.

When it says no

A blocked action is not the end of the task. Claude is told the reason, usually the name of the rule it matched. In the terminal the block also appears under Recently blocked in /permissions, where you can approve it for a retry. The desktop app has no such tab; there, name the action and its specifics in your next message.

If the classifier blocks three actions in a row, or twenty in a session, auto mode pauses and you are back to ordinary prompts until you approve one. Those numbers aren't configurable. Hitting them repeatedly usually means the classifier is missing context about your setup, which is what the environment list is for.

What it isn't

The docs are direct about this: auto mode reduces prompts and does not guarantee safety, and it is not a replacement for review on sensitive operations. Two limits are worth holding on to.

It is not a sandbox. The built-in Bash sandbox runs on macOS, Linux and WSL2. On native Windows, which is where I work, commands run unsandboxed, so the classifier's judgement and your own rules are most of the protection.

And it is a judgement. A classifier deciding whether an action fits the request is the right tool for the thousand small decisions in a working day. It is the wrong tool to rely on alone for the few actions that can't be taken back. Those want rules that don't depend on anyone's reading of the situation, which is the subject of the next post: the deny list, and hooks.

Sources

All from the Claude Code documentation, read on 1 December 2026:

  • Settings files and precedence: the files, precedence, merging lists and broken files.
  • Settings reference: attribution, includeCoAuthoredBy, cleanupPeriodDays, permissions.defaultMode and autoMode.classifyAllShell.
  • Configure permissions: rule order, wrappers and workspace trust.
  • Permission modes: the starting mode, how auto mode decides, what the classifier is given, the tool-result check, its defaults, dropped rules, fallback thresholds, and boundaries and approvals.
  • Configure auto mode: the autoMode block, checkpoints and the inspection commands.
  • Sandboxing: platform support.

Deciding what an AI agent may do without asking, and blocking the actions that could send data out, is part of the work I do on AI and LLM integration.