Claude Code settings.json explained: every file, every key that matters
Where Claude Code's settings.json files live, which one wins, and the keys you actually use (permissions, env, hooks, model, statusLine), with JSON you can copy and the mistakes that break them.
Claude Code reads its configuration from a stack of settings.json files: one for you, one for the project, one for you in that project, and one your organization may deploy. They merge, and a fixed order decides which value wins when two files disagree. This guide covers the files, that order, the keys most people need and the mistakes that make a setting silently do nothing.
Everything below comes from Anthropic's settings, settings reference and permissions pages, as of December 3, 2026. Claude Code changes often, so check those pages before relying on a detail.
#Which settings.json files does Claude Code read?
Four places, each with its own audience:
| Scope | File | Who it applies to |
|---|---|---|
| User | ~/.claude/settings.json | You, in every project on this machine |
| Shared project | .claude/settings.json | Everyone working in that folder; commit it so teammates get it |
| Project local | .claude/settings.local.json | You, in this one project only |
| Managed | managed-settings.json (and other managed sources) | Everyone your organization deploys it to |
Managed settings live in a system folder that users don't normally edit:
- macOS:
/Library/Application Support/ClaudeCode/managed-settings.json - Linux and WSL:
/etc/claude-code/managed-settings.json - Windows:
C:\Program Files\ClaudeCode\managed-settings.json
A managed-settings.d/ folder next to it is merged after the base file, in alphabetical order (10-telemetry.json, 20-security.json). Organizations can also push the same settings through MDM on macOS (domain com.anthropic.claudecode) or the Windows registry.
On Windows, ~/.claude means %USERPROFILE%\.claude. Setting CLAUDE_CONFIG_DIR moves the whole user folder somewhere else, which is how people run several Claude accounts.
One file that is easy to confuse with these: ~/.claude.json, in your home folder, not inside ~/.claude. By the docs, it "holds your account details, MCP server configurations, per-project state such as trust decisions, and the global config keys". You rarely edit it by hand.
#Which file wins?
From highest to lowest priority:
- Managed settings. Nothing overrides them.
- Command line.
claude --settings <file-or-json>applies to that one session. - Project local.
.claude/settings.local.json - Shared project.
.claude/settings.json - User.
~/.claude/settings.json
Two details change how that order plays out:
- Lists merge. When several files set the same list, such as
permissions.allow, Claude Code combines them instead of picking one. Each file adds entries without removing another file's. The docs name a few exceptions that don't merge:fallbackModel,modelPicker,availableModelsandmodelSettings. - Environment variables are not a level in the stack. They work beside it. For example,
ANTHROPIC_MODELexported in your shell applies over themodelkey from any file, and--modelon the command line wins over both.
To see what is actually loaded, /status shows a "Setting sources" line, /permissions lists every permission rule with the file it came from, and claude doctor lists settings entries it rejected.
#A starting file you can copy
A project .claude/settings.json that lets Claude run your scripts and commit, asks before a push, and keeps it out of your .env:
{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"permissions": {
"allow": [
"Bash(npm run *)",
"Bash(git commit *)"
],
"ask": [
"Bash(git push *)"
],
"deny": [
"Read(./.env)"
]
}
}
The $schema line is optional. It points your editor at the published JSON schema, so you get completion and a warning on a misspelled key.
#Permissions: allow, ask and deny
permissions holds three lists of rules:
- allow: run without asking.
- ask: always ask, even if another rule would allow it.
- deny: never run.
Rules are evaluated in order: deny, then ask, then allow. In the docs' words, "the first match in that order determines the outcome, and rule specificity doesn't change the order." So a broad Bash(aws *) in deny blocks aws s3 ls even if Bash(aws s3 ls) sits in allow. Since lists from every file merge, a deny written in any of them applies.
#The rule syntax
A rule is Tool or Tool(specifier). A bare tool name matches every use of that tool.
Bash. A * matches any text, spaces included, so place it after the subcommand you mean:
{
"permissions": {
"allow": [
"Bash(git log *)",
"Bash(npm run build)"
]
}
}
Bash(git log *) allows only git log commands; Bash(git *) would allow every git command, git push --force included. The older :* suffix still works and means the same thing (Bash(ls:*) equals Bash(ls *)), but only at the very end of a pattern. For compound commands (&&, ||, ;, |, |&, &, newlines), each part has to be allowed on its own.
Read and Edit. Paths use gitignore syntax, and the leading characters matter:
| Pattern | Means | Example |
|---|---|---|
//path | Absolute path from the filesystem root | Read(//Users/alice/secrets/**) |
~/path | From your home folder | Read(~/Documents/*.pdf) |
/path | Relative to the settings file's source (the project, for project settings) | Edit(/src/**/*.ts) |
path or ./path | Relative to the current directory | Read(*.env) |
WebFetch. Use the domain: prefix. WebFetch(domain:example.com) matches that host only; WebFetch(domain:*.example.com) matches its subdomains at any depth but not example.com itself. Matching is case-insensitive.
MCP tools. mcp__github__* (or mcp__github) matches every tool from the github server, mcp__github__<tool> matches one tool, and mcp__* matches every MCP tool. To block all of them:
{
"permissions": {
"deny": ["mcp__*"]
}
}
#Other keys under permissions
defaultMode: the mode new sessions start in:default,acceptEdits,plan,auto,dontAskorbypassPermissions(manualis accepted as an alias fordefault). What each one does is in Claude Code permission modes.
{
"permissions": {
"defaultMode": "acceptEdits"
}
}
additionalDirectories: gives Claude file access to directories outside the current one.disableBypassPermissionsMode: set to"disable"so nobody can enterbypassPermissions. Most often deployed through managed settings.
#env: environment variables for every session
env sets variables for every session and every process it starts. Values are strings:
{
"env": {
"DISABLE_AUTO_COMPACT": "1",
"ANTHROPIC_BASE_URL": "https://proxy.example.com"
}
}
The values are plain text in the file. Don't put API keys or tokens here, least of all in a committed .claude/settings.json. For credentials, the docs offer apiKeyHelper, a command whose output Claude Code uses as the API credential:
{
"apiKeyHelper": "/bin/generate_temp_api_key.sh"
}
Keeping secrets out of Claude Code covers the other places keys leak.
#hooks: commands Claude Code runs for you
hooks maps an event to commands. This one runs a script before every Bash call:
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{ "type": "command", "command": "~/.claude/hooks/check-bash.sh" }
]
}
]
}
}
matcher takes tool names, and Edit|Write matches either. Events include SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, Notification, Stop, PreCompact and SessionEnd, among about thirty. "disableAllHooks": true turns them all off, along with any custom status line. Exit codes, matchers and working examples are in Claude Code hooks.
#model
Sets the model every new session starts with. The docs' example:
{
"model": "claude-sonnet-5"
}
--model on the command line and ANTHROPIC_MODEL in your shell both win over it. Related keys in the reference include effortLevel ("low", "medium", "high" or "xhigh"), fallbackModel and, for organizations, availableModels.
#statusLine
Runs your own command to draw a line under the prompt. Claude Code passes it session data as JSON, and the script prints what to show:
{
"statusLine": {
"type": "command",
"command": "~/.claude/statusline.sh",
"padding": 2
}
}
padding is optional. The docs suggest putting this in your user settings, since a status line is usually a personal preference.
#MCP servers: not in settings.json
MCP servers are defined in .mcp.json at the project root (shared) or in ~/.claude.json (yours), not in settings.json. What settings.json holds is whether project servers are approved:
{
"enabledMcpjsonServers": ["memory", "github"]
}
"enableAllProjectMcpServers": true approves every server in a project's .mcp.json without a prompt, and disabledMcpjsonServers rejects the ones you name. Scopes and the .mcp.json format are in Claude Code MCP servers.
#What do you commit, and what stays local?
- Commit
.claude/settings.json. The docs say to commit it "so everyone who clones the repository gets the same permissions, hooks, and plugin settings." Keep it free of personal paths and secrets. - Keep
.claude/settings.local.jsonlocal. When Claude Code creates it, it adds**/.claude/settings.local.jsonto your global git excludes file. If you create the file yourself, add it to.gitignore. ~/.claude/settings.jsonis yours. It lives outside any repository. If you keep dotfiles in git, the same rule applies: no keys inenv..mcp.jsoncan be committed when its secrets are${VAR}references rather than values.
A practical split: team rules (deny .env, ask before a push, the project's hooks) in the shared file; your own allow rules and experiments in the local file; your status line, model and personal hooks in the user file.
#Common mistakes
- Comments or a trailing comma. Settings files are strict JSON: "a
//comment or a trailing comma is a syntax error." - A single slash taken for an absolute path.
Read(/Users/alice/file)is anchored at the settings source, not the filesystem root. WriteRead(//Users/alice/file). - Expecting a narrow allow to beat a broad deny. Deny is checked first, whatever the specificity.
- A Bash rule wider than meant.
Bash(git *)allowsgit push. Put the*after the subcommand:Bash(git log *). :*in the middle of a rule. It only works at the end; inBash(git:* push)the colon is a literal character.- A
modelkey that seems ignored. Check your shell forANTHROPIC_MODEL, and for--modelin an alias. - MCP servers added to settings.json. They belong in
.mcp.jsonor~/.claude.json. cleanupPeriodDaysset to 0 to keep transcripts forever. It fails validation; the docs suggest a large value such as3650.- Keys in
env. Plain text, passed to every subprocess, and committed if it's the shared file.
When a setting doesn't apply, /status, /permissions and claude doctor usually tell you why within a minute.
#What does Grok Build's /import-claude take from these files?
By its announcement, Grok Build's /import-claude brings over Claude Code's permissions, environment variables, MCP servers and hooks: the permissions, env and hooks keys of the files above, and the servers in .mcp.json and ~/.claude.json. The checks to run before importing, and what can hide in each, are in Grok Build's /import-claude and /resume-claude.
#FAQ
Where is the Claude Code settings.json file?
Your own is ~/.claude/settings.json. A project's is .claude/settings.json at its root, with .claude/settings.local.json beside it for your personal overrides.
Can I put comments in settings.json?
No. It's strict JSON, so comments and trailing commas are syntax errors.
Does settings.local.json override settings.json?
For single values, yes: project local sits above shared project. For lists such as permissions.allow, both files' entries are combined.
How do I change settings without editing JSON?
Run /config inside Claude Code and open the Config tab, or /permissions to manage permission rules.
Is settings.json the same as ~/.claude.json?
No. ~/.claude.json holds your account details, MCP servers and per-project state. settings.json holds permissions, env, hooks, model and the other keys above.
#More on configuring Claude Code
- Claude Code permission modes
- Claude Code hooks
- Claude Code MCP servers
- Keeping secrets out of Claude Code
- Using several Claude accounts
- Grok Build's /import-claude
#In Relais
Relais is a Mac app that runs real Claude Code sessions, so they read the same settings.json files as Claude Code in a terminal: your user file, the project's and your local one. When you add more Claude accounts in Relais, each gets its own Claude Code folder whose settings.json, skills and plugins are links to your usual ~/.claude. Only the login differs, so a session that moves from one account to another keeps the same permission rules, hooks and env. Relais is not affiliated with Anthropic. An iPhone app is coming soon.