Claude Code settings load order
Managed settings beat --settings, then project local, shared project, then user ~/.claude/settings.json.
Published here · 2 sources · Resume reading
You set "deny" for .env in ~/.claude/settings.json, then a teammate's shared project file silently changes another key and you assume your deny vanished. Claude Code did not merge opinions for scalar keys. It took the value from the highest level that set that key. Learn the stack once [1].
Read the precedence stack
When the same key appears in more than one place, Claude Code uses the value from the highest level that sets it. Highest first [1]:
- Managed settings (
managed-settings.json, MDM, or server-managed settings from the claude.ai console) - Command line
--settings <file-or-json>for that session - Project local settings (
.claude/settings.local.json) - Shared project settings (
.claude/settings.json) - User settings (
~/.claude/settings.json)
Nothing in your own files or --settings overrides a managed key [1]. Environment variables are not a level in this stack; pairs such as ANTHROPIC_MODEL vs the model key are decided per pair [1].
| Scope | File | Who it affects |
|---|---|---|
| User | ~/.claude/settings.json | You, every project on this machine |
| Shared project | .claude/settings.json | Everyone in the folder; commit it for teammates |
| Project local | .claude/settings.local.json | You, this project only |
| Managed | managed sources | Everyone your organization deploys it to |
Claude Code keeps .claude/settings.local.json out of git when it creates the file; if you create it by hand, add it to .gitignore yourself [1].
Know merge vs replace
List keys such as permissions.allow combine across files. Claude Code merges the lists instead of picking one, so each file can add entries without removing another file's [1].
Four model-list style keys follow their own rules [1]:
| Key | Behavior |
|---|---|
fallbackModel | Whole value from the highest-precedence file that defines it |
modelPicker | Whole value from the highest of managed, --settings, and user; ignored in project/local; needs v2.1.242+ |
availableModels | Managed list applies as-is when managed settings define it |
modelSettings | Resolved per model (with effortLevel) |
If your personal allow list seems "ignored", check whether another scope added more allows rather than replacing yours [1].
Deny .env with strict JSON
Settings files are strict JSON: a // comment or a trailing comma is a syntax error, and Claude Code reports a Settings Error at the next start [1]. Example from the settings docs (lint/test allows plus .env denies) [1]:
{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"permissions": {
"allow": ["Bash(npm run lint)", "Bash(npm run test *)"],
"deny": ["Read(./.env)", "Read(./.env.*)"]
}
}Commit shared permissions, hooks and project env needs in .claude/settings.json. Keep personal theme, model preference and standing local allows out of the shared file [1]. For a fuller .env lock walkthrough, see Lock Claude Code out of your .env.
Confirm with /status
Run /status inside Claude Code. The Status tab includes a Setting sources line that lists each settings file loaded for the session (for example User settings or Project local settings). When managed settings apply, that entry shows in parentheses how they reached the machine [1]. The line confirms which files were read; it does not show which file supplied each key [1]. For rejected entries, the docs point at claude doctor [1].
Standing prose instructions are not this JSON stack. Use CLAUDE.md / AGENTS.md (memory docs) or --append-system-prompt. Those files load into context; they are not enforced configuration [1] [2].
Failure checklist
- Key ignored: name the key, list every file that sets it, then walk the stack from managed down [1].
- Tips or flags flipped by the team: shared project sits above user; put your override in
.claude/settings.local.json[1]. - Org policy wins: managed sits on top;
/statusnames the managed source [1]. - One-session surprise: you started with
claude --settings '{...}'; that lasts one session and does not write a file [1]. - Settings Error dialog: fix JSON first; comments and trailing commas break the file [1].
Related: Where each Claude Code instruction belongs, Write an AGENTS.md coding agents actually read, Rewrite AGENTS.md rules with a checklist.
Your next debug step for a "settings ignored" report should be: name the key, list which files set it, then read the stack from the top.
Send this to the teammate who keeps rewriting user settings while a managed policy silently wins.
Keep this guide
Filed under Claude Code
Questions about this guide
What overrides my ~/.claude/settings.json?
Per Claude Code settings docs, higher levels win: managed settings, then --settings on the command line, then .claude/settings.local.json, then .claude/settings.json, then user ~/.claude/settings.json.
Where do team settings go?
Commit .claude/settings.json for shared project settings. Put personal overrides in .claude/settings.local.json so they stay out of the repo.
How do I see what loaded?
Run /status inside Claude Code. The Status tab Setting sources line lists each settings file loaded for the session.
Do permission allow lists replace each other?
No. Per the settings docs, list keys such as permissions.allow combine across files. Each file can add entries without removing another file's. Some model-list keys are exceptions and take the whole value from the highest file.
Are CLAUDE.md files part of this JSON stack?
No. Settings docs say standing instructions go in CLAUDE.md files or --append-system-prompt. Memory docs cover how CLAUDE.md and AGENTS.md load into context separately from settings JSON.
Sources
- Claude Code docs: Settings files and precedencecode.claude.com
- Claude Code docs: How Claude remembers your projectcode.claude.com