Permissions
Ulmi controls which tool calls the agent may execute through a small multi-level permission system. The decision for every tool call is one of three levels.
| Level | Behaviour |
|---|---|
allow | The tool runs without confirmation. |
ask | The TUI shows a confirmation dialog. The model receives a denied result if the user rejects. In non-interactive mode (ulmi run) ask denies by default. |
deny | The tool is blocked and the model receives permission denied so it can adapt. |
The evaluator lives in
internal/permission/permission.go.
The TUI plugs it in via App.WithPermissionEvaluator.
Priority chain
For every tool call Ulmi walks these sources, highest priority first:
- Session mode hard-gate — in
/planor/askmode, mutating tools (write,edit,delete,patch,bash,task) are always denied. Allow rules cannot override this. - Pattern rules —
permissions.rulesfrom config. The first rule whosepatternmatches the tool name or the call’s subject (the file path for filesystem tools, the command forbash) wins. - Agent overrides — the
toolsmap of the active agent (agents.<name>.tools.bash: ask). Useful for restricting an otherwise permissive agent. Applied on agent switch in the TUI. - Preset —
permissions.preset:manual(default) — no baseline changeaccept_edits— auto-allow file mutations (write/edit/delete/patch)dont_ask— treataskasdeny(no prompts)
- Global per-tool / MCP / category —
permissions.tools.<name>, thenmcp.<server>.permissions(short name or"*"), then category fallbackspermissions.bash(bash only) andpermissions.edit(write/edit/delete/patchonly). - Hardcoded default —
bash,webfetch,websearch,write,edit,delete, andpatchdefault toask; everything else defaults toallow. - Session grants — if the result is still
askand an in-memory Always-session pattern matches, the call is allowed. Grants never overridedenyor the hard-gate.
The first source that produces a decision short-circuits the rest (except
dont_ask, which remaps a final ask to deny, and session grants, which
only remap a final ask to allow).
Edit the live policy with /permissions in the TUI (alias /perms).
Configuration
permissions:
edit: ask # category fallback for write/edit/delete/patch
bash: ask # category fallback for bash
preset: manual # manual | accept_edits | dont_ask
default_mode: build # build | plan | ask — initial TUI session mode (`agent` is a legacy alias for `build`)
# Per-tool levels (win over edit/bash categories).
tools:
read: allow
glob: allow
grep: allow
list: allow
write: ask
edit: ask
delete: ask
patch: ask
bash: ask
webfetch: ask
websearch: ask
question: allow
task: allow
rules:
# Allow editing Go files anywhere in the repo.
- pattern: "**/*.go"
edit: allow
# Block reading/editing secrets.
- pattern: "*.env"
tools:
read: deny
edit: deny
write: deny
# Block edits and shell commands targeting system paths.
- pattern: "/etc/**"
edit: deny
bash: deny
# Block specific destructive shell commands.
- pattern: "rm -rf"
bash: deny
- pattern: "sudo *"
bash: denyBuilt-in defaults allow read-only tools (read, glob, grep, list, …),
question, and the task tool (sub-agents). Mutations, shell,
webfetch, and websearch still ask. In /plan and /ask modes task
remains hard-denied, but webfetch / websearch / question stay available
for research (still subject to their permission levels).
Mutating file tools (write, edit, delete, patch) also refuse paths
outside the workspace, even when the permission level is allow. Absolute
paths that resolve outside the project root, .. escapes, and symlinks that
point outside are rejected with path … is outside workspace …. Read-only
tools do not apply this confine: they may still read absolute paths the user
or model names. See Tools.
Subjects used for pattern rules and Always-allow grants:
| Tool | Subject |
|---|---|
bash | command string |
| filesystem tools | file path |
webfetch | URL |
websearch | query string |
MCP tool levels live under the server config (short names), not under
permissions.tools:
mcp:
github:
permissions:
"*": ask
create_issue: ask
list_issues: allowSee MCP. permissions.tools.mcp__… still works as an
override if you need a one-off qualified-name entry. Canonical MCP tool
names are mcp__<server>__<tool> — not <server>:.
Pattern matching
The matcher in
internal/permission/matcher.go
supports several styles, tried in order:
- Exact equality (
pattern == subject). - Standard
filepath.Matchglob (*.go,?.md). The pattern is also tested against the file’s basename for paths. - Recursive double-star glob (
internal/**/*.go,**/*.json). - Shell-style glob where
*matches anything including spaces and slashes — useful for command patterns likerm *orgit push --force*. - Plain prefix match —
rm -rfmatchesrm -rf /tmp/foo.
This means you can write rules in whichever style is most natural for the case at hand.
Bash allow patterns use the whole command, without the file-basename
fallback. A literal prefix must end at an argument boundary: git status
does not allow git status-other. Bash allow rules and session grants only
approve simple commands. Shell operators, substitutions, redirections,
backslashes, comments, control characters other than tabs, and unbalanced
quotes require confirmation. This is intentionally conservative: even a
quoted literal such as echo 'a;b' requires confirmation. Balanced quotes
around ordinary arguments remain supported.
A matching Bash allow rule becomes ask for these complex commands
(deny with dont_ask); existing deny rules and read-only modes still apply.
Explicit unrestricted tool/category or agent-level bash: allow remains
unrestricted. These patterns are convenience grants, not an OS sandbox or
a guarantee that an allowed executable and its arguments are harmless.
Per-agent tool overrides
User-defined agents can ship their own permission policy in their YAML frontmatter:
---
name: safe-reviewer
description: "Code-review agent with no shell access"
tools: [read, glob, grep, list]
permissions:
bash: deny
edit: deny
tools:
read: allow
---
You are a code reviewer …The same shape works in the project config under agents.<name>.tools and
agents.<name>.permissions if you prefer to keep all configuration in YAML.
Built-in agent policies
| Agent | bash | edit | Allowed tools |
|---|---|---|---|
build | ask | ask (hardcoded default) | All registered tools |
plan | deny | deny | read, glob, grep, list, webfetch, websearch, question |
ask | deny | deny | same as plan |
Built-in policies are defined in
internal/agent/builtin.go.
How the TUI handles ask
When a streaming response asks for one or more tool calls:
- Each call is evaluated.
allowcalls are queued for execution.denycalls are recorded as failed results immediately.askcalls go into a queue; the confirmation overlay walks them sequentially.- Once the queue is empty, all approved calls run in parallel (capped at 10 concurrent executions). Results are sent back to the model.
This batching means a single response that calls multiple tools only prompts you for the ones that need confirmation.
Always allow
The confirmation dialog offers four outcomes when a safe pattern can be derived from the tool call:
| Key | Action |
|---|---|
y | Allow this call only |
a | Always allow matching calls for the rest of this session |
A | Always global — allow and prepend a rule to the global config |
n / Esc | Deny |
The dialog shows Will remember: <pattern> for the suggested rule. Bash
patterns use a safe command prefix (sleep 15 → sleep *,
git status --porcelain → git status *). File tools use an extension
glob (internal/tui/app.go → **/*.go).
Dangerous prefixes (rm, sudo, curl, …) still offer Always session
but hide Always global — persist those only via /permissions.
Complex shell commands do not offer Always allow. The same restriction
applies when matching previously saved rules or session grants, so an
existing git status * grant does not allow an appended shell command or
command substitution. Ambiguous executable/subcommand tokens containing
glob characters do not produce suggested grants.
Empty executable/subcommand tokens also do not produce grants. Bash parsing
preserves empty quoted arguments and treats only ASCII spaces and tabs as
word separators, so Unicode spaces cannot change the remembered command.
Session grants only suppress ask; they never override the /plan//ask
hard-gate or an explicit deny rule. Saved rules are prepended to
permissions.rules and written with config.SavePermissions (global
~/.config/ulmi/config.yaml).
Non-interactive mode
ulmi run evaluates every built-in tool call using the configured policy.
allow executes the call; ask and deny return a denied tool result without
prompting. Multi-file reads and patches check every target path before
execution, including write/edit path aliases. Read-only agents and modes
cannot mutate files even if a rule would otherwise allow it.
For example, to allow file creation and editing in CI:
permissions:
tools:
write: allow
edit: allowUse per-tool entries: the generated config’s permissions.tools settings
have precedence over category fallbacks such as permissions.edit or
permissions.bash. Shell execution requires its own tools.bash: allow
or a matching Bash rule; allowing file edits does not allow shell commands.
Subject extraction
The TUI extracts the subject of a tool call from its arguments before
evaluation via permission.ExtractSubject:
bash→commandwebfetch→urlwebsearch→query- otherwise →
path, orpathsfor multi-fileread
That is what allows pattern: "**/*.go" to gate file mutations and
pattern: "rm -rf" to gate shell commands. Implementation:
internal/permission/checker.go.