Skip to main content

A config-driven notification router — rule matching, audio playback, multi-backend command execution

Project description

hermes-notify

English | 中文

A config-driven notification router for Hermes Agent — rule matching, context injection, audio playback, and custom command execution.

Transport-agnostic. Reads messages from stdin or a Bus hook, matches against notify.yaml rules, and executes the configured action.

What is this?

hermes-notify is a message router for the Hermes Agent ecosystem. When a message arrives (from a bus, a script, or stdin), it checks the message type against your notify.yaml rules. If a rule matches, it executes the configured command — anything from a macOS notification to a Slack webhook.

Quickstart

  1. Install: pip install hermes-notify
  2. Create a notify.yaml config file with a rule (see Configuration below)
  3. Send a message: notify-hermes --to my-service --type task_done "Hello"
  4. The callback matches match_type: task_done and runs your command

Install

pip install hermes-notify

Or from source:

git clone https://github.com/mlinquan/hermes-notify.git
cd hermes-notify && pip install -e .

CLI

# Send a message to any bus endpoint
notify-hermes --to my-service --type task_done "Task completed"
notify-hermes --to my-service --type progress "50% done"
notify-hermes --to my-service --type ack "Received"

# Send a notification to a tmux session
notify-agent mysession "Start working"
notify-agent --simple mysession "FYI: something happened"

# Process a callback message from stdin
echo '{"body":{"type":"task_done","text":"done"}}' | hermes-callback

Configuration

Messages are routed by notify.yaml. Each callback rule specifies a match_type and a command to execute:

callbacks:
  - match_type: task_error
    print: false
    context: true
    command: "notify-send 'Task failed'"

  - match_type: task_done
    print: false
    context: true
    command: "afplay ~/sounds/done.mp3"

Two boolean fields control behavior: print (terminal output), context (inject into LLM context).

The command field receives these environment variables:

  • MESSAGE — full message JSON
  • TYPE — message type
  • FROM — sender endpoint name
  • Stdin — raw message JSON (for backward compatibility)

Print Format

When print: true, the terminal output uses print_format template. Supports placeholders:

Placeholder Description Example
{from} Sender endpoint name 银锭
{text} Message body text 任务完成
{type} Message type task_done
{ts} Unix timestamp (raw) 1744986323
{ts:%Y-%m-%d %H:%M:%S} Formatted timestamp 2026-05-18 17:45:23
{color:cyan} ANSI foreground color black/red/green/yellow/blue/magenta/cyan/white
{color:bold_green} Bold color variant bold_red, bold_green, etc.
{bold} Bold text
{reset} Reset all styles

Default: [{from}] {text}

callbacks:
  - match_type: task_done
    print: true
    print_format: "{color:bold_green}✔ {from}{reset}  {color:cyan}[{ts:%H:%M:%S}]{reset}  {text}"
    context: true
    command: "afplay /System/Library/Sounds/Glass.aiff"

Example callback scripts are bundled in examples/:

examples/macos-notify.py    # macOS notification via osascript
examples/play-sound.py      # Play random sound via afplay  
examples/slack-notify.sh    # Slack webhook (set SLACK_WEBHOOK_URL)

Architecture

stdin / Bus hook ──→ bus_callback.py ──→ notify.yaml rules
                                              │
                                         Match?
                                        ├─ yes → execute command
                                        └─ no  → silent

notify-hermes — Bus message sender
notify-agent  — tmux notification sender

Session Aliases

Map tmux session names to human-readable sender names in notify.yaml:

session_aliases:
  session-1: alias-1
  session-2: alias-2

default_sender: notify-agent

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

hermes_notify-0.3.0.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

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

hermes_notify-0.3.0-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file hermes_notify-0.3.0.tar.gz.

File metadata

  • Download URL: hermes_notify-0.3.0.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for hermes_notify-0.3.0.tar.gz
Algorithm Hash digest
SHA256 c4dfce2a0247164b45b44dd95cf1c5f87099e08b0cc2c1659ec7a6e0aed49b0e
MD5 6eb0318f2a5ef99fc064dd00470ed00e
BLAKE2b-256 76d45eea99f048332e3924f3165990da2cd758477d31736eec874385129e472b

See more details on using hashes here.

File details

Details for the file hermes_notify-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: hermes_notify-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 13.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for hermes_notify-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9bb0825a2249a9cb4c60a962fc359368ad4d96d94b33947d4121ec148aa4ce0b
MD5 3eda3c366fc0cdc605e043d2bf6742e4
BLAKE2b-256 65f5fed6e2b8dfbc73907a83b10ac841c3e901fcb3d7dd083969643b7cc62997

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