Claude Code sessions erase after 30 days by default Anthropic's Claude Code erases sessions after 30 days by default, with configuration scopes including Managed, User, Project, and Local settings that determine how configurations apply and who they are shared with. /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 | Scope | Location | Who it affects | Shared with team? | |---|---|---|---| Managed | Server-managed settings, plist / registry, or system-level managed-settings.json | All users on the machine | Yes deployed by IT | User | ~/.claude/ directory | You, across all projects | No | Project | .claude/ in repository | All collaborators on this repository | Yes committed to git | Local | .claude/settings.local.json | You, in this repository only | No gitignored when Claude Code creates it | 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: Managed highest - can’t be overridden by anything Command line arguments - temporary session overrides Local - overrides project and user settings Project - overrides user settings User lowest - applies when nothing else specifies the setting 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. See Settings precedence settings-precedence . What uses scopes Scopes apply to many Claude Code features:| Feature | User location | Project location | Local 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.md | CLAUDE.md or .claude/CLAUDE.md | CLAUDE.local.md | ~/.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 that are 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. When Claude Code creates .claude/settings.local.json , it configures git to ignore the file. If you create the file yourself, add it to your gitignore manually. - Managed settings : For organizations that need centralized control, Claude Code supports multiple delivery mechanisms for managed settings. All use the same JSON format and cannot be overridden by user or project settings:- Server-managed settings : delivered from Anthropic’s servers via the Claude.ai admin console. See server-managed settings /docs/en/server-managed-settings . - MDM/OS-level policies : delivered through native device management on macOS and Windows:- macOS: com.anthropic.claudecode managed preferences domain. The plist’s top-level keys mirror managed-settings.json , with nested settings as dictionaries and arrays as plist arrays. Deploy via configuration profiles in Jamf, Iru Kandji , or similar MDM tools. - Windows: HKLM\SOFTWARE\Policies\ClaudeCode registry key with a Settings value REG SZ or REG EXPAND SZ containing JSON deployed via Group Policy or Intune - Windows user-level : HKCU\SOFTWARE\Policies\ClaudeCode lowest policy priority, only used when no admin-level source exists - macOS: - 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\ managed-settings.d/ in the same system directory alongside managed-settings.json . This lets separate teams deploy independent policy fragments without coordinating edits to a single file. 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 . - macOS: managed settings /docs/en/permissions managed-only-settings and Managed MCP configuration /docs/en/managed-mcp for details. This repository https://github.com/anthropics/claude-code/tree/main/examples/mdm includes starter deployment templates for Jamf, Iru Kandji , Intune, and Group Policy. Use these as starting points and adjust them to fit your needs.Managed deployments can also restrict plugin marketplace additions using strictKnownMarketplaces . For more information, see Managed marketplace restrictions /docs/en/plugin-marketplaces managed-marketplace-restrictions . - - Other configuration is stored in ~/.claude.json . This file contains your OAuth session, MCP server /docs/en/mcp 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. Example settings.json $schema line in the example above points to the official JSON schema https://json.schemastore.org/claude-code-settings.json for Claude Code settings. Adding it to your settings.json enables autocomplete and inline validation in VS Code, Cursor, and any other editor that supports JSON schema validation. The published schema is updated periodically and may not include settings added in the most recent CLI releases, so a validation warning on a recently documented field does not necessarily mean your configuration is invalid. 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 fires for each detected change. A few keys are read once at session start and apply on the next restart instead: /docs/en/hooks configchange ConfigChange hook model : useto switch mid-session /model : part of the system prompt, which is rebuilt on outputStyle /clear or restart Invalid entries in managed settings Managed settings parse tolerantly. When a managed configuration contains an entry that fails schema validation, Claude Code strips that entry, records a warning, and enforces every remaining valid policy. A single typo cannot disable the rest of your organization’s policy. This behavior is consistent across all three delivery mechanisms: server-managed settings /docs/en/server-managed-settings , plist and registry policies deployed through MDM, and managed-settings.json files. Requires Claude Code v2.1.169 or later. Security-enforcement fields are handled per field instead of being stripped wholesale when they are present but invalid: | Field | Behavior when present but invalid | |---|---| allowedMcpServers | Enforced as an empty allowlist, so no MCP servers are admitted until the value is fixed. An individual invalid entry is stripped and the valid subset is enforced. | allowManagedMcpServersOnly | Treated as true . | availableModels | Enforced as an empty allowlist, so only the Default model is available until the value is fixed. An individual non-string entry is stripped and the valid subset is enforced. Applies in v2.1.175 and later. | enforceAvailableModels | Treated as true . Applies in v2.1.175 and later. | forceLoginOrgUUID | No organization is permitted to log in until the value is fixed. | deniedMcpServers | An individual invalid entry is stripped and the valid subset is enforced. A wholly invalid value is dropped with a warning, since denying every server would block servers the policy never named. | requiredMinimumVersion and requiredMaximumVersion fail open by design: an invalid value is stripped rather than enforced, so a bad policy push cannot prevent Claude Code from starting. Validation errors surface in three places: - Interactive sessions show a dialog at startup listing the invalid entries. - Headless runs with -p print a summary to stderr. lists each invalid entry with its source and field. claude doctor claude doctor on a test machine before deploying them fleet-wide. This tolerance applies only to managed settings. User, project, and local settings files remain strict: a file that fails validation is rejected as a whole and reported. Available settings settings.json supports a number of options: | Key | Description | Example | |---|---|---| advisorModel | Model for the server-side "opus" , "sonnet" , or "fable" v2.1.170+ , or a full model ID. Written automatically when you run /advisor . Unset to disable the advisor. Requires Claude Code v2.1.98 or later | "opus" agent claude agents . Applies that subagent’s system prompt, tool restrictions, and model. See Invoke subagents explicitly /docs/en/sub-agents invoke-subagents-explicitly "code-reviewer" agentPushNotifEnabled Remote Control /docs/en/remote-control is connected, allow Claude to send proactive push notifications to your phone, for example when a long task finishes. Default: false . Appears in /config as Push when Claude decides . See Mobile push notifications /docs/en/remote-control mobile-push-notifications . Requires Claude Code v2.1.119 or later true allowAllClaudeAiMcps managed-mcp.json , which otherwise takes exclusive control and suppresses them. See Managed MCP configuration /docs/en/managed-mcp true allowedChannelPlugins channelsEnabled: true . See Restrict which channel plugins can run /docs/en/channels restrict-which-channel-plugins-can-run { "marketplace": "claude-plugins-official", "plugin": "telegram" } allowedHttpHookUrls as a wildcard. When set, hooks with non-matching URLs are blocked. Undefined = no restriction, empty array = block all HTTP hooks. Arrays merge across settings sources. See Hook configuration hook-configuration "https://hooks.example.com/ " allowedMcpServers Managed MCP configuration /docs/en/managed-mcp { "serverName": "github" } allowManagedHooksOnly enabledPlugins are loaded. User, project, and all other plugin hooks are blocked. See Hook configuration hook-configuration true allowManagedMcpServersOnly allowedMcpServers from managed settings are respected. deniedMcpServers still merges from all sources. Users can still add MCP servers, but only the admin-defined allowlist applies. See Managed MCP configuration /docs/en/managed-mcp true allowManagedPermissionRulesOnly allow , ask , or deny permission rules. Only rules in managed settings apply. See Managed-only settings /docs/en/permissions managed-only-settings true alwaysThinkingEnabled extended thinking /docs/en/model-config extended-thinking by default for all sessions. Typically configured via the /config command rather than editing directly. To force thinking off regardless of this setting, set in /docs/en/env-vars MAX THINKING TOKENS=0 env , which disables thinking on the Anthropic API except on Fable 5, which cannot have thinking turned off. On third-party providers /docs/en/third-party-integrations this omits the thinking parameter instead, and adaptive-reasoning models may still think true apiKeyHelper /bin/sh , to generate an auth value. This value will be sent as X-Api-Key and Authorization: Bearer headers for model requests. Set the refresh interval with CLAUDE CODE API KEY HELPER TTL MS /bin/generate temp api key.sh attribution Attribution settings attribution-settings {"commit": "🤖 Generated with Claude Code", "pr": ""} autoCompactEnabled true . Appears in /config as Auto-compact . To disable via environment variable, set in /docs/en/env-vars DISABLE AUTO COMPACT env false autoMemoryDirectory auto memory /docs/en/memory storage-location storage. Accepts an absolute path or a ~/ -prefixed path. From project or local settings, this is honored only after you accept the workspace trust dialog, since a cloned repository can supply this file "~/my-memory-dir" autoMemoryEnabled auto memory /docs/en/memory enable-or-disable-auto-memory . When false , Claude does not read from or write to the auto memory directory. Default: true . You can also toggle this with /memory during a session. To disable via environment variable, set in /docs/en/env-vars CLAUDE CODE DISABLE AUTO MEMORY env false autoMode auto mode /docs/en/permission-modes eliminate-prompts-with-auto-mode classifier blocks and allows. Contains environment , allow , soft deny , and hard deny arrays of prose rules. Include the literal string "$defaults" in an array to inherit the built-in rules at that position. See Configure auto mode /docs/en/auto-mode-config . Not read from shared project settings {"soft deny": "$defaults", "Never run terraform apply" } autoScrollEnabled fullscreen rendering /docs/en/fullscreen , follow new output to the bottom of the conversation. Default: true . Appears in /config as Auto-scroll . Permission prompts still scroll into view when this is off false autoUpdatesChannel "stable" for a version that is typically about one week old and skips versions with major regressions, or "latest" default for the most recent release. To disable auto-updates entirely, set in /docs/en/setup disable-auto-updates DISABLE AUTOUPDATER env "stable" availableModels subagents /docs/en/sub-agents , and the advisor /docs/en/advisor . See Restrict model selection /docs/en/model-config restrict-model-selection . See enforceAvailableModels to also constrain Default "sonnet", "haiku" awaySummaryEnabled false or turn off Session recap in /config to disable. Same as CLAUDE CODE ENABLE AWAY SUMMARY true awsAuthRefresh .aws directory see advanced credential configuration /docs/en/amazon-bedrock advanced-credential-configuration aws sso login --profile myprofile awsCredentialExport advanced credential configuration /docs/en/amazon-bedrock advanced-credential-configuration /bin/generate aws grant.sh blockedMarketplaces Managed marketplace restrictions /docs/en/plugin-marketplaces managed-marketplace-restrictions { "source": "github", "repo": "untrusted/plugins" } channelsEnabled channels /docs/en/channels for the organization. On claude.ai Team and Enterprise plans, channels are blocked when this is unset or false . For Anthropic Console /docs/en/authentication claude-console-authentication accounts using API key authentication, channels are allowed by default unless your organization deploys managed settings, in which case this key must be set to true true claudeMd organization-wide CLAUDE.md /docs/en/memory deploy-organization-wide-claude-md "Always run make lint before committing." claudeMdExcludes CLAUDE.md files to skip when loading memory /docs/en/memory . Patterns match against absolute file paths. Only applies to user, project, and local memory; managed policy files cannot be excluded " /vendor/ /CLAUDE.md" cleanupPeriodDays 0 is rejected with a validation error. Also controls the age cutoff for automatic removal of orphaned subagent worktrees /docs/en/worktrees clean-up-worktrees at startup. To disable transcript writes entirely, set the environment variable, or in non-interactive mode /docs/en/env-vars CLAUDE CODE SKIP PROMPT HISTORY -p use the --no-session-persistence flag or the persistSession: false SDK option. 20 companyAnnouncements "Welcome to Acme Corp Review our code guidelines at docs.acme.com" defaultShell commands. Accepts "bash" default or "powershell" . Setting "powershell" routes interactive commands through PowerShell on Windows. Requires CLAUDE CODE USE POWERSHELL TOOL=1 . See PowerShell tool /docs/en/tools-reference powershell-tool "powershell" deniedMcpServers Managed MCP configuration /docs/en/managed-mcp { "serverName": "filesystem" } disableAgentView true to turn off background agents and agent view /docs/en/agent-view : claude agents , --bg , /background , and the on-demand supervisor. Typically set in managed settings /docs/en/permissions managed-settings . Equivalent to setting CLAUDE CODE DISABLE AGENT VIEW to 1 true disableAllHooks hooks /docs/en/hooks and any custom status line /docs/en/statusline true disableAutoMode "disable" to prevent auto mode /docs/en/permission-modes eliminate-prompts-with-auto-mode from being activated. Removes auto from the Shift+Tab cycle and rejects --permission-mode auto at startup. Most useful in managed settings /docs/en/permissions managed-settings where users cannot override it "disable" disableBundledSkills true to disable the skills /docs/en/skills and workflows that ship with Claude Code: bundled skills and workflows are removed entirely, while built-in slash commands like /init stay typable but are hidden from the model. Skills from plugins, .claude/skills/ , and .claude/commands/ are unaffected. Equivalent to setting CLAUDE CODE DISABLE BUNDLED SKILLS to 1 true disableDeepLinkRegistration "disable" to prevent Claude Code from registering the claude-cli:// protocol handler with the operating system on startup. Deep links /docs/en/deep-links let external tools open a Claude Code session with a pre-filled prompt. Useful in environments where protocol handler registration is restricted or managed separately "disable" disabledMcpjsonServers .mcp.json files to reject "filesystem" disableRemoteControl Remote Control /docs/en/remote-control : blocks claude remote-control , the --remote-control flag, auto-start, and the in-session toggle. Typically placed in managed settings /docs/en/permissions managed-settings for per-device MDM enforcement, but works from any scope. Requires Claude Code v2.1.128 or later true disableSkillShellExecution ... and blocks in skills /docs/en/skills and custom commands from user, project, plugin, or additional-directory sources. Commands are replaced with shell command execution disabled by policy instead of being run. Bundled and managed skills are not affected. Most useful in managed settings /docs/en/permissions managed-settings where users cannot override it true disableWorkflows dynamic workflows /docs/en/workflows turn-workflows-off and the bundled workflow commands. Default: false . Equivalent to setting CLAUDE CODE DISABLE WORKFLOWS to 1 true editorMode "normal" or "vim" . Default: "normal" . Appears in /config as Editor mode "vim" effortLevel effort level /docs/en/model-config adjust-effort-level across sessions. Accepts "low" , "medium" , "high" , or "xhigh" . Written automatically when you run /effort with one of those values. --effort and override this for one session. See /docs/en/env-vars CLAUDE CODE EFFORT LEVEL Adjust effort level /docs/en/model-config adjust-effort-level for supported models "xhigh" enableAllProjectMcpServers .mcp.json files true enabledMcpjsonServers .mcp.json files to approve "memory", "github" enforceAvailableModels true and availableModels is a non-empty list in managed or policy settings, the Default model is also constrained to the allowlist. See Restrict model selection /docs/en/model-config restrict-model-selection for details and the merge behavior /docs/en/model-config merge-behavior when availableModels is set at multiple levels. Requires Claude Code v2.1.175 or later true env NO COLOR and FORCE COLOR set here are passed to subprocesses but do not change Claude Code’s own interface colors. Set those in your shell before launching claude to change interface colors {"FOO": "bar"} fallbackModel "default" expands to the default model. Chains are capped at three models; extra entries are ignored. Unlike most array settings, this key does not merge across settings files: the highest-precedence file that defines it supplies the entire chain. The flag overrides this for one session. See /docs/en/cli-reference cli-flags --fallback-model Fallback model chains /docs/en/model-config fallback-model-chains "claude-sonnet-4-6", "claude-haiku-4-5" fastModePerSessionOptIn true , fast mode does not persist across sessions. Each session starts with fast mode off, requiring users to enable it with /fast . The user’s fast mode preference is still saved. See Require per-session opt-in /docs/en/fast-mode require-per-session-opt-in true feedbackSurveyRate session quality survey /docs/en/data-usage session-quality-surveys appears when eligible. Set to 0 to suppress entirely, or set in /docs/en/env-vars CLAUDE CODE DISABLE FEEDBACK SURVEY env . Useful when using Bedrock, Vertex, or Foundry where the default sample rate does not apply 0.05 fileCheckpointingEnabled can restore them. Default: /docs/en/checkpointing /rewind true . Appears in /config as Rewind code checkpoints . To disable via environment variable, set in /docs/en/env-vars CLAUDE CODE DISABLE FILE CHECKPOINTING env false fileSuggestion @ file autocomplete. See File suggestion settings file-suggestion-settings {"type": "command", "command": "~/.claude/file-suggestion.sh"} footerLinksRegexes pattern , a url template with {name} placeholders filled from named capture groups, and an optional label . Read from user, --settings flag, and managed settings only. See Footer link badges footer-link-badges for URL constraints, scheme allowlist, and limits. Requires Claude Code v2.1.176 or later {"type": "regex", "pattern": "\\b ?