How to stop an agent doing something, and what each harness gives you to control it. Permission rules decide what the agent may do; a sandbox limits what a command can reach even when it is allowed.
Block a command, for example git push
| Cursor Agent | |
|---|---|
| How | A deny rule in the permission settings |
| File | .cursor/cli.json |
| Example | |
| How it matches | Shell(commandBase) with an optional command:args glob; exact argument-string behavior is not fully documented |
| What wins | deny takes precedence over allow and survives --force/--yolo |
| Watch out for | Matching details are only partly documented. Shell(git) is the unambiguous declarative form but blocks every git command. For exact git-push matching, use a beforeShellExecution hook that returns permission deny or exits 2; other non-zero hook exits fail open. |
What you can control
| Cursor Agent | |
|---|---|
| Decisions | allow, ask, deny |
| Permission rules | |
| Sandbox | Not established |
| Approval prompts | Not established |
| Skills granting tools | Not established |
| Hooks that decide | Built in
Can: allow, deny, ask Hook permission decisions are a separate surface from CLI permission files. ask is not enforced for preToolUse. Docs |
| Where rules live |
Project settings override global ones. |
Sources
Cursor Agent
- Cursor CLI permissions, Documentation, checked 2026-10-15
- Cursor hooks, Documentation, checked 2026-10-15