Skip to content

Policy commands

Commands marked terminal must be run by a person in a terminal of their own (Commands).

Command What it does Example
openmoat edit Edit ~/.moat/policy.yaml in $VISUAL or $EDITOR; it is linted and the diff shown before Apply? [y/N]. Terminal openmoat edit
openmoat policy check "<action>" [--kind shell|fs-read|fs-write|net|fetch|mcp] [--policy <file>] [--cwd <dir>] [--project <dir>] [--format json] The verdict for an action, without running it; exit 0 allow or defer, 2 deny, 3 review. Without --policy, it decides with your installed policy and the project’s repository policy, as the hook does openmoat policy check "~/.aws/credentials" --kind fs-read
openmoat policy check-diff [--base <rev> [--head <rev>]] [--policy <file>] [--format text|json|github] Check a change before it is merged: every file it adds, edits, deletes or renames is decided by the policy as a write from untrusted content, and added lines are searched for tokens. Added lines are read for what they do too (content checks, levels in check_diff.levels), and provenance notes are shown (--provenance review|info|off, never changing the exit code). From --base to --head (HEAD), or a unified diff on stdin; exit 0 nothing found, 2 deny, 3 review. Without --policy it uses the shipped default policy, not your installed one, so every machine agrees (Check a pull request) openmoat policy check-diff --base origin/main
openmoat policy lint [<file>] Check a policy: schema, ids, globs; warnings for rules that can never match, for deny and review rules without a title, for servers in mcp.flow_trusted, for content checks set to off, and for ask:, the name review: had before 0.14.0 openmoat policy lint ./policy.yaml
openmoat policy compile [--policy <file>] [--format json] What the OS layers enforce for the policy, and what they cannot openmoat policy compile
openmoat policy upgrade [--dry-run] [--diff] [--yes] [--undo] Take what a new release’s default adds, keeping your edits, grouped by what it does (new protections, fewer interruptions, renames); then writes the agents’ sandboxes as sandbox sync does. --dry-run shows the changes anywhere; --diff adds the full diff; --undo puts the previous policy back. Terminal, except --dry-run openmoat policy upgrade --dry-run
openmoat policy trust-key <key.pub> --name <who> Trust an SSH public key to sign policy packs, and repository policies where the policy asks for signed ones. Terminal openmoat policy trust-key alice.pub --name alice@example.com
openmoat policy install <pack.yaml> [--sig <file>] [--name <name>] Install a signed policy pack once its signature verifies; its rules apply as pack:<name>:<id>. Terminal openmoat policy install team.yaml
openmoat policy remove <name> Take a pack out. Terminal openmoat policy remove team

How to write a rule: The policy file. How to change one safely: Change the rules.