Claude Settings JSON
Find Claude Code’s settings.json, see which file wins, and copy five examples for permissions, hooks, models, the status line and compaction.
Published

Put a team's agreed Claude Code permissions in .claude/settings.json and commit the file. The next developer who clones the repository can review the same rules in the same place. Keep your own default model in ~/.claude/settings.json. That small tilde is the difference between changing your workday and changing everyone else's.
Where does Claude Code look for settings.json?
Who should inherit this change? If six developers would each spend ten minutes copying the same setup, that is one staff-hour of duplicate work. With a shared file, one developer proposes the change, another reviews it, and the next clone includes it. The table shows which source wins for an ordinary single value on your machine, highest priority first. The terminal and editor integrations use the same files. Settings files and precedence
For example, suppose your user file selects Sonnet and the project file selects Opus. A session started at the project root gets Opus. Put Sonnet in your local file and your clone goes back to Sonnet while your teammate keeps Opus, assuming no higher source or model override applies. Think of these as defaults written in the margins of the same form: a more specific entry changes one field. You still inherit the other fields.
Start Claude Code at the repository root to load the shared file there. It reads shared settings from the session's primary working directory. The local file usually lives at the Git root, or at the main checkout for a worktree. On Windows, outside Git, in a home-directory repository, or when ownership checks fail, Claude Code looks beside the shared file instead. It can also read a local file left in a launch subdirectory by an older version. To relocate your user configuration, set CLAUDE_CONFIG_DIR before launch.
Where administrators put managed settings
An administrator can place extra JSON files in a sibling managed-settings.d/ directory. Claude Code reads the base file first, then the visible *.json files in alphabetical order. Policy can also arrive from the organization's server, a macOS device-management profile or Windows registry policy. A host application can supply managed settings too. If the system file is missing, check the active sources before assuming the machine has no policy. Managed settings deployment
A commented example you can copy
Here is a complete project file for a team whose foreground checks need a three-minute timeout. Claude Code requires strict JSON, so the comments sit directly below the file. Save just the contents of the box as .claude/settings.json.
{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"permissions": {
"allow": ["Bash(git status)"],
"deny": ["Read(./.env)"]
},
"env": {
"BASH_DEFAULT_TIMEOUT_MS": "180000"
}
}$schemagives a compatible editor autocomplete and validation as you type. A trailing comma or an inline comment makes the JSON invalid.permissionsrecords two narrow decisions. Claude can run the exact status command, and its file-reading tool must leave the named environment file alone. Review the scope of each rule before sharing it.envsupplies named environment variables to the session and its subprocesses. Values here are strings. In this example,"180000"sets the default foreground command timeout in milliseconds. Use a shared value only if teammates want that timing too. Environment variable reference
Five settings snippets for real sessions
Each snippet is a complete JSON object you can use in an empty settings file. In an existing file, merge the relevant entries into the object you already have. Keep each top-level key only once. The settings reference lists the supported scopes for each key.
1. Give reviewers the same permission rules
A repository owner can review this pair once in a pull request. It gives colleagues a precise answer when they ask which command the team approved or which file the Read tool should skip.
{"permissions":{"allow":["Bash(git status)"],"deny":["Read(./.env)"]}}
Permission lists can combine across files. A local allow list therefore needn't erase a shared deny list. When rules match an action, Claude Code checks deny, then ask, then allow. Adding a local allow for the same read won't cancel the deny. The rule here covers a named file and tool. Keep credentials outside the repository and use operating-system controls when you need to restrict access across programs. Permission rule evaluation
2. Give a fresh session the current Git branch
A release engineer moving between checked-out branches can have Claude start with the actual branch name. A hook is a command that runs at a named event. This one asks Git for the current branch when a new session opens, while you have a named branch checked out.
{
"hooks": {
"SessionStart": [{
"matcher": "startup",
"hooks": [{
"type": "command",
"command": "git branch --show-current"
}]
}]
}
}Claude receives the command's printed output as context. The startup matcher limits it to fresh sessions. Try the hook locally, then share it if the whole team needs the branch at startup. Review any script a shared hook invokes as carefully as the hook itself. SessionStart hook reference · More hook events and examples

3. Start your own projects with Sonnet
A consultant switching between client repositories can put this in the user file once. Use the local file instead if the choice belongs to one engagement.
{"model":"sonnet"}
The alias chooses the Sonnet model available through your provider. Its underlying version can change. If a team needs to repeat an evaluation against a particular version, record an available full model ID. Model aliases and selection
4. Show which model is actually working
When pairing with a colleague, put the active model's name below the prompt so either person can see a session switch. On a machine with the JSON reader jq installed, this personal setting reads the display name from the session data Claude Code sends to the command.
{"statusLine":{"type":"command","command":"jq -r .model.display_name"}}
The model key chooses a default. The status line reports what the current session is using. Keeping the status line in your user file also keeps your choice of terminal utility off everyone else's machine. Status line input and examples

5. Try an earlier summary during a long migration
An engineer working through a large migration can try a smaller auto-compact window in the local file. Compaction condenses older conversation into a summary so work can continue. On a model with a larger default window, this is a way to see how well the migration survives an earlier handoff.
{"autoCompactEnabled":true,"autoCompactWindow":100000}
The window is measured in tokens, the units a model uses to process text. The minimum accepted value is 100,000. Claude Code caps it at the model's context capacity. Keep exact acceptance criteria and remaining tasks in the repository so the next step doesn't depend on a summary retaining every detail. How Claude Code auto-compaction works

What belongs in settings.json, CLAUDE.md and .mcp.json?
Commit the shared definitions and the scripts they depend on. Keep credentials in the team's credential store. Keep private experiments in .claude/settings.local.json. Claude Code excludes that file from Git when it creates it. If you create it yourself, add it to .gitignore. The similarly named ~/.claude.json holds Claude Code's own account and project state. Leave that file to the application.
How to check what actually loaded
- Start Claude Code from the directory containing the team's
.claude/folder. Run/statusand read Setting sources. It lists active, nonempty sources. A managed entry also identifies the delivery method. - For a tool permission, open
/permissions. Find the rule and the file that supplied it. Check for matching deny and ask rules, and whether the user has trusted the project for its shared allow rules. - If a source is missing or an entry seems ineffective, run
claude doctorfrom the shell to see what Claude Code rejected. Correct the path, syntax or value it identifies. For a model surprise, also check the launch flag and the shell'sANTHROPIC_MODELvariable. They can change the model you see even when the file loaded.
Two tools worth building for a platform team
Build a permission review tool first. A reviewer could enter a proposed command and see which changed rule would apply, alongside its source file. Two public requests describe the investigation from opposite ends: one developer wanted the source file in a denial, and another wanted a trace of permission decisions. A first version could annotate a pull request with exact matches for literal rules and flag patterns that need a live check. The buyer is a platform lead reviewing changes across repositories. The reason to pay is the preview before a rule reaches developers. Pattern matching, managed policy and local exceptions put a limit on what repository files alone can predict.
A multi-project setup checker could catch a different mistake. Two other requests ask about nested application configurations and hooks in additional directories. A team maintaining several apps in one repository could give the checker its common launch directories. The smallest version would print the expected shared file for each directory and a short verification step for the developer. Pilot it with a team that regularly launches from package folders. A team that always starts at the root can solve the same problem with one line in its onboarding guide.
Where is Claude Code's settings.json on a Mac?
For your own defaults, open ~/.claude/settings.json under your home directory. For shared defaults, open .claude/settings.json inside the project. The system-wide managed file lives under /Library/Application Support/ClaudeCode/.
Which Claude settings file should go on GitHub?
Commit .claude/settings.json after reviewing its rules, variables and hook commands. Share CLAUDE.md and a credential-free .mcp.json when the team uses them. Exclude .claude/settings.local.json.
Why does Claude Code still say permission denied after I added an allow rule?
Open /permissions to see which rules loaded and where they came from. A matching deny wins over an allow, even a more specific allow. Check /status for managed policy if the rule comes from outside your repository.
If your platform team wants a settings check built into its review workflow, I can help with AI production systems.
- Published
- Category
- Build







