Skip to content

Claude Code Settings

Configure Claude Code with global and project-level settings, and environment variables.

Claude Code offers a variety of settings to configure its behavior to meet your needs. You can configure Claude Code by running the /config command when using the interactive REPL, which opens a tabbed Settings interface where you can view status information and modify configuration options.

Configuration scopes

Claude Code uses a scope system to determine where configurations apply and who they're shared with. Understanding scopes helps you decide how to configure Claude Code for personal use, team collaboration, or enterprise deployment.

Available scopes

ScopeLocationWho it affectsShared with team?
ManagedServer-managed settings, plist / registry, or system-level managed-settings.jsonAll users on the machineYes (deployed by IT)
User~/.claude/ directoryYou, across all projectsNo
Project.claude/ in repositoryAll collaborators on this repositoryYes (committed to git)
Local.claude/settings.local.jsonYou, in this repository onlyNo (gitignored)

When to use each scope

Managed scope is for:

  • Security policies that must be enforced organization-wide
  • Compliance requirements that can't be overridden
  • Standardized configurations deployed by IT/DevOps

User scope is best for:

  • Personal preferences you want everywhere (themes, editor settings)
  • Tools and plugins you use across all projects
  • API keys and authentication (stored securely)

Project scope is best for:

  • Team-shared settings (permissions, hooks, MCP servers)
  • Plugins the whole team should have
  • Standardizing tooling across collaborators

Local scope is best for:

  • Personal overrides for a specific project
  • Testing configurations before sharing with the team
  • Machine-specific settings that won't work for others

How scopes interact

When the same setting appears in multiple scopes, Claude Code applies them in priority order:

  1. Managed (highest) - can't be overridden by anything
  2. Command line arguments - temporary session overrides
  3. Local - overrides project and user settings
  4. Project - overrides user settings
  5. User (lowest) - applies when nothing else specifies the setting

For example, if your user settings set spinnerTipsEnabled to true and project settings set it to false, the project value applies. Permission rules behave differently because they merge across scopes rather than override.

What uses scopes

FeatureUser locationProject locationLocal location
Settings~/.claude/settings.json.claude/settings.json.claude/settings.local.json
Subagents~/.claude/agents/.claude/agents/None
MCP servers~/.claude.json.mcp.json~/.claude.json (per-project)
Plugins~/.claude/settings.json.claude/settings.json.claude/settings.local.json
CLAUDE.md~/.claude/CLAUDE.mdCLAUDE.md or .claude/CLAUDE.mdCLAUDE.local.md

On Windows, paths shown as ~/.claude resolve to %USERPROFILE%\.claude.


Settings files

The settings.json file is the official mechanism for configuring Claude Code through hierarchical settings:

  • User settings are defined in ~/.claude/settings.json and apply to all projects.

  • Project settings are saved in your project directory:

    • .claude/settings.json for settings checked into source control and shared with your team
    • .claude/settings.local.json for settings that are not checked in, useful for personal preferences and experimentation. Claude Code will configure git to ignore .claude/settings.local.json when it is created.
  • Managed settings: For organizations that need centralized control, Claude Code supports multiple delivery mechanisms:

    • Server-managed settings: delivered from Anthropic's servers via the Claude.ai admin console.

    • MDM/OS-level policies: delivered through native device management on macOS and Windows:

      • macOS: com.anthropic.claudecode managed preferences domain
      • Windows: HKLM\SOFTWARE\Policies\ClaudeCode registry key
      • Windows (user-level): HKCU\SOFTWARE\Policies\ClaudeCode
    • File-based: managed-settings.json and managed-mcp.json deployed to system directories:

      • macOS: /Library/Application Support/ClaudeCode/
      • Linux and WSL: /etc/claude-code/
      • Windows: C:\Program Files\ClaudeCode\

      The legacy Windows path C:\ProgramData\ClaudeCode\managed-settings.json is no longer supported as of v2.1.75.

      File-based managed settings also support a drop-in directory at managed-settings.d/ in the same system directory alongside managed-settings.json.

      Following the systemd convention, managed-settings.json is merged first as the base, then all *.json files in the drop-in directory are sorted alphabetically and merged on top. Later files override earlier ones for scalar values; arrays are concatenated and de-duplicated; objects are deep-merged. Hidden files starting with . are ignored.

      Use numeric prefixes to control merge order, for example 10-telemetry.json and 20-security.json.

  • Other configuration is stored in ~/.claude.json. This file contains your OAuth session, MCP server configurations for user and local scopes, per-project state (allowed tools, trust settings), and various caches. Project-scoped MCP servers are stored separately in .mcp.json.

