Worker permission rules
These settings live in LibraOS Engine's config file,
~/.local/share/agentd/config.toml. With none of them set, workers start
exactly as they did before: guarded, with no rules of yours, and never
publishing.
This is a guardrail against mistakes, not containment. A worker runs as your OS user. Do not rely on these rules alone for a worker you do not trust; see Limits.
Rules
[dispatch.rules] limits what a dispatched worker may do:
[dispatch.rules]
allow = ["Bash(go test *)", "Read"] # no prompt needed (Claude only)
ask = ["Bash(git push *)", "Bash(git * push *)"] # you decide, in the dashboard
block = ["Bash(rm -rf *)", "Bash(rm -fr *)", "WebFetch"] # refused
codex = "refuse" # or "advisory"; see below
codex_sandbox = "workspace-write" # or "read-only"
A rule is a tool name (WebFetch, mcp__gh__*) or a tool with a pattern
(Bash(git push *), Edit(/etc/*)). Block beats ask, and ask beats allow. A
call no rule names follows the client's own settings. A pattern on a file or
web tool reads its path or URL; on any other tool, an MCP tool above all, it
reads everything in the call. A bad rule, a misspelt key or
codex_sandbox = "danger-full-access" is a config error.
Rules also cover the tools of MCP servers attached to workers: on a Claude
worker they are mcp__NAME__TOOL, so block = ["mcp__docs__delete_page"]
refuses one of them.
What is enforced
| Rule | Claude worker | Codex worker |
|---|---|---|
block | Refused by --disallowedTools and by LibraOS Engine's hook. | Not enforced. The Codex CLI has no per-command rule, so the worker does not start, unless codex = "advisory". |
ask | Refused by the hook and filed as an approval. Your click releases that exact call once. | Not enforced. The worker does not start, unless codex = "advisory", where it is told to ask and trusted to. |
allow | --allowedTools. | Ignored; it does not stop the worker from starting. |
codex_sandbox | Does not apply. | The codex exec --sandbox value. It limits writes as a whole, not one command. |
A check command matching block or ask | Refused: LibraOS Engine runs the check itself. | Refused, the same way. |
opencode and Pi workers are refused while [dispatch.rules] has rules they
cannot hold: use a Claude worker.
A Claude worker is not stopped by a prompt where no rule applies: in a background session nobody answers it. Rules are the guard there, not prompts.
How ask works
- A Claude worker's call matches an
askrule. The hook refuses it and files an approval with the command text. It appears in the dashboard's Needs you column. - Repeating the call while it waits files nothing new. At most 5 rule approvals wait per task. A command over 600 characters is refused rather than filed, since you could not read it.
- Approve in the dashboard, and the same call goes through once. The next
attempt is a new question, because a later
git pushpushes other commits. Reject, and the same call stays refused without asking again.
Only your click in the dashboard releases a call. An answer recorded from an agent session does not, because the worker could record it itself.
The hook refuses when it cannot read the call, the task or the config, so a
broken config.toml refuses too. Refusals name the rule and tool in the task's
history, never the command, which may hold a secret.
Every worker: no publishing
Every dispatched worker gets these block rules on top of yours:
Bash(git push *), Bash(git -* push *), Bash(gh pr create *),
Bash(gh pr merge *), Bash(gh pr ready *), and gh api calls that write
(-X, --method, -f, -F, --field, --raw-field or --input). On a
Claude worker they are flags and the hook; on a Codex worker they are a prompt
rule only. A check command that matches them is refused. An ask or allow
rule of yours with the very same pattern replaces that one default.
Publishing a finished worker's branch is your step: Open a draft PR in the
dashboard, or libraos-core handoff pr ID; see
Review and publish. The one exception is
merge mode auto, where LibraOS Engine itself, never the worker,
publishes verified work.
A worker started by libraos-core run also gets Bash(git commit *) and
Bash(git -* commit *) blocked, and commits through LibraOS Engine instead,
so its commits can be told from yours in a shared checkout. Its result card
compares every remote's refs before and after, and prints !! PUSHED if
anything was pushed.
Permission mode: guarded or yolo
[dispatch] permission_mode says whether a worker keeps its own client's
sandbox and prompts:
[dispatch]
permission_mode = "guarded" # the default
# "yolo": claude --dangerously-skip-permissions; codex --sandbox danger-full-access (which has network)
[dispatch.permission_mode_roles]
reviewer = "guarded" # workers of role reviewer, in any repository
[dispatch.permission_mode_repos]
"/home/me/src/app" = "yolo" # workers in that checkout and its worktrees
The most specific scope that sets the mode wins: the role's, else the
repository's, else the global one, else guarded. To keep a checkout guarded
for every role, do not give any role yolo. opencode and Pi workers have no
sandbox or prompts of their own, so the mode changes nothing for them.
Who sets it. Only an owner at their own terminal:
libraos-core config set dispatch.permission_mode yolo # or guarded
libraos-core config set dispatch.permission_mode guarded --role reviewer
libraos-core config set dispatch.permission_mode "" --repo ~/src/app # clear: the next scope out applies
libraos-core config get dispatch.permission_mode
It is refused to a worker, an agent session, a process one of them started,
and input that is not a terminal. A role file cannot set it.
libraos-core init --permission-mode guarded|yolo sets it at first setup
only. The dashboard's Settings can only lower it to guarded. Each change
is an audit record: libraos-core audit list --action permission_mode. A
running worker keeps the mode it started with.
Before a yolo Claude worker, run claude --dangerously-skip-permissions
once at your own terminal and accept its disclaimer. Until you do, no yolo
Claude worker starts. A yolo Claude worker also loads your user Claude Code
settings, so your user hooks and plugins run with its permissions: enable only
those you trust.
What yolo lifts: the client's own sandbox and prompts (a role's read-only
sandbox included), and your block rules. Each call a lifted block rule would
have refused runs and is an audit record
(libraos-core audit list --action rule:lifted).
What yolo never lifts:
- Publishing. Every shell command of a yolo worker is classified by its
words and refused when it publishes:
git push(and git aliases for it),git send-pack,hub push,gh pr create,gh pr merge,gh pr review --approve, release writes,gh repo delete,renameandarchive, andgh apiwrites to merge, release, repository and ref endpoints, also insidebash -c, pipes, lists,$( )and common wrappers such asenv,timeoutandsudo. Reads and local commands (git merge,git fetch,gh pr view) run. askrules, the budget, report deadlines, the check and delivery.- A write of the merge-mode setting.
The classifier cannot see a script file the worker writes and runs, a heredoc
piped to a shell, or curl to the API with a token. So after the fact, when a
yolo worker commits or finishes, LibraOS Engine reads every remote and refuses
the result if a remote ref points at one of the worker's commits, naming the
commit and ref; a person then decides. Remote tips that existed before the
worker started do not count as its push.
Because a yolo worker can write config.toml, LibraOS Engine records a digest
of its permission settings at the start and refuses the worker's commit and
finish if they changed while it ran, unless a person changed them with
libraos-core config set or Settings.
On a host, not a container. When LibraOS Engine finds no container
(/.dockerenv, /run/.containerenv or a container cgroup), each yolo start
warns once: in the dispatch result, the task's history, the Inbox and
libraos-core status. The warning names the scope that turned yolo on and the
command that turns it off there. It never refuses the start.
Merge mode: manual or auto
[dispatch] merge_mode says whether LibraOS Engine itself publishes and merges
work it has verified, or leaves that to you:
[dispatch]
merge_mode = "manual" # the default
# "auto": verified work is pushed and merged without a person
[dispatch.merge_mode_roles]
shipper = "auto" # work of role shipper, in any repository
[dispatch.merge_mode_repos]
"/home/me/src/prod" = "manual" # work in that checkout and its worktrees
A repository set to manual stays manual whatever else is set: a merge cannot
be undone, so a role's auto never overrides it. Otherwise the most specific
scope wins: the role's, else the repository's, else the global one, else
manual.
Who sets it. Only an owner at their own terminal:
libraos-core config set dispatch.merge_mode auto --repo ~/src/app
libraos-core config set dispatch.merge_mode "" --repo ~/src/app # clear
libraos-core config history # every change
It is refused to a worker, an agent session, a process one of them started,
input that is not a terminal, and the dashboard. Setting auto prints a
warning naming its scope and the command that turns it off. LibraOS Engine
honours auto only when the newest recorded change says auto: a value
written into config.toml by hand or by a worker is read as manual, and
libraos-core doctor (merge-mode) warns of it.
What auto does. It acts only on verified work: the review clean, the head merged with the default branch without a conflict, and the check passing at that merge. Then LibraOS Engine (never the worker):
- pushes the task's own branch (
agentd/<id>, never the default branch, never with force) and opens a pull request that is not a draft; - waits while CI runs, and merges once every check is green and GitHub allows
the merge, pinned to the checked commit and never with
--admin; - merges with no CI only when the target branch has no workflows at all, in which case LibraOS Engine's own check was the gate.
It never merges on a failed check, red CI, a conflict, a pull request moved
past the checked commit, CI that is configured but did not run, or a change to
CI or review configuration (.github/workflows/, CODEOWNERS and the like).
Branch protection is respected, never bypassed: while GitHub blocks the merge,
LibraOS Engine waits up to 6 hours, then leaves it for you. Each of these is
left for a person, and the sender is told. Once you have resolved it,
libraos-core delivery retry ID takes the pull request up again.
Each automatic push and merge is an audit record
(libraos-core audit list --action delivery:auto_) and a line in the task's
history naming the scope.
A Codex worker with network
The default Codex sandbox has no network, so tests with listeners and gh
fail. Two settings turn it on:
[dispatch]
codex_network = true # every Codex worker on a workspace-write sandbox; default false
and network: true in a role, for that role's workers. A role with
network: false stays without network, and a read-only sandbox never has it.
With network, the worker's gh is signed in, so each dispatch writes
.codex/rules/agentd-worker.rules in the worker's directory (excluded from
commits), a rules file Codex loads. It forbids git push, git -C, git -c,
gh api, gh pr merge|comment|review|create, gh issue comment|create,
--repo/-R, and bash -c/sh -c, since Codex does not look inside a shell
run from its own. gh pr view, gh issue list and git fetch still run.
This is a guardrail: /usr/bin/gh, a script file or curl with the token get
past it.
Workers through a model gateway
[dispatch]
claude_base_url = "https://api.libraos.com"
claude_key_file = "~/.config/agentd/libraos.key" # the key alone, chmod 600
or from the terminal:
libraos-core config set dispatch.claude_base_url https://api.libraos.com --key-file ~/.config/agentd/libraos.key
dispatch.codex_base_url (an OpenAI Responses-compatible URL, such as
https://api.libraos.com/v1), dispatch.opencode_base_url and
dispatch.pi_base_url take the same form. "" as the URL clears both. Only
you at your own terminal set these: they decide where workers send their
prompts and your key, so they are refused to a worker's or an agent's shell
and to the dashboard. The key is never written to config.toml, its history
or any output. See Models and billing for the LibraOS model
API.
A Claude worker gets the key through Claude Code's apiKeyHelper, not its
environment. A Codex worker gets it in the environment variable
AGENTD_CODEX_API_KEY, which Codex's default shell policy keeps from the
commands it runs. Either worker runs as you and can read the key file, so give
workers a key you would let them use.
A key goes over plain http only to this machine (127.0.0.0/8, ::1 or
localhost); elsewhere the URL must be https.
Key files
A key file takes an absolute path or one starting with ~/. It must hold the
key alone on one line, be a regular file that belongs to you, and be readable
and writable only by you (mode 0600). It may be a symbolic link to such a file.
Key files are read each time a worker starts, so rotating a key needs no
restart. libraos-core doctor names the gateway workers use and fails on a key
file they could not use, with the fix.
What a worker's environment loses
A worker inherits the environment of the process that starts it, less:
| Removed | Why |
|---|---|
ORCA_PANE_KEY and every ORCA_AGENT_* | Desktop app hook variables: only LibraOS Engine decides a worker's permissions. |
AGENTD_SESSION, AGENTD_USER and the like, PATH | Replaced by the worker's own, so it never acts as the session that started it. |
OPENCODE_*, PI_* | That tool's own settings would undo the worker's. |
Other credentials in that environment stay. Start workers from an environment that holds only what you would let them use.
Limits
- A pattern reads the text of a call. It finds
git pushaftercd x &&, insidebash -c '...'or as/usr/bin/git push. It missesgit -C x pushunless you addBash(git * push *), and it missesrm -r -f, a script file, a quoted or escaped word and a variable. It can also match too much:git commit -m "before git push"is refused. - Rules are read when each call is checked. A worker that can write
config.tomlor the ledger can change them. - Credentials stay in the worker's environment, except those named above.
- Triggers refuse to start a worker unless your rules stop a set of sample
push, merge and
gh apicommands.Bash(git * push *),Bash(gh pr merge *),Bash(gh pr create *)andBash(gh api *)pass them. Passing does not prove the rules are complete.