Skip to main content

Discord webhook notifier for cursor-agent activity in tmux panes

Project description

cursor-notifier

Discord webhook notifier for cursor-agent activity in tmux panes.

It polls tmux panes, identifies panes running cursor agent (by foreground TTY process names like cursor-agent or node), and sends a Discord message when activity transitions from active to idle (token counter disappears).

Features

  • Foreground process detection via pane TTY (robust to shells/multiplexers)
  • Token counter detection with flexible regex (e.g. 12 tokens, 12.3k tokens)
  • Discord webhook integration with error details
  • Includes pane working directory and git branch in notifications
  • .env support for configuration
  • Binary entrypoint cursor-notifier when installed

Install (from source)

# Clone and enter
git clone https://github.com/yourname/cursor-notifier.git
cd cursor-notifier

# Optional: use the provided runner
./run_notifier.sh --verbose --dry-run

# Or install locally in editable mode
python3 -m venv .venv
. .venv/bin/activate
pip install --upgrade pip
pip install -e .

Configuration

You can configure via environment variables or a .env file in the project directory (loaded automatically if python-dotenv is installed).

  • CURSOR_NOTIFIER_WEBHOOK: Discord webhook URL (required unless --dry-run)
  • CURSOR_NOTIFIER_INTERVAL: Poll interval seconds (default: 7)
  • CURSOR_NOTIFIER_LINES: Number of lines to scan from tmux buffer (default: 120)
  • CURSOR_NOTIFIER_PROCESSES: Comma-separated executable names to treat as cursor agent (default: cursor-agent,node)

Example .env:

CURSOR_NOTIFIER_WEBHOOK=https://discord.com/api/webhooks/123/abc
CURSOR_NOTIFIER_PROCESSES=cursor-agent,node
CURSOR_NOTIFIER_INTERVAL=7
CURSOR_NOTIFIER_LINES=120

Usage

After installation, you can run the console script:

notifier-cursor --verbose

Or from source within this repo:

./run_notifier.sh --verbose

Useful flags:

  • --process-names: Comma-separated executable names to monitor (e.g., cursor-agent,node)
  • --interval: Polling interval seconds
  • --lines: How many recent lines to scan in each pane
  • --debug: Log diagnostics for all panes
  • --verbose: Print logs
  • --dry-run: Do not send Discord messages
  • --test [message]: Send a test message to the webhook and exit

Send a quick test:

notifier-cursor --test "hello from cursor-notifier"

How it works

  • Enumerates tmux panes with tmux list-panes -a
  • For each pane, gets its TTY and uses ps -t <tty> -o comm= to list executable names
  • If any of those names match your configured target names, the pane is considered a cursor agent pane
  • It captures recent pane output and checks for a token counter; when it disappears, it sends a Discord message with the pane path and git branch

Packaging and publishing to PyPI

This project is set up with pyproject.toml using setuptools and exposes an entrypoint cursor-notifier.

Build

python3 -m pip install --upgrade build twine
python3 -m build

Artifacts will be in dist/ (e.g., cursor_notifier-0.1.0-py3-none-any.whl and .tar.gz).

Test upload to TestPyPI (recommended)

python3 -m twine upload --repository testpypi dist/*
# Then install to verify
python3 -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple cursor-notifier

Upload to PyPI

python3 -m twine upload dist/*

You will need a PyPI account and API token. Store credentials securely, e.g., in ~/.pypirc:

[distutils]
index-servers = pypi testpypi

[pypi]
  repository = https://upload.pypi.org/legacy/
  username = __token__
  password = pypi-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

[testpypi]
  repository = https://test.pypi.org/legacy/
  username = __token__
  password = pypi-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Troubleshooting

  • 403 on webhook: ensure the webhook URL is correct, the webhook has channel access, and you are not using the Slack-compatible URL. Use --test to get detailed error info.
  • No panes detected: confirm tmux is running and that tmux list-panes -a works. Ensure the target process names include the executable you run (e.g., add node).
  • Git branch missing: the pane path must be inside a git repo.

License

MIT

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

cursor_notifier-0.1.0.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

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

cursor_notifier-0.1.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file cursor_notifier-0.1.0.tar.gz.

File metadata

  • Download URL: cursor_notifier-0.1.0.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.2

File hashes

Hashes for cursor_notifier-0.1.0.tar.gz
Algorithm Hash digest
SHA256 39ca3617d634b2a4e9b52cd7145caad2ff4a39663e7ec75b24383d3553008204
MD5 a6fb363add6708acbbfe515c751d5167
BLAKE2b-256 49ebfed7c7620e4e45982e1aee860e275b82a30b779b732dad28117fa263ecb9

See more details on using hashes here.

File details

Details for the file cursor_notifier-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cursor_notifier-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bb99775ec012022d4b8f5f948588dd462906c743995dd77aba9b70556f843596
MD5 4da86dcf6cedcd1a750b255944046043
BLAKE2b-256 6a294e65642aa09136425b83338684e4770c773fdeedc324f3f4505f56138134

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