Permission rules

permissions in config refines the permission mode with allow, ask and deny rules:

{ "permissions": {
    "allow": ["bash(git status *)", "bash(zig build *)", "edit(src/**)", "web_fetch(domain:docs.rs)", "mcp__github__*"],
    "ask":   ["bash(git push *)"],
    "deny":  ["read(.env)", "bash(rm -rf *)", "web_search"] } }
  • Form. A rule is tool or tool(pattern), and the tool part may use *.
  • Shell commands. bash(...) patterns match the command, * matching anything; "git status *" also matches plain git status. A command is split on &&, ||, ;, | and newlines: an allow rule applies only when every part is allowed, and a deny rule blocks the whole command if any part matches. A command with $(...), backticks or <(...) is never allowed by a rule.
  • Paths. read(...), write(...) and edit(...) take path globs relative to the working directory (or absolute, or ~/). edit covers write, and read covers grep and glob.
  • Web. web_fetch(domain:host) matches the host and its subdomains.
  • Precedence. Deny beats ask, ask beats allow, and allow beats the mode. Allow rules refine ask mode; they never loosen read-only mode, the write roots or the OS sandbox.
  • "Always allow". Answering it saves the suggested rules to the project's entry in ~/.config/oi/projects.json: one per part of a shell command (its program and subcommand), the file's directory for file tools, the host for web_fetch, otherwise the tool name. No rule is offered for a command that writes to a file (>), contains substitutions, or runs an interpreter or another command (python -c, bash x.sh, env, sudo, xargs, find, a bare git, ...), since a prefix rule would allow anything. A rule's * never covers a redirection to a file either.
  • Searches. grep and glob check every file they read against read(...) deny and ask rules and the credential-store block, symlinks resolved; skipped files are counted in the result.