cmdop policy
cmdop policy manages the rules that gate remote-agent tool calls on this
machine. Every rule is a plain string; the gate evaluates them against each
incoming call and allows it, prompts you, or denies it.
cmdop policy list
cmdop policy allow 'execute_command(git *)'
cmdop policy mode strictcmdop permissions still works as an alias for every subcommand below, kept
for compatibility — policy is the current name.
Rules live in this machine’s state database. A rule you add is live immediately; there is no separate config file to reload.
Rule grammar
A rule is a bare string naming a tool, optionally narrowed by a pattern in parentheses:
read_file
execute_command(git *)
connect(exec:prod-*)
write_file(.env*)* matches any run of characters, so execute_command(git *) covers every
git invocation and connect(exec:prod-*) covers exec against any machine
whose name starts with prod-.
Precedence
Deny beats ask beats allow. A deny rule is the strongest block you can write, so adding one is the reliable way to shut something off regardless of what else matches.
Underneath all of it sits a hardcoded floor — paths such as ~/.ssh/** and
.env*, and commands such as rm -rf /. No rule and no mode can unblock the
floor.
Add and remove rules
cmdop policy allow read_file
cmdop policy allow 'connect(exec:prod-*)' --reason="trusted cluster"
cmdop policy ask 'execute_command(kubectl *)'
cmdop policy deny 'write_file(.env*)'
cmdop policy revoke 'execute_command(git *)'| Command | Effect |
|---|---|
allow <rule> | The matching call runs without prompting. |
ask <rule> | The matching call prompts you at call time. |
deny <rule> | The matching call is blocked outright. |
revoke <rule> | Removes the first rule whose raw form matches, whatever its action. |
allow, ask, and deny each take an optional --reason note that is saved
alongside the rule. For revoke, run cmdop policy list first and pass
the exact raw form it prints.
Modes
The mode decides what happens when no rule matches a call:
cmdop policy mode
cmdop policy mode strict| Mode | Behavior with no matching rule |
|---|---|
default | Prompt you in the terminal. The prompt denies the call if you do not answer within 60 seconds. |
strict | Deny everything not explicitly allowed. |
bypass | Allow everything except the hardcoded floor. |
Run cmdop policy mode with no argument to print the current mode. Turning
bypass on or off is its own deliberate command rather than a value you set
directly through mode:
cmdop policy bypass on # allow every tool call except the hardcoded floor
cmdop policy bypass off # return to the default (ask) posture
cmdop policy bypass # show whether bypass is activeTo bypass for a single session without changing stored policy, start the
agent with --approve instead of touching the persisted mode.
Audit the decisions
cmdop policy audit
cmdop policy audit --tail 200
cmdop policy audit --followThe audit log records one line per decision — allow, deny, prompt-allowed,
prompt-denied, prompt-timeout, or floor-deny — with the tool name, the target
argument, the rule that matched, and timing. --tail <n> sets how many lines
to print (default 50) and -f/--follow streams new ones.
Related
- Admin and policy
- cmdop connect — the surface
connect(...)rules gate.