skip to content

In Claude Code, when one key is set in several settings files, which value wins, and why do list keys behave differently?

level: middleimportance: must knowfreq 17%

answer

  1. highest level wins
  2. organization on top, you at the bottom
  3. closer file beats broader file
  4. arrays combine instead of replacing
  5. fallbackModel is taken whole

basics

~10 s

Claude Code uses the highest level setting a key: managed, then command line, then .claude/settings.local.json, then .claude/settings.json, then ~/.claude/settings.json. List keys such as permissions.allow merge across files instead.

solid answer

~40 s

The order, highest first, is managed settings, command-line flags including `--settings`, project local `.claude/settings.local.json`, shared project `.claude/settings.json`, and user `~/.claude/settings.json`. A scalar key is taken from the highest level that sets it, so a team's `true` in the shared file beats your `false` in the user file until you restate it in your local file. List keys merge: `permissions.allow` entries from every file all apply. A few model keys are exceptions — `fallbackModel` and `modelPicker` are taken whole, and a managed `availableModels` ignores your entries. Environment variables aren't a level; each variable–key pair has its own rule. And for a few security keys, a stricter value from a lower file beats managed.

code

json · 4 lines
json
{
  "$schema": "https://json.schemastore.org/claude-code-settings.json",
  "spinnerTipsEnabled": false
}

go deeper

for a junior

Recite the order managed, command line, local, project, user, and know that the highest level setting a key wins.

for a middle

Explain scalar override against list merge, why fallbackModel and modelPicker are taken whole, and where environment variables and flags sit outside the stack.

for a senior

Walk through a real conflict end to end, including that a merged allow list can still lose to an ask rule elsewhere and that a few keys honour the stricter lower value.

for a principal

Weigh which keys a team should rely on merging for and which need a managed value, given that any developer can restate a scalar in their local file.

## The five levels When the same key is set in more than one place, Claude Code uses the value from the **highest level** that sets it. Highest first: 1. **Managed settings** — deployed by the organization through a `managed-settings.json` file, an MDM policy or server-managed settings. 2. **Command line** — flags passed when starting `claude` for one session, including JSON passed with `--settings`. 3. **Project local** — `.claude/settings.local.json`, your personal layer for this project. 4. **Shared project** — `.claude/settings.json`, committed for the team. 5. **User** — `~/.claude/settings.json`, your personal default for every project. The order reads as "closer and more specific beats broader", with the organization above everything and the command line above your files for one session. | Level | Who sets it | Lasts | | :- | :- | :- | | Managed | Organization | Until the policy changes | | Command line | You, at launch | One session | | Project local | You | Until you edit it | | Shared project | The team, via a commit | Until the next commit | | User | You | Until you edit it | ## Scalars override A key that holds a single value — a boolean, a string, a number — is decided by the highest level that sets it. Take `spinnerTipsEnabled`, which shows or hides tips under the spinner: - you set `false` in `~/.claude/settings.json`; - the team's `.claude/settings.json` sets `true`; - in that project you see tips, because shared project sits above user. To get your value back without changing it for teammates, put `"spinnerTipsEnabled": false` in `.claude/settings.local.json`; local sits above shared project. If managed settings set it, nothing in your files or `--settings` changes it. `--settings` merges key by key: a key you set there overrides the files for that session, and a key you omit keeps its file value. ## Lists merge **List-valued keys merge across scopes instead of overriding.** If `permissions.allow` holds one rule in your user file and two in the shared project file, the session uses all three. That lets each file add entries without deleting another file's — the team's rules and yours coexist. Four keys holding model lists or per-model entries follow their own rules: - **`fallbackModel`** is an ordered chain where position matters, so the whole value comes from the highest file that defines it. - **`modelPicker`** never merges rows; it is taken whole from the highest of managed, `--settings` and user settings, and ignored in project and local files. - **`availableModels`** set by managed settings applies as-is and ignores entries in your own files; across non-managed scopes it merges as usual. - **`modelSettings`** is resolved one model at a time together with `effortLevel`. Merging also explains a common surprise with permission rules: an `allow` rule saved to your local file doesn't cancel an `ask` rule from the project or managed file, because both lists stay in force and the rules leaf's evaluation order decides between them. ## Where environment variables and flags fit Environment variables are **not a level** in this stack. When a behaviour has both a shell variable and a settings key, the pair decides: `ANTHROPIC_MODEL` exported in your shell applies over the `model` key from any file, while `ANTHROPIC_DEFAULT_MODEL` applies only when no file sets `model`. Some keys also have a dedicated flag, such as `--model`, which overrides both for one session. The `env` block inside a settings file is an ordinary key and follows the five levels. ## Exceptions at the top For a few security-sensitive keys, Claude Code honours a **stricter value from a lower level** over a managed value: | Key | Honoured from any scope | | :- | :- | | `disableClaudeAiConnectors` | `true` | | `isolatePeerMachines` | `true` | | `maxEffortLevel` | a lower cap | These are deliberate: a developer or project can always make a session more restrictive, never less. ## Reasoning about a conflict To predict a value, list every place that sets the key, take the highest, and then ask two questions: is this key a list (merge) or one of the special model keys, and does a paired flag or environment variable override it? Run `/status` to see which files loaded.

  • Your user file allows one command and the trusted project file allows two others. How many allow rules apply?
    All three. `permissions.allow` is a list key, so Claude Code combines the entries from every file instead of letting the higher file replace the lower one. The project's allow rules do wait for the folder to be trusted, and an organization can restrict permission rules to managed ones, but by default each scope adds entries.
  • Why doesn't fallbackModel merge like other lists?
    It is an ordered chain where position carries meaning — the first model is tried first — so merging two chains would produce an order nobody chose. Claude Code takes the whole value from the highest-precedence file that defines it. `modelPicker` likewise never merges rows and is read only from managed, `--settings` and user settings.
  • Is managed settings always the final word?
    Almost. For a few security-sensitive keys Claude Code honours a stricter value from a lower scope: `disableClaudeAiConnectors: true` or `isolatePeerMachines: true` from any file, and a lower `maxEffortLevel` cap. A lower file can make a session stricter, never looser.

Settings precedence works like stacked transparent sheets: wherever a higher sheet has ink on a spot, that ink is what you see, so one scalar value shows. Lists behave like a guest list each host adds names to — every file's entries end up at the party.

  • User settings beat project settings because personal preferences come first
  • A higher file's permissions.allow list replaces the lists in lower files
  • --settings can override a managed value for one session
  • Environment variables form their own level just below the command line
  • Every list key merges across scopes, fallbackModel included