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.
| Mode | In the app | Agents and the CLI may… |
|---|---|---|
ask | Ask first | Read everything. Changes are refused with an approval error. This is the default for a new project. |
allow-writes | Allow changes | Also rename, comment, import, analyze and revert. Every change can be undone. |
allow-all | Allow changes and scripts | Also 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.
Agent chat and scripts
Section titled “Agent chat and scripts”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.
Change the policy
Section titled “Change the policy”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:
opcodex policy getopcodex policy set allow-writespolicy 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.
History
Section titled “History”Every change through the engine is recorded with:
- the time;
- the actor:
desktop,cli, ormcp:<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.
Undo a change
Section titled “Undo a change”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.
Revisions
Section titled “Revisions”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.