Cursor hooks: control what Cursor's agent can do

The short answer

Cursor runs hooks from .cursor/hooks.json around tool calls. Scopebond registers on beforeShellExecution, beforeMCPExecution, beforeReadFile and afterFileEdit. Shell commands, MCP calls and file reads are checked before they run, and a rule in Block stops one that breaks it. Each action gets a signed record you can check offline, with the same rules and records you use for Claude Code.

Turn on protection

Install Scopebond (see Get started). In a workspace, force-pushes to protected branches, secret-file reads and changes to Scopebond itself are blocked from the start; every other rule starts in Monitor, so you see what it would block before you switch it to Block. Scopebond finds Cursor on the computer and registers itself in .cursor/hooks.json.

One set of rules, both agents

The same rules cover Claude Code and Cursor, and the records look the same. Install once per computer, and a project's own rules still take precedence.

File edits

Cursor file edits are recorded, not prevented: Cursor's afterFileEdit hook runs after the edit is made. A required GitHub check stops an edit that breaks a rule from merging.

See what happened

Every action shows in your workspace's Activity, and each signed record can be checked offline.

Good to know

What this does not do

Scopebond checks actions Cursor sends through its tools. An action taken outside the agent is not covered. If the coding tool cannot start Scopebond's check, the action runs unchecked, and the Scopebond app on the computer reports it. Scopebond decides on the action and does not read your code.

Alternatives

Questions

Do I need separate rules for Cursor?

No. The same rules cover Cursor and Claude Code; install once per computer and every project you open is protected.

Which Cursor events are covered?

beforeShellExecution, beforeMCPExecution and beforeReadFile are checked before the action runs. afterFileEdit arrives after the edit is made, so Scopebond records the edit.