---
title: "oz0 policy edit"
description: "Change one rule, by its ID (oz0 policy show lists them): only what a flag names changes, and the rule keeps its place and its ID."
canonical_url: "https://docs.oz0.ai/reference/cli/oz0/policy/edit"
---
# oz0 policy edit

> Change one rule, by its ID (oz0 policy show lists them): only what a flag names changes, and the rule keeps its place and its ID.

For: Operators and developers looking up a command.

Change one rule, by its ID (oz0 policy show lists them): only what a flag names changes, and the rule keeps
its place and its ID. --action is allow, ask or refuse; --match its pattern; --enforce turns a shadow rule on (it then
decides), --shadow back to watching; the other flags are oz0 policy allow's, and --no-when, --no-expires, --no-callers
and --no-deciders take a setting away.

--class and --agent write the rule's whole condition, so on a rule with a
condition give the part to keep with --when too, or --no-when to drop it. A command rule takes --action, --command (its pattern), --default, --agent,
--no-agents, --caller, --no-callers, --target, --shadow, --enforce, --expires and --no-expires. To move a rule, remove it and add it again, or export the policy, reorder it and
apply it.

The change's reason (--reason or $OZ0_REASON) becomes the rule's reason; a change that loosens the policy
waits for another admin where four eyes are on.

## Usage

```bash
oz0 policy edit <id> [flags]
```

## Flags

