cursor-hooks
cursor-hooks
Hooks are file-based, not programmatic. The SDK does not expose JS callbacks for the agent loop — use .cursor/hooks.json and rely on local.settingSources to load them.
When to use
- Lint / type-check gates before agent commits
- Audit logging or compliance commands after each turn
- Fail-fast policies that must run regardless of prompt
Concepts
- [[references/file-format]] —
.cursor/hooks.jsonshape - [[references/loading]] —
settingSourcesand project vs user vs team scope - [[references/programmatic-alternatives]] — what to use when you need JS callbacks (
onDelta,onStep)
Cross-links
More from hktitan/cursor-sdk
cursor-runs
Run lifecycle, streaming, follow-ups, and conversation introspection in the Cursor SDK. Use when consuming agent output, handling progress events, or chaining turns.
1cursor-subagents
Define delegated subagents on a Cursor SDK agent via the `agents` field — `AgentDefinition`, MCP scoping, and model inheritance. Use when decomposing work across specialist personas.
1cursor-sdk
Entry point for the Cursor TypeScript SDK — install, auth, and the Agent.create / Agent.resume / Agent.prompt lifecycle. Use when starting any Cursor SDK integration or wiring durable agent IDs.
1cursor-errors
CursorAgentError class hierarchy, isRetryable, and recovery patterns. Use when classifying SDK failures, building retry logic, or surfacing actionable messages.
1cursor-models
Model discovery and selection on Cursor SDK — Cursor.models.list, ModelSelection, parameters (e.g. thinking levels), per-run sticky overrides.
1cursor-cloud
Cloud runtime for Cursor SDK — dedicated VMs, repo-bound runs, auto-PR creation, artifacts, and reattachment. Use when running long, review-oriented, or repo-modifying agents off the local machine.
1