Sub topic 15
Choosing a Mode: A Decision Checklist
This chapter assumes you have read the earlier chapters on risk categories, the allow/ask/deny decision, approval modes, rules, and sandboxing. You should be comfortable in a terminal and with git. Here you turn that material into a repeatable way to pick a mode for a real task.
Why a checklist
Choosing a mode by habit tends to fail in one of two ways. People who always pick the strictest mode get approval fatigue. They start approving prompts without reading them, so the safety is nominal. People who always pick the loosest mode run an untrusted repository with full autonomy on a laptop that holds cloud credentials.
A checklist makes you look at the task, the environment, and your own attention before you choose. The mode is a result of those facts. It is not a personality setting.
The five questions
Answer these in order. Each answer pushes the choice toward more or less autonomy.
- What is the worst realistic outcome? Think about what the agent could do with its tools, not what it will probably do. Deleting build output is cheap. Force-pushing over a shared branch, running a database migration, or sending data to a remote host is not.
- Can you undo it? Edits inside a git working tree with no uncommitted work are reversible. Network calls, deployments, sent messages, and anything outside the repository usually are not.
- Is any input untrusted? Cloned third-party code, issue text, web pages, and tool output can contain instructions aimed at the agent. Untrusted input means a human should still gate actions with side effects.
- What can the agent reach? Look at secrets in environment variables, files such as
~/.sshand~/.aws, network access, and mounted volumes. A sandbox that removes these changes the answer. A sandbox that leaves them in place does not. - Will a human actually review the prompts? If you are present and attentive, prompts are a real control. If you are tired, or the job runs overnight in CI, a prompt is either rubber-stamped or never answered.
Mapping answers to modes
The table summarizes where each mode fits. Mode names vary between tools. The descriptions here follow the common pattern from read-only to fully autonomous.
| Mode | Agent can do without asking | Fits when | Main risk |
|---|---|---|---|
| Read-only / plan | Read files, search | Exploring an unfamiliar or untrusted repo, reviewing code, planning a change | Low. The agent cannot change anything, and the cost is speed. |
| Ask for everything | Nothing with side effects | First use of a tool, high-stakes systems, untrusted input | Approval fatigue after a long session |
| Auto-edit | File edits in the workspace | Reversible code changes in a git repo you trust | Edits to build scripts or hooks that run later |
| Allowlist (rule-based) | Edits plus commands that match your allow rules | Routine work with a stable set of safe commands such as tests and `git diff` | Pattern gaps, such as chained commands |
| Fully autonomous | Everything not denied | Disposable sandbox with no secrets and limited network, or CI | Any hole in the sandbox becomes a hole on your system |
Two rules of thumb hold across the table:
- Autonomy should be paid for with containment. Move toward the bottom rows only as the sandbox gets tighter.
- Deny rules and sandbox limits still apply in the loosest mode. Autonomy means the agent skips the prompt, not that the limits go away.
The decision flow
The checklist as code
Writing the logic down exposes gaps in your own reasoning. This function encodes the flow above. It is a teaching model, not a policy engine.
from dataclasses import dataclass
@dataclass
class Task:
reversible: bool # can every effect be undone with git or a rebuild?
untrusted_input: bool # third-party code, web pages, issue text
has_secrets: bool # credentials reachable from the agent's environment
sandboxed: bool # container or VM with limited mounts
network: bool # outbound network access available
human_present: bool # someone reads the prompts
def choose_mode(t: Task) -> str:
if not t.human_present and not t.sandboxed:
return "refuse to run"
contained = t.sandboxed and not t.has_secrets and t.reversible
if contained and not (t.network and t.untrusted_input):
return "autonomous"
if t.untrusted_input:
return "ask-every-action"
if t.reversible:
return "allowlist"
return "ask-every-action"
local_trusted = Task(True, False, False, False, False, True)
cloned_unknown = Task(True, True, True, False, True, True)
throwaway_vm = Task(True, False, False, True, False, True)
unattended_laptop = Task(False, False, False, False, False, False)
print(choose_mode(local_trusted)) # allowlist
print(choose_mode(cloned_unknown)) # ask-every-action
print(choose_mode(throwaway_vm)) # autonomous
print(choose_mode(unattended_laptop)) # refuse to runThe ordering matters. The "refuse to run" check comes first because no later answer can make an unattended, unsandboxed agent safe. The untrusted_input check comes before reversible, because a prompt-injected agent can do harm inside a repository that is technically reversible, such as exfiltrating files over the network.
Worked scenarios
Refactoring in your own repository
The repo is yours, the work is committed, and tests run locally. Use auto-edit or an allowlist. Allow the test runner and read-only git commands such as git status and git diff. Deny git push --force* and rm -rf *. Leave installs, network commands, and anything outside the workspace on ask. You review the diff afterward, and git makes every edit reversible.
Evaluating a repository you just cloned
Treat everything inside as untrusted, including the README, comments, and test fixtures. Start in read-only or ask-for-everything. Do not run its install scripts or test suite on your main machine. If you must run it, do it in a disposable container without your credentials, then reconsider the mode.
Nightly dependency update in CI
No human reads prompts, so prompts cannot be your control. Use a container with a scoped, short-lived token, a narrow filesystem mount, and an egress allowlist for the package registry. Run fully autonomous inside that boundary and keep explicit deny rules for publishing and deleting branches. The pipeline should open a pull request for human review. It should not merge.
Production database investigation
Even with a human present, the actions are hard to reverse. Use read-only credentials at the database level, and keep the agent on ask-for-everything for any command that touches the connection. The credential's permissions are the real limit here. The prompt is a second layer.
Common errors
- Escalating mode to stop the prompts. If prompts annoy you, the fix is usually an allowlist for the safe, repeated commands. Do not switch to autonomous. Fewer, more meaningful prompts get read.
- Choosing a mode once per project. The right mode changes with the task. Moving from editing code to running a migration should change the mode.
- Trusting prefix rules on compound commands. An allow rule for
git diff*can matchgit diff; curl .... Send commands that contain;,&,|, backticks,$, or redirection back to ask. - Treating the prompt as the sandbox. A prompt depends on your attention and on the command text being honest. A sandbox does not depend on either.
- Leaving secrets in the environment. Autonomy plus reachable credentials is the highest-risk combination in the table. Remove the credentials or the autonomy.
Review after the run
Whatever mode you chose, close the loop. Read the diff, check the command log for anything you did not expect, and look at git status for files outside the intended paths. If the agent needed a permission your rules did not cover, decide deliberately whether to add a rule. Do not add one only because you were prompted. Adjust the mode for next time based on what you saw.
Exercise
You are asked to let an agent triage issues in a public repository overnight in CI. It will read issue text from strangers, run the test suite, and comment on issues using a token. No one will watch it. Which mode and controls do you choose, and which single fact most limits how autonomous it can be?
Show answer
Run it fully autonomous only inside a sandboxed CI container, because no human will answer prompts and an unsandboxed unattended run should not happen. Give the container a narrow-scope, short-lived token limited to commenting, restrict outbound network access to what the job needs, add deny rules for pushing, merging, and deleting, and have a human review any resulting changes. The limiting fact is that the issue text is untrusted input. Strangers can plant instructions in it, so the agent's side effects must be bounded by the sandbox and the token's permissions, not by the agent's own judgment.