Skip to content
Cursor Handbook

Hooks

Hooks are scripts Cursor calls at defined points in the agent loop so your policies run automatically.

  • Automation
  • Pro, Pro+, Ultra, Teams and Enterprise.

Checked against cursor.com on 25 September 2026

What it does

Everything an agent does passes through a small number of observable moments: a prompt is submitted, a tool is about to run, a file has just been edited, a session ends. Hooks let you attach your own executable to those moments so the behaviour you care about happens every time rather than when someone remembers.

Two categories matter in practice. Observational hooks record what happened, feeding audit logs, usage telemetry, or a compliance trail. Gating hooks sit in front of an action and can block it, which is how teams stop agents from touching production configuration, committing secrets, or running a command outside an allowlist.

Because a hook is a normal executable receiving structured input, it can be written in whatever language your repo already uses, and it is reviewable in version control alongside the rules and skills it enforces.

Worth knowing

  • A slow hook slows every agent action it is attached to, so keep gating hooks fast and push expensive analysis into observational hooks that do not block.
  • Hooks run with your local permissions. Treat a hook script from an untrusted source the same way you would treat any other code you are about to execute.

Checked against Hooks documentation on 25 September 2026.

Frequently asked questions

What can a Cursor hook actually block?
Gating hooks run before an agent action and can reject it. Typical uses are refusing edits to protected paths, blocking shell commands outside an allowlist, and stopping a commit when a secret scanner fires.
Which plans include hooks?
Hooks are listed alongside MCP and skills in the paid feature set, so Pro, Pro+, Ultra, Teams and Enterprise accounts have them. Hobby does not.
Do hooks work with cloud agents?
Hooks are configured per repository, which is what lets the same policies apply to agents running on Cursor's infrastructure rather than only the ones on your laptop. Check the current docs for which events fire in which environment.