Claude Code automatically creates timestamped backups of configuration files and retains the five most recent backups to prevent data loss.

json
{
  "$schema": "https://json.schemastore.org/claude-code-settings.json",
  "permissions": {
    "allow": [
      "Bash(npm run lint)",
      "Bash(npm run test *)",
      "Read(~/.zshrc)"
    ],
    "deny": [
      "Bash(curl *)",
      "Read(./.env)",
      "Read(./.env.*)",
      "Read(./secrets/**)"
    ]
  },
  "env": {
    "CLAUDE_CODE_ENABLE_TELEMETRY": "1",
    "OTEL_METRICS_EXPORTER": "otlp"
  },
  "companyAnnouncements": [
    "Welcome to Acme Corp! Review our code guidelines at docs.acme.com",
    "Reminder: Code reviews required for all PRs",
    "New security policy in effect"
  ]
}

When edits take effect

Claude Code watches your settings files and reloads them when they change, so edits to most keys apply to the running session without a restart. This includes permissions, hooks, and credential helpers like apiKeyHelper. The reload covers user, project, local, and managed settings, and the ConfigChange hook fires for each detected change.

A few keys are read once at session start and apply on the next restart instead:

  • model: use /model to switch mid-session
  • outputStyle: part of the system prompt, which is rebuilt on /clear or restart

Available settings

settings.json supports a number of options:

KeyDescriptionExample
agentRun the main thread as a named subagent"code-reviewer"
allowedChannelPlugins(Managed) Allowlist of channel plugins that may push messages[{ "marketplace": "claude-plugins-official", "plugin": "telegram" }]
allowedHttpHookUrlsAllowlist of URL patterns that HTTP hooks may target["https://hooks.example.com/*"]
allowedMcpServersWhen set in managed-settings.json, allowlist of MCP servers users can configure[{ "serverName": "github" }]
allowManagedHooksOnly(Managed) Only managed hooks, SDK hooks, and force-enabled plugin hooks are loadedtrue
allowManagedMcpServersOnly(Managed) Only admin-defined allowlist of MCP servers appliestrue
allowManagedPermissionRulesOnly(Managed) Only rules in managed settings applytrue
alwaysThinkingEnabledEnable extended thinking by default for all sessionstrue
apiKeyHelperCustom script to generate an auth value/bin/generate_temp_api_key.sh
attributionCustomize attribution for git commits and pull requests{"commit": "... Generated with Claude Code", "pr": ""}
autoMemoryDirectoryCustom directory for auto memory storage"~/my-memory-dir"
autoMemoryEnabledEnable auto memoryfalse
autoModeCustomize what the auto mode classifier blocks and allows{"soft_deny": ["$defaults", "Never run terraform apply"]}
autoScrollEnabledIn fullscreen rendering, follow new output to the bottomfalse
autoUpdatesChannelRelease channel to follow for updates"stable"
availableModelsRestrict which models users can select["sonnet", "haiku"]
awaySummaryEnabledShow a one-line session recap when you return after a few minutes awaytrue
awsAuthRefreshCustom script that modifies the .aws directoryaws sso login --profile myprofile
awsCredentialExportCustom script that outputs JSON with AWS credentials/bin/generate_aws_grant.sh
blockedMarketplaces(Managed) Blocklist of marketplace sources[{ "source": "github", "repo": "untrusted/plugins" }]
channelsEnabled(Managed) Allow channels for the organizationtrue
claudeMd(Managed) CLAUDE.md-style instructions injected as organization-managed memory"Always run make lint before committing."
claudeMdExcludesGlob patterns or absolute paths of CLAUDE.md files to skip["**/vendor/**/CLAUDE.md"]
cleanupPeriodDaysSession files older than this period are deleted at startup (default: 30)20
companyAnnouncementsAnnouncement to display to users at startup["Welcome to Acme Corp!"]
defaultShellDefault shell for input-box ! commands"powershell"
deniedMcpServers(Managed) Denylist of MCP servers explicitly blocked[{ "serverName": "filesystem" }]
disableAgentViewTurn off background agents and agent viewtrue
disableAllHooksDisable all hooks and custom status linetrue
disableAutoModePrevent auto mode from being activated"disable"
disableDeepLinkRegistrationPrevent registering the claude-cli:// protocol handler"disable"
disabledMcpjsonServersList of specific MCP servers from .mcp.json files to reject["filesystem"]
disableRemoteControlDisable Remote Control (min v2.1.128)true
disableSkillShellExecutionDisable inline shell execution for skills and custom commandstrue
editorModeKey binding mode for the input prompt"vim"
effortLevelPersist the effort level across sessions"xhigh"
enableAllProjectMcpServersAutomatically approve all MCP servers defined in project .mcp.jsontrue
enabledMcpjsonServersList of specific MCP servers from .mcp.json to approve["memory", "github"]
envEnvironment variables applied to every session and subprocesses{"FOO": "bar"}
fastModePerSessionOptInWhen true, fast mode does not persist across sessionstrue
feedbackSurveyRateProbability (0-1) that the session quality survey appears0.05
fileSuggestionConfigure a custom script for @ file autocomplete{"type": "command", "command": "~/.claude/file-suggestion.sh"}
forceLoginMethodRestrict login to claudeai or consoleclaudeai
forceLoginOrgUUIDRequire login to belong to a specific organization"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
forceRemoteSettingsRefresh(Managed) Block CLI startup until remote managed settings are freshly fetchedtrue
gcpAuthRefreshCustom script that refreshes GCP Application Default Credentialsgcloud auth application-default login
hooksConfigure custom commands to run at lifecycle eventsSee hooks docs
httpHookAllowedEnvVarsAllowlist of environment variable names HTTP hooks may interpolate["MY_TOKEN", "HOOK_SECRET"]
includeCoAuthoredByDeprecated: Use attribution insteadfalse
includeGitInstructionsInclude built-in commit and PR workflow instructions in system promptfalse
languageConfigure Claude's preferred response language"japanese"
maxSkillDescriptionCharsPer-skill character cap on description text (min v2.1.105)2048
minimumVersionFloor that prevents installing a version below this one"2.1.100"
modelOverride the default model to use"claude-sonnet-4-6"
modelOverridesMap Anthropic model IDs to provider-specific model IDs{"claude-opus-4-6": "arn:aws:bedrock:..."}
otelHeadersHelperScript to generate dynamic OpenTelemetry headers/bin/generate_otel_headers.sh
outputStyleConfigure an output style to adjust the system prompt"Explanatory"
parentSettingsBehavior(Managed) Controls parent-supplied settings behavior (min v2.1.133)"merge"
permissionsPermission rules structureSee table below
plansDirectoryCustomize where plan files are stored"./plans"
pluginTrustMessage(Managed) Custom message appended to plugin trust warning"All plugins from our marketplace are approved by IT"
policyHelperAdmin-deployed executable that computes managed settings dynamically (min v2.1.136){"path": "/usr/local/bin/claude-policy"}
preferredNotifChannelMethod for task-complete and permission-prompt notifications"terminal_bell"
prefersReducedMotionReduce or disable UI animations for accessibilitytrue
prUrlTemplateURL template for the PR badge"https://reviews.example.com/{owner}/{repo}/pull/{number}"
respectGitignoreControl whether the @ file picker respects .gitignore patternsfalse
showClearContextOnPlanAcceptShow the "clear context" option on plan accept screentrue
showThinkingSummariesShow extended thinking summaries in interactive sessionstrue
showTurnDurationShow turn duration messages after responsesfalse
skillListingBudgetFractionFraction of context window reserved for skill listing (min v2.1.105)0.02
skillOverridesPer-skill visibility overrides (min v2.1.129){"legacy-context": "name-only", "deploy": "off"}
skipWebFetchPreflightSkip the WebFetch domain safety checktrue
spinnerTipsEnabledShow tips in the spinner while Claude is workingfalse
spinnerTipsOverrideOverride spinner tips with custom strings{ "excludeDefault": true, "tips": ["Use our internal tool X"] }
spinnerVerbsCustomize the action verbs shown while a turn is in progress{"mode": "append", "verbs": ["Pondering", "Crafting"]}
sshConfigsSSH connections to show in Desktop environment dropdown[{"id": "dev-vm", "name": "Dev VM", "sshHost": "user@dev.example.com"}]
statusLineConfigure a custom status line to display context{"type": "command", "command": "~/.claude/statusline.sh"}
strictKnownMarketplaces(Managed) Allowlist of plugin marketplace sources[{ "source": "github", "repo": "acme-corp/plugins" }]
syntaxHighlightingDisabledDisable syntax highlighting in diffs, code blocks, and file previewstrue
teammateModeHow agent team teammates display"in-process"
terminalProgressBarEnabledShow the terminal progress bar in supported terminalsfalse
tuiTerminal UI renderer"fullscreen"
useAutoModeDuringPlanWhether plan mode uses auto mode semantics when availablefalse
viewModeDefault transcript view mode on startup"verbose"
voiceVoice dictation settings{ "enabled": true, "mode": "tap" }
voiceEnabledLegacy alias for voice.enabledtrue
wslInheritsWindowsSettings(Windows managed) WSL reads managed settings from Windows policy chaintrue

Global config settings

These settings are stored in ~/.claude.json rather than settings.json. Adding them to settings.json will trigger a schema validation error.

KeyDescriptionExample
autoConnectIdeAutomatically connect to a running IDE when starting from external terminaltrue
autoInstallIdeExtensionAutomatically install the Claude Code IDE extension when running from a VS Code terminalfalse
externalEditorContextPrepend Claude's previous response as #-commented context when opening external editor with Ctrl+Gtrue
teammateDefaultModelDefault model for agent team teammates when spawn prompt doesn't specify one"sonnet"

Worktree settings

Configure how --worktree creates and manages git worktrees.

KeyDescriptionExample
worktree.baseRefWhich ref new worktrees branch from ("fresh" or "head")"head"
worktree.symlinkDirectoriesDirectories to symlink from main repository into each worktree["node_modules", ".cache"]
worktree.sparsePathsDirectories to check out via git sparse-checkout["packages/my-app", "shared/utils"]
worktree.bgIsolationIsolation mode for background sessions (min v2.1.143)"none"

To copy gitignored files like .env into new worktrees, use a .worktreeinclude file in your project root instead of a setting.

Permission settings

KeysDescriptionExample
allowArray of permission rules to allow tool use[ "Bash(git diff *)" ]
askArray of permission rules to ask for confirmation[ "Bash(git push *)" ]
denyArray of permission rules to deny tool use[ "WebFetch", "Bash(curl *)", "Read(./.env)" ]
additionalDirectoriesAdditional working directories for file access[ "../docs/" ]
defaultModeDefault permission mode when opening Claude Code"acceptEdits"
disableBypassPermissionsModePrevent bypassPermissions mode from being activated"disable"
skipDangerousModePermissionPromptSkip confirmation prompt before entering bypass permissions modetrue

Permission rule syntax

Permission rules follow the format Tool or Tool(specifier). Rules are evaluated in order: deny rules first, then ask, then allow. The first matching rule wins.

RuleEffect
BashMatches all Bash commands
Bash(npm run *)Matches commands starting with npm run
Read(./.env)Matches reading the .env file
WebFetch(domain:example.com)Matches fetch requests to example.com

Sandbox settings

Configure advanced sandboxing behavior. Sandboxing isolates bash commands from your filesystem and network.

KeysDescriptionExample
enabledEnable bash sandboxing (macOS, Linux, and WSL2)true
failIfUnavailableExit with error at startup if sandbox cannot starttrue
autoAllowBashIfSandboxedAuto-approve bash commands when sandboxedtrue
excludedCommandsCommands that should run outside of the sandbox["docker *"]
allowUnsandboxedCommandsAllow commands to run outside the sandbox via dangerouslyDisableSandbox parameterfalse
filesystem.allowWriteAdditional paths where sandboxed commands can write["/tmp/build", "~/.kube"]
filesystem.denyWritePaths where sandboxed commands cannot write["/etc", "/usr/local/bin"]
filesystem.denyReadPaths where sandboxed commands cannot read["~/.aws/credentials"]
filesystem.allowReadPaths to re-allow reading within denyRead regions["."]
filesystem.allowManagedReadPathsOnly(Managed) Only managed allowRead paths are respectedtrue
network.allowUnixSockets(macOS only) Unix socket paths accessible in sandbox["~/.ssh/agent-socket"]
network.allowAllUnixSocketsAllow all Unix socket connections in sandboxtrue
network.allowLocalBindingAllow binding to localhost ports (macOS only)true
network.allowMachLookupAdditional XPC/Mach service names the sandbox may look up (macOS only)["com.apple.coresimulator.*"]
network.allowedDomainsArray of domains to allow for outbound network traffic["github.com", "*.npmjs.org"]
network.deniedDomainsArray of domains to block for outbound network traffic["sensitive.cloud.example.com"]
network.allowManagedDomainsOnly(Managed) Only managed allowedDomains are respectedtrue
network.httpProxyPortHTTP proxy port8080
network.socksProxyPortSOCKS5 proxy port8081
enableWeakerNestedSandboxEnable weaker sandbox for unprivileged Docker environmentstrue
enableWeakerNetworkIsolation(macOS only) Allow access to system TLS trust service in sandboxtrue
bwrapPath(Managed, Linux/WSL2) Absolute path to bubblewrap binary/opt/admin/bwrap
socatPath(Managed, Linux/WSL2) Absolute path to socat binary/opt/admin/socat

Sandbox path prefixes

Paths in filesystem.allowWrite, filesystem.denyWrite, filesystem.denyRead, and filesystem.allowRead support these prefixes:

PrefixMeaningExample
/Absolute path from filesystem root/tmp/build stays /tmp/build
~/Relative to home directory~/.kube becomes $HOME/.kube
./ or no prefixRelative to project root for project settings, or to ~/.claude for user settings./output in .claude/settings.json resolves to <project-root>/output

Configuration example:

json
{
  "sandbox": {
    "enabled": true,
    "autoAllowBashIfSandboxed": true,
    "excludedCommands": ["docker *"],
    "filesystem": {
      "allowWrite": ["/tmp/build", "~/.kube"],
      "denyRead": ["~/.aws/credentials"]
    },
    "network": {
      "allowedDomains": ["github.com", "*.npmjs.org", "*.example.com"]
    }
  }
}

Windows sandbox settings

Claude Code does not currently support sandboxing on native Windows. The sandbox settings documented above apply to macOS, Linux, and WSL2 only.

Attribution settings

Customize attribution for git commits and pull requests:

KeyDescriptionExample
attribution.commitFooter added to Claude-generated commits. Set to "" to suppress entirely"... Generated with Claude Code"
attribution.prFooter added to Claude-generated pull requests. Set to "" to suppress entirely"Created with Claude Code"
json
{
  "attribution": {
    "commit": "... Generated with Claude Code",
    "pr": "Created with Claude Code"
  }
}

File suggestion settings

Configure a custom script for @ file autocomplete:

json
{
  "fileSuggestion": {
    "type": "command",
    "command": "~/.claude/file-suggestion.sh"
  }
}

The script receives the partial path as $1 and should output one suggestion per line.

Hook configuration

Configure custom commands to run at lifecycle events. See the hooks documentation for format and available events.

Settings precedence

Settings are merged across scopes in this priority order:

  1. Managed (highest priority)
  2. Command line arguments
  3. Local
  4. Project
  5. User (lowest priority)

Permission rules merge across scopes rather than override — all allow, ask, and deny rules from all scopes are combined. Managed settings can use allowManagedPermissionRulesOnly to restrict which scopes can define permission rules.

Compute managed settings with a policy helper

The policyHelper setting (min v2.1.136) specifies an admin-deployed executable that computes managed settings dynamically at startup. Only honored from MDM or a system managed-settings.json file. The executable should output JSON to stdout matching the managed settings format.

json
{
  "policyHelper": {
    "path": "/usr/local/bin/claude-policy"
  }
}

The policy helper runs at startup and its output is merged with static managed settings, with the policy helper's output taking precedence.

AI 落地咨询
艾维禾砺数字科技

企业 AI 落地全链路服务

Agent 开发工作流搭建Claude Code 集成
微信咨询
d187l8801b6124
访问官网 ivheli.com