Files
DietrichGebert 67a1601553 feat: add native Cursor hooks via hooks.json (#817) (#869)
Cursor's sessionStart accepts additional_context, and the 3.20.17 client
also injects additional_context from beforeSubmitPrompt as a per-turn
system reminder (not on the docs page, verified in the shipped code).
subagentStart takes only permission/user_message, so subagents stay
uncovered and that is documented rather than claimed.

- hooks/cursor-hooks.json: sessionStart + beforeSubmitPrompt template
- scripts/cursor-hooks.js: install/uninstall that merges into
  ~/.cursor/hooks.json (or .cursor/hooks.json with --project), keeps
  unrelated hooks, is idempotent and refuses malformed JSON
- runtime: isCursor via CURSOR_VERSION, state in ~/.cursor, Cursor JSON
  output; activate and mode-tracker step back with a notice while
  .cursor/rules/ponytail.mdc is in the workspace, so the ruleset is never
  duplicated and off is not silently undermined by the static rule
- mode-tracker delivers the new level's ruleset on /ponytail <level>,
  since Cursor has no /ponytail command to load the skill body
- scripts/uninstall.js also removes the Cursor flag and hook entries
- tests/cursor-hooks.test.js: runnable input/output compatibility check
- docs/cursor-hooks.md: contract, limitations and the live session check
  record (Cursor 3.20.17 on Windows: startup, level switch and off
  verified from the hooks log and transcript; subagent probe declined
  by the model)
- README (en/es/ko) and docs/agent-portability.md updated
2026-09-14 16:27:56 +02:00
..