Claude Code Settings Reference A practical map of Claude Code configuration: settings files and precedence, how arrays and locks merge, permission rule syntax, the most useful settings keys by area (permissions, sandbox, model, memory, MCP, plugins, hooks, git, worktrees, enterprise), key environment variables, and copy-ready example files for a developer, a team and an organisation.
Simple definition#
Claude Code reads JSON settings files at several levels — your user file, the project’s shared and local files, and the organisation’s managed settings — and combines them into one effective configuration. Settings control what Claude may do (permissions, sandbox), which model it uses, what loads into context, which extensions run, and what is reported. Environment variables cover authentication, providers and a few low-level limits.
Files#
File
Who
Committed
Typical contents
~/.claude/settings.json
You, every project
No
Model, effort, theme, status line, autoMode, personal hooks
.claude/settings.json
Everyone in the repo
Yes
Permissions, hooks, env, plugins, marketplaces
.claude/settings.local.json
You, this repo
No (gitignored)
Personal overrides; “don’t ask again” approvals land here
Managed settings
Organisation
Deployed
Policy: deny rules, sandbox, MCP and plugin limits, versions
--settings <file|json>
One session
—
Script and CI overrides
~/.claude.json
You
No
Global config (IDE, UI toggles), local-scope MCP servers, per-project state
.mcp.json
Repo
Yes
Project MCP servers
Edit with /config (UI or key=value), /permissions, /hooks, or ask Claude via /update-config. Add "$schema": "https://json.schemastore.org/claude-code-settings.json" for editor completion. /status shows which sources loaded.
Precedence and merging#
Managed, project, local and user settings combine into one effective configuration · drawn with Archify · zoom, guided views, search and SVG/PNG export. © 2026 Samir Kumar Sahoo, all rights reserved.
Open full screen ↗
Highest first: managed → command line (--settings) → project local → shared project → user. A key set higher overrides the same key lower down — but not every key merges the same way:
Kind of key
Rule
Examples
Arrays
Merge across all scopes — lower levels can add, not remove
permissions.allow, permissions.deny, sandbox.network.allowedDomains
Locks
The strictest value any source sets wins
allowManagedPermissionRulesOnly, permissions.disableBypassPermissionsMode
Restrictive booleans
A restrictive true from any scope is honoured, even over managed
permissions.blockWritesOutsideWorkingDirectories, disableClaudeAiConnectors
Managed-replace lists
The managed value replaces lower ones
availableModels, fallbackModel, modelPicker
Highest source only
Read only from the top source with policy
apiKeyHelper, permissions.defaultMode
Everything else
Highest level that sets it
model, cleanupPeriodDays
Project allow rules, additionalDirectories, marketplaces and most env values wait for workspace trust ; deny and ask apply immediately.
Shell environment variables are not a level: some (ANTHROPIC_MODEL) beat the matching settings key, others don’t — check the key’s entry.
CLAUDE.md edits don’t apply mid-session, because the system prompt is cached; start a new session to pick them up.
Permission rule syntax#
Rules are Tool or Tool(specifier) in permissions.allow, ask or deny. Deny beats ask beats allow , in every mode.
Rule
Matches
Bash
Every shell command
Bash(npm run build)
Exactly that command
Bash(npm run *)
npm run build, npm run test --watch (not npm install)
Bash(git * main)
git merge main, git push origin main
Bash(ls *) vs Bash(ls*)
ls -la / also lsof — the space matters
Read(./.env), Read(**/.env)
.env here / any .env under the working directory
Read(~/Documents/*.pdf)
Path from home
Read(//etc/**)
Absolute path from filesystem root
Edit(/src/**/*.ts)
Relative to the settings file’s project root
Edit(**/src/**)
A src directory at any depth
WebFetch(domain:example.com)
Fetches to that domain
mcp__github, mcp__github__*
Every tool from the github server
mcp__github__create_issue
One MCP tool
Agent(Explore), Agent(my-reviewer)
A sub-agent (deny to disable it)
Agent(model:opus), Bash(run_in_background:true)
Calls with that input parameter
Warning Bash patterns are not a sandbox
Bash(curl *) doesn’t match /usr/bin/curl … or sh -c 'curl …'; a Read deny doesn’t stop a script that opens the file; a WebFetch deny doesn’t stop curl. Use the sandbox for real filesystem and network limits.
Most-used keys by area#
Permissions#
Key
Does
permissions.allow / ask / deny
Rule lists
permissions.defaultMode
Starting mode: default, acceptEdits, plan, auto, dontAsk, bypassPermissions
permissions.additionalDirectories
Extra directories Claude may read and edit
permissions.disableBypassPermissionsMode
"disable" — nobody can enter bypass mode
permissions.blockReadsOutsideWorkingDirectories, …Writes…
File tools refuse paths outside working dirs in every mode
disableAutoMode
Remove auto mode from the cycle
autoMode (environment, allow, soft_deny)
Plain-English classifier context — user settings only; keep "$defaults"
autoMode.classifyAllShell
Send every shell command through the classifier
useAutoModeDuringPlan
Classifier reviews shell commands in plan mode
allowManagedPermissionRulesOnly
Only managed rules apply (managed)
Sandbox#
Key
Does
sandbox.enabled
OS sandbox for Bash (macOS, Linux, WSL2)
sandbox.failIfUnavailable
Refuse to start rather than run unsandboxed
sandbox.autoAllowBashIfSandboxed
Sandboxed commands don’t prompt
sandbox.allowUnsandboxedCommands
Allow or forbid retrying outside the sandbox (strict mode)
sandbox.excludedCommands
Commands that run outside it, e.g. ["docker *"]
sandbox.filesystem.allowWrite / denyRead / denyWrite
Path controls
sandbox.network.allowedDomains / deniedDomains
Domain allowlist / blocklist
sandbox.network.strictAllowlist
Deny unlisted hosts instead of prompting
sandbox.network.allowManagedDomainsOnly
Lock the allowlist to managed settings
sandbox.credentials.envVars / files
Hide or mask credentials inside the sandbox
Model and responses#
Key
Does
model
Starting model (opus, sonnet, haiku, fable, or an ID)
effortLevel
Default effort
maxEffortLevel
Cap effort, globally or per model in modelSettings
availableModels, enforceAvailableModels, deniedModels
Restrict the picker and the default
fallbackModel
Backups when the primary is overloaded
modelOverrides
Map IDs to provider IDs (e.g. Bedrock ARNs)
fastMode
Fast mode on where available
outputStyle, language
Response style; response language
promptCacheTtl, subagentPromptCacheTtl
Prompt cache lifetime
modelPricing
Report cost at your contracted rates
advisorModel
Model the advisor tool consults
Memory and context#
Key
Does
autoCompactEnabled, autoCompactWindow, idleCompaction
Compaction behaviour
autoMemoryEnabled, autoMemoryDirectory
Auto memory on/off and location
claudeMdExcludes
Skip specific CLAUDE.md files (monorepos)
claudeMd
Organisation-wide instructions from managed settings
env
Environment variables for every session and subprocess
bashOutputMaxChars
How much command output Claude receives inline
fileCheckpointingEnabled
Snapshots that /rewind restores
plansDirectory
Where plan mode writes plans
skillListingBudgetFraction, skillListingMaxDescChars
Context reserved for the skill list
MCP#
Key
Does
enableAllProjectMcpServers
Approve every .mcp.json server without asking
enabledMcpjsonServers / disabledMcpjsonServers
Approve or reject specific project servers
allowedMcpServers / deniedMcpServers
Allow- and blocklists (by name, URL or command)
allowManagedMcpServersOnly, managedMcpServers
Lock to, or provide, managed servers
disableClaudeAiConnectors
Don’t fetch claude.ai connectors
Plugins and skills#
Key
Does
enabledPlugins
Turn plugins on or off per scope (name@marketplace)
extraKnownMarketplaces
Register marketplaces for the repo or organisation
strictKnownMarketplaces, blockedMarketplaces
Restrict marketplace sources
strictPluginOnlyCustomization
Skills, agents, hooks, MCP only from plugins or policy
skillOverrides
Hide or collapse a skill without editing it
disableBundledSkills, disableSkillShellExecution
Turn off bundled skills; block inline shell in skills
syncClaudeAiSkills, syncClaudeAiPlugins
Stop syncing from claude.ai
Hooks and automation#
Key
Does
hooks
Hook configuration — see the hooks reference
disableAllHooks
Turn off hooks, status line and custom file suggestion
allowManagedHooksOnly, allowedHttpHookUrls, httpHookAllowedEnvVars
Restrict hooks
enableWorkflows, disableWorkflows, workflowSizeGuideline
Dynamic workflows
Git, worktrees and agents#
Key
Does
attribution.commit, attribution.pr
Change or hide the commit trailer and PR line
includeGitInstructions
Remove built-in commit/PR instructions
prUrlTemplate
PR links to an internal review tool
worktree.symlinkDirectories, worktree.sparsePaths, worktree.baseRef
Worktree creation
agent
Start every session as a named sub-agent
teammateMode
How agent-team teammates display
disableAgentView, processWrapper
Background agents off, or via a corporate launcher
cleanupPeriodDays
Transcript retention
Interface (personal)#
theme, tui, editorMode (vim), statusLine, viewMode, spinnerTipsEnabled, prefersReducedMotion, respectGitignore, preferredNotifChannel, voice, companyAnnouncements (managed).
Enterprise and updates#
Key
Does
forceLoginMethod, forceLoginOrgUUID, allowedProviders
Who and how people sign in
apiKeyHelper, awsAuthRefresh, gcpAuthRefresh
Credentials from your own command
minimumVersion, requiredMinimumVersion, requiredMaximumVersion, autoUpdatesChannel
Versions
policyHelper
Executable that computes managed settings at start
forceRemoteSettingsRefresh
Block start until server-managed settings are fresh
wslInheritsWindowsSettings
WSL reads Windows policy
disableSideloadFlags
Reject CLI flags that sideload plugins, agents, MCP
Environment variables worth knowing#
Variable
Use
ANTHROPIC_API_KEY
API key — overrides your subscription login when set
CLAUDE_CODE_OAUTH_TOKEN
Subscription token for CI (claude setup-token)
CLAUDE_CODE_USE_BEDROCK / _VERTEX / _FOUNDRY
Select a cloud provider
ANTHROPIC_BASE_URL
Route through a proxy or LLM gateway
ANTHROPIC_MODEL, ANTHROPIC_DEFAULT_{OPUS,SONNET,HAIKU}_MODEL
Model and alias resolution
CLAUDE_CODE_SUBAGENT_MODEL
Default model for sub-agents, teammates and workflow agents
CLAUDE_CODE_MAX_OUTPUT_TOKENS
Output token cap
BASH_DEFAULT_TIMEOUT_MS
Foreground command timeout (default 2 min)
MCP_TIMEOUT, MAX_MCP_OUTPUT_TOKENS
MCP start-up timeout (30 s); MCP output cap (25,000 tokens)
CLAUDE_CODE_ENABLE_TELEMETRY + OTEL_*
OpenTelemetry export
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC
No auto-update, telemetry, error reports or feedback
DISABLE_AUTOUPDATER
Keep manual claude update only
CLAUDE_CODE_SUBPROCESS_ENV_SCRUB
Strip credentials from Bash, hooks and stdio MCP environments
CLAUDE_CODE_STOP_HOOK_BLOCK_CAP
Consecutive Stop-hook blocks allowed (default 8)
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS
Enable agent teams
CLAUDE_CONFIG_DIR
Use another config directory (isolated runs)
HTTPS_PROXY
Corporate proxy
Put shared variables in a settings file’s env block rather than shell profiles, so every session and subprocess gets them.
Example: a developer’s user settings#
{
"$schema" : "https://json.schemastore.org/claude-code-settings.json" ,
"model" : "opus" ,
"effortLevel" : "medium" ,
"theme" : "auto" ,
"statusLine" : { "type" : "command" , "command" : "~/.claude/statusline.sh" },
"autoMode" : {
"environment" : [ "$defaults" , "Source control: github.com/example-org" , "Trusted internal domains: *.internal.example.com" ],
"allow" : [ "$defaults" , "Deploying to the staging namespace is fine; it resets nightly" ]
}
}
Example: a team’s .claude/settings.json#
{
"$schema" : "https://json.schemastore.org/claude-code-settings.json" ,
"permissions" : {
"allow" : [ "Bash(./mvnw *)" , "Bash(git diff *)" , "Bash(gh pr view *)" ],
"ask" : [ "Bash(git push *)" ],
"deny" : [ "Read(./.env)" , "Read(./.env.*)" , "Read(./secrets/**)" , "Edit(/src/gen/**)" ]
},
"env" : { "SPRING_PROFILES_ACTIVE" : "local" },
"hooks" : {
"PostToolUse" : [{ "matcher" : "Edit|Write" ,
"hooks" : [{ "type" : "command" , "command" : "./mvnw -q spotless:apply" }] }],
"Stop" : [{ "hooks" : [{ "type" : "command" , "command" : "./mvnw -q -DskipITs test 1>&2 || exit 2" }] }]
},
"extraKnownMarketplaces" : {
"acme-tools" : { "source" : { "source" : "github" , "repo" : "acme/claude-plugins" } }
},
"enabledPlugins" : { "acme-reviewer@acme-tools" : true },
"attribution" : { "commit" : "Co-Authored-By: Claude <noreply@anthropic.com>" }
}
Example: organisation managed settings#
{
"permissions" : {
"deny" : [ "Read(**/.env)" , "Read(**/secrets/**)" , "Read(~/.aws/**)" , "Bash(curl * | bash)" ],
"disableBypassPermissionsMode" : "disable"
},
"sandbox" : {
"enabled" : true ,
"failIfUnavailable" : true ,
"network" : { "allowedDomains" : [ "github.com" , "*.npmjs.org" , "*.internal.example.com" ] }
},
"allowManagedMcpServersOnly" : true ,
"strictKnownMarketplaces" : [{ "source" : "github" , "repo" : "acme/claude-plugins" }],
"maxEffortLevel" : "xhigh" ,
"minimumVersion" : "2.1.300" ,
"env" : {
"CLAUDE_CODE_ENABLE_TELEMETRY" : "1" ,
"OTEL_METRICS_EXPORTER" : "otlp" ,
"OTEL_EXPORTER_OTLP_ENDPOINT" : "https://otel.internal.example.com:4317"
}
}
Structured keys such as strictKnownMarketplaces accept more source types (git, url, host patterns) — see the reference before deploying.
Common mistakes#
Common mistake autoMode in project settings
The classifier ignores autoMode in project files, and omitting "$defaults" replaces the built-in rules — including the blocks on force pushes and production deploys.
Common mistake Expecting a local allow to beat a project ask
Permission rules combine by kind: deny beats ask beats allow across all files. “Yes, and don’t ask again” saves an allow to your local file, which won’t silence a team ask rule.
Common mistake ANTHROPIC_API_KEY left in a shell profile
It silently overrides your subscription login and bills the API key. Set it only where you mean to.
Common mistake Secrets in committed env
.claude/settings.json is in Git. Use apiKeyHelper, your secret manager, or settings.local.json.
Review questions#
The organisation denies Read(**/.env); a developer adds Read(./.env) to their local allow list. Can Claude read .env?
No. Arrays merge across scopes and deny wins over allow.
Where must autoMode customisation go, and why keep "$defaults"?
In ~/.claude/settings.json (user settings); without "$defaults" your entries replace the built-in list rather than extend it.
Which keys are honoured from any scope even if managed settings disagree?
Restrictive ones such as permissions.blockWritesOutsideWorkingDirectories: true and disableClaudeAiConnectors: true — a developer can always make their own session stricter.
References#