Permission the agent once
Every tool call the agent makes is a permission decision. Answering the same prompt forty times is not a workflow, so the answers live in a file and the prompt stops appearing.
Where the rules live
~/.claude/settings.jsonapplies to every project on the machine. This is where personal rules belong..claude/settings.jsoninside a project applies to that project and is committed, so the rules travel with the repo..claude/settings.local.jsonapplies to one project on one machine and is gitignored.
The files merge. A project rule adds to the personal rule; it does not replace the whole list.
Allow and deny
Two lists do most of the work. Anything not matched is asked for the first time and remembered for the session.
{
"permissions": {
"allow": [
"Bash(obsidian *)",
"Bash(ls *)",
"Bash(find *)",
"Bash(mkdir *)"
],
"deny": [
"CronCreate",
"CronDelete",
"EnterWorktree"
]
}
}The allow list above is the whole vault toolchain: list, find, make a folder, and talk to Obsidian. Nothing there can delete a file, push a commit or send a message.
How a pattern is written
A rule is a tool name, optionally followed by a specifier in parentheses. For Bash the specifier is the start of the command; a trailing :* turns it into a prefix match.
Bash(npm run build) exactly this command
Bash(npm run test:*) anything starting with npm run test
Read(./.env) one file, relative to the project
Read(./src/**) everything under src
Edit(./docs/**) edit anything under docs
WebFetch(domain:example.com) only that hostAllow by prefix only when the prefix is safe.
A rule for Bash(git:*) also allows git push --force. Write the narrowest prefix that covers the work you actually repeat.
The other three ways to answer
- Approve one call when the prompt appears. Good for a one-off; it does not survive the session.
- Run
/permissionsto see the merged rules and add or remove one without editing JSON by hand. - Switch to accept-edits mode for a stretch of editing, so file changes stop asking while commands still do.
Modes are a session preference. Rules are the durable answer, and the two are not a substitute for each other.
What to allow in a vault
- Read-only inspection:
ls,find,grep,cat. - The vault CLI:
Bash(obsidian *)lets the agent open, search, append and read notes without a screenshot. - The project's own build and test commands, written as prefixes.
- Nothing that deletes broadly, publishes, pays or sends. If a task needs one of those, approve it by hand that once.
A rule you cannot explain is a rule to delete.
Fewer, sharper rules produce fewer prompts and a smaller blast radius than a long allow list nobody has read.