Skip to content

Approval policy & history

Each project has an approval policy. It decides which changes agents and the command line may make. Reading is always allowed. Changes you make in the desktop app are always allowed.

ModeIn the appAgents and the CLI may…
askAsk firstRead everything. Changes are refused with an approval error. This is the default for a new project.
allow-writesAllow changesAlso rename, comment, import, analyze and revert. Every change can be undone.
allow-allAllow changes and scriptsAlso run scripts (script.run), which can change anything in the program.

Under ask, a refused write ends with exit code 2 in the CLI and an error for the agent that names the policy. To let the change through, change the mode, then ask the agent to try again.

The agent chat follows the same policy. Reads always run. Under ask, every change waits for Approve or Decline. Under allow-writes, changes run, but scripts still ask. Under allow-all, both run.

Running a script (script.run) is the one operation that runs code. Agents and the CLI can run scripts only under allow-all. In the app, Run on the Plugins screen always works, because a person chose it. Installing, enabling or removing plugins and adding scripts are desktop-only: agents and the CLI can’t do them.

Only a person can change the policy. Agents never get the operations that change it.

In the app: open Agents and choose a mode under What agents may change. A project must be open.

In a terminal:

Terminal window
opcodex policy get
opcodex policy set allow-writes

policy set prints a six-digit one-time code and asks you to type it, for example Type 482913 to let agents make changes in curl:. The code is valid for 60 seconds and for one attempt. The command refuses to run unless both its input and its error output are a terminal, so an agent can’t pipe the code back to itself.

Use --project PATH to choose the project when the app isn’t running.

Every change through the engine is recorded with:

  • the time;
  • the actor: desktop, cli, or mcp:<client name>;
  • the operation and a short summary;
  • the value before and after.

You can see history in three places:

  • the Inspector’s History panel, for the open program;
  • Recent agent activity on the Agents page, which shows only changes by agents and the CLI;
  • opcodex history.list --program-id PROGRAM_ID.

Select Revert this change in the Inspector, or Undo this change on the Agents page. From a terminal, use history.revert with the entry ID from history.list.

A revert succeeds only if the value hasn’t changed again since. The revert is itself recorded, so you can see who undid what. In the app, renames and comments can be reverted.

Each program has a revision number that goes up with every change. Writes must state the revision they read (expectedRevision). If someone else changed the program in between, the write is refused and the client reads again. This stops an agent and a person from overwriting each other.