Skip to content

AgentGate v0.2.0 — Cursor hook adapter

Choose a tag to compare

@FelixMa01 FelixMa01 released this 14 Aug 06:43
· 32 commits to main since this release

v0.2.0 — Cursor hook adapter

This release adds first-class support for Cursor's hooks (beforeShellExecution, beforeFileEdit, beforeFileRead), on top of the v0.1.x Claude Code support.

What's new

  • agentgate.cursor_hook — Python module that reads Cursor's hook JSON payload, translates it to AgentGate's event schema, and routes it through the same policy + audit + approval flow as Claude Code.
  • agentgate install-cursor-hook — writes .cursor/hooks.json for you, pointing at the project venv's Python.
  • Shared evaluate_event() core — both Claude Code and Cursor hooks funnel through the same policy.evaluate → audit.record → notify_ask → wait pipeline. Adding a third adapter is now ~50 lines.
  • 53 unit tests (up from 48), including a real-subprocess test for the Cursor hook.
  • scripts/verify.sh now exercises 7 steps (up from 6), adding the Cursor hook end-to-end.

Installing for Cursor

cd your-project
agentgate install-cursor-hook \
  --policy ./policy.yaml \
  --db ./audit.db \
  --target .
# Restart Cursor to pick up the new hooks.

Caveats

  • Cursor's hook schema isn't part of the public docs yet. The current mapping is inferred from community examples; if a future Cursor version renames fields, only src/agentgate/cursor_hook.py:_CURSOR_TO_AGENTGATE needs updating.
  • The hook subprocess reads stdin (Cursor's payload) or AGENTGATE_PAYLOAD_FILE (for tests).

No breaking changes

All v0.1.x flags and config files still work. Same SQLite schema, same policy.yaml format, same Slack fallback.