arXiv:2610.40753cs.CROct 2026

Manuscript Offprint

arXiv:2610.40753

"Shall We Approve?" Consequence-Aware Approval for Autonomous Coding Agents

Weiheng Wu, Junkai Chen, Zhensu Sun, Jieke Shi, Yunbo Lyu, David Lo

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Coding agents increasingly rely on automated approvers to decide whether a proposed shell command may run. Existing approvers, from rule-based checkers to guardrail models and deployed permission classifiers, base their decisions on the text of the request and command. Yet a command's behavior depends on the code it invokes and the state of the workspace, and systems that observe file changes leave the assessment to the agent or a human after execution. We present CAPER, a consequence-aware approval mechanism that pre-executes each command in a snapshotted sandbox, provides an independent approver with a bounded report of its observed effects, commits allowed commands, and rolls back blocked ones with a reason the agent can act on. Compared with six existing systems, CAPER achieves the lowest harmful-outcome rate on SABER (6.7% versus at least 14.8%) and YoloFS-Ext, a benchmark we build in which harmful behavior is hidden inside invoked tools (7.8% versus at least 35.3%), while blocking 1.0% of the safe twins of the dangerous tasks in YoloFS-Ext.

github.com/wudaoz/Caper

1. Introduction

Autonomous coding agents edit code, run builds and tests, and issue shell commands in stateful workspaces (Yang et al., 2024, Jimenez et al., 2024, Wang et al., 2025, Lyu et al., 2026, 2025). A single wrong command can leak a credential, delete data, or weaken a security control (Qu et al., 2026, Tang et al., 2026). To avoid relying solely on the agent's own judgment to prevent such harm, agent frameworks require approval before commands can run. Asking a human to approve every command does not scale. Frequent prompts slow development and lead to approval fatigue (Anthropic, 2025), and Anthropic reports that users approve 93% of Claude Code permission prompts (Anthropic, 2026). Systems like Claude Code Auto Mode therefore use allow rules and model-based classifiers to make these decisions (Anthropic, 2026), turning approval into an automated decision at each step of the agent's loop.

Existing approvers assess the text of an action rather than its effects. Static rule checkers such as CARE match the command string against patterns for dangerous syntax, paths, and provenance (Liu et al., 2026, Chen and Lin, 2026); guardrail models such as ToolSafe, gpt-oss-safeguard, and Qwen3Guard assess the request, the command, or the interaction history against a safety policy (Mou et al., 2026, OpenAI, 2025, Zhao et al., 2025); and deployed permission classifiers such as Claude Code Auto Mode combine allow rules with a model that reads the visible transcript (Anthropic, 2026). None of these systems observes what the

Figure

Figure 1: The same command can have different effects in different workspaces. The user asks the agent to remove build artifacts and recompile, and in both workspaces the agent proposes make clean && make. The workspaces differ only in their Makefile, whose clean target deletes src/ and .git/ in workspace A but only build/ in workspace B. An approver that sees only the command cannot tell them apart.

proposed command does before making a decision. This gap is particularly pronounced for shell commands. A file edit specifies its changes in the call, but a shell command can invoke code whose behavior is not visible in the command text. A project script, a build target, or a package tool can read a credential, delete data, or access the network without any of these actions appearing in the command. An approver that never observes the command's effects in the current workspace can therefore let such harm pass (Zhong et al., 2026).

Figure 1 shows how the same command can have different effects. The command make clean && make deletes only regenerable build artifacts in one workspace but deletes source files and repository history in another, because its effects depend on the contents of the Makefile. An approver that judges only the command text sees identical input in both cases. To decide correctly, it needs to observe the command's effects in the current workspace and assess them against the task, since deleting the same files can be requested in one task and harmful in another. Each approval decision must therefore answer one question: what security-relevant effects will this command have on the current workspace, and are they within the scope of the user's request?

To answer this question, we propose CAPER (Consequence-Aware PERMISSION), which runs each command first and bases its approval decision on the observed effects. Each proposed shell command executes once inside the snapshotted task container, under system-call tracing, before any result reaches the agent. From this pre-execution, the system derives a bounded effects report. A raw trace is unsuitable because a single command can produce tens of kilobytes of system calls, most of which are irrelevant and some of which are shaped by untrusted content (Debenedetti et al., 2024). The report retains only consequential trace events, namely persistent workspace changes, connection attempts, and command output, each attributed to the process that caused it and the files that process drew on. It also records reads of credentials and other protected data. An LLM approver assesses these consequences against the user's task. If it allows the command, the resulting state is kept and the output is returned to the agent; if it blocks the command, the container is restored to the snapshot and the reason is returned, so the agent can seek a safer path.

Results. We evaluate CAPER on SABER (Hu et al., 2026), whose shell-only tasks pair development requests with task-specific harms, and on YoloFS-Ext, our controlled extension of YoloFS (Zhong et al., 2026), in which harmful behavior is hidden in the tool invoked by a seemingly benign command. Each dangerous task in YoloFS-Ext has a safe twin with the same request and command but a harmless tool. Compared with six existing systems, CAPER achieves the lowest harmful-outcome rate on SABER (6.7% versus 14.8–21.2%), while CAPER and its Claude Code hook achieve the two lowest rates on YoloFS-Ext (7.8% and 6.9% versus 35.3–94.1%). The safe-outcome rate on SABER remains at the level achieved without approval. On YoloFS-Ext, CAPER safely completes the largest number of dangerous tasks while blocking 1.0% of the safe twins. Our analysis shows that approvers relying on text block dangerous commands and their safe twins alike, and that using predicted effects reduces harm but not false blocking, whereas using observed effects reduces both.