Skip to main content

Module risk

Module risk 

Source
Expand description

Which commands are dangerous enough to stop and ask about, and which are not.

A prompt costs a person a decision, so the decision has to be worth their attention. Asking before every ls teaches them to press y without reading, which is worse than not asking at all: the one prompt that matters then arrives in a stream of noise. So the default is inverted from what it was — a command runs unless it can destroy something — and this module is the one place that decides what “destroy something” means.

It is a word classifier over the command text, not a shell parser. A parser would be more precise and would also be a second implementation of bash to get wrong. The cost of a false positive here is one unnecessary question; the cost of a false negative is a deleted directory. Everything named below is something a re-run cannot undo.

What it deliberately does not cover: a plain redirect (echo x > /etc/foo), because judging where a redirect points means parsing it, and [tools] shell_isolate = "fs" is the real answer to writing outside the workspace. Nor cargo, npm or git status: building and inspecting are what an agent does all day, and gating them would drown the prompts that matter.

Functions§

danger
Why this command is dangerous, in the words the approval prompt shows. None means “run it”.