Skip to content llms.txt

Cursor — Hooks

File format
JSON
Discovery path
.cursor/settings.json
Syllago install method
JSON merge
Symlink support
No
Config file
.cursor/settings.json
Handler types
command

Hook events

Canonical Event Native Name Category
after_model afterAgentResponse Model
after_tool_execute PostToolUse Tool
agent_stop Stop Lifecycle
before_compact PreCompact Context
before_model beforeAgentResponse Model
before_prompt UserPromptSubmit Lifecycle
before_tool_execute PreToolUse Tool
before_tool_selection beforeToolSelection Model
file_changed afterFileEdit Workspace
session_end SessionEnd Lifecycle
session_start SessionStart Lifecycle
subagent_start SubagentStart Lifecycle
subagent_stop SubagentStop Lifecycle
tool_use_failure postToolUseFailure Tool

Features

How each feature converts to syllago's canonical format. See format conversion for what these statuses mean.

Fields

Native frontmatter or config fields this provider exposes. The first column is the provider's own field name; the canonical key column links to syllago's cross-provider equivalent.

Provider fieldConversionCanonical keySummary
type Translated Conversion type: Translated Actively mapped to the target provider’s equivalent field during conversion. Learn more → Each hook entry uses type: command with a shell command string; this is the only handler type documented for Cursor.
failClosed Embedded Conversion type: Embedded No canonical equivalent — appended as prose in a conversion notes block so nothing is silently lost. Learn more → Matcher groups may set failClosed to treat hook failures as blocking (alias for the blocking semantic) rather than non-fatal warnings.
loop_limit Embedded Conversion type: Embedded No canonical equivalent — appended as prose in a conversion notes block so nothing is silently lost. Learn more → Matcher groups may bound how many times the hook fires within a loop to guard against runaway tool sequences.
statusMessage Embedded Conversion type: Embedded No canonical equivalent — appended as prose in a conversion notes block so nothing is silently lost. Learn more → Hooks may surface a short camelCase statusMessage to the agent to explain a decision or provide feedback.
timeout Embedded Conversion type: Embedded No canonical equivalent — appended as prose in a conversion notes block so nothing is silently lost. Learn more → Hook entries accept a timeout in milliseconds that limits how long a command may run before being terminated.

Other features

Behaviors, conventions, and capabilities that aren't tied to a single named field — things like path-based activation, discovery rules, and lifecycle behavior.

FeatureConversionSummary
Cursor hook event set Translated Conversion type: Translated Actively mapped to the target provider’s equivalent field during conversion. Learn more → Cursor documents a large set of camelCase lifecycle events including beforeShellExecution, beforeReadFile, beforeSubmitPrompt, afterFileEdit, stop, and related pre/post tool hooks.
decision_control Translated Conversion type: Translated Actively mapped to the target provider’s equivalent field during conversion. Learn more → Exit codes drive decisions: non-zero blocks the action and surfaces stderr, zero allows it to proceed; JSON on stdout can also return structured decision fields.
hook_scopes Translated Conversion type: Translated Actively mapped to the target provider’s equivalent field during conversion. Learn more → Project-scope hooks live under .cursor/hooks/ and are wired through .cursor/settings.json; user-global hooks live under ~/.cursor/ using the same shape.
json_io_protocol Translated Conversion type: Translated Actively mapped to the target provider’s equivalent field during conversion. Learn more → Command hooks receive event data as JSON on stdin and may return structured JSON on stdout to signal decisions and supply output fields.
matcher_patterns Translated Conversion type: Translated Actively mapped to the target provider’s equivalent field during conversion. Learn more → Hook entries accept a matcher string that filters which tool or event fires the hook (for example a specific shell command or tool name).
Hooks wired through .cursor/settings.json Not portable Conversion type: Not portable Unique to this provider — can’t be carried across providers. Learn more → Hook files under .cursor/hooks/ are activated via entries in .cursor/settings.json; enabling or disabling a hook means editing the settings file, not moving the hook file itself.

Sources

Source
https://cursor.com/docs/hooks