Topic 1 of 4 · 4 min read
Settings scopes from user to managed policy
Goal: Place each setting in the right scope and predict the effective value when user, project and managed settings disagree.
A coding agent reads settings from several files, and each file has an owner and a rank: put every setting in the file whose owner should control it, and remember that the higher rank wins.
Check yourself · 1 of 3
Which settings file is meant to be committed to git and shared with the whole team?
Why it matters
Ten engineers, ten laptops, ten different agent setups. One person allows rm without asking, another has a hook that only runs on their machine, a third added a server nobody reviewed. When the setup is spread over personal files, you cannot say what the agent is allowed to do. Scopes let the team share what must be shared and keep personal taste personal.
The four scopes
Claude Code is used here as the worked example. Other agents (Cursor, Codex, Copilot) have the same idea under other file names.
- User (
~/.claude/settings.json): your defaults in every project. Theme, editor mode, your favourite model. Never shared. - Project (
.claude/settings.json): committed to git. Everyone who clones the repository gets the same permissions, hooks and plugin list. - Local (
.claude/settings.local.json): your personal overrides for one project. It must stay out of git. Claude Code adds it to your global git excludes when it creates the file; if you create it by hand, add it to.gitignoreyourself. - Managed: deployed by the organisation (a file in a system directory, an MDM policy, or server-managed settings from the admin console). Nothing in your own files or on the command line overrides a managed key.
Precedence, highest first: managed, command line, local, project, user. A key set higher overrides the same key set lower. Lists such as allow rules merge instead of replacing each other.
Where each setting goes
- Test and lint commands the agent may run without asking: project.
- A deny rule for
.envfiles orrm -rf: project (or managed, if it is a rule nobody may remove). - Your model choice or a rule you are only trying out: local.
- Security policy that must hold on every machine: managed.
Before and after
Weak: a teammate clicks "Yes, and don't ask again" on a git push prompt. The approval lands in their local file, so only they have it, and the next engineer is prompted again and confused.
Fixed: the team agrees that git push stays on ask, writes the rules it does want into the committed project file, and reviews that file in a pull request.
{
"permissions": {
"allow": ["Bash(npm run test:*)", "Bash(npm run lint)"],
"deny": ["Read(./.env)", "Bash(git push --force:*)"]
}
}
What goes wrong
- A secret or personal path is committed in the project file because the author did not know the local file existed.
- A teammate expects a project
allowrule to beat a manageddeny. It never does. - Some project keys, such as allow rules, only apply after the engineer trusts the folder, so a fresh clone can behave differently from what the file suggests.
Examples
Predicting the effective value
The user file sets "model": "fast-model". The committed project file sets "model": "strong-model". Your local file sets nothing. Your sessions use strong-model, because project outranks user.
You add "model": "fast-model" to your local file. Now only your sessions in this project use fast-model; teammates still get strong-model. If a managed file also sets model, it is only a starting default, so check which keys the policy locks.
Sorting a config review
A pull request edits .claude/settings.json and adds three things: an allow rule for npm run test, a personal path to the author's editor, and an API key in env. Keep the first. Move the second to local settings. Remove the third and rotate the key: committed secrets are leaked secrets.
Key points
- Agent settings come from user, project, local and managed files, each with a different owner and audience.
- Precedence runs managed, command line, local, project, user: a key set higher overrides the same key set lower.
- Only the project file is committed and shared; the local and user files stay on one machine.
- Allow and deny lists merge across scopes, but a managed key cannot be undone from any file the user controls.
- A personal approval such as "don't ask again" is saved locally, so it does not change the team's setup.
Common mistakes
- Committing the local settings file, or hand-creating it without adding it to
.gitignore. - Putting a team rule in the user file, so it protects one person and nobody else.
- Assuming a project allow rule can override a deny from a higher scope.
- Treating the committed file as private: everyone with repository access can read it.
Check yourself · 2 of 3
The project file sets a model to X. Your own local file sets the same key to Y. No managed policy touches it. Which value do your sessions use?
Check yourself · 3 of 3
A new rule must hold on every engineer's machine and no engineer should be able to remove it. Where should it go?
Practice items, not counted towards your mastery.
Start here
- Claude Code settings (opens in a new tab)DocsFree
Lists the settings files, where each lives, and the precedence order from managed down to user.
- Plugins overview (Claude Code docs) (opens in a new tab)DocsFree
What a plugin can hold (skills, agents, hooks, MCP servers) and when to use one.
- Configure server-managed settings (Claude Code docs) (opens in a new tab)DocsFree
How an admin delivers policy from the console, how it is cached, and what a failed fetch does.