Claude Code notifications: know when it finishes, fails, gets stuck or needs you
LastPing installs Claude Code hooks that report every run on their own: a start when you send a prompt, a finish when Claude stops, a failure when the turn dies on an API error, and a blocked signal while a permission prompt or a question waits on you. You choose which of those reach Slack, Discord, email or your phone.
Your assistant can do this for you
Monitor this agent with LastPing
On this page
What you can be notified about
- Finished: the Stop hook closes the run as a success. Route the success or every-run event to a destination and you hear the moment Claude is done.
- Failed: a turn that dies on an API error (rate limit, overload, authentication) is reported by the StopFailure hook, and three in a row open an upstream incident. When the work itself fails, Claude reports it with the script's
failcall and the reason lands on the incident. - Waiting for you: a permission prompt, an AskUserQuestion dialog or an MCP form marks the run blocked. LastPing holds that notification for 10 minutes and sends it only if Claude is still waiting, so a prompt you answer straight away notifies no one. A run left blocked past its limit (24 hours unless you set another) opens an incident.
- Stuck: set a maximum runtime on the monitor. A run still open after it opens an overrun incident, so a session that hangs mid-task does not stay quiet forever.
- Never started: for a Claude Code agent that runs unattended, set a silence floor: the longest normal gap between runs. No run in that window opens an incident.
Set it up
Install the set-up skill and ask Claude Code
In a terminal, install LastPing's set-up skill, then ask Claude Code to monitor itself. The skill connects the LastPing MCP server (you sign in once, in your browser), registers this agent, creates a monitor for it and installs the hooks, each only after you say yes.
npx skills add lastping-dev/skillsThen, in Claude Code: Monitor this agent with LastPing. Without the skill, connect the server yourself and ask the same thing:
claude mcp add --transport http --scope user lastping https://mcp.lastping.dev/mcpType /mcp in Claude Code, choose lastping and sign in.
Let it write the hook script
The install writes one script, ~/.claude/lastping-report.sh, and adds hooks for seven Claude Code events to ~/.claude/settings.json: SessionStart, UserPromptSubmit, Stop, StopFailure, Notification, PreToolUse and PostToolUse. From then on every prompt you send opens a run and every finished answer closes it, without Claude having to remember anything. Each new session also tells Claude how to report what the hooks cannot see:
~/.claude/lastping-report.sh title "<what this task is>"
~/.claude/lastping-report.sh fail "<short reason>"
~/.claude/lastping-report.sh blocked "<what you need>"
~/.claude/lastping-report.sh note "<progress worth recording>"
Choose where each notification goes
Your account email gets alerts from the first monitor, with nothing to configure. Add Slack, Discord, Telegram, Microsoft Teams, Google Chat, a webhook, or ntfy or Pushover for your phone in the console, then pick per event which destination hears about it: for example blocked and failed runs to your phone, finished runs to a Slack channel. A notification duration floor keeps a 20-second answer from notifying anyone, and it never silences a failure.
Optional: trace tokens, cost and tool calls
The same monitor can take Claude Code's OpenTelemetry traces, so each run shows its model calls, tool sequence, tokens and cost. See trace your agents.
What the hooks cannot see
The hooks are exact for start, finish and API-error failures. Three things still depend on Claude, and the set-up says so plainly:
- Work that failed but ended normally: if the tests failed and Claude wrote a normal reply about it, the turn ends through the same Stop as a success. Only Claude knows the task failed, so it calls
failitself. - A question asked in plain text: dialogs are reported as blocked automatically. A question at the end of a reply is not, so Claude calls
blockedwhen it cannot continue without you. - An interrupt: pressing Esc fires no Stop, so the next prompt continues the open run instead of starting a new one.
Your prompts are not sent. The start ping carries the run id, the session id and the project's name (the name of the folder that holds its git repository, or the folder's name when it is not in a repository); a title comes from Claude's own title call. A run still untitled when it finishes can take a short title Claude Code generates from the conversation, which can repeat words from your prompt; off unless you turn it on at setup (LASTPING_AUTO_TITLE=1 in ~/.claude/lastping-report.sh). Taking the title from the prompt text is off unless you turn it on.
Questions people ask
-
How do I get a notification when Claude Code finishes?
Install LastPing's Claude Code hooks (ask Claude Code to monitor itself with LastPing, or use the set-up skill). The Stop hook closes each run as a success. In the console, route the success or every-run event to Slack, Discord, email or a phone app such as ntfy or Pushover. A notification duration floor keeps very short runs quiet.
-
Can LastPing tell me when Claude Code is waiting for permission?
Yes. A permission prompt, an AskUserQuestion dialog or an MCP form marks the run blocked automatically. LastPing holds the notification for 10 minutes and sends it only if Claude is still waiting, and answering the prompt clears it.
-
Does LastPing receive my prompts or code?
No. The hooks send run events: start, finish, a failure or blocked reason Claude writes, the session id, the project's name (the name of the folder that holds its git repository, or the folder's name when it is not in a repository) and, only if you turn it on at setup, a short title Claude Code generates from the conversation, which can repeat words from your prompt. Prompt text is never sent unless you turn on titles from prompts. Tracing is a separate, optional set-up and drops prompt and tool content by default.
-
What if Claude Code hangs in the middle of a task?
Set a maximum runtime on the monitor, for example two hours. A run that has not finished by then opens an overrun incident and alerts you, even though Claude Code never reported an error.
-
Does this work with Codex or Cursor too?
Codex has a hook install of its own: see Codex notifications. Cursor reports through a standing instruction in its rules file instead of hooks: see Cursor agent monitoring.
-
Is it free?
Yes. LastPing is free for individuals, with no monitor cap. The MCP server, the hooks and the set-up skill are included.
Hear about the run that needs you, not every run.
One prompt installs the hooks. Free for individuals.