Skip to content

Permissions System

Cycle through modes with Shift+Tab in a session, or set defaultMode in settings.

ModeBehavior
defaultAsk before edits and shell commands
acceptEditsAuto-accept file edits, ask for shell
planRead-only — no edits or shell commands
autoAuto-approve safe actions
dontAskRequire pre-approval, no runtime prompts
bypassPermissionsSkip all prompts — use only in containers!
{
"permissions": {
"allow": [
"Bash", // allow all bash
"Bash(npm run *)", // npm run <anything>
"Bash(npm test)", // exact command
"Bash(git *)", // all git subcommands
"Bash(* --version)" // any command with --version
],
"deny": [
"Bash(rm -rf *)",
"Bash(sudo *)",
"Bash(curl * | bash)"
]
}
}
{
"permissions": {
"allow": [
"Read", // read all files
"Edit", // edit all files
"Edit(/src/**)", // edit only under src/
"Write(/tmp/**)" // write only in /tmp
],
"deny": [
"Edit(/secrets/**)",
"Edit(/.env)",
"Read(~/.ssh/**)",
"Edit(//etc/**)" // absolute path: double slash
]
}
}
{
"permissions": {
"allow": [
"WebFetch(domain:github.com)",
"WebFetch(domain:*.anthropic.com)"
],
"deny": [
"WebFetch(domain:internal.corp)"
]
}
}
{
"permissions": {
"allow": [
"mcp__github__*", // all GitHub MCP tools
"mcp__slack__send_message"
],
"deny": [
"mcp__*" // block all MCP tools
]
}
}
{
"permissions": {
"deny": [
"Agent(Explore)" // disable a specific subagent
]
}
}
Terminal window
/permissions # view current rules
Shift+Tab # cycle through modes
  • * matches any single path segment or command token
  • ** matches any number of path segments
  • For absolute paths use // prefix: Edit(//etc/**)
  • For home dir use ~: Read(~/.ssh/**)
  • Deny rules take precedence over allow rules at the same scope
  • Trick:deny > ask > allow — deny always wins.”
  • Rule shape: Tool(filter) — e.g. Bash(npm test:*).
  • Show: add one allow rule, re-run the command, watch the prompt vanish.
  • They’ll trip on: Bash(npm *) not covering chained commands — each part of a && b needs allowing.

Learning path:13-model-config-env-vars.md · Index · ➡ 15-permissions-real-examples.md

Written by Fenil Patel