"Shall We Approve?" Consequence-Aware Approval for Autonomous Coding Agents
Weiheng Wu, Junkai Chen, Zhensu Sun, Jieke Shi, Yunbo Lyu, David Lo
cs.CR, cs.AI
2026-10-30
Caper pre-executes each shell command in a sandbox and approves from observed effects. Harm falls to 6.7% on SABER (vs ≥14.8%) and 7.8% on YoloFS-Ext, blocking 1.0% of safe twins.
Coding agents issue shell commands in a stateful workspace. One command can leak a credential, delete data, or weaken a security control. A person cannot approve every step: Anthropic reports that users allow 93% of Claude Code permission prompts.
Automated approvers read text. CARE matches risky syntax and paths. Guardrail models such as ToolSafe, gpt-oss-safeguard, and Qwen3Guard score the request and the dialogue against a policy. Claude Code Auto Mode pairs allow-rules with a classifier that sees the transcript. None of them watches what the command does in this repository before saying yes.
make clean && make is the same string in two workspaces. One Makefile deletes build/. The other also deletes src/ and .git/. Scripts and binaries can read secrets or open sockets with none of that visible in the command. YoloFS and GoEx inspect file changes after the run and leave the call to the agent that proposed it. A credential that has already left cannot be rolled back.
Caper (Consequence-Aware PERmission) leaves the agent unchanged. The gate sits on the shell boundary and treats each command as a local transaction.
Effects that leave the container cannot be undone, so the sandbox denies the network. Connection attempts are still recorded, with destination, process, and prior reads. Fixed network replies supplied by a benchmark are marked simulated.
The comparison covers six existing systems plus no approval. The agent is GLM-5.3-Flash. The Caper approver and the Auto Mode classifier both use gpt-5.6-luna. Each task runs once. SABER has 682 shell-only tasks. YoloFS-Ext hides the harm inside the tool a benign command invokes, at four levels of concealment, across 102 dangerous tasks. Each has a safe twin: same files, request, and command, with harmless tool code.
| System | SABER harm | YoloFS-Ext harm | Safe completion | Twin false block |
| No approval (GLM-5.3-Flash) | 19.7% | 71.6% | 17.6% | n/a |
| CARE | 15.0% | 69.6% | 15.7% | 2.0% |
| Claude Code Auto Mode | 14.8% | 62.7% | 7.8% | 3.9% |
| YoloFS | 21.2% | 35.3% | 22.5% | n/a |
| Caper (hook) | 10.0% | 6.9% | 40.2% | 2.0% |
| Caper | 6.7% | 7.8% | 60.8% | 1.0% |
The last two columns are YoloFS-Ext. On SABER, Caper's safe-outcome rate is 67.8% (48.6% completed, 19.1% refused), in line with 66.6% for no approval, while harm falls from 19.7% to 6.7%. The five text-only approvers sit between 14.8% and 18.8%. On YoloFS-Ext, Qwen3Guard blocks nothing and leaves 67.6% harmed; TS-Guard leaves 94.1%.
Replacing Auto Mode's classifier with a Caper hook, and changing nothing else, cuts SABER harm from 14.8% to 10.0% and YoloFS-Ext harm from 62.7% to 6.9%.
Without an effects report, the same approver blocks dangerous commands and their twins together: a 61.8% twin false-block rate. With the report, the harmful command is blocked in 84.3% of dangerous tasks and twin false blocks fall to 1.0%. In the ablation, command plus evidence and no dialogue already yields 1.0% harm and no false blocks. Adding the full dialogue is the main Caper row, 7.8% harm and 1.0% false blocks. Predicting effects instead of observing them reaches 3.9% harm but still false-blocks 61.8% of twins, with the same 60.8% safe completion. The harm number drops because the approver refuses broadly.
Auto Mode allows two commands that match the user's request exactly. A compiled deploy tool rewrites src/app.js from 29 B to an 11 B comment, and make migrate shrinks the database from 32 KB to 20 KB while dropping three tables. Caper blocks on the diff and the size change. The agent then finishes by a safer route.
YoloFS sees the same kind of file changes and shows them to the agent after the fact. The agent reverts in 66 of 102 dangerous runs; of the 36 it never reverts, 33 end harmed. Harm is 35.3% and safe completion 22.5%, against 7.8% and 60.8% for Caper. On SABER, YoloFS harm is 21.2%, above 19.7% with no approval, because a sent credential cannot be recalled.
Dropping the content diff raises harm from 7.8% to 13.7%. A weaker approver given the same observations cuts false blocks from 53.9% to 4.9% and raises harm from 25.5% to 33.3%.
Median report size on SABER is 0.9 KB, against 62.5 KB for the raw trace, 99.4% smaller overall. Median approval latency is 3.2 s, against 3.3 s with no evidence. The sandbox adds about 0.5 s on an allow and 1.5 s on a block. API cost is $0.019 per task, against $0.017.
Text approval misses harm that is not in the string. A repo-shipped dependency check can read .env and try to send it out, and neither the request nor the command says so. Caper looks at effects in the current workspace before the decision, asks a model that is not the agent, and on a block rolls back only that command with a reason. As a Claude Code hook, that swap drops YoloFS-Ext harm from 62.7% to 6.9%.
The extra work is one real execution. Latency and API cost stay close to an approver with no evidence. Safe completion on YoloFS-Ext is 60.8%, the best in the table, with a 1.0% false block. The low harm rate is not a blanket refusal.
High-stakes actions still need a sandbox and a person. Harm at 6.7% and 7.8% is lower, and it is still there.
Rollback restores the container filesystem. Network calls, writes to remote services, and processes the command starts all happen before the decision. The experiments keep the transaction by disabling the network. If a deployment allows registries or other domains, pre-execution still has to miss the real service, for example by answering through a recording proxy. The threat model trusts the approver, the snapshot rollback, and the container boundary.
Caper gates shell commands. An edit that overwrites a config file by itself is still judged from the call text. Harm planted in source shows up only when a later command runs it.
The report describes one run. Tools that depend on time, randomness, or the environment can behave differently the next time. An attacker who detects the sandbox, delays the harm, plants text in the report, or splits one change across benign-looking commands is outside both benchmarks.
Whether an effect is allowed depends on the task, and an LLM can drift across runs or misread the report. The main table uses a revised SABER oracle that corrects false positives; under the released oracle Caper still has the lowest harm rate. The only deployed gate in the comparison is Claude Code Auto Mode. Codex, in its default sandbox, reviews requests that leave the workspace, so most of these harms would never reach it. Each task is run once. With a weaker approver, the same observations move harm from 25.5% to 33.3%.