Agents running unattended
The problem
Section titled “The problem”With auto-approve, in the background or overnight, nobody is there to answer a prompt. A call the policy has no rule for then simply runs, and code inside an allowed command can do whatever it contains.
The commands
Section titled “The commands”Put the whole agent and everything it starts in one sandbox, with network only through OpenMoat’s proxy:
openmoat run --write ~/.claude --write ~/.claude.json -- claudeopenmoat run --isolate --write ~/.claude --write ~/.claude.json -- claude # Linux: refuse to start without bubblewrapThe two --write paths are Claude Code’s own state, which it must write to run. Whatever follows the agent’s name goes to the agent, so an auto-approve flag goes there. On Linux, where bubblewrap works, openmoat run starts the Isolated tier by default: the agent sees only the project, the policy’s read roots, its own executable, the --write paths and an empty temp directory. --isolate refuses to start where that tier cannot (Linux tiers and Landlock); require.run: full-boundary makes every openmoat run refuse.
openmoat run also takes a snapshot of the project’s files before the agent starts and after it exits, so openmoat restore can put them back after a bad session (Undo an agent’s changes). A call held for review can be approved from your phone while you are away (Approve reviews from your phone).
openmoat runneeds macOS 13 or later, or Linux. On macOS 12 and earlier it refuses to start and says so. On Windows it refuses too: for OS confinement, run the agent andopenmoatinside WSL2.- Turn the agent’s own sandbox off inside, because sandboxes do not nest. Credentials must not come from the keychain: use an API key or
apiKeyHelper.
Afterwards, read what happened:
openmoat replay --since today # one tree per agent session: every call, verdict and ruleopenmoat report --since 7d # totals, hosts, top rules, reviews per active houropenmoat why --last # the newest deny or review, explained in fullWhat the agent is told when a call is denied:
OpenMoat blocked: reading or changing your keys and credential files call cat ~/.ssh/id_rsa rule moat: deny [secrets-paths] — secret material: read /Users/you/.ssh/id_rsa why a key or token that leaves this machine cannot be taken back next if you need this, do it yourself in your own terminal more openmoat why --last · https://openmoat.dev/r/secrets-pathsWhat it stops
Section titled “What it stops”| Verdict | With a prompt | Nobody answering |
|---|---|---|
| allow | runs | runs |
| defer | your agent asks you | runs |
| review | waits for you | stopped |
| deny | never runs | never runs |
- Everything the policy denies stays denied: secrets read or sent, data sent to unlisted hosts, a download piped into a shell, destructive commands, changes to OpenMoat.
- A review stops the call. Agents that cannot prompt receive it as a deny that says how to approve the call (
openmoat allow --last). - Under
openmoat run, the operating system confines what an allowed command does, the network goes only through the proxy, and npm and uv skip package versions published in the last 7 days.
What it does not stop
Section titled “What it does not stop”- Deferred calls run.
npm install left-padandgit push origin mainhave no rule, so in auto-approve nothing asks. - Some modes answer or skip the check. OpenCode 2’s
--autoapproves OpenMoat’s reviews, and OpenMoat’s plugin cannot tell. The Cline CLI’s--yoloruns no hooks. Hermes Agent’s in-session/yoloapproves a review unseen. - Antigravity CLI.
--dangerously-skip-permissionsapproves its requests unseen, which OpenMoat cannot see. A realagyblocks the call when the hook is missing or exits with an error; what it does when the hook times out is not documented, so OpenMoat assumes the call runs then. - Some agents run a call when the hook fails or is not loaded.
openmoat statusreports what it can see. - Without a sandbox, the hook decides alone. On a hook-only agent an allowed call runs with your permissions.
- Under
openmoat run, the agent’s own login is readable to the commands it runs. An API-key login can go through the broker instead; an OAuth login cannot. - Under
openmoat run, tool commands of some agents still receive the relay token. Under Codex, Cursor, GitHub Copilot CLI, Gemini CLI, the Cline CLI and the Antigravity CLI, a script or a test runner can send the run calls the agent never made. - On Linux without bubblewrap,
openmoat runcannot create anything directly at the project’s top. From 0.21.0 it grants the project entry by entry there, so.env,.gitand.moatat the top stay covered, while a.envin a subfolder stays open. Where bubblewrap works it starts the Isolated tier by default;--isolaterefuses to start without it (Project files on Linux). - Commit, pull and install outside the run. Under
openmoat runthe project’s.gitand the agents’ configuration folders are read-only, sogit commit, or agit pullor install that changes those folders, fails inside it. - An allowed host can receive data. The proxy checks the host, not what is sent inside HTTPS.
- Sending what a session collected is recorded, not stopped. It appears in the audit log and in
openmoat report.