This tool helps you clean up GitHub notifications from repositories that no longer exist ("phantom notifications"), which can clutter your notification feed.
The Node.js script comes from this GitHub Community discussion with minor modifications to console output.
- The Node.js script works on any platform that supports Node.js
- The integration shown in these instructions uses bash as the shell, but the concepts can be adapted to other shells (zsh, fish, etc.)
- These shell examples are designed for GNU/Linux, macOS, or other Unix-like systems
- Node.js
- GitHub CLI (
gh) with completed authentication setup (verify withgh auth status,Token scopesmust containrepo)
- Place the
remove_notifications.cjsscript in a directory of your choice. These instructions use/opt/node/as an example. - Add the following function to your
~/.bashrcor equivalent shell configuration file:
RemoveNotifications() {
SINCE="${*:-yesterday}"
FORMATTED_DATE=$(date --utc --date "${SINCE}" "+%Y-%m-%dT00:00:00Z")
MESSAGE=$(date --utc --date "${FORMATTED_DATE}" "+%Y-%m-%d")
echo "Removing all phantom notifications since ${MESSAGE}"
node /opt/node/remove_notifications.cjs "${FORMATTED_DATE}"
}- If you placed the script somewhere other than node, update the path in the function accordingly
- Reload your shell configuration with
source ~/.bashrcor open a new terminal session
RemoveNotifications [date_expression]date_expression: Optional. Any date string understood by thedatecommand (defaults to "yesterday" if omitted)
# Remove phantom notifications since yesterday
RemoveNotifications
# Remove phantom notifications since 7 days ago
RemoveNotifications 7 days ago
# Remove phantom notifications since a specific date
RemoveNotifications 2025-09-01$ RemoveNotifications
Removing all phantom notifications since 2025-09-22
Processing repository "gitcoiindao/orgs" (https://api.github.com/notifications/threads/XXXXXXXXXXX)
Marking notification read
Marking notification done
Unsubscribing from repo
Done
I ran into this issue as well; here's a similar option: https://github.com/orgs/community/discussions/174310#discussioncomment-14514685