Skip to contentllms.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 EventNative NameCategory
after_modelafterAgentResponseModel
after_tool_executePostToolUseTool
agent_stopStopLifecycle
before_compactPreCompactContext
before_modelbeforeAgentResponseModel
before_promptUserPromptSubmitLifecycle
before_tool_executePreToolUseTool
before_tool_selectionbeforeToolSelectionModel
file_changedafterFileEditWorkspace
session_endSessionEndLifecycle
session_startSessionStartLifecycle
subagent_startSubagentStartLifecycle
subagent_stopSubagentStopLifecycle
tool_use_failurepostToolUseFailureTool

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
typeTranslatedConversion type: TranslatedActively mapped to the target provider’s equivalent field during conversion.Learn more →Command-based hooks execute shell scripts that receive JSON via stdin; exit code 0 indicates success and exit code 2 blocks actions.
failClosedEmbeddedConversion type: EmbeddedNo 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_limitEmbeddedConversion type: EmbeddedNo 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.
statusMessageEmbeddedConversion type: EmbeddedNo 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.
timeoutEmbeddedConversion type: EmbeddedNo 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
context_injectionTranslatedConversion type: TranslatedActively mapped to the target provider’s equivalent field during conversion.Learn more →Hooks can inject context at session initialization via the sessionStart event, enabling custom context to be added to the agent's active session at startup.
Cursor hook event setTranslatedConversion type: TranslatedActively mapped to the target provider’s equivalent field during conversion.Learn more →Cursor documents lifecycle events for both Agent (sessionStart, preToolUse, beforeShellExecution, afterFileEdit, stop, and related pre/post tool hooks) and Cursor Tab inline completions (beforeTabFileRead and related Tab-specific hooks).
decision_controlTranslatedConversion type: TranslatedActively mapped to the target provider’s equivalent field during conversion.Learn more →Exit codes drive decisions: exit code 2 blocks the action, exit code 0 allows it to proceed; JSON on stdout can also return structured decision fields.
handler_typesTranslatedConversion type: TranslatedActively mapped to the target provider’s equivalent field during conversion.Learn more →Two handler types documented: command (shell scripts communicating over stdio via JSON) and prompt (LLM-evaluated natural language conditions for policy enforcement without custom scripting).
hook_scopesTranslatedConversion type: TranslatedActively mapped to the target provider’s equivalent field during conversion.Learn more →Four scopes documented in priority order: Enterprise (system-wide MDM-managed), Team (cloud-distributed for Enterprise plans), Project (.cursor/hooks/ in the repository), and User (global personal configuration at ~/.cursor/hooks/).
json_io_protocolTranslatedConversion type: TranslatedActively 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_patternsTranslatedConversion type: TranslatedActively 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).
Cursor Tab inline completion hooksNot portableConversion type: Not portableUnique to this provider — can’t be carried across providers.Learn more →Separate hook events (e.g., beforeTabFileRead) fire for Cursor Tab inline completion operations, distinct from Agent hook events, enabling separate control policies for inline vs. Agent-mode completions.
Enterprise and Team hook scopesNot portableConversion type: Not portableUnique to this provider — can’t be carried across providers.Learn more →Cursor supports Enterprise (MDM-managed system-wide) and Team (cloud-distributed for Enterprise plans) hook scopes above the Project and User levels, enabling organization-wide hook policy deployment.
Hooks wired through .cursor/settings.jsonNot portableConversion type: Not portableUnique 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.
Partner ecosystem hooksNot portableConversion type: Not portableUnique to this provider — can’t be carried across providers.Learn more →Cursor partners with ecosystem vendors (MintMCP, Semgrep, Snyk, 1Password, and others) who have built pre-built hook integrations covering security scanning, governance, and secrets management.
Prompt (LLM) handler typeNot portableConversion type: Not portableUnique to this provider — can’t be carried across providers.Learn more →Prompt-based hooks leverage an LLM to evaluate natural language conditions, enabling policy enforcement without custom scripting — the model determines whether to allow or block based on a natural language rule.

Sources

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