cursor-hooks
File-based agent loop hooks via `.cursor/hooks.json` — pre/post commands, governance gates. Use when enforcing policy without modifying agent prompts.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
File-based agent loop hooks via `.cursor/hooks.json` — pre/post commands, governance gates. Use when enforcing policy without modifying agent prompts.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
The `agent` CLI — install, interactive modes (Agent / Plan / Ask), headless `-p` mode for CI, GitHub Actions integration, and how it relates to the TypeScript SDK. Use when scripting Cursor in shell pipelines or workflows instead of (or alongside) the SDK.
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.
CursorAgentError class hierarchy, isRetryable, and recovery patterns. Use when classifying SDK failures, building retry logic, or surfacing actionable messages.
Configure MCP servers on Cursor SDK agents — stdio subprocess, HTTP, and SSE transports, inline vs file-based config, and per-run overrides. Use when extending an agent's tools beyond the built-ins.
Model discovery and selection on Cursor SDK — Cursor.models.list, ModelSelection, parameters (e.g. thinking levels), per-run sticky overrides.
Project, user, and team rules that the Cursor SDK and Agent load — `.cursor/rules/*.mdc`, `AGENTS.md`, and the legacy `.cursorrules`. Use when authoring rules that the SDK will pick up via `local.settingSources`, or when writing rule frontmatter with the right type (always / auto-attached / agent-requested / manual).
| name | cursor-hooks |
| description | File-based agent loop hooks via `.cursor/hooks.json` — pre/post commands, governance gates. Use when enforcing policy without modifying agent prompts. |
| metadata | {"internal":false,"source":"https://cursor.com/docs/sdk/typescript"} |
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.
.cursor/hooks.json shapesettingSources and project vs user vs team scopeonDelta, onStep)local.settingSources → [[../cursor-sdk/references/local-options]].cursor/ features → [[../cursor-rules/SKILL]] · [[../cursor-skills-system/SKILL]]