Claude Code Settings & Permissions
How to configure Claude Code with settings.json and environment variables: the scope system, precedence, permissions, and the settings you'll reach for most. Run /config to edit these from inside a session.
Configuration scopes
Where a configuration lives determines who it applies to and whether it is shared. When the same key appears in several scopes, the higher-priority scope wins (scalars override; arrays merge).
managed-settings.json). Highest precedence — cannot be overridden by anyone, not even CLI args.~/.claude/settings.json · not shared.claude/settings.json · shared ✔ (committed to git).claude/settings.local.json · not sharedFiles & locations
Scopes apply to many features, each with its own user / project / local location.
~/.claude/settings.json · .claude/settings.json · .claude/settings.local.json~/.claude/agents/ · .claude/agents/~/.claude.json; project servers in .mcp.json.~/.claude.json · .mcp.json~/.claude/CLAUDE.md · CLAUDE.md · CLAUDE.local.mdsettings.json.Settings precedence
Settings apply in order of precedence, highest first. Higher scopes win for scalar values.
- 1Managed settings — IT-deployed policy. Cannot be overridden by anything, including command-line arguments.
- 2Command-line arguments — temporary per-session overrides, e.g.
--settings <file-or-json>. - 3Local project settings —
.claude/settings.local.json(personal, per-repo). - 4Shared project settings —
.claude/settings.json(team, in source control). - 5User settings —
~/.claude/settings.json(personal global; applies when nothing else specifies the key).
Scalars override, arrays merge. A scalar (like model) from a higher scope replaces the lower one; array settings like permissions.allow are concatenated and de-duplicated across scopes.
Two array exceptions: fallbackModel is an ordered chain supplied whole by the highest scope that sets it; a managed availableModels list applies as-is and can't be extended.
Reload: most keys (permissions, hooks, apiKeyHelper) reload live. model and outputStyle are read at start — use /model to switch mid-session.
Permission modes
permissions.defaultMode sets how Claude Code asks before acting. The --permission-mode flag overrides it for one session.
~/.claude/settings.json onlydisableBypassPermissionsMode: "disable".--dangerously-skip-permissionsPermission rules
permissions.allow / ask / deny hold rules in the form Tool or Tool(specifier). Rules evaluate deny → ask → allow, and the FIRST match wins regardless of specificity.
["Bash(git diff *)"]["Bash(git push *)"]["Read(./.env)", "Bash(curl *)"]["../docs/"]npm run..env file.example.com.deny, * blocks every tool and mcp__* blocks all MCP tools.Key settings reference
A curated slice of settings.json — the keys most worth knowing. The full list lives in the official docs.
Model & core behavior
--model / ANTHROPIC_MODEL override it for one session."claude-sonnet-5"["claude-sonnet-5", "claude-haiku-4-5"]{"CLAUDE_CODE_ENABLE_TELEMETRY": "1"}X-Api-Key / Authorization: Bearer./bin/generate_temp_api_key.sh/clear."Explanatory"0 is rejected.20true).falseHooks, status line & attribution
true{"type": "command", "command": "~/.claude/statusline.sh"}includeCoAuthoredBy. Empty strings hide it.{"commit": "...", "pr": ""}Co-Authored-By trailer — use attribution instead.falseMCP servers
.mcp.json files.true.mcp.json servers by name.["memory", "github"].mcp.json servers by name.["filesystem"]Authentication & enterprise
claudeai, console, or gateway."claudeai""xxxxxxxx-…".aws directory (interactive SSO).aws sso login --profile myprofile/bin/generate_aws_grant.shSandboxing
Bash sandboxing isolates commands from the filesystem and network (macOS / Linux / WSL2).
false).trueEdit/Read rules.["/tmp/build"] · ["~/.aws/credentials"]["github.com", "*.npmjs.org"]Plugins
plugin-name@marketplace.{"formatter@acme-tools": true}{"acme-tools": {"source": {…}}}[{"source": "github", "repo": "acme/plugins"}]Verify & diagnose
key=value (v2.1.181+)./config verbose=truemodel is read at start).Key takeaways
- Precedence (high → low): Managed → CLI args → Local → Project → User. Managed policy can't be overridden by anything.
- Scalars override; arrays merge. Permission rules and sandbox path lists concatenate across scopes and de-duplicate.
- Put team-shared config in
.claude/settings.json(committed); keep personal per-repo tweaks in.claude/settings.local.json(gitignored). - Hide secrets with
permissions.denyRead(...)rules — this replaces the deprecatedignorePatterns. permissions.defaultModevalues:default/manual,acceptEdits,plan,auto(user-scope only),bypassPermissions.- Permission rules evaluate deny → ask → allow, first match wins — order matters, not specificity.
- Use
attribution(not the deprecatedincludeCoAuthoredBy) to customize or hide commit/PR credit.
Summarized from the official Claude Code settings documentation (code.claude.com/docs/en/settings) for study. Always check the live docs for the newest keys and defaults.
Independent study notes. Consult the official documentation for current product behavior and exam requirements.
About this guide & our sources ↗