AI agents

Claude Code

Claude Code — Configuration

Claude Code is configured through layered settings.json files plus environment variables. Adding "$schema": "https://json.schemastore.org/claude-code-settings.json" to a settings file enables editor autocomplete.

Settings locations and precedence

Highest priority first:

PriorityScopeLocation
1 (highest)Managed (enterprise)macOS: /Library/Application Support/ClaudeCode/managed-settings.json; Linux/WSL: /etc/claude-code/managed-settings.json; Windows: C:\Program Files\ClaudeCode\managed-settings.json
2Command-line argumentsSession-only overrides (see Claude Code — CLI Flags)
3Local project.claude/settings.local.json (gitignored automatically)
4Project.claude/settings.json (commit this to share with the team)
5 (lowest)User~/.claude/settings.json

Managed settings cannot be overridden — that’s how enterprises enforce policy.

Other state lives in ~/.claude.json: preferences, the OAuth session, user/local-scope MCP servers, and per-project state such as allowed tools and trust. Claude Code keeps timestamped backups (5 most recent) of config files.

Key settings

A representative settings.json:

{
  "$schema": "https://json.schemastore.org/claude-code-settings.json",
  "model": "sonnet",
  "cleanupPeriodDays": 30,
  "env": {
    "BASH_DEFAULT_TIMEOUT_MS": "120000"
  },
  "permissions": {
    "defaultMode": "plan",
    "allow": ["Bash(npm run *)", "Read"],
    "deny": ["Read(./.env)"],
    "additionalDirectories": ["../shared-lib"]
  },
  "enabledPlugins": {
    "my-plugin@my-marketplace": true
  },
  "statusLine": { "type": "command", "command": "my-statusline.sh" }
}

Frequently used keys (all verified in the settings reference):

KeyPurpose
modelDefault model
apiKeyHelperHelper command that supplies an API key
cleanupPeriodDaysSession retention (default 30; 0 deletes all sessions at startup)
envEnvironment variables applied to every session
permissionsallow / ask / deny / additionalDirectories / defaultMode / disableBypassPermissionsMode — see Claude Code — Permissions
hooksEvent hooks; disableAllHooks turns them off
attributioncommit, pr — replaces the deprecated includeCoAuthoredBy
outputStyleOutput style (e.g. Explanatory)
statusLineCustom status line command
respectGitignoreRespect .gitignore in file operations
fileSuggestionFile-suggestion behavior for @ mentions
enableAllProjectMcpServersAuto-enable .mcp.json servers
enabledMcpjsonServers / disabledMcpjsonServersPer-server .mcp.json allow/deny lists
forceLoginMethodclaudeai or console
forceLoginOrgUUIDPin login to an organization
autoUpdatesChannelstable or latest
plansDirectoryWhere plan-mode plans are stored (default ~/.claude/plans)
languageResponse language
showTurnDuration / spinnerVerbs / spinnerTipsEnabledTUI cosmetics
terminalProgressBarEnabled / prefersReducedMotionTUI behavior
teammateModeAgent-team display mode
awsAuthRefresh / awsCredentialExportBedrock credential handling
alwaysThinkingEnabledKeep extended thinking on
companyAnnouncementsAnnouncements shown to users

Managed-only keys (enterprise policy): allowManagedHooksOnly, allowManagedPermissionRulesOnly, allowedMcpServers, deniedMcpServers, strictKnownMarketplaces.

Plugin keys: enabledPlugins (format "plugin@marketplace": true/false), extraKnownMarketplaces.

Sandbox keys (sandbox.enabled, autoAllowBashIfSandboxed, network rules, …) are covered in Claude Code — Permissions.

Environment variables

All of these can also be set inside settings.json under env.

VariablePurpose
ANTHROPIC_API_KEYAPI key authentication
ANTHROPIC_AUTH_TOKENCustom auth token
ANTHROPIC_CUSTOM_HEADERSExtra headers on API requests
ANTHROPIC_MODELDefault model
ANTHROPIC_DEFAULT_HAIKU_MODEL / _OPUS_MODEL / _SONNET_MODELPer-tier model overrides
CLAUDE_CODE_USE_BEDROCK / _VERTEX / _FOUNDRYRoute via a third-party cloud
AWS_BEARER_TOKEN_BEDROCKBedrock bearer token
CLAUDE_CODE_SUBAGENT_MODELModel used by subagents
CLAUDE_CODE_MAX_OUTPUT_TOKENSOutput cap (default 32,000; max 64,000)
MAX_THINKING_TOKENSThinking budget (default 31,999; 0 disables thinking)
CLAUDE_CODE_EFFORT_LEVELlow / medium / high (Opus 4.6+)
CLAUDE_AUTOCOMPACT_PCT_OVERRIDEAuto-compact trigger percentage (default ~95)
BASH_DEFAULT_TIMEOUT_MS / BASH_MAX_TIMEOUT_MS / BASH_MAX_OUTPUT_LENGTHBash tool limits
CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIRKeep Bash in the project directory
CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MDAlso load CLAUDE.md from --add-dir directories
CLAUDE_CODE_DISABLE_AUTO_MEMORYDisable automatic memory (see Claude Code — Project Instructions (CLAUDE.md))
CLAUDE_CODE_DISABLE_BACKGROUND_TASKSDisable background tasks
CLAUDE_CONFIG_DIRRelocate the config directory
DISABLE_AUTOUPDATERTurn off auto-updates
DISABLE_TELEMETRY / DISABLE_ERROR_REPORTING / DISABLE_COST_WARNINGSPrivacy/UX toggles
ENABLE_TOOL_SEARCHTool search (auto default; enables at 10% of context)
MAX_MCP_OUTPUT_TOKENSMCP tool output cap (default 25,000)
MCP_TIMEOUT / MCP_TOOL_TIMEOUTMCP startup / tool-call timeouts
MCP_OAUTH_CALLBACK_PORTOAuth callback port for MCP auth
SLASH_COMMAND_TOOL_CHAR_BUDGETSkill metadata budget (2% of context window; fallback 16,000 chars)
HTTP_PROXY / HTTPS_PROXY / NO_PROXYProxy configuration
CLAUDE_ENV_FILEFile sourced before each Bash command (settable via SessionStart hooks)
CLAUDE_CODE_SHELL / CLAUDE_CODE_SHELL_PREFIXShell selection and wrapping
USE_BUILTIN_RIPGREPUse the bundled ripgrep

Deprecated: ANTHROPIC_SMALL_FAST_MODEL, and includeCoAuthoredBy (a setting, replaced by attribution).

Notes

  • Edit settings interactively with /config, or set a value straight from the prompt: /config model=opus.
  • The legacy claude config CLI subcommand no longer appears in the current CLI reference — ? Unable to verify; use /config or edit the JSON files.
  • CLI flags like --settings and --setting-sources can layer extra settings per session (see Claude Code — CLI Flags).

Last verified: 2026-09-07

Official sources:

AI coding tools evolve quickly. If you find outdated information, please open an issue or pull request.