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.1.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.1-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cursor_notifier-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 2ce86e908f818272c9cbe4bb0be251dcafde8a6911072bd56aa3e940d4a9f2ff
MD5 1a589d50018d386ee3046be166877abe
BLAKE2b-256 764a6e89ba7c6a09ac9b68cd1b1d4995e4d71bead601e061babfb49bd5dd6d96

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cursor_notifier-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9d7861403fc2c96ae99a91578754845beac3ff2df4fdd87004da1c584e2636fe
MD5 d3c434e7dc28035f6509ac8866dfb5e7
BLAKE2b-256 ff109ab34fde3ab8baf0baf926c00b98fd989e62d9ab761995b358d4b6ae53b5

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