P5: Safe Retries and Explicit Mutation Boundaries
Definition
Every CLI MUST support --dry-run so agents can preview any command before committing it. Write operations MUST clearly
separate destructive actions from read-only queries. An agent that cannot distinguish a safe read from a dangerous write
will either avoid the tool or execute mutations blindly — both are failure modes.
Why Agents Need It
Agents retry failed operations by default. If a write operation is not idempotent, a retry creates duplicates, corrupts
data, or trips rate limits. When destructive operations require explicit confirmation (--force, --yes) and support
preview (--dry-run), an agent can safely explore what a command would do before committing to it. Read-only tools are
inherently safe for retries, but they still benefit from help text that names the mutation contract — "this does not
modify state" is a better sentence to put in --help than to assume.
Requirements
MUST:
- Destructive operations (delete, overwrite, bulk modify) require an explicit
--forceor--yesflag. Without it, the tool refuses the operation or enters dry-run mode — never mutates silently. - The distinction between read and write commands is clear from the command name and help text alone. An agent reading
--helpimmediately knows whether a command mutates state. - A
--dry-runflag is present on every write command. When set, the command validates inputs and reports what it would do without executing. Dry-run output respects--output jsonso agents can parse the preview programmatically.
SHOULD:
- Write operations are idempotent where the domain allows it — running the same command twice produces the same result rather than doubling the effect.
Evidence
--dry-runflag on commands that create, update, or delete resources.--forceor--yesflag on destructive commands.- Command names that signal intent:
add,remove,delete,createfor writes;list,show,get,searchfor reads. - Dry-run output that shows what would change without executing.
Anti-Patterns
- A
deletecommand that executes immediately without--forceor confirmation. - Write commands sharing a name pattern with read commands (e.g., a
syncthat silently overwrites local state). - No
--dry-runoption on bulk operations, where a preview prevents costly mistakes. - Operations that fail on retry because the first attempt partially succeeded — non-idempotent writes without rollback.
Measured by check IDs p5-dry-run, p5-destructive-guard. Run agentnative check --principle 5 . against your
CLI to see each.