1 min lesson
Guardrails: rules and approvals
Put this idea into your own words: "Let the agent move fast on reversible edits, and slow it down where a mistaken command changes shared state."
Step 1 of 3
Let the agent move fast on reversible edits, and slow it down where a mistaken command changes shared state.
Learn more
Advanced table
Action
- Action
- Edits, renames, refactors
- Auto-run or hold
- Auto-run.
gitputs it back.
- Action
- Package install
- Auto-run or hold
- Hold. It rewrites the dependency tree.
- Action
- File deletion
- Auto-run or hold
- Hold. The file may not be committed yet.
- Action
- Network call
- Auto-run or hold
- Hold. It leaves your machine.
- Action
- Reading or writing secrets
- Auto-run or hold
- Hold. A leak is not reversible.
- Action
- Database write
- Auto-run or hold
- Hold. Shared state, other people's data.
- Action
- Deploy
- Auto-run or hold
- Hold. Everyone sees it.
| Action | Auto-run or hold |
|---|---|
| Edits, renames, refactors | Auto-run. git puts it back. |
| Package install | Hold. It rewrites the dependency tree. |
| File deletion | Hold. The file may not be committed yet. |
| Network call | Hold. It leaves your machine. |
| Reading or writing secrets | Hold. A leak is not reversible. |
| Database write | Hold. Shared state, other people's data. |
| Deploy | Hold. Everyone sees it. |
Your two guardrails
- Project rules
- Project RulesVersion-controlled instructions in the repo that every Cursor agent interaction inherits, so standards are encoded once. Press Enter for the full definition. are version-controlled conventions kept in
.cursor/rulesas.mdcfiles. You choose how each one applies: always, when its description matches the work, on matching file globs, or only when you @-mention it. - Command approvals
- Auto-RunThe Cursor Settings > Agents setting that decides which commands the agent runs automatically and which wait for your approval, via allow and block lists. Press Enter for the full definition. (Cursor Settings → Agents → Auto-Run): which commands fire automatically, which wait for your click, set by allow and block lists.
Write it once
If you correct Agent the same way twice, make it a rule. That is a one-line .mdc file under .cursor/rules, not a sentence you retype in every prompt.
Learn more
Optional practice
Practice: Guardrails: rules and approvals
QWhat's the difference between a project rule and a command approval?
QAgent is about to run four commands. Which one should wait for your click?