---
title: Claude Code
description: Send Trigv push notifications from Claude Code using Stop and Notification hooks.
---
# Claude Code

Notify when Claude Code finishes a session — or when it needs permission or your input.

## Before you start

- [Shared `trigv-notify.sh` script](/docs/learn/ai-agents)
- `export TRIGV_API_KEY=trgv_…` in `~/.zshrc` or `~/.bashrc`

## Step 1 — Create the hook script

Create `~/.claude/hooks/trigv-stop.sh`:

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

INPUT=$(cat)
CWD=$(echo "$INPUT" | jq -r '.cwd // empty')
NAME=$(basename "\${CWD:-claude}")

TRIGV_LEVEL=success "\${HOME}/.local/bin/trigv-notify.sh" \
		"Claude: \${NAME} done" \
		"Session finished — open terminal to review"
```

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

## Step 2 — Add hooks to settings

Edit `~/.claude/settings.json`:

```
{
		"hooks": {
			"Stop": [{
				"hooks": [{
					"type": "command",
					"command": "~/.claude/hooks/trigv-stop.sh",
					"async": true
				}]
			}],
			"Notification": [{
				"matcher": "permission_prompt|idle_prompt",
				"hooks": [{
					"type": "command",
					"command": "TRIGV_LEVEL=warning ~/.local/bin/trigv-notify.sh 'Claude: needs you' 'Waiting for input'",
					"async": true
				}]
			}]
		}
}
```

## Step 3 — Test

<ol>
  <li>Start a Claude Code session and let it complete a task.</li>
  <li>For <strong>Notification</strong>, trigger a permission prompt and check your phone.</li>
</ol>

## Team projects

You can put `.claude/settings.json` in a repo — don't commit API keys; each developer uses their own `TRIGV_API_KEY`.

<p><a href="https://code.claude.com/docs/en/hooks-guide" rel="noopener noreferrer">Claude Code hooks guide →</a></p>
