Skip to content

All posts

AI

Claude Code settings precedence: which setting wins

Ritesh Patel

AI: Claude Code settings precedence: which setting wins

Claude Code uses the value from the highest level that sets a key. From highest to lowest, the levels are managed settings, the command line, project local, shared project and user. A key set at a higher level overrides the same key lower down. List keys such as permissions.allow are the exception: they combine across files.

Checked against the Claude Code settings docs on code.claude.com as of 2026-11-22. The settings page names no CLI version for the precedence order, so the steps below describe the docs as published that day.

The five levels and the files behind them

The settings page gives the order in one line: “Settings precedence, highest first: managed settings, command line, project local, shared project, user.” The table maps each level to its file and to the people it reaches. The command line has no file. It is the --settings value for one session.

Precedence Level Where it lives Who it affects
1, highest Managed managed-settings.json, an MDM policy, or server-managed settings Everyone your organization deploys it to
2 Command line --settings <file-or-json> That session only
3 Project local .claude/settings.local.json You, in this project only
4 Shared project .claude/settings.json Everyone working in the folder that contains it
5, lowest User ~/.claude/settings.json You, in every project on this machine

The page also names the scope of each file in its settings index. In that index, User means ~/.claude/settings.json, Project means .claude/settings.json, Local means .claude/settings.local.json, and Managed means what your organization deploys. A key marked Any file can be set in any of the four.

How a single key resolves

The settings page uses spinnerTipsEnabled as its worked example. Suppose your user file sets it to false, and the team’s shared project file sets it to true. In that project, Claude Code uses true, because the shared project level sits above the user level. Your other projects still use false.

To get your value back in that one project, add the key to .claude/settings.local.json. Project local sits above shared project, so your sessions there change and your teammates’ sessions do not.

A session can also change a value without saving it. The page gives this example for one session on a different model:

claude --settings '{"model": "claude-opus-5-5"}'

The command line sits above your files and below managed settings. The page says “Nothing in your own settings files or --settings overrides a managed key.” So a --settings value cannot change a key that your organization manages.

Lists merge instead of overriding

A key that holds a list does not follow the single-value rule. The page says that when you set the same list key in more than one file, “Claude Code combines the lists instead of picking one,” so each file can add entries without removing another file’s. The page’s example is permissions.allow.

Four keys follow their own rules. The table shows the behaviour for each type.

Key type Example Result across levels
Single value spinnerTipsEnabled, model The highest level that sets the key wins
List permissions.allow Lists from the non-managed files combine
Ordered chain fallbackModel The whole value comes from the highest file that defines it
Managed model list availableModels When managed settings define the list, it applies as written, and entries in user, project and local files are ignored

The managed model list is the one case where a list stops merging. If your policy restricts which models developers can pick, a developer’s own availableModels entries cannot widen it.

Permission rules add a second order

Permission rules follow the settings stack above, and then apply their own order. The permissions page says “Rules are evaluated in order: deny, then ask, then allow. The first match in that order determines the outcome, and rule specificity doesn’t change the order.”

Rule Effect Checked
deny Blocks the tool call First
ask Prompts for confirmation Second
allow Runs without a prompt Third

Across files, a deny from any scope is checked before an allow from any scope. The permissions page gives two cases: if user settings allow a permission and project settings deny it, the deny blocks it. A user-level deny also blocks a project-level allow. A managed deny cannot be overridden by --allowedTools.

For a deny rule applied in practice, the destructive commands post shows where a Bash deny rule stops and where it does not.

Deny rules can name a tool or a pattern. The example below comes from the settings page, and it blocks reads of the environment files at the project root.

{
  "permissions": {
    "deny": [
      "Read(./.env)",
      "Read(./.env.*)"
    ]
  }
}

Gotchas that change the answer

  • Environment variables are not a level. The page says so directly: “Environment variables aren’t a level in this stack.” A variable such as ANTHROPIC_MODEL applies over the model key in any file, and --model overrides both for one session. Check the variable when a key looks ignored.
  • Trust gates project allow rules. permissions.allow in a project’s .claude/settings.json applies only after each teammate accepts the workspace trust dialog. Deny and ask rules apply at once. The auto-updates post shows the same split for a team’s shared file.
  • Saved approvals stay local. Choosing “Yes, and don’t ask again” writes an allow rule to .claude/settings.local.json. That rule does not outrank an ask rule from a project or managed file.
  • Some keys ignore project files. The permissions.defaultMode values auto and bypassPermissions do not take effect from project or local settings. Set them in user or managed settings, or pass --permission-mode for one session.
  • A few security keys break the top-down rule. A true for disableClaudeAiConnectors in any scope stays on even when a managed source sets false. The page lists the others in its exceptions table.
  • A broken file is skipped. Settings files are strict JSON, so a // comment or a trailing comma is an error. In an interactive session Claude Code shows a Settings Error. In a -p run it skips the broken user, project or local file and continues.

Check which value won

Use this order when a key does not behave as you expect.

  1. Run /status inside Claude Code. The Setting sources line lists each settings file that loaded for the session.
  2. Find the key in the settings reference and read its Scope column, which says which files can set it.
  3. Check whether a managed source sets the key. If one does, nothing below it overrides it, apart from the security keys listed in the exceptions, and /status names the managed source.
  4. For a permission, check deny rules first, then ask, then allow, across every scope.
  5. Check for an environment variable that sets the same behaviour, such as ANTHROPIC_MODEL for model.
  6. Run claude doctor to see which entries Claude Code rejected or dropped.

Step 1 has a limit. The page says the Setting sources line “confirms which files Claude Code read; it doesn’t show which file supplied each key.” Steps 2 and 3 are the way to find the file behind a value.

Where managed settings fit

Managed settings are the top level, so they are the one place a policy can stop a developer’s own files from changing a key. The mechanics of deploying them, including the system directory for each operating system and the MDM and server-managed options, are covered in the managed settings guide for enterprises. This post does not repeat them.

Use the precedence order here to decide which level a setting belongs in. Use the managed settings guide to get that level onto each machine.

Enforcing this with AIControls

The precedence order is set by Claude Code itself. To hold a policy on developer machines, put the key in the managed level, as the managed settings guide describes. AIControls covers Claude Code through the gateway, in the CLI and in VS Code, with per-user tokens and per-user and per-session cost and budget limits. Start with the governance for AI coding agents page, and see the AIControls download page for the product.

Frequently asked questions

If my project file and my user file set the same key, which value does Claude Code use?

The project value. The shared project file sits above the user file, and Claude Code uses the value from the highest level that sets the key. Your user file still applies in every other project on the machine. To keep a personal value in one project only, set the key in .claude/settings.local.json inside that project, because the project local level sits above the shared project file.

Can a --settings flag override a managed setting?

No. Managed settings sit above the command line, so nothing passed with --settings overrides a managed key. A --settings value can change keys that your user, project and local files set, but only for that one session. It writes to no file, so the next session goes back to the values saved in your files.

Why does Claude Code still ask me to approve a command I allowed?

Claude Code checks deny rules first, then ask rules, then allow rules, and the first match decides. If you chose Yes, and don't ask again, the allow rule went into .claude/settings.local.json, and that allow does not outrank an ask rule from a project or managed file. Open /permissions to see which settings file each rule came from.

Why don't the allow rules in our shared project file apply on my machine yet?

Project allow rules wait for trust. Claude Code applies permissions.allow entries from a project's .claude/settings.json only after you accept the workspace trust dialog for that folder. Deny and ask rules apply right away, because they only restrict. Accept the dialog, then run /status to confirm the shared project file loaded.

Does /status show which file set each value?

No. The Setting sources line confirms which settings files Claude Code loaded for the session. It does not show which file supplied each key. For a model set by a project or managed file, the startup header names the file. To list entries Claude Code rejected, run claude doctor from your terminal.

Ritesh Patel, Founder & VP Product, Nirmata

Ritesh Patel is a founder of Nirmata and leads its products. He writes about governing AI coding agents, MCP security and Kubernetes policy as code.

LinkedIn

Govern AI agents with AIControlsControl what AI agents do, and prove it.
Share

Stay up-to-date with the latest in AI, governance, and infrastructure

Subscribe to our free monthly newsletter to get industry news, DevOps tips, and articles right to your inbox on Kyverno, containerization, Kubernetes deployment & management and more.