Skip to main content

Cross-platform notification system for Claude Code hooks with intelligent project detection

Project description

Claude-notify

A simple, cross-platform notification system to alert you when Claude needs your attention.

Features

  • 🖥️ Cross-platform support: Works on macOS, Linux, and Windows
  • 🔔 Native notifications: Uses system-native notification methods when available
  • 🪝 Claude Code hooks: Integrates seamlessly with Claude's hook system
  • ⚙️ Configurable: Customize notification preferences
  • 🎯 Simple CLI: Easy-to-use command-line interface
  • 🔄 Watch mode: Continuous monitoring with periodic notifications
  • 🚨 Smart alerts: Critical notifications for potentially destructive operations
  • 📁 Project identification: All notifications include project name and path

Installation

From Source

# Clone the repository
git clone https://github.com/yourusername/claude-notify.git
cd claude-notify

# Install dependencies
pip install -r requirements.txt

# Install the package
pip install -e .

Using pip (when published)

pip install claude-notify

Usage

Claude Code Hook Integration (Recommended)

Claude-notify can be integrated directly with Claude Code as a hook to notify you when Claude needs attention or performs certain actions.

Setting up as a Claude Hook

You can configure claude-notify as a hook in two ways:

Option 1: Using Claude's /hooks command (Recommended)

# In Claude Code, simply run:
/hooks
# This will automatically add claude-notify hooks for Notification and Stop events

Option 2: Manual configuration

Add to your Claude settings file (~/.claude/settings.json or .claude/settings.json in your project):

{
  "hooks": {
    "Notification": [
      {
        "matcher": ".*",
        "hooks": [
          {
            "type": "command",
            "command": "claude-notify hook"
          }
        ]
      }
    ],
    "Stop": [
      {
        "matcher": ".*",
        "hooks": [
          {
            "type": "command",
            "command": "claude-notify hook"
          }
        ]
      }
    ],
    "PreToolUse": [
      {
        "matcher": "(Bash|Write|Edit|MultiEdit)",
        "hooks": [
          {
            "type": "command",
            "command": "claude-notify hook"
          }
        ]
      }
    ]
  }
}

This configuration will:

  • Notify you when Claude finishes responding (Stop event)
  • Alert you before Claude uses potentially destructive tools (Bash, Write, Edit, MultiEdit)
  • Show the project name in ALL notification titles and full project path in ALL messages

Available Hook Events

  • PreToolUse: Before Claude uses a tool (can be used to review/block actions)
  • PostToolUse: After a tool completes successfully
  • Notification: When Claude sends a notification
  • Stop: When Claude finishes responding
  • SubagentStop: When a Claude subagent completes

Testing Hook Integration

# Test hook with sample data (includes project path extraction)
claude-notify hook --test  # Reads from test.json

# Test project path extraction
python examples/test-project-path.py

# Test with specific event type
echo '{"tool_name": "Bash", "tool_input": {"command": "ls"}}' | claude-notify hook --event-type PreToolUse

# Hook command options:
# --event-type, -e: Override event type detection
# --test, -t: Read from test.json instead of stdin

Project Path Display

For ALL hook events, claude-notify automatically extracts and displays:

  • Project name in the notification title (e.g., "Claude Tool Request - my-project", "Claude Response Complete - my-project")
  • Full project path in the notification message (e.g., "Project: my-project (/home/user/projects/my-project)")

This helps you identify which Claude session/project needs your attention when working on multiple projects, regardless of the event type.

Manual Usage

Send a notification

# Basic notification
claude-notify send

# Custom notification
claude-notify send --title "Custom Title" --message "Custom message" --urgency critical

# Without sound
claude-notify send --no-sound

Watch mode

Monitor Claude sessions for activity that requires your attention:

# Monitor current project (checks every 30 seconds)
claude-notify watch

# Monitor all Claude projects
claude-notify watch --all-projects

# Custom check interval with verbose output
claude-notify watch --interval 10 --verbose

# Monitor specific project
cd /path/to/project && claude-notify watch

Watch mode features:

  • Real-time monitoring of Claude transcript files
  • Smart detection of when Claude needs your input
  • Project-aware notifications showing which project needs attention
  • Pattern matching for questions, waiting states, and errors
  • One-time notifications per session (won't spam you)

Configuration

# Show current configuration
claude-notify config show

# Set configuration values
claude-notify config set timeout 15
claude-notify config set sound false
claude-notify config set urgency critical

# Reset to defaults
claude-notify config reset

System check

Check if your system is properly configured:

claude-notify check

Configuration Options

Configuration is stored in:

  • Linux/macOS: ~/.config/claude-notify/config.yaml
  • Windows: %APPDATA%\claude-notify\config.yaml

Available options:

  • timeout: Notification display duration in seconds (default: 10)
  • sound: Play notification sound (default: true)
  • urgency: Notification urgency level - low, normal, critical (default: normal)
  • interval: Watch mode check interval in seconds (default: 300)
  • title: Default notification title
  • message: Default notification message

Platform-specific Notes

macOS

  • Uses native osascript for notifications
  • Sound support included

Linux

  • Requires notify-send (usually part of libnotify-bin package)
  • Install with: sudo apt-get install libnotify-bin (Debian/Ubuntu)
  • Falls back to Python plyer if notify-send is not available

Windows

  • Uses PowerShell for native Windows 10+ toast notifications
  • Falls back to Python plyer if PowerShell method fails

Development

# Install in development mode
pip install -e .

# Run tests (when implemented)
python -m pytest

License

MIT License - see LICENSE file for details

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

claude_notify-0.1.1.tar.gz (23.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

claude_notify-0.1.1-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file claude_notify-0.1.1.tar.gz.

File metadata

  • Download URL: claude_notify-0.1.1.tar.gz
  • Upload date:
  • Size: 23.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.3

File hashes

Hashes for claude_notify-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8cf045c0cfa01188392c234869d4b04006f66c16f3f6a8fc07d6f9d21dd29414
MD5 b9cd974fde6e3d9a2b04183d1c81441c
BLAKE2b-256 d93d336bc63cf4a46ad5d496d5cdb530051b2fda29affdd350ef73f1d54eab93

See more details on using hashes here.

File details

Details for the file claude_notify-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: claude_notify-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.3

File hashes

Hashes for claude_notify-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a12e08b0cbd2a073b157533842cfcdaa8a9789f7e31fd673c18616a82234646c
MD5 738361bb518866da3a1f6dd6f7d035f8
BLAKE2b-256 28a38d37c60508484de107c6448af8ee2113e00428bca645336f2694a0513ebf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page