Permissions
Swarmie uses rule-based permission evaluation with trust presets.
Source of truth:
- Presets:
crates/permissions/src/preset.rs - Rule syntax:
crates/permissions/src/rule.rs - Evaluation precedence:
crates/permissions/src/evaluator.rs
Trust Presets
safe
Read-only workflow with sandboxed web tools.
- Allow:
Read,Glob,Grep,FileSearch - Sandbox:
WebFetch,WebSearch - Deny:
Bash,Write,Edit,NotebookEdit,Patch
standard (default)
Recommended default for day-to-day coding.
- Allow: file tools +
Undo+ safe bash patternsBash(cargo *)Bash(npm run *)Bash(git status)Bash(git diff *)Bash(git log *)Bash(git branch *)
- Sandbox:
WebFetch,WebSearch - Ask: risky git operations (
git push,git commit,git checkout,git rebase,git merge,git reset) - Deny:
Bash(rm -rf *)
full
All core tools allowed natively, no sandbox/ask/deny rules.
Rule Syntax
Rules are strings in one of these forms:
ToolNameToolName(specifier)
Examples:
Bash(npm run *)Read(./src/**)WebFetch(domain:*.example.com)
Matching behavior:
- Tool name is case-insensitive.
- No specifier means "all calls to this tool".
- Specifiers use glob/prefix matching.
domain:specifiers match URL hostnames forWebFetch.
Evaluation Precedence
PermissionEvaluator::evaluate() applies rules in this order:
- Bypass mode (
bypass=true) -> allow. - Read-only mode + mutating tool -> reject.
- Deny rules (agent overrides, then global) -> reject.
- Session allows -> allow.
- Agent non-deny rules (
ask>sandbox>allow). - Global non-deny rules (
ask>sandbox>allow). - Default -> escalate (ask user).
Interactive Permission Responses
When a permission prompt appears in TUI (pending_permission):
y-> allow oncen-> denya-> always allow this session rule!-> bypass all checks for the sessionCtrl+C-> deny
These are handled in crates/tui/src/app/update/keys.rs.