Claude Code Finished? Get a Notification Automatically

Claude Code Finished? Get a Notification Automatically

Aident AI

A coral pulse travels from a large violet form to a warm amber oval across a dark field.

Claude Code Finished? Get a Notification Automatically

Claude Code can notify you when it finishes a response, needs permission, or has been idle waiting for input. For the quickest setup, use its built-in desktop notifications in Ghostty, Kitty, or iTerm2. In other terminals, enable the terminal bell or add a Notification or Stop hook to ~/.claude/settings.json.

Use Notification with the idle_prompt matcher when you want an alert after Claude is done and waiting. Use Stop when you want an immediate alert after every completed response. The distinction matters: idle_prompt is less noisy but can be delayed, while Stop fires once per turn, including short answers.

Choose the Signal You Actually Need

You want to know when...

Use

Tradeoff

Claude finishes any response immediately

Stop hook

Fast, but can alert after short conversational turns

Claude is done and waiting for your next prompt

Notification with idle_prompt

Quieter, but the idle notification is not immediate

Claude needs permission

Notification with permission_prompt

Separate alert for an actionable block

A background agent completes

Notification with agent_completed

Requires Claude Code 2.1.198 or later and the agent view open

Your terminal supports native desktop alerts

Built-in notification

Default support is limited to Ghostty, Kitty, and iTerm2

You only need an audible signal

preferredNotifChannel terminal bell

Simple, but carries no message or project context

If you keep forgetting to return to a long-running task, start with Stop. If that produces too many alerts, switch the completion alert to idle_prompt and keep a separate permission_prompt alert.

Prerequisites

You need a current Claude Code installation and one native notification command that works outside Claude Code.

Check the installed version:

claude --version

Then test the command for your operating system before putting it in a hook.

macOS

osascript -e 'display notification "Claude Code test" with title "Claude Code"'

Expected result: macOS shows a notification from Script Editor. If nothing appears, open System Settings, select Notifications, enable Script Editor notifications, and run the command again.

Linux

command -v notify-send
notify-send 'Claude Code' 'Claude Code test'

Expected result: command -v prints the executable path and your desktop notification service shows the message. A headless shell without a desktop session or notification bus will not display it.

Windows PowerShell

Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.MessageBox]::Show('Claude Code test', 'Claude Code')

Expected result: Windows opens a message box. Close it before continuing.

Do not configure a hook until its native command works by itself. That separates an operating-system permission problem from a Claude Code configuration problem.

Option 1: Turn On the Terminal Bell

If a sound is enough, add this top-level setting to ~/.claude/settings.json:

{
  "preferredNotifChannel": "terminal_bell"
}

Restart Claude Code after saving the file. Expected result: the terminal rings when Claude finishes a task or pauses for permission. Your terminal profile must allow the audible bell.

This is the smallest setup, but a bell cannot tell you which project needs attention when several sessions are running.

Option 2: Notify When Claude Finishes a Response

Add a Stop hook for an immediate completion alert. On macOS:

{
  "hooks": {
    "Stop": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "osascript -e 'display notification \"Claude Code finished\" with title \"Claude Code\"'",
            "async": true
          }
        ]
      }
    ]
  }
}

For Linux, replace only the command:

"command": "notify-send 'Claude Code' 'Claude Code finished'"

For Windows, use the native PowerShell hook support:

{
  "hooks": {
    "Stop": [
      {
        "hooks": [
          {
            "type": "command",
            "shell": "powershell",
            "command": "Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.MessageBox]::Show('Claude Code finished', 'Claude Code')",
            "async": true
          }
        ]
      }
    ]
  }
}

The asynchronous setting prevents a notification command from delaying Claude Code. A Stop hook does not support a matcher, so it runs after every response. If your settings file already contains hooks, merge Stop beside the existing event keys instead of replacing the whole object.

Option 3: Alert Only When Claude Is Waiting

Use the Notification event when you want fewer alerts. This macOS example separates completed work from permission requests:

{
  "hooks": {
    "Notification": [
      {
        "matcher": "idle_prompt",
        "hooks": [
          {
            "type": "command",
            "command": "osascript -e 'display notification \"Ready for your next prompt\" with title \"Claude Code\"'",
            "async": true
          }
        ]
      },
      {
        "matcher": "permission_prompt",
        "hooks": [
          {
            "type": "command",
            "command": "osascript -e 'display notification \"Permission needed\" with title \"Claude Code\"'",
            "async": true
          }
        ]
      }
    ]
  }
}

Use the tested Linux or Windows command in the same structure if you are not on macOS. The idle_prompt alert waits until Claude is idle rather than firing the instant a response finishes. An open Anthropic issue documents a 60-second idle delay, so choose Stop if immediate completion timing is important.

Verify the Hook End to End

Restart Claude Code, then enter:

/hooks

Expected result: the hooks browser shows the configured event and command. The browser is read-only; edit the settings file to change the hook.

Now ask Claude to complete a harmless task, such as summarizing the current directory without editing files, and switch to another window.

  • With Stop, expect an alert as soon as the response finishes.

  • With idle_prompt, wait through the idle period before judging the test.

  • With permission_prompt, ask Claude to propose a command that requires approval and confirm the alert appears before approving or denying it.

Finally, run Claude Code with debug output if the event appears in /hooks but the command does not run:

claude --debug

Common Failure Modes

Symptom

Likely cause

Fix

Native test command shows no alert

OS notification permission is missing

Enable notifications for Script Editor, the terminal, or the desktop service

Hook is absent from /hooks

Invalid JSON or the setting is in the wrong file

Validate ~/.claude/settings.json and restart Claude Code

idle_prompt feels late

It waits for the idle threshold

Use Stop for immediate completion timing

Every short response creates noise

Stop fires once per turn

Move the alert to Notification with idle_prompt

tmux swallows the desktop notification

Terminal escape-sequence passthrough is disabled

Add set -g allow-passthrough on to ~/.tmux.conf and reload tmux

Linux works locally but not over SSH

The remote shell lacks a desktop notification bus

Use terminal forwarding or send the alert through a connected service

Two notifications appear

Built-in terminal alerts and a custom hook both fire

Keep one channel or use different matchers for different events

A hook command hangs the session

The notifier is running synchronously

Set "async": true after confirming the command is safe

Hooks run with your user permissions. Keep commands fixed, review them before use, and never interpolate untrusted task text into a shell command.

Send the Alert to Lark When You Leave Your Desk

A local alert solves the desktop case. For a phone or team channel, connect Lark through Aident Loadout, inspect the current send-message Action, and test one destination before wiring it into a wrapper script.

If Aident Loadout is not installed, tell Claude Code:

Follow https://aident.ai/SETUP.md

Then use this request:

Confirm my Aident Loadout account and Vault status. Find the current Lark send-message Action, inspect its input schema, and prepare one test message for the destination I name. Do not send it until I approve

Expected result: Claude identifies a current Action, shows the exact fields it needs, and waits for approval before sending. After one verified test, keep the destination and message shaping in a single reviewed script and call that script from the hook. Do not paste provider credentials into settings.json or duplicate the integration logic across several hook commands.

This follows the practical pattern behind Aident's Ollama networking guide: answer the exact problem, provide reproducible commands, show expected results, cover failure modes, and explain why the fix works. For the wider integration setup, see how to connect Claude Code and Codex to real-world tools.

Test One Completion Alert

Connect Lark through Aident Loadout, inspect the current send-message Action, and send one approved test alert. Success means the named destination receives exactly one message, the local hook still works, and no provider credential appears in your Claude settings or repository.

Why This Works

Claude Code exposes lifecycle events instead of forcing a script to scrape terminal output. Stop represents the end of a response. Notification represents a state that needs attention, and its matcher distinguishes idle, permission, authentication, and background-agent events. The hook maps one of those structured events to a native or connected notification command.

The result is a dependable handoff: Claude works, one event fires, and you return only when the session needs you.

Sources

Refresh this guide when Anthropic changes Notification matchers, the idle delay, background-agent requirements, terminal support, hook configuration, or PowerShell behavior.

Home

Home

Home

Integrations

Integrations

Integrations

Vault

Vault

Vault

Audit

Audit

Audit

Arana Grande

Arana Grande

Arana Grande

Free

Free

Free

30-day audit summary

30-day audit summary

30-day audit summary

Daily action-call volume and the latest receipts from the Loadout audit trail.

Daily action-call volume and the latest receipts from the Loadout audit trail.

Daily action-call volume and the latest receipts from the Loadout audit trail.

View Audit

View Audit

View Audit

Loadout usage

Loadout usage

Loadout usage

617 action calls in the last 30 days

617 action calls in the last 30 days

617 action calls in the last 30 days

May 19 - Jun 17

May 19 - Jun 17

May 19 - Jun 17

10 active days

10 active days

10 active days

Less

Less

Less

More

More

More

Recent activity

Recent activity

Recent activity

Latest action-call receipts from connected agents

Latest action-call receipts from connected agents

Latest action-call receipts from connected agents

Apr 23, 09:23 AM

Apr 23, 09:23 AM

Apr 23, 09:23 AM

Shopify

Shopify

Shopify

Creates Or Updates An Asset For A Theme

Creates Or Updates An Asset For A Theme

Creates Or Updates An Asset For A Theme

Success

Success

Success

Apr 23, 09:21 AM

Apr 23, 09:21 AM

Apr 23, 09:21 AM

Shopify

Shopify

Shopify

Update Products Param Product Id

Update Products Param Product Id

Update Products Param Product Id

Success

Success

Success

Apr 23, 08:53 AM

Apr 23, 08:53 AM

Apr 23, 08:53 AM

Shopify

Shopify

Shopify

Update Products Param Product Id

Update Products Param Product Id

Update Products Param Product Id

Failed

Failed

Failed

Apr 22, 22:13 PM

Apr 22, 22:13 PM

Apr 22, 22:13 PM

Shopify

Shopify

Shopify

Create Product Image

Create Product Image

Create Product Image

Success

Success

Success

Apr 22, 22:12 PM

Apr 22, 22:12 PM

Apr 22, 22:12 PM

Shopify

Shopify

Shopify

Create Product Image

Create Product Image

Create Product Image

Success

Success

Success

Connected integration coverage

Connected integration coverage

Connected integration coverage

162

162

162

of 753 accessible connected

of 753 accessible connected

of 753 accessible connected

Callable actions

Callable actions

Callable actions

1,126

1,126

1,126

Vault credentials

Vault credentials

Vault credentials

8

8

8

Explore what's possible

Explore what's possible

Explore what's possible

See all Integrations

See all Integrations

See all Integrations

Google Ads

Google Ads

Google Ads

All available Goolge Ads tools via...

All available Goolge Ads tools via...

All available Goolge Ads tools via...

X (twitter)

X (twitter)

X (twitter)

All available X tools via...

All available X tools via...

All available X tools via...

Github

Github

Github

All available Github tools via...

All available Github tools via...

All available Github tools via...

Notion

Notion

Notion

All available Notion tools via...

All available Notion tools via...

All available Notion tools via...

Slack

Slack

Slack

All available Slack tools via...

All available Slack tools via...

All available Slack tools via...

Firecrawl

Firecrawl

Firecrawl

All available Firecrawl tools via...

All available Firecrawl tools via...

All available Firecrawl tools via...

753 integrations are available for loadouts.

753 integrations are available for loadouts.

753 integrations are available for loadouts.

Plug your entire stack into your AI agents.

Plug your entire stack into your AI agents.

Plug your entire stack into your AI agents.

Skip the integration headache. Plug 750+ tools into Claude Code, Codex, and OpenClaw in one go, and let your agents execute today.

Skip the integration headache. Plug 750+ tools into Claude Code, Codex, and OpenClaw in one go, and let your agents execute today.