An intelligent Claude Code notification system providing real-time, multi-channel notifications and smart throttling/controls.
- Smart detection for privileged operations and task completion
- Global enablement via one-time setup across projects
- 6+ popular notification channels
- Beautified messages with rich cards and layered design
- Easy configuration with scripts and templates
- Secure with signature verification and encrypted transport
- Smart rate limiting to prevent notification flooding
- Message grouping for deduplication
- Operation gating for sensitive actions with user confirmation
- Adaptive strategy tuning based on usage patterns
- Event toggles with fine-grained control
- Custom events with user-defined triggers and payloads
- Template engine with unified styles
- Multi-channel routing per event type
- Metrics and effectiveness analysis
- Config backup and restore
- ๐ง Hooks API Adaptation - Fixed
installer.pyandclaude_hook.pyto adapt to new Claude Code Hooks API (PreToolUse, PostToolUse, Stop, Notification list format) - ๐ก๏ธ Type Safety Enhancement - Fixed type checking issues, improved code robustness
- โ Test Case Updates - Updated 14 test cases to match actual event implementation
- ๐ Exception Handling Optimization - Used specific exception types instead of bare
except - ๐๏ธ Code Cleanup - Removed deprecated
ConfirmationRequiredEventclass
- ๐ฆ CLI Module Refactoring - Split CLI commands into independent modules (
core,config,hooks,debug) - ๐ง Code Quality Fixes - Multiple optimizations including config cache, permission comparison, clear screen methods
- ๐ CI/CD Friendly - Added
--yes/-yoption for non-interactive uninstall
- ๐ฏ PreToolUse Hook - Triggered before tool use, supports sensitive operation detection (Bash, Edit, Write, DeleteFile, etc.)
- ๏ฟฝ PostToolUse Hook - Triggered after tool use, supports error detection and result logging
- โ Stop Hook - Triggered when Claude stops working, for task completion notifications
- ๐ Notification Hook - Handles permission requests (permission_prompt) and idle prompts (idle_prompt)
- ๐ Backward Compatible - Retains old API support via command-line arguments
๐ Breakthrough Feature: PyPI users now enjoy the same seamless experience as Git users!
- โ
โก One-Click Smart Setup -
claude-notifier setup --autoauto-detects and configures all features - โ
๐ง Complete Hook Management - New
hookscommand group provides install/uninstall/status/verify - โ ๐ก Smart Environment Detection - Auto-discover Claude Code installation, supports multiple locations
- โ
๐ Enhanced Status Display -
--statusnow includes complete hook system status - โ ๐ก๏ธ Error Recovery - Works even with missing dependencies, provides graceful degradation
- โ ๐ Dual-Mode Compatibility - Hook system supports both PyPI and Git modes with smart switching
- โ
PEP 440 Versioning - Pre-release (
a/b/rc) alongside stable releases - โ CLI Version Info - Stable builds omit pre-release warnings; pre-releases show "Version Type: Alpha/Beta/RC"
- โ README Badge - Updated to Stable badge
- โ CI/CD Workflow - Stable releases via GitHub Actions to PyPI; pre-releases managed via repo tags/releases
| Channel | Status | Features |
|---|---|---|
| ๐ DingTalk Bot | โ | ActionCard + Markdown |
| ๐ Webhook | โ | HTTP callback + Multi-format + Multi-auth |
| ๐ Feishu (Lark) Bot | ๐ง In Development | Rich text + Interactive cards |
| ๐ผ WeCom (WeChat Work) Bot | ๐ง In Development | Markdown + News |
| ๐ค Telegram | ๐ง In Development | Bot message push |
| ๐ฎ Email | ๐ง In Development | SMTP delivery |
| ๐ง ServerChan | ๐ง In Development | WeChat push |
# Install latest stable version
pip install claude-code-notifier
# Or install specific version
pip install claude-code-notifier==0.0.8
# Verify installation
claude-notifier --version
# ๐ One-Click Smart Setup (New Feature!)
claude-notifier setup --auto๐ New Feature: PyPI version now supports Claude Code hook auto-configuration!
After installation, the system will automatically:
- ๐ฆ Create configuration directory
~/.claude-notifier/ - โ๏ธ Generate default configuration files
- ๐ง Set up CLI commands
- ๐ Smart Claude Code detection with integration prompts
- โก One-click Claude Code hook configuration
Suitable for: General users, quick setup, production use
git clone https://github.com/kdush/Claude-Code-Notifier.git
cd Claude-Code-Notifier
./install.shโจ New Smart Installation System Features:
- ๐ฏ Intelligent Mode Selection - Auto-detect environment and recommend best installation method
- ๐ฆ Three Installation Modes - PyPI/Git/Hybrid to meet different needs
- ๐ Auto-Update Mechanism - Scheduled checks with one-click updates
- ๐ Unified Command Interface -
cncommand auto-routes to correct execution method - ๐ Version Management - Unified version info and upgrade paths
Quick Setup:
# Run configuration wizard after installation
python3 scripts/quick_setup.pyThe quick setup script will guide you to:
- Configure channels (DingTalk, Feishu/Lark, Telegram, Email, etc.)
- Select event types to enable
- Add custom events
- Set advanced options (rate limits, quiet hours, etc.)
- Test your notification setup
git clone https://github.com/kdush/Claude-Code-Notifier.git
cd Claude-Code-Notifier
chmod +x install.sh
./install.sh
# Copy config template
cp config/enhanced_config.yaml.template config/config.yaml
# Edit configuration
vim config/config.yamlSuitable for: Developers, contributors, custom features needed, testing latest features
| Feature | PyPI Installation | Git Source Installation |
|---|---|---|
| ๐ฏ Target Users | General users | Developers |
| โก Installation Speed | Fast | Slower |
| ๐ Update Method | pip install --upgrade |
git pull + reinstall |
| ๐งช Version | Stable releases | Latest development |
| ๐ ๏ธ Customization | Basic configuration | Full customization |
| ๐ฆ Dependency Management | Automatic | Manual |
| ๐ Claude Code Integration | Manual setup | Auto Hook setup |
| ๐ Directory Structure | Standard Python package | Full project structure |
# Initialize configuration
claude-notifier init
# Test notifications
claude-notifier test
# Check status
claude-notifier status๐ Regardless of installation method, use the unified cn command:
# Smart command routing - auto-selects correct execution method
cn init # Initialize configuration
cn test # Test notifications
cn status # Check status
cn --help # Show help๐ Smart Update System:
# Check for updates
python3 scripts/smart_update.py --check
# Perform update
python3 scripts/smart_update.py --update
# Enable auto-update
python3 scripts/smart_update.py --enable-auto
# Show update status
python3 scripts/smart_update.py --statusAuto-Update Features:
- โ Auto-detect installation type (PyPI/Git)
- โ Smart version comparison and updates
- โ Scheduled checks (daily)
- โ Configuration backup and migration
- โ Update logging
./scripts/test.sh
# Test a specific channel
./scripts/test.sh --channel dingtalkWhen Claude Code detects a sensitive operation:
- Execution is paused automatically
- A confirmation notification is sent
- Terminal waits for your confirmation
When Claude Code finishes all tasks:
- A celebration notification is sent
- Execution summary is shown
- Action suggestions are provided
Permission Confirmation (ActionCard)
๐ Claude Code Permission Check
---
โ ๏ธ Sensitive operation detected
> Claude Code paused execution automatically
---
๐ Project: my-awesome-project
โก Operation: sudo systemctl restart nginx
๐ก Please confirm in your terminal
[๐ฑ Open Terminal] button
Task Completion (Markdown)
โ
Claude Code Task Completed
๐ Great job! It's time for a break.
๐ Project: my-awesome-project
๐ Status: Code refactor task completed
โฐ Time: 2025-08-20 15:30:20
โ Consider taking a break or reviewing the results
Config file path: ~/.claude-notifier/config.yaml
# Channels configuration
channels:
dingtalk:
enabled: true
webhook: "https://oapi.dingtalk.com/robot/send?access_token=..."
secret: "SEC..."
feishu:
enabled: true
webhook: "https://open.feishu.cn/open-apis/bot/v2/hook/..."
# Notification settings
notifications:
permission:
enabled: true
channels: ["dingtalk", "feishu"]
completion:
enabled: true
channels: ["dingtalk"]
delay: 3
# Detection rules
detection:
permission_patterns:
- "sudo"
- "rm -"
- "chmod"
- "git push"
- "npm publish"
- "docker"
- "kubectl"- Create a new file under
src/claude_notifier/core/channels/ - Implement the
BaseChannelinterface and required class attributes - Register the channel in
src/claude_notifier/core/channels/__init__.py - Add channel configuration template to config file
- Update documentation and tests
See docs/development.md for detailed development guide
Edit the detection section in ~/.claude-notifier/config.yaml.
# Send a notification
claude-notifier send "Hello World!"
# Test configuration
claude-notifier test
# Show status
claude-notifier status --intelligence
# Config management
claude-notifier config show
claude-notifier config backup
# Real-time monitor
claude-notifier monitor --watch
# System diagnostics
claude-notifier debug diagnose --full-
Versioning (PEP 440)
- Pre-releases:
aN(Alpha),bN(Beta),rcN(Release Candidate), e.g.,0.0.3a1,0.0.3b4,0.0.3rc1 - Stable: remove the suffix, e.g.,
0.0.3 - Version source file:
src/claude_notifier/__version__.py
- Pre-releases:
-
Pre-release policy
- Publish pre-releases via Git tags (e.g.,
v0.0.3b4) and create a repo Release with change notes - CLI
--versiondisplays โVersion Type: Alpha/Beta/RCโ and a pre-release notice - If distribution is needed, you may manually publish pre-releases to PyPI (optional)
- Publish pre-releases via Git tags (e.g.,
-
Stable release (default)
- Tag
vX.Y.Ztriggers GitHub Actions to build (sdist + wheel) and publish to PyPI - Update
CHANGELOG.mdand docs accordingly
- Tag
See details: docs/development_en.md
- Quickstart:
docs/quickstart.md(Chinese) - Configuration:
docs/configuration.md(Chinese) - Channels:
docs/channels.md(Chinese) - Advanced Usage:
docs/advanced-usage.md(Chinese) - Development:
docs/development.md(Chinese)
This project integrates with ccusage to analyze Claude Code token usage and costs:
# Analyze local usage data
npx ccusage
bunx ccusage
# Monthly stats
ccusage --monthly
# Generate usage report
ccusage --output usage-report.jsonccusage features:
- Token usage analytics with detailed breakdowns
- Cost tracking per Claude model
- Time-based reports (daily/monthly/session)
- Real-time monitoring of 5-hour billing windows
- Offline analysis from local JSONL files
Thanks to @ryoppippi for this great tool!
- โ macOS 15 - Fully tested and supported
- ๐ง Windows/Linux - Theoretically supported, but not extensively tested
This project is designed with cross-platform compatibility in mind:
- ๐ช Windows Support - Hook installer has been optimized for Windows command line and path handling
- ๐ง Linux Support - Uses standard Python and shell commands, should work normally
- ๐ง Automatic Platform Detection - Code includes
os.nameand platform-specific processing logic
๐ We warmly invite users on other platforms to test and improve:
- If you use it on Windows or Linux, please share your experience
- Please submit Issues for any problems you encounter, we will actively resolve them
- Welcome to submit platform-specific improvements and fixes via PR
Issues and Pull Requests are welcome!
Apache License
๐ก Make Claude Code smarter. Make development more efficient!
