# Claude Code

Send a Pushbag notification when Claude Code finishes a turn and give the agent a packaged publishing guide.

Claude Code can send a Pushbag message when its main assistant finishes responding. Register a project Stop hook for this event. Subagent completion and API failures have separate events.

## Install the skill

Complete the [CLI quickstart](/docs) on the machine running Claude Code. For notifications alone, use a Notifications key granted access to Personal. Install the packaged skill from your project directory:

```sh
pushbag guide pushbag --install --claude
pushbag notify "Claude Code setup check"
```

The project installation writes `.agents/skills/pushbag/SKILL.md` under the Git root, or the current directory outside Git. The installer also creates a link at `.claude/skills/pushbag`, where Claude Code can discover the skill. The skill teaches Claude how to publish on request. The Stop hook below handles automatic messages. Confirm the setup check appears in Personal. The hook process needs the same CLI on its PATH and access to the saved profile or `PUSHBAG_API_KEY`.

## Configure completion notifications

Add the following to `.claude/settings.json`, merging with any existing configuration.

```json
{
  "hooks": {
    "Stop": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "pushbag notify 'Claude Code turn finished' >/dev/null"
          }
        ]
      }
    ]
  }
}
```

Start a turn in Claude Code and ask it to summarize a file. When it finishes, check Personal in the dashboard or in the Inbox on your phone. See the [Claude Code hook reference](https://code.claude.com/docs/en/hooks).

## Include the project name

For a project-specific message, replace the handler’s `command` field with this JSON member. These examples use a POSIX shell:

```json
{
  "command": "pushbag notify \"Claude finished in ${CLAUDE_PROJECT_DIR##*/}\" >/dev/null"
}
```

## Send a report link instead

For turns that produce a review, have the agent write `review.html` at the project root. Use a Both key granted Personal. Replace the command with a call to a shell script saved in the project:

```json
{
  "command": "sh \"$CLAUDE_PROJECT_DIR/.claude/publish-review.sh\""
}
```

```sh title=".claude/publish-review.sh"
report="$CLAUDE_PROJECT_DIR/review.html"
if [ -f "$report" ]; then
  pushbag upload "$report" --private --notify >/dev/null || exit 1
fi
```

The hook publishes once per invocation while the report exists. Move the report after review if later turns should stay quiet. To test, create a small HTML report, finish a turn and open the version link in Personal.

## Troubleshooting

Use the Claude project directory variable when Claude changes working directory. Review the registered Stop entry in `/hooks` if a manual publish succeeds but turns finish silently. Run `command -v pushbag` in the environment that launches the agent. If PATH differs from your shell, use the absolute executable path. Run `pushbag config show` and `pushbag whoami` there to check for a missing key or unexpected account. A Notifications key can send the setup message but lacks upload access. For report uploads use a Both key with a grant for the target channel. See [key presets](/docs/keys).

## Packaged skill example

```sh
pushbag upload report.html --notify
pushbag upload report.html --notify --channel CHANNEL_ID
pushbag upload report.html --notify --title "Report ready" --priority high --json
```
