Permissions
Permissions are the user-authored policy layer that decides which agent tool calls may run silently, which must always ask, and which must never run. They complementโrather than replaceโnormal approval prompts, workspace trust, path validation, and the optional command sandbox.
This page explains the on-disk files, rule language, matching behavior, precedence, examples, approval shortcuts, worktree scope, diagnostics, and common mistakes. The behavior described here is implemented in internal/permissions/ and is shared by the TUI, yottacode run, and ACP runtime.
Important: A permission rule is not a general operating-system sandbox. In particular, a
Bash(...)rule governs the command descriptor that yottacode extracts; it cannot make arbitrary shell indirection, aliases, scripts, or child processes safe. Use the command sandbox or an outer container when you need host isolation. See Security and allow lists and Sandbox.
Quick start
Create or edit one of these files:
/etc/yottacode/permissions.json
<repo>/.yottacode/permissions.json
<repo>/.yottacode/permissions.local.jsonThe file format is JSON:
{
"permissions": {
"allow": [
"Tests(go *)",
"Edit(internal/**)"
],
"ask": [
"Read(**/.env*)",
"Github(create_pr)"
],
"deny": [
"Bash(rm *)",
"Edit(/etc/**)"
]
}
}Each entry has the form:
Tool(pattern)For example:
Bash(go test *)matches shell commands beginning withgo test.Edit(internal/**)matches edits below the repository’sinternal/directory.Github(read_*)matches native GitHub read operations without matching GitHub writes.Read(**/.env*)forces a prompt before reading.env,.env.local, or a nested environment file.
The three arrays are optional. A minimal file such as { "permissions": { "allow": ["Bash(go *)"] } } is valid.
Which file should contain a rule?
| File | Owner | Typical purpose | Committed? | Writable by yottacode? |
|---|---|---|---|---|
/etc/yottacode/permissions.json | Machine administrator | Baseline policy for every user and project on the machine | Administrator-managed | No |
<repo>/.yottacode/permissions.json | Repository/team | Shared rules that should apply to contributors and CI working from the repository | Yes, normally | No automatic writes; edit it deliberately |
<repo>/.yottacode/permissions.local.json | Individual developer | Personal convenience or machine-specific rules | No; gitignore it | Yes, for approval-derived rules |
System policy: /etc/yottacode/permissions.json
This optional file is loaded first and applies machine-wide. yottacode never creates, edits, or persists approval decisions into it. Administrators can use it to establish a baseline such as:
{
"permissions": {
"deny": [
"Edit(/etc/**)",
"Write(/usr/**)",
"Bash(sudo *)"
],
"ask": [
"Read(**/.ssh/**)"
]
}
}Treat this as administrator-owned policy. A project rule cannot weaken a system deny or ask rule.
Shared project policy: .yottacode/permissions.json
Use this for rules that describe how the repository should be operated. Good examples include allowing the project’s normal test command, allowing edits in a known source directory, or requiring confirmation before publishing:
{
"permissions": {
"allow": [
"Tests(go *)",
"Edit(cmd/**)",
"Edit(internal/**)"
],
"ask": [
"Bash(git push *)",
"Github(create_pr)",
"Github(update_pr)"
],
"deny": [
"Bash(rm -rf *)"
]
}
}Because this file is shared, keep rules narrow and explain unusual policy choices in the repository’s review history. Do not put personal usernames, home-directory paths, or machine-specific commands here unless that is intentional.
Personal project policy: .yottacode/permissions.local.json
Use this for rules that are useful to you but should not affect teammatesโfor example, a local formatter, a private helper command, or a temporary rule for an exploratory session that you want to keep across restarts.
Add it to .gitignore:
.yottacode/permissions.local.jsonAutomatic always allow and always deny decisions write only to this file. The file is created with restrictive directory/file handling by the permission store and duplicate rules are ignored. When /permissions opens a missing or blank writable policy, yottacode seeds the local file with the {allow, ask, deny} skeleton. It does not create the shared project file or the administrator file.
Linked worktrees
When the active directory is a yottacode-managed linked worktree:
- the shared
permissions.jsonis read from that worktree’s checkout, so each branch uses its own committed policy; permissions.local.jsonis read from and written to the main repository root, so personal grants survive worktree removal;- path rules are still evaluated relative to the active worktree.
Rules previously saved inside a worktree-local permissions.local.json are not migrated automatically.
If the current directory is not inside a Git repository, yottacode uses the current directory itself as the storage root for the local file:
<cwd>/.yottacode/permissions.local.jsonPrecedence: what wins?
For a normal tool call, the effective order is:
Deny > Ask > Allow > session allow > tool defaultThe source file does not change the priority. A deny in the local file beats an allow in the system file; an ask in the system file beats an allow in the shared file.
- Deny: refuse the call. It remains enforced when
/yolois active. - Ask: force confirmation for a call that reaches the normal approval gate, even if the tool is normally read-only or an active mode would otherwise skip the prompt. Higher-priority boundaries such as plan-mode restrictions, unattended background-worker policy, and hard execution guards can reject a call without presenting a prompt.
- Allow: skip the normal approval prompt for a matching call.
- Session allow: an in-memory allow created with
[S]in an approval modal. It disappears when the process exits and is below persistedallowrules. - Tool default: if no rule matches, the tool’s own approval policy decides. Reads generally run without prompting; mutating tools, shell commands, and other sensitive surfaces generally prompt.
Other safety gates can run before or after this policy. Plan mode blocks most mutations, background-worker policy can reject unattended operations, write-path validation can reject a path, and execution-time hardening can reject commands such as sudo. A permission allow is not a bypass for those independent boundaries.
Modes and permission interaction
Permission files are persistent policy. Modes are session-level operating postures layered on top of that policy.
| Mode | Entry points | What changes | What still wins |
|---|---|---|---|
| Normal | Startup default; cycle with Shift+Tab | Uses each tool’s normal approval behavior | deny, ask, path validation, trust, and hard safety guards |
| Plan | /plan, Shift+Tab, --permission-mode plan | Read-only research; only the resolved plan file may be written automatically | deny, plan boundary restrictions, trust, path validation, and hard safety guards |
| Auto | /auto, Shift+Tab, --permission-mode auto | Most ordinary edits auto-approve; shell, tests, commits, rollback, and worktree shifts remain in the safety floor | deny, ask, safety-floor prompts, trust, path validation, and hard safety guards |
| Yolo | /yolo, Shift+Tab | Skips remaining non-boundary approval prompts and raises the iteration budget | deny, ask, plan-boundary approvals, trust, path validation, and hard safety guards |
The important distinction is:
- Auto mode is not an allowlist. It changes the default approval behavior for the session. An explicit
askrule still prompts, and shell/test/commit/worktree safety-floor tools normally remain gated. - Plan mode is a restriction, not an approval shortcut. It blocks ordinary mutations even if an
allowrule exists. The plan file is the narrow exception needed to write the plan. - Yolo is not a policy bypass. It skips prompts for calls that reach the mode overlay, but explicit
denyandaskrules still apply. Use/yoloto toggle the overlay during a TUI session orShift+Tabto cycle into and out of it. - A persisted
allowrule is more targeted than auto or yolo. It applies only to matching descriptors and can override the auto-mode safety floor for that exact pattern, subject to all other safety boundaries.
The safety-floor tools in auto mode include run_bash, run_tests, commit-family tools, rollback, enter_worktree, and exit_worktree. Read-only shell commands from the built-in safe command set may be auto-approved when they carry no risk flags; commands involving mutation, redirects, shell pipelines, credentials, or elevated execution remain gated.
Rule matching
Rule syntax
The parser accepts a capitalized or mixed-case identifier beginning with an ASCII letter, followed by a pattern in parentheses:
Bash(go test *)
Edit(src/**)Whitespace around the complete rule is accepted. Whitespace inside the parentheses is part of the pattern, so these are different rules:
Bash(git status)
Bash(git status *)The first matches only the bare command. The second matches git status -s, but not the bare git status. Add both when you want both forms.
* and ? for string descriptors
For shell, Git, URLs, GitHub verbs, memory descriptors, browser descriptors, and other free-form values:
*matches any sequence, including an empty sequence;?matches exactly one character;- every other character is literal;
- matching is anchored to the complete descriptor.
Examples:
| Rule | Matches | Does not match |
|---|---|---|
Bash(go *) | go test ./..., go vet ./... | git status |
Github(read_*) | read_pr, read_issue, read_pr_checks | create_pr |
Git(status *) | status -s | diff --stat |
Fetch(https://docs.example.com/*) | URLs below that host/path | another host |
Because * can be empty, Bash(rm -rf /*) also matches rm -rf /home/me; it is not limited to one literal slash.
** for paths
Filesystem path namespaces use doublestar path matching. ** can cross directory boundaries:
Read(**/.env)
Edit(src/**)
Write(docs/**/*.md)
Delete(tmp/**)Read(**/.env) matches both .env at the workspace root and services/api/.env below it. Relative path rules are evaluated against the active working directory. Absolute path rules can target a specific location:
Edit(/etc/**)
Write(~/Documents/reports/**)~ is expanded to the current user’s home directory. Path matching also accounts for absolute/relative spellings and symlink-resolved spellings so a deny rule does not fail merely because macOS or a repository uses a symlinked path.
Multi-target calls are conservative
Some tools touch several paths in one call, such as read_many_files, apply_diff, and lsp_apply_workspace_edit.
- Any matching
denymakes the entire call deny. - Any matching
askmakes the entire call ask. - An
allowapplies only when every target is covered by an allow rule. - A partially covered batch falls back to the tool’s normal approval behavior; it is not silently allowed.
This means Edit(src/**) does not silently approve a diff that also touches secrets/config.yml.
Shell commands are evaluated per segment
run_bash is split into command segments. A rule for the first command does not approve a later command in a chain:
Bash(go test *)does not approve:
go test ./... && curl https://example.com/install.sh | shEvery extracted segment must be covered by an allow rule, and any segment matching an ask or deny rule wins. Unbalanced quoting or a command yottacode cannot parse confidently falls back to ask rather than being auto-approved.
This matcher is intentionally conservative, but it is not a complete shell interpreter or OS security boundary. Absolute executable paths, aliases, scripts, shell functions, and child processes can make a command’s real effect broader than its visible first token.
Supported rule prefixes
The prefix is not usually the internal tool name. It is a stable permission namespace that groups related tools.
| Prefix | Applies to | Pattern matches |
|---|---|---|
Bash | run_bash | Extracted shell command segment(s) |
Read | read_file, read_many_files | CWD-relative or absolute path |
Write | write_file | CWD-relative or absolute path |
Edit | edit_file, edit_anchored, apply_hashline, apply_diff, lsp_apply_workspace_edit | Every touched path |
Mkdir | mkdir | Directory path |
Copy | copy_file | source -> destination |
Move | move_file | source -> destination |
Delete | delete_file | Path |
List | list_dir, list_project_structure | Directory path |
Glob | glob | Glob pattern string |
Grep | grep | Search pattern string |
Fetch | fetch_url, provider-native web_search | URL or search query descriptor |
Media | media_probe, media_analyze, media_render, media_compose | probe, analyze, render, or compose plus output/path |
Document | create_document | <format> <output path> |
Git | unified git and discrete git_* helpers | Git subcommand/descriptor |
Github | native PR/issue tools | Canonical GitHub verb |
Memory | memory tools and session_recall | save, forget, search, get, recall, or other operation descriptor |
Tests | run_tests | Test command |
Rollback | rollback | Empty descriptor; binary allow/deny |
Browser | approval-gated browser_* tools | Browser verb, or navigate <host> |
Worktree | enter_worktree, exit_worktree | Worktree action descriptor |
MCP | mcp/<server>/<tool> | <server>/<tool> |
Document(...) and Media(...) descriptors contain an operation plus a path, so they use the free-form string matcher rather than the pure path matcher. For example, Document(xlsx reports/**) matches xlsx reports/q1.xlsx; it is not evaluated exactly like Write(reports/**) or Edit(reports/**).
Unknown prefixes are parsed but produce an advisory lint warning and do not govern a tool unless yottacode later maps that namespace.
GitHub verbs
GitHub rules match canonical verbs, not the names shown in the tool registry:
| Tool | Rule descriptor |
|---|---|
pr_context | read_pr_context |
pr_read | read_pr |
pr_review_context | read_pr_review_context |
pr_watch_checks | read_pr_checks |
pr_check_logs | read_pr_check_logs |
pr_create | create_pr |
pr_update | update_pr |
pr_add_comment | add_pr_comment |
pr_rerun_checks | rerun_pr_checks |
issue_context | read_issue_context |
issue_read | read_issue |
issue_list | list_open_issues |
issue_create | create_issue |
Useful patterns:
{
"permissions": {
"allow": ["Github(read_*)"],
"ask": [
"Github(create_pr)",
"Github(update_pr)",
"Github(add_pr_comment)",
"Github(create_issue)"
]
}
}Github(*) is a catch-all for the native GitHub namespace. Use it sparingly: allowing it also silently allows GitHub writes.
GitHub permission rules currently do not scope to an arbitrary owner/repository string. Calls resolve against the current working directory’s Git remote.
Git rules and worktree-only commits
Commit-family tools can be restricted to yottacode-managed worktrees:
Git(commit * @worktree)The @worktree suffix is evaluated from the session’s actual working directory, not from model-controlled Git arguments. It matches commits from inside a yottacode worktree and does not match commits from the main checkout.
Examples:
Git(status *)
Git(diff *)
Git(commit * @worktree)
Git(push *)A commit approved from inside a managed worktree can automatically derive the scoped rule. Commits from the main checkout do not offer a one-click standing allow because an unscoped Git(commit *) would also cover every worktree. git push never derives an allow rule automatically; publishing remains a per-call decision unless you write a rule yourself.
Discrete Git helpers use descriptors derived from their helper names. Useful examples include:
Git(branch_status *)
Git(diff_files *)
Git(stage *)
Git(commit_apply *)
Git(commit_amend *)
Git(worktree_list *)
Git(push *)Use yottacode permissions test <tool> <args-json> to see the exact descriptor and verdict for a particular helper.
MCP rules
MCP tool names look like mcp/filesystem/read_file, but the rule descriptor omits the mcp/ prefix:
MCP(filesystem/read_file)
MCP(filesystem/read_*)
MCP(github/*)
MCP(*)Prefer exact or narrowly scoped rules. MCP(*) covers every configured server and tool, but a glob rule such as MCP(github/*) cannot silently auto-allow a tool the server marks destructive. Such a call still falls back to normal approval; only an exact rule such as MCP(github/create_issue) can auto-allow it. Persisting MCP(*) through an interactive always-allow flow requires an explicit second confirmation. Hand-editing the file bypasses that confirmation, so /permissions warnings are important.
Browser rules
Browser rules are based on the approval-gated browser action:
Browser(inspect)
Browser(screenshot)
Browser(click)
Browser(navigate example.com)Browser(navigate example.com) covers that exact host, not every subdomain. The descriptor uses the hostname without the port, so the rule applies to that host across ports. A hand-written pattern can use a wildcard when that is intentional. Upload and download operations have additional local path and data-transfer protections and should not be broadly auto-allowed.
The currently permission-governed browser verbs are:
navigate, screenshot, inspect, click, type, hotkey, scroll, handoff,
upload, download, console_logs, network_requests, select, response_body,
hover, drag, dialog, find, extract, fill_formBrowser lifecycle/status tools such as browser_status, browser_wait, browser_close, browser_tabs, browser_switch_tab, and browser_close_tab do not prompt and are outside the permission namespace. A Browser(*) rule cannot block those tools.
Only unambiguous HTTP(S) navigation is represented as Browser(navigate <host>). Ambiguous or non-web targets such as file:, data:, malformed URLs, URLs with userinfo, or unusual authorities are represented internally as Browser(navigate-nonweb <raw-url>); they do not match Browser(navigate *). You can explicitly deny that class with Browser(navigate-nonweb *).
Memory rules
Memory and session-recall operations share the Memory namespace:
Memory(save user:*)
Memory(forget project:temporary-*)
Memory(search *)
Memory(recall *)
Memory(*)Use Memory(*) only when you intentionally want to govern all memory writes, reads, recall, and maintenance with one rule. A narrower ask or deny is usually easier to reason about.
Worktree rules
Worktree actions are separate from low-level Git worktree helpers:
Worktree(enter *)
Worktree(exit keep *)
Worktree(exit auto *)Worktree(exit remove *) is destructive and is not derived as an always-allow rule. The worktree tools remain subject to their own lifecycle and cleanup safeguards.
Starter rule set
The default skeleton is intentionally empty. yottacode does not assume that git, package managers, publishing, or browser actions are safe for every project. The following is a curated starting point based on the configuration guide; paste it into the shared file and remove anything that does not fit your repository:
{
"permissions": {
"allow": [
"Bash(git status)",
"Bash(git status *)",
"Bash(git diff)",
"Bash(git diff *)",
"Bash(git log)",
"Bash(git log *)",
"Bash(git show *)",
"Bash(git branch)",
"Bash(git branch -*)",
"Bash(git remote -v)",
"Bash(ls)",
"Bash(ls *)",
"Bash(pwd)",
"Bash(echo *)",
"Bash(which *)",
"Bash(head *)",
"Bash(tail *)",
"Bash(wc *)",
"Github(read_*)",
"Github(list_open_issues)"
],
"ask": [
"Bash(git push *)",
"Bash(git reset --hard *)",
"Bash(git rebase *)",
"Github(create_pr)",
"Github(create_issue)",
"Github(update_pr)",
"Github(add_pr_comment)",
"Bash(gh release *)",
"Bash(npm publish*)",
"Bash(cargo publish*)",
"Bash(docker push *)",
"Read(**/.env)",
"Read(**/.env.*)",
"Read(**/*.pem)",
"Read(**/id_rsa)",
"Read(**/credentials*)"
],
"deny": [
"Bash(rm -rf /*)",
"Bash(rm -rf ~*)",
"Bash(sudo rm -rf *)",
"Bash(curl * | sh)",
"Bash(curl * | bash)",
"Bash(wget * | sh)",
"Bash(wget * | bash)",
"Bash(* | sudo sh)",
"Bash(* | sudo bash)",
"Bash(dd if=* of=/dev/*)",
"Bash(mkfs.*)",
"Bash(chmod -R 777 /)",
"Bash(chmod -R 777 /*)",
"Edit(/etc/**)",
"Edit(/usr/**)",
"Edit(/bin/**)",
"Edit(/sbin/**)",
"Edit(/boot/**)",
"Write(/etc/**)",
"Write(/usr/**)",
"Delete(/etc/**)",
"Delete(/usr/**)"
]
}
}The starter set is deliberately conservative but is not a complete security policy. In particular, shell rules are descriptor matching rather than full shell authorization, and structured file tools have separate path validation and secret deny lists.
Approval shortcuts and generated rules
When an approval modal appears, the keyboard choices are:
Yโ approve this call once;Sโ allow the derived rule for the rest of this process only;Aโ save the derived allow rule topermissions.local.json;Nโ reject this call;Dโ save the derived deny rule topermissions.local.json.
The modal displays the exact derived rule before it is saved. [S] and [A] use the same derivation logic; the difference is persistence.
Automatic derivation intentionally refuses broad or ambiguous allow rules for dangerous shell verbs such as rm, curl, wget, sudo, bash, sh, python, and xargs, for unparseable shell syntax, and for several high-trust tools. You can still write a rule by hand when you understand the blast radius.
Persistent [D] deny derivation is currently offered only for run_bash, Git tools, and approval-gated browser tools. It is not offered for ordinary file edits, writes, document generation, media operations, or memory operations, although hand-written deny rules can govern those namespaces.
Examples of derived rules include:
Bash(go *)
Tests(go *)
Edit(/absolute/path/to/repository/**)
Move(/absolute/path/to/repository/** -> /absolute/path/to/repository/**)
MCP(github/create_issue)
Worktree(enter *)
Git(commit * @worktree)Path-derived rules are intentionally anchored to the current workspace so a personal grant copied to another project does not unexpectedly apply there. Worktree names are normalized to * when yottacode derives a rule, avoiding a grant tied to one ephemeral name.
Inspecting, editing, and reloading rules
TUI: /permissions
Run /permissions in the TUI to reload the policy and open the picker. It shows separate system, shared, and local rows and displays advisory warnings for broad or shadowed rules. Editing a file directly on disk does not replace the active in-memory policy until you reopen /permissions or restart yottacode.
- The system row is read-only.
- Enter opens the shared or local project file in
vim. - A missing or blank local file is seeded with the
{allow, ask, deny}skeleton before editing; the shared file is not created automatically. - Existing non-empty content is preserved.
- If a just-edited file is malformed, reload reports the error and keeps the previous in-memory policy active instead of silently replacing it. Fix the file and reopen
/permissionsto retry.
CLI: test without executing
Use the same evaluator that the agent loop uses, without running the tool:
yottacode permissions test bash "git push origin main --force"
yottacode permissions test run_bash '{"command":"go test ./..."}'
yottacode permissions test edit_file '{"path":"internal/foo.go"}'
yottacode permissions test write_file '{"path":".env"}'
yottacode permissions test pr_create '{"base":"main","title":"Test","body":"Body"}'The output reports the normalized arguments, verdict, and matching source rule:
tool: run_bash
args: {"command":"git push origin main --force"}
verdict: ask
matched: Ask(git push *) [/repo/.yottacode/permissions.json]bash is an alias for run_bash; for that alias only, a bare command string is accepted. A tool with no permission mapping reports verdict: n/a. A mapped tool with no matching rule reports default, which means its own approval policy remains in charge.
Run validation diagnostics without modifying files:
yottacode doctordoctor reports missing, empty, valid, unreadable, and malformed policy files. Syntax, read, and rule-format errors are issues. Broad, unknown, or shadowed rules are advisory warnings.
Lint warnings: useful, not enforcement
/permissions and yottacode doctor may warn about:
- unknown prefixes;
- broad shell allows such as
Bash(gh *),Bash(python3 *),Bash(sed *), orBash(sudo *); Git(-C *), which allows Git to operate in another directory;Github(*)orMCP(*)namespace-wide allows;Browser(*)orBrowser(navigate *);- repository-wide delete rules;
- allow rules that are shadowed by a deny rule.
Warnings do not change behavior. yottacode honors valid rules exactly as written. If you intentionally use a broad rule, review the warning and keep the reason documented for your team.
Common mistakes
Allowing only the command prefix
Bash(go *) allows Go commands, but it does not allow git status, make, or go test && git diff unless each segment is also covered.
Forgetting the bare command form
Bash(git status *) does not match bare git status. Add Bash(git status) too.
Using path syntax for a string descriptor
Github(read_*) is correct. Github(**/read_*) is not a path rule and does not provide a special recursive match.
Expecting an allow to override ask or deny
A broad allow is not an exception mechanism. Add a narrower deny or ask rule if a sensitive subset must remain protected:
{
"permissions": {
"allow": ["Read(**)"],
"ask": ["Read(**/.env*)"],
"deny": ["Read(**/credentials*)"]
}
}Assuming the file is an OS sandbox
Bash(*) is a very broad permission grant. It does not constrain what a shell, script, interpreter, alias, or child process can do. Prefer structured tools and narrow rules; enable the command sandbox or run yottacode in a container for stronger isolation.
Editing the wrong file in a worktree
Personal automatic grants from a managed worktree go to the main repository’s .yottacode/permissions.local.json, while shared rules come from the active worktree checkout. Use /permissions or yottacode permissions test from the active directory to see the paths and effective result.
Relationship to other safety controls
Permissions are one layer in a larger safety model:
- Workspace trust controls whether yottacode may operate in the project at all.
- Write-path validation constrains structured filesystem writes to the workspace or configured
--allow-pathsroots and rejects symlink writes and protected application paths. - Read protection blocks common secret-bearing paths from silent structured reads. A
Read(*)orRead(**)allow rule does not override this hardcoded deny list; use an explicitly approved shell command if you intentionally need to inspect a protected file. - Approval modes change how often the normal prompt appears; explicit
denyandaskrules still win. - Plan mode is a workflow boundary that blocks ordinary mutations while planning.
- The command sandbox isolates approved shell/test/document subprocesses when configured, but does not sandbox every tool.
/yoloskips remaining prompts but does not override explicitdenyoraskrules. It also does not bypass trust checks, write-path validation, plan-boundary approvals, background-worker policy, or hard execution guards.
For the complete safety model, see Security and allow lists.