# Cursor with Grodmir

**Status: not verified.** No Cursor installation was available; the hook template follows
Cursor's documented hook format and its command is tested with synthetic payloads
(`dataplane/tests/test_integration_templates.py`), but Cursor itself was not run.

## Gateway (model traffic)

Cursor's built-in agent sends requests through Cursor's own servers, not from your machine.
Two consequences:

- Setting *Override OpenAI Base URL* to your gateway only covers requests Cursor makes to that
  URL. The URL must be reachable from Cursor's servers, so a gateway on `localhost` does not work,
  and a publicly reachable gateway must be protected with TLS and a virtual key.
- Whatever goes through Cursor's own channel (Tab, Cursor-hosted models, the indexing service)
  does **not** pass through Grodmir. Grodmir reports such channels as *unprotected* (coverage
  report). Do not tell users that Cursor as a whole is protected.

For traffic that does reach the gateway, use an OpenAI-compatible model with the base URL
`https://aiguard.example.com/v1` and a virtual key.

## Excluded files (hooks)

Copy `deploy/integrations/cursor/hooks.json` to `.cursor/hooks.json` in the repository. The
`beforeReadFile` and `beforeShellExecution` hooks run `aiguard repo check --agent cursor`, which
denies access to paths from [`.aiguard.yaml`](https://grodmir.com/dokumentacja/zrodla/repo-rules.md) (`failClosed: true`).

Per-repository headers cannot be attached to Cursor's requests, so the gateway-side repository
rules (markers, paths in text) apply only to Cursor if the headers are configured some other
way; the hooks do not depend on them.
