settings.json files. As of February 2026, Claude Code exposes 38 settings and 84 environment variables (use the "env" field in settings.json to avoid wrapper scripts).
Settings Hierarchy
Claude Code settings use a 5-level user-writable override chain plus an enforced policy layer:| Priority | Location | Scope | Version Control | Purpose |
|---|---|---|---|---|
| 1 | Command line arguments | Session | N/A | Single-session overrides |
| 2 | .claude/settings.local.json | Project | No (git-ignored) | Personal project-specific |
| 3 | .claude/settings.json | Project | Yes (committed) | Team-shared settings |
| 4 | ~/.claude/settings.local.json | User | N/A | Personal global overrides |
| 5 | ~/.claude/settings.json | User | N/A | Global personal defaults |
Policy layer:
managed-settings.json is organization-enforced and cannot be overridden by local settings.Core Configuration
General Settings
Override default model. Accepts aliases (
sonnet, opus, haiku) or full model IDsSet the default agent for the main conversation. Value is the agent name from
.claude/agents/. Also available via --agent CLI flagClaude’s preferred response language
Sessions inactive longer than this are deleted at startup
Release channel:
"stable" or "latest"Enable extended thinking by default for all sessions
Skip WebFetch blocklist check before fetching URLs
Plans Directory
Store plan files in a custom location relative to project root.Directory where
/plan outputs are storedAttribution Settings
Customize attribution messages for git commits and pull requests.Git commit attribution (supports trailers)
Pull request description attribution
DEPRECATED - Use
attribution insteadSet to empty string (
"") to hide attribution entirely.Permissions
Control what tools and operations Claude can perform.Permission Structure
Permission Modes
| Mode | Behavior |
|---|---|
"default" | Standard permission checking with prompts |
"acceptEdits" | Auto-accept file edits without asking |
"askEdits" | Ask before every operation |
"viewOnly" | Read-only mode, no modifications |
"bypassPermissions" | Skip all permission checks (dangerous) |
"plan" | Read-only exploration mode |
Tool Permission Syntax
- Bash
- File Operations
- MCP
- Other Tools
Hooks
Execute custom shell commands at various points in Claude Code’s lifecycle.Hook Events (16 total)
SessionStart
SessionStart
When: New or resumed sessionMatcher Support: NoUse Cases: Load context, set environment
SessionEnd
SessionEnd
When: Session terminatesMatcher Support: NoUse Cases: Cleanup, logging
PreToolUse
PreToolUse
When: Before tool executionMatcher Support: YesUse Cases: Validate commands, modify inputs
PostToolUse
PostToolUse
When: After tool succeedsMatcher Support: YesUse Cases: Run linters, verify output
Stop
Stop
When: Claude finishes respondingMatcher Support: NoUse Cases: Block/continue decisions
SubagentStart
SubagentStart
When: Subagent spawnedMatcher Support: YesUse Cases: Per-agent setup
SubagentStop
SubagentStop
When: Subagent completesMatcher Support: YesUse Cases: Cleanup, validation
Hook Configuration Structure
Hook Exit Codes
| Exit Code | Behavior |
|---|---|
0 | Success, continue |
1 | Error (logged, continues) |
2 | Block the operation |
MCP Servers
Configure Model Context Protocol servers for extended capabilities.Auto-approve all
.mcp.json serversAllowlist specific server names
Blocklist specific server names
Sandbox
Configure bash command sandboxing for security.Enable bash sandboxing
Auto-approve bash when sandboxed
Commands to run outside sandbox
Specific Unix socket paths accessible in sandbox
Allow binding to localhost ports (macOS)
Model Configuration
Model Aliases
| Alias | Description |
|---|---|
"default" | Recommended for your account type |
"sonnet" | Latest Sonnet model (Claude Sonnet 4.6) |
"opus" | Latest Opus model (Claude Opus 4.6) |
"haiku" | Fast Haiku model |
"sonnet[1m]" | Sonnet with 1M token context |
"opusplan" | Opus for planning, Sonnet for execution |
Effort Level (Opus 4.6)
When Opus 4.6 is selected, the/model command exposes an effort level control that adjusts how much reasoning the model applies per response.
| Effort Level | Description |
|---|---|
| High (default) | Full reasoning depth, best for complex tasks |
| Medium | Balanced reasoning, good for everyday tasks |
| Low | Minimal reasoning, fastest responses |
Display & UX
Display Settings
Custom status line configuration
Output style (e.g.,
"Explanatory")Show tips while waiting
Show progress bar in terminal
Show turn duration messages
Respect .gitignore in file picker
Environment Variables (via env)
Set environment variables for all Claude Code sessions.
Common Environment Variables
Authentication
Authentication
ANTHROPIC_API_KEY— API key for authenticationANTHROPIC_AUTH_TOKEN— OAuth tokenANTHROPIC_BASE_URL— Custom API endpoint
Cloud Providers
Cloud Providers
CLAUDE_CODE_USE_BEDROCK— Use AWS Bedrock (1to enable)CLAUDE_CODE_USE_VERTEX— Use Google Vertex AI (1to enable)CLAUDE_CODE_USE_FOUNDRY— Use Microsoft Foundry (1to enable)
Context & Compaction
Context & Compaction
CLAUDE_AUTOCOMPACT_PCT_OVERRIDE— Auto-compact threshold percentage (1-100). Default is ~95%. Set lower (e.g.,50) to trigger compaction earlierMAX_THINKING_TOKENS— Limit thinking token budget (set to0to disable)
MCP
MCP
MCP_TIMEOUT— MCP startup timeout in ms (default: 10000)MAX_MCP_OUTPUT_TOKENS— Max MCP output tokens (default: 50000)ENABLE_TOOL_SEARCH— MCP tool search threshold (e.g.,auto:5)
Useful Commands
/model
Switch models and adjust Opus 4.6 effort level
/config
Interactive configuration UI
/memory
View/edit all memory files
/agents
Manage subagents
/mcp
Manage MCP servers
/hooks
View configured hooks
/plugin
Manage plugins
/permissions
View and manage permission rules
--doctor
Diagnose configuration issues
Sources
Settings Documentation
Official Claude Code settings reference
Settings JSON Schema
Complete schema definition
Configuration Guide
ClaudeLog configuration guide
GitHub Examples
Community settings examples
