1 min lesson
The canonical use case: PII / secret block
Connect "The headline hook is a prompt-submit scan" to the decision you would make.
Step 1 of 2
The headline hook is a prompt-submit scan: inspect every prompt for PIIPersonally Identifiable Information. Data that can identify a person (names, emails, SSNs); regulated and sensitive. Press Enter for the full definition., API keys or secrets and, if any is found, halt the prompt before it ever reaches the model and return a custom error. A preToolUse gate applies the same logic to an edit that would add a private key. This is deterministic DLP. It happens whether or not the model would have 'known better', which is exactly the assurance a security or controls owner wants beside your gates.
Hooks came from enterprise customers' bespoke requirements: rather than Cursor building everyone's one-off control, hooks let any team extend Cursor themselves. A before-prompt hook can also audit which rules were actually in context, turning 'are our standards being followed?' into a logged fact.
Admins can distribute team and enterprise hooks from the dashboard; cloud agents run your repo's command-based hooks.
"Your gates assert what passes. Hooks are the deterministic layer underneath them: real code at fixed lifecycle points that can scan a prompt for secrets and halt before the model sees it. Build it once, push it to the team, and your repo's hooks run in cloud agents too."