Contents
Cursor integration

Cursor agent push notifications

Cursor's stop hook pings your phone through PushPiper when an agent run ends, errors or is aborted, free for 10,000 messages a month on 10 devices. Hooks arrived as a beta in Cursor 1.7 on September 29, 2025, and the stop event runs a shell script every time the agent wraps up. No credit card needed.

How Cursor hooks work

Cursor executes local scripts based on events defined in a configuration file. You can configure hooks globally for your user profile in ~/.cursor/hooks.json, or configure them inside a single workspace using .cursor/hooks.json. When you put your configuration in ~/.cursor/hooks.json, any relative paths you specify run from the ~/.cursor/ directory.

The event to use is the stop hook. Cursor fires this hook whenever an agent turn ends. The hook passes execution details into your script as JSON over standard input. This payload includes several key fields:

  • status: A string showing how the turn ended, returning completed, aborted, or error.
  • loop_count: An integer counting the iterations run by the agent.
  • conversation_id: The identifier for the current agent conversation.
  • workspace_roots: An array of file paths representing the open project root folders.

Cursor can also parse hook files written for Claude Code, which makes migrating configurations between the two editors straightforward. If you have existing hooks from Claude Code, check our guide on Claude Code push notifications. However, Claude's Notification event does not run inside Cursor. Cursor only executes the lifecycle hooks it officially supports, such as stop.

Mapping agent status to notification priority

PushPiper uses priority levels ranging from -2 up to 2 to decide how an alert gets delivered to your devices. The stop hook's status value lets you separate normal finishes from errors and manual cancellations so you do not get noisy alerts when you are actively watching the terminal.

The following table compares the Cursor status strings with their practical meaning and the corresponding priority mapped in the script.

statusMeaningPriority in the script
completedThe agent finished0
abortedYou stopped it-1
errorThe agent failed1

When an agent run finishes normally, status completed maps to priority 0. This delivers a standard notification with sound on your phone or desktop, but it stays quiet if your device is inside its scheduled quiet hours.

If you hit cancel to stop the agent manually, status aborted maps to priority -1. This delivers a low-urgency silent notification that appears on your lock screen without making a sound or vibrating.

When something breaks, status error maps to priority 1. High priority ignores your configured quiet hours in PushPiper, alerting you immediately that the run failed. While PushPiper also supports an emergency priority 2 that repeats every 30 seconds or more for up to 10,800 seconds (3 hours) until acknowledged, priority 1 is ideal for coding errors because it does not require an active acknowledgement loop to stop ringing. Note that no priority level breaks through iOS Do Not Disturb or Focus modes, as PushPiper does not send native iOS critical alerts.

Writing the notification script

Your notification script parses the JSON payload sent by Cursor, extracts the status and project directory name, and posts the alert to PushPiper's API. PushPiper delivers push alerts to Android, Windows, macOS, and Linux through standard desktop and mobile browsers via Web Push. On iPhone and iPad, open pushpiper.com/app in Safari on iOS 16.4 or later, tap Share, and select Add to Home Screen.

The script requires two standard command-line utilities installed on your system:

  • jq to parse the JSON string on stdin.
  • curl to make the HTTP POST request to PushPiper.

Create a directory named hooks inside your ~/.cursor/ directory, and place the script at ~/.cursor/hooks/pushpiper.sh.

~/.cursor/hooks/pushpiper.sh
#!/usr/bin/env bash
input=$(cat)
status=$(jq -r '.status' <<<"$input")
project=$(basename "$(jq -r '.workspace_roots[0] // "Cursor"' <<<"$input")")

case "$status" in
  completed) title="Cursor agent finished"; priority=0 ;;
  aborted) title="Cursor agent stopped"; priority=-1 ;;
  *) title="Cursor agent hit an error"; priority=1 ;;
esac

curl -s -o /dev/null https://api.pushpiper.com/1/messages.json \
  --form-string "token=APP_TOKEN" \
  --form-string "user=USER_KEY" \
  --form-string "title=$title" \
  --form-string "message=$project" \
  --form-string "priority=$priority"

echo '{}'

Before running the script, make sure to adjust the placeholder values:

  • Replace APP_TOKEN with your PushPiper application token, which is a 30-character string starting with a.
  • Replace USER_KEY with your PushPiper user key, a 30-character string starting with u. You can also supply a group key here if your whole team needs the alert.
  • PushPiper's API allows messages up to 1,024 characters and titles up to 250 characters. The script uses the project folder name extracted from workspace_roots as the message body, keeping payloads well within limits.

After saving the file, make the script executable by running chmod +x ~/.cursor/hooks/pushpiper.sh in your terminal. Cursor expects hook scripts to output a valid JSON object to standard output when finished, which is why the script ends with echo '{}'.

Configuring hooks in Cursor

Once your script is ready and marked executable, you need to register it in Cursor's hook configuration file. You can set this up globally so every project you open triggers notifications, or you can check it into a repository to share with a team.

  1. Open your terminal or text editor and open ~/.cursor/hooks.json for global notifications, or create .cursor/hooks.json at the root of a specific project.
  2. Add the stop hook definition pointing to your script relative to the configuration path.
~/.cursor/hooks.json
{
  "version": 1,
  "hooks": {
    "stop": [{ "command": "./hooks/pushpiper.sh" }]
  }
}

If you are using user-level configuration in ~/.cursor/hooks.json, the command path ./hooks/pushpiper.sh resolves directly to ~/.cursor/hooks/pushpiper.sh. For project-level configs, make sure the path points accurately to wherever you placed the script inside that repository.

To verify your configuration, launch Cursor and trigger an agent task in the chat panel. Let the agent complete its work. Cursor will pass the completion payload into standard input, your script will parse the fields, and PushPiper will deliver the push notification to every registered device on your account.

PushPiper's API is directly compatible with Pushover endpoints. If you already have existing scripts, review our migration from Pushover guide or explore our other shell and cron notification examples to trigger alerts across other terminal workflows. You can also sign up for an account directly at PushPiper's app portal using Google authentication.

Managing notification volume and devices

A typical software development workflow can trigger dozens of agent turns a day. Because PushPiper's Free tier includes 10,000 messages every month, solo developers rarely hit monthly quota walls. Quotas reset on the 1st of every month at 00:00 UTC. If you manage larger development pipelines, our pricing overview outlines higher tiers like Pro, which provides 50,000 messages a month for EUR 4, or Team plans at EUR 5 per user a month.

When configuring multi-device delivery:

  • Target specific hardware: If you only want notifications sent to your phone while away from your desk, add the device parameter to your curl request containing the name of your mobile device.
  • Configure quiet hours: In PushPiper's settings, establish quiet hours so priority 0 completed messages never buzz your phone late at night.
  • Manage team delivery: PushPiper groups support up to 500 members. If multiple developers share a Cursor workspace, sending to a group key delivers notifications to everyone simultaneously, counting as one message per recipient against your monthly balance.

Sources

Questions and answers

Can I get notifications when Cursor asks for permission to run a terminal command?

Not with a Claude Code Notification hook. While Claude Code fires a Notification event for permission_prompt and idle_prompt alerts and Cursor can load Claude Code hooks, Claude's Notification event is not supported in Cursor. This setup uses Cursor's stop hook, which fires when a turn ends.

Why does my script fail to run inside Cursor?

Make sure the script is executable by running chmod +x on it, verify that jq and curl are installed in your PATH, and make sure the script ends by printing an empty JSON object to standard output.

Do PushPiper notifications wake my phone if it is set to Do Not Disturb?

No. PushPiper does not send native iOS critical alerts and cannot bypass iOS Do Not Disturb or Focus modes. Priority 1 and 2 notifications only ignore the quiet hours configured inside PushPiper itself.

Can I run different scripts for different Cursor projects?

Yes. Place a .cursor/hooks.json file in your project root instead of ~/.cursor/hooks.json. A project-level configuration lets you route notifications to different PushPiper application tokens or adjust priority mappings per project.