<table>
<thead>
  <tr>
    <th>
      Flag
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Default
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        --action
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      
    </td>
    
    <td>
      allow, ask or refuse
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --after-class
      </code>
    </td>
    
    <td>
      stringArray
    </td>
    
    <td>
      
    </td>
    
    <td>
      a sequence rule's first call: its action class; repeatable
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --after-compartment
      </code>
    </td>
    
    <td>
      stringArray
    </td>
    
    <td>
      
    </td>
    
    <td>
      a sequence rule's first call: a compartment its result's labels name; repeatable
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --after-function
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      
    </td>
    
    <td>
      a sequence rule's first call: its function, a pattern
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --after-level
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      
    </td>
    
    <td>
      a sequence rule's first call: a level its result's labels reach, a name of the tenant's list
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --after-outbound
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      
    </td>
    
    <td>
      a sequence rule's first call: yes if it can send data out, no if it cannot
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --after-plugin
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      
    </td>
    
    <td>
      a sequence rule's first call: its plugin
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --after-trust
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      
    </td>
    
    <td>
      a sequence rule's first call: the trust of its result's labels
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --agent
      </code>
    </td>
    
    <td>
      stringArray
    </td>
    
    <td>
      
    </td>
    
    <td>
      only for calls of this agent's jobs: for functions, the condition caller.agent (beside --when); for a command rule, its agents; repeatable or comma-separated
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --caller
      </code>
    </td>
    
    <td>
      stringArray
    </td>
    
    <td>
      
    </td>
    
    <td>
      only for calls by plugins: plugin:&lt;name>, publisher:&lt;namespace> or source:&lt;kind> (git, workspace, bundle, oci, hub, mcp, npm, archive); repeatable
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --class
      </code>
    </td>
    
    <td>
      stringArray
    </td>
    
    <td>
      
    </td>
    
    <td>
      only for calls of functions of this action class: read, write, egress (Sends out) or destructive, host tools included (it writes the condition with each class's host form); repeatable
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --command
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      
    </td>
    
    <td>
      a command rule's pattern instead of functions: the program after its wrappers and its flags and operands, * for one operand, ** for the rest, [class] for an operand of a class (home, root, inside-workdir, outside-workdir, unresolvable, device, default-branch, host:&lt;name>), such as 'git push --force * [default-branch]'
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --confirm
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      
    </td>
    
    <td>
      for an ask rule: the argument a decider types to confirm each call
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --deadline
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      
    </td>
    
    <td>
      for an ask rule: how long its approvals wait, 1m to 720h
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --deciders
      </code>
    </td>
    
    <td>
      stringArray
    </td>
    
    <td>
      
    </td>
    
    <td>
      for an ask rule: who decides: role:&lt;role>, team:&lt;name>, user:&lt;name> or key:&lt;API key ID>; repeatable or comma-separated
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --decision-ref
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      
    </td>
    
    <td>
      the decision or case the change follows, such as a case number (at most 200 characters)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --default
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      
    </td>
    
    <td>
      a command rule over a default command rule by its ID, such as cmd.download-run: allow turns it off, refuse makes it refuse, for the agents, callers and targets named (oz0 policy show lists the defaults)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --enforce
      </code>
    </td>
    
    <td>
      bool
    </td>
    
    <td>
      
    </td>
    
    <td>
      turn a shadow rule on: it then decides
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --escalation
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      
    </td>
    
    <td>
      for an ask rule: its escalation ladder: default, off, or steps such as 0.25:deciders,0.5:owner
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --expires
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      
    </td>
    
    <td>
      when the rule stops: a time in RFC 3339 or a duration from now, such as 72h
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --id
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      
    </td>
    
    <td>
      the new rule's ID (rule-&lt;letters and digits>); the server gives one when empty
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --json
      </code>
    </td>
    
    <td>
      bool
    </td>
    
    <td>
      
    </td>
    
    <td>
      print JSON instead of a table
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --match
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      
    </td>
    
    <td>
      the rule's pattern, &lt;tool>.&lt;function> with * for anything
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --no-agents
      </code>
    </td>
    
    <td>
      bool
    </td>
    
    <td>
      
    </td>
    
    <td>
      a command rule: take its agents away
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --no-callers
      </code>
    </td>
    
    <td>
      bool
    </td>
    
    <td>
      
    </td>
    
    <td>
      take the rule's callers and --other-plugins away
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --no-deciders
      </code>
    </td>
    
    <td>
      bool
    </td>
    
    <td>
      
    </td>
    
    <td>
      take the rule's deciders and --not-starter away
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --no-expires
      </code>
    </td>
    
    <td>
      bool
    </td>
    
    <td>
      
    </td>
    
    <td>
      take the rule's end away: it lasts until removed
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --no-when
      </code>
    </td>
    
    <td>
      bool
    </td>
    
    <td>
      
    </td>
    
    <td>
      take the rule's condition away
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --not-starter
      </code>
    </td>
    
    <td>
      bool
    </td>
    
    <td>
      
    </td>
    
    <td>
      for an ask rule: never the job's starter (four eyes)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --origin
      </code>
    </td>
    
    <td>
      stringArray
    </td>
    
    <td>
      
    </td>
    
    <td>
      an origin rule's floor: &lt;argument>=&lt;origin> or role:&lt;role>=&lt;origin>, origin request, identity, record or any; repeatable
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --other-plugins
      </code>
    </td>
    
    <td>
      bool
    </td>
    
    <td>
      
    </td>
    
    <td>
      only for calls of another plugin's functions (granted uses)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --reason
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      
    </td>
    
    <td>
      why, required for every governance change (at most 500 characters; default $OZ0_REASON); the audit log keeps it
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --shadow
      </code>
    </td>
    
    <td>
      bool
    </td>
    
    <td>
      
    </td>
    
    <td>
      decide nothing: record what the rule would have decided (oz0 tenant tool-policy shadow-report)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --target
      </code>
    </td>
    
    <td>
      stringArray
    </td>
    
    <td>
      
    </td>
    
    <td>
      for a rule over a default: only what it finds of this class: home, root, outside-workdir, unresolvable, device or default-branch; repeatable
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --tenant
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      <code>
        default
      </code>
    </td>
    
    <td>
      tenant
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --then-class
      </code>
    </td>
    
    <td>
      stringArray
    </td>
    
    <td>
      
    </td>
    
    <td>
      a sequence rule's later call, which the rule decides: its action class; repeatable
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --then-function
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      
    </td>
    
    <td>
      a sequence rule's later call, which the rule decides: its function, a pattern
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --then-outbound
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      
    </td>
    
    <td>
      a sequence rule's later call, which the rule decides: yes if it can send data out, no if it cannot
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --then-plugin
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      
    </td>
    
    <td>
      a sequence rule's later call, which the rule decides: its plugin
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --type
      </code>
    </td>
    
    <td>
      stringArray
    </td>
    
    <td>
      
    </td>
    
    <td>
      only for functions of this kind: read (says readOnlyHint: true; never a remote server's), destructive (says destructiveHint: true), declares-nothing (no annotations at all), not-read or reaches-outside; repeatable
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --when
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      
    </td>
    
    <td>
      a CEL condition over each call, such as "args.repo.startsWith('acme/')": the rule decides only the calls it holds for
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --within
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      
    </td>
    
    <td>
      a sequence rule's scope: job (default) or tree (the whole job tree)
    </td>
  </tr>
</tbody>
</table>

## Inherited flags

<table>
<thead>
  <tr>
    <th>
      Flag
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Default
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        --context
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      <code>
        $OZ0_CONTEXT or &lt;config dir>/orchestrator-zero/context.json
      </code>
    </td>
    
    <td>
      CLI context file written by server init
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        --log-level
      </code>
    </td>
    
    <td>
      string
    </td>
    
    <td>
      <code>
        info
      </code>
    </td>
    
    <td>
      log level: debug, info, warn or error
    </td>
  </tr>
</tbody>
</table>

See [all `oz0` commands](https://docs.oz0.ai/reference/cli/oz0) and the [global flags](https://docs.oz0.ai/reference/cli/oz0#global-flags).


## Sitemap

See the full [sitemap](https://docs.oz0.ai/sitemap.md) for all pages.
