Skip to content
Source on GitHub (opens in a new tab)

Permissions explains how zelk decides each tool call. This page is about setting it up: which mode to use where, how to write rules and where to keep them, and how to confine commands.

Where Starts in Good for
The terminal UI default, or mode in tui.json working alongside zelk: it asks before anything that changes state
zelk -p bypass trusted one-off tasks in a directory you are willing to have changed
zelk exec plan headless jobs that read and report; give -mode to let them change files
zelk acp default editors, which show the approval prompts

-mode plan|default|accept-edits|auto|dont-ask|bypass (or -plan) picks another for any of them. In the terminal UI, Shift+Tab cycles default, accept-edits, plan and auto, and the terminal UI never saves bypass as a default.

dont-ask is useful for unattended runs that should only do what your rules allow: whatever would ask is refused instead.

A rule names a tool and, in parentheses, what it acts on:

zelk -p -allow 'Bash(go test *)' -deny 'Bash(rm *)' -mode dont-ask "run the tests"
zelk -human 'Bash(git push *)' # always a person, even in auto mode
zelk -ask 'Edit(go.mod)' # ask even in accept-edits
zelk -allow 'WebFetch(domain:go.dev)' # a site and its subdomains

Quote rules for the shell: * and parentheses are shell syntax. In a Bash rule, a trailing * also matches nothing, so Bash(npm test *) matches npm test as well. Every command in a pipeline or && chain must be allowed for the whole line to be. On Windows, PowerShell(Get-ChildItem *) names the PowerShell tool in the same way; see PowerShell commands. In PowerShell, quote a rule in single quotes, as above.

Rules you want every time go in ~/.config/zelk/config.json, under the same names as the flags:

~/.config/zelk/config.json
{
"allow": ["Bash(go test *)", "Bash(go vet *)"],
"deny": ["Bash(rm -rf *)"],
"human": ["Bash(git push *)"],
"protect": ["secrets/**"]
}

Flags, config.json and the project’s settings are used together; none overrides another. The strongest matching rule decides: deny, then human, then ask, then allow.

A repository can carry rules for everyone who works in it, in .zelk/settings.json, with the keys allow, ask, deny, human and protect:

.zelk/settings.json
{"allow": ["Bash(make test)"], "deny": ["Bash(rm -rf *)"]}

Its deny, ask and human rules and its protected paths apply at once: they only make zelk more careful. Its allow rules widen what zelk may do, so they apply only once you trust that exact file. The terminal UI asks at start, together with the project’s hooks; elsewhere, review and trust it with:

zelk project list # what the project's .zelk files bring, and whether each is trusted
zelk project trust # trust them as they are now
.zelk/settings.json (allow rules trusted: false, sha256 2615…)
deny Bash(rm -rf *)
allow Bash(make test)

Changing the file asks again.

Writes to .git/, agent settings (.zelk/, .claude/, .agents/, .codex/), Git configuration, shell startup files and tool configuration such as .vscode/ always go to a person, whatever the mode or rules, and are refused where no one can be asked. Add your own with -protect or protect: a pattern with a slash is relative to the workspace, one without matches that name anywhere.

zelk -protect 'deploy/**' -protect '*.pem'

In auto, file edits in the workspace run (except edits to configuration, build files, CI workflows and scripts, which are reviewed), and a reviewer model decides what would otherwise ask you. Allow rules that would run any code, such as Bash(python *), don’t apply in auto mode, so the reviewer sees those commands. After three denials in a row, or ten of the last fifty, the run stops for you.

Two flags shape the reviewer:

  • -trust TEXT names something you count as your own, such as a repository, a bucket or an internal service, so that working with it isn’t judged as reaching outside. It authorizes no particular operation.
  • -reviewer-effort low|medium|high sets how much it reasons per verdict.

Before relying on a model as reviewer, zelk checks it on a short built-in set of actions, once per model; a model that fails isn’t relied on, and what the rules leave open goes to you. -no-reviewer-check skips the check. The auto-mode reviewer explains what it sees, what its verdicts do and how well it has done when measured.

A denial says why. In the terminal UI, Denied actions… lists what the reviewer denied and asks it once more about one you choose. In exec, resume with the denied action’s digest, read from its permission_decided event in -json output:

zelk exec -mode auto -retry-denied DIGEST resume --last "try that exact action again"

The retry asks the reviewer again under the current policy; it doesn’t force the action.

Rules decide which commands run; a sandbox limits what a running command can do. For a run you leave alone, use one:

zelk exec -mode auto -sandbox bwrap "refactor pkg/foo" # Linux: bubblewrap
zelk exec -mode auto -sandbox seatbelt "refactor pkg/foo" # macOS
zelk -sandbox bwrap -network-allow github.com:443 -network-allow '*.golang.org'
zelk -sandbox bwrap -sandbox-read-only ~/.local/bin
zelk -env GOPRIVATE -env NPM_CONFIG_REGISTRY

On Windows, run zelk sandbox setup, review and accept Microsoft’s MXC telemetry, then select -sandbox mxc. Unattended auto mode uses MXC when it is set up and available.

  • Files. A sandboxed command writes inside the workspace and to the sandbox’s private temporary directory and explicit writable roots. bwrap hides your home directory, but binds the toolchains it finds there read-only (Go and its module cache, rustup and cargo, the node on your PATH); -sandbox-read-only PATH adds more, and credential files such as ~/.ssh stay hidden under them. -sandbox-read-only works only with bwrap. MXC grants read-only what it finds of Go, Git for Windows, PowerShell, Node, Python and Rust (the rg.exe executable alone), and gives Go, npm and cargo caches of its own to write in.
  • Network. Off under a sandbox unless -network full, or -network-allow DOMAIN[:PORT] for an allowlist with bwrap or MXC. Without a port, only 80 and 443 are allowed. MXC allows Windows DNS queries outside the allowlist.
  • Environment. Commands get only a base set of variables (PATH, HOME, user, locale, time zone, TMPDIR, XDG directories), sandbox or not. On Windows they also get the variables programs need to start (SystemRoot, PATHEXT, COMSPEC, TEMP, USERPROFILE, APPDATA, LOCALAPPDATA and the like), and -env names match without regard to case. -env NAME passes another. API keys and tokens never reach a command unless you name them.

On Linux, -mode auto with no one to ask (-input deny) uses bwrap by default; "sandbox": "none" in config.json, or -sandbox none, turns that off. On Windows it uses MXC the same way when MXC is set up, and runs commands unconfined, saying so, when it isn’t. Save a sandbox you always want with "sandbox": "bwrap".