Sub topic 4
Approval modes from read-only to fully autonomous
This chapter assumes you know the allow, ask, and deny decisions and the five risk categories (read, write, execute, network, destructive) from earlier chapters. It covers approval modes, which are presets that set a default decision for each category.
What an approval mode is
An approval mode is a named bundle of default decisions. Instead of answering a prompt for every action, you pick one setting. The setting maps each risk category to allow, ask, or deny.
Modes only set defaults. Explicit deny rules and sandbox limits still apply on top of them. Tools name their modes differently, such as "plan", "default", "auto-edit", or "yolo". The underlying ladder is similar everywhere.
The ladder
The table shows a typical ladder. Check your tool's documentation for its exact names and behavior.
| Mode | Read | Write | Execute | Network | Destructive |
|---|---|---|---|---|---|
| Read-only | allow | deny | deny | deny | deny |
| Ask for everything risky | allow | ask | ask | ask | ask |
| Auto-edit | allow | allow in workspace | ask | ask | ask |
| Fully autonomous | allow | allow | allow | allow | allow |
The modes in practice
- Read-only suits exploring an unfamiliar codebase or planning a change. The agent can read and propose, but it cannot change anything.
- Ask for risky actions is the usual default. Reads are free, and you approve each edit and command. It is safe, but it produces many prompts.
- Auto-edit trusts file changes inside the workspace and still asks before running commands. Edits are easy to undo with version control, but commands may not be.
- Fully autonomous removes prompts entirely. It is only reasonable inside a sandbox, because nothing but your deny rules and the sandbox stands between a bad action and your system.
A mode as a lookup table
The following Python sketch models modes as data. Deny rules are checked first, as in the permission decision you already know.
MODES = {
"read-only": {"read": "allow", "write": "deny", "execute": "deny",
"network": "deny", "destructive": "deny"},
"default": {"read": "allow", "write": "ask", "execute": "ask",
"network": "ask", "destructive": "ask"},
"auto-edit": {"read": "allow", "write": "allow", "execute": "ask",
"network": "ask", "destructive": "ask"},
"autonomous": {"read": "allow", "write": "allow", "execute": "allow",
"network": "allow", "destructive": "allow"},
}
def decide(mode: str, category: str, denied_by_rule: bool = False) -> str:
if denied_by_rule:
return "deny" # explicit deny rules beat every mode
return MODES[mode][category]
print(decide("auto-edit", "write")) # allow
print(decide("auto-edit", "execute")) # ask
print(decide("autonomous", "network", denied_by_rule=True)) # denyThe last line is the key point. A deny rule still blocks the action in the most permissive mode.
Common mistakes
- Treating a mode as a security boundary. A mode only changes when the agent asks you. It does not limit what a command can do once approved. Sandboxing, covered later, enforces limits.
- Staying in one mode. Switch modes as the task changes. Use read-only to explore, then auto-edit to implement.
- Jumping to autonomous to avoid prompts. Frequent prompts are better fixed with narrow allow rules for safe commands, such as
git status.
Exercise
You are letting an agent refactor a project inside a disposable container with no credentials. Which mode might be reasonable, and which control keeps it safe even if the agent misbehaves?
Show answer
Fully autonomous can be reasonable here, because the container limits the damage. The safety comes from the sandbox (no credentials, disposable environment) and from any explicit deny rules, not from the mode itself.
Exercise
In the Python sketch, what does decide("read-only", "write") return, and what would decide("default", "network", deniedbyrule=True) return?
Show answer
The first returns "deny", because read-only denies writes. The second also returns "deny", because the explicit deny rule is checked before the mode's default of "ask".