Skip to content

settings.json

settings.json configures Claude Code's behavior — permissions, environment, model, hooks, and more. The same keys work at every scope; what changes is precedence.

Precedence

Claude Code reads settings from five layers. Higher layers win on conflict. Permission rules are the exception: they merge across scopes rather than override, with deny taking precedence.

PriorityLayerLocationShared with
1 (highest)ManagedSystem managed-settings.json (MDM/policy)Whole organization
2--settings flagPath passed on the CLICurrent session
3Local.claude/settings.local.json (gitignored)Just you (this project)
4Project.claude/settings.jsonTeam, via source control
5 (lowest)User~/.claude/settings.jsonJust you (all projects)

NOTE

Managed settings cannot be overridden by any other layer. Use them for organization-wide enforcement.

Key settings

json
{
  "model": "claude-opus-4-8",
  "outputStyle": "Explanatory",
  "includeCoAuthoredBy": true,
  "autoMemoryEnabled": true,
  "env": {
    "NODE_ENV": "development"
  },
  "permissions": {
    "defaultMode": "acceptEdits",
    "allow": ["Bash(npm run test:*)"],
    "deny": ["Read(./.env)", "Read(./.env.*)"],
    "additionalDirectories": ["../shared-lib"]
  }
}
KeyPurpose
permissionsallow / deny / ask rules, defaultMode, additionalDirectories
envEnvironment variables exported to every command and hook
hooksLifecycle automation — see Hooks
modelDefault model for the session
availableModelsModels offered in the picker
effortLevelReasoning effort level
outputStyleActive output style — see Output styles
autoMemoryEnabledToggle auto memory — see CLAUDE.md & memory
includeCoAuthoredByAdd the Claude co-author trailer to commits
autoUpdatesChannelWhich release channel to auto-update from
autoCompactEnabledCompact automatically near the context limit (default true); DISABLE_AUTO_COMPACT=1 overrides
autoCompactWindowHow full the context gets before auto-compaction fires, 1000001000000 tokens — see Tune auto-compaction

NOTE

Claude Code ships many more keys (e.g. statusLine, claudeMdExcludes, autoMemoryDirectory). Check the official reference for the full, current list.

Permission rule syntax

Rules take the form Tool(pattern):

text
Bash(npm run test:*)     # any command starting with "npm run test"
Read(./.env)             # exact path
Read(./secrets/**)       # everything under secrets/
Edit(src/**)             # any file under src/
  • * matches a single path segment; ** matches multiple segments.
  • A bare tool name (e.g. WebFetch) applies to all uses of that tool.
  • deny always wins over allow; rules from all scopes are combined.

For interactive permission flow control, see Permission modes.

/config and /permissions

  • /config opens an interactive panel to edit common settings (model, output style, theme). Selections save to the appropriate settings.json.
  • /permissions opens a dedicated panel to review and edit allow / deny / ask rules without hand-editing JSON.

Both write to the same files described above, so changes persist across sessions.

TIP

Commit .claude/settings.json for team-wide defaults and keep machine-specific or secret-adjacent overrides in .claude/settings.local.json (gitignored).

Source: code.claude.com/docs/en/settings

Released under the MIT License.