---
title: Cursor
description: Send Trigv push notifications when Cursor Agent finishes using hooks.
---
# Cursor

Get a push when Cursor's Agent finishes a task — set up once per project or globally.

## Before you start

- [Shared `trigv-notify.sh` script](/docs/learn/ai-agents) installed and tested
- `TRIGV_API_KEY` in your shell — add to `~/.zshrc` and restart Cursor
- Cursor with hooks enabled: **Cursor Settings** → search **Hooks**

## Step 1 — Create the hook script

In your project, create `.cursor/hooks/trigv-stop.sh`:

```
#!/usr/bin/env bash
set -euo pipefail

INPUT=$(cat)
WORKSPACE=$(echo "$INPUT" | jq -r '.workspace_roots[0] // .cwd // "project"' 2>/dev/null || echo "project")
BASENAME=$(basename "$WORKSPACE")

"\${HOME}/.local/bin/trigv-notify.sh" \
		"Cursor: \${BASENAME} ready" \
		"Agent finished — review in Cursor" || true

exit 0
```

Run: `chmod +x .cursor/hooks/trigv-stop.sh`

## Step 2 — Register the hook

Create or edit `.cursor/hooks.json` in your project root:

```
{
		"version": 1,
		"hooks": {
			"stop": [
				{ "command": ".cursor/hooks/trigv-stop.sh" }
			]
		}
}
```

## Step 3 — Test

<ol>
  <li>Restart Cursor (so it picks up <code>TRIGV_API_KEY</code>).</li>
  <li>Run an Agent task and wait for it to finish.</li>
  <li>Check your phone — and Cursor's <strong>Hooks</strong> output panel if nothing fires.</li>
</ol>

## All projects (optional)

Use `~/.cursor/hooks.json` and `~/.cursor/hooks/trigv-stop.sh` instead of project files.

<p><a href="https://cursor.com/docs/hooks" rel="noopener noreferrer">Cursor hooks documentation →</a></p>
