published fresh until

How do I get a desktop alert when Claude Code needs me or finishes?

Summary As of November 2026, use PreToolUse on AskUserQuestion for questions and PermissionRequest for permission alerts. Version 2.1.233 fixed missing Desktop and VS Code permission notifications. For turn completion, inspect background work in Stop

Not for tracing what each session did in Langfuse via a Stop hook; see langfuse-trace-claude-code-sessions-stop-hook-plugin

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

As of 2026-11-19, use PreToolUse with matcher AskUserQuestion, plus a separate PermissionRequest hook, for immediate attention alerts, and Stop for the end of a turn. Do first: distinguish turn completion from background work using the Stop payload. Hooks reference.

The problem

Long Claude Code runs need a ping when Claude finishes or stops to ask something. People found the Notification hook silent in the VS Code extension, slow to fire, and absent for AskUserQuestion. Issue 13024 requests a waiting-for-input hook; issue 8985 reports the VS Code Native UI problem. Both are closed.

Available hooks

  • Notification hook: the hooks guide shows an empty-matcher Notification hook that runs osascript (macOS); the guide gives Linux and Windows variants. In a terminal, permission_prompt waits about six seconds and typing defers it; idle_prompt waits about 60 seconds, requires no typing or running background agent, and is suppressed during usage-limit waits. Desktop and VS Code permission notifications wait about six seconds without keystroke deferral, and do not fire if permission was already answered. Notification timing.
  • VS Code and Desktop fix: a bot comment on the VS Code issue cites the changelog for 2.1.233: Notification hooks not firing for permission prompts under Claude Desktop or VS Code were fixed. If it still fails on 2.1.233 or later, the comment asks for your version.
  • Immediate signals (maintainer comment, 2026-08-17): a PreToolUse hook with matcher AskUserQuestion fires when Claude calls the tool; PermissionRequest fires at once when Claude asks permission; Stop fires when the turn ends. A chime script on PreToolUse AskUserQuestion plus PermissionRequest covers the needs-attention cases. A commenter who ships a VS Code extension described this on 2.1.241 and said matcher AskUserQuestion|ExitPlanMode also catches plan approval.

Commenter tips

  • Stop fired in VS Code: several said the Stop hook fired while Notification did not.
  • A Linux example in the thread chains notify-send and paplay in a Stop hook. A commenter could not get the PermissionRequest example to fire with an AskUserQuestion matcher in April 2026; the maintainer's PreToolUse route came later.
  • Stop can end a turn while background work remains. Its background_tasks and session_crons arrays let a notification script distinguish completed work from a session waiting to resume; API-error endings use StopFailure instead. Stop payload.
  • Other users built a statusline flag file, iTerm2 triggers matching "Enter to select", or third-party apps; these remain individual suggestions.

Caveats

Hook names and timings come from the current reference; inspect /hooks on your installed version.

Sources

Started from a post by @currenthandle, packaged by the editor. Original post

Subjects

More in agent workflows

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# How do I get a desktop alert when Claude Code needs me or finishes?
Summary: As of November 2026, use `PreToolUse` on `AskUserQuestion` for questions and `PermissionRequest` for permission alerts. Version 2.1.233 fixed missing Desktop and VS Code permission notifications. For turn completion, inspect background work in `Stop`
Copy for agent
get the whatworks thread claude-code-notify-when-finished-stop-hook and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread claude-code-notify-when-finished-stop-hook
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks