Have you ever left Claude Code to chew on a hard task, only to learn it stopped 1s after you were out?
Giving Claude Code full access to your computer is not the wisest decision, so the next safest alternative is actually deciding on permission queries that need your attention.
So, assuming you took the safest route, as I did, there is a way to not lose queries from Claude code when you are away from your desk, and I explain it here.
Please note the Roadmap, where I will add a way to make decisions on the go too.**
How to tackle the problem
We will use an open-source app called ntfy that sends custom notifications directly to your mobile. It can be installed on your iOS or Android mobile and you can use it for free.***
Option 1 - Quick-win
Use ntfy claude, as opposed to self-hosted, without a de-bouncer
NTFY Setup
- Sign-up at ntfy app
- Sign-in and access your dashboard
- Click
Subscribe to topic
- Click
GENERATE NAME* ->SUBSCRIBEand take note of the topic
- Click on your avatar at the top -> Click your username
- At
Access tokensclickCreate access token, choose a name (e.g. claude-code), clickCREATE TOKENand take note of the created token (it is always available at the user settings).
- Download NTFY app to your mobile and enable notifications
- Sign-in to your ntfy account in the app (make sure you are subscribed to topic created on 4.)
Claude Code Setup
- Edit
~/.claude/settings.json(create if needed) to have it as below
{
"hooks": {
"PermissionRequest": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "curl -H 'Authorization: Bearer <your-token-from-step-6-above>' -v -L -d 'Claude Code is requesting your input to move on' ntfy.sh/<topic-ntfy-step-4>"
}
]
}
],
"Stop": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "curl -H 'Authorization: Bearer <your-token-from-step-6-above>' -v -L -d 'Claude Code has finished working' ntfy.sh/<your-topic-name-from-step-4>"
}
]
}
]
}
}
Start a new claude session and enjoy!
Option 2: de-bouncing add-on
To avoid multiple notifications at the same time we can add a de-bouncer.
- Create the de-bouncer script at the path
~/.claude/scripts/ntfy-debouncer.shbelow
#!/usr/bin/env bash
set -euo pipefail
NTFY_SERVER_URL="ntfy.sh"
NTFY_TOPIC="<your-topic-name-from-step-4>"
LOGFILE="/tmp/ntfy-hook.log"
TOKEN="<your-token-from-step-6-above>"
exec >>"$LOGFILE" 2>&1
LOCKFILE="/tmp/claude-notify-last"
COOLDOWN=30
if [[ -f "$LOCKFILE" ]]; then
LAST="$(cat "$LOCKFILE")"
NOW="$(date +%s)"
if (( NOW - LAST < COOLDOWN )); then
exit 0
fi
fi
date +%s >"$LOCKFILE"
MSG="${1:-}"
[[ -n "$MSG" ]] || exit 2
curl -v \
-H "Authorization: Bearer ${TOKEN}" \
-L \
-d "$MSG" \
"https://${NTFY_SERVER_URL}/${NTFY_TOPIC}"
- Chmod the script
chmod +x .claude/scripts/ntfy-debouncer.sh
- Update
~/.claude/settings.jsonto use it
{
"hooks": {
"PermissionRequest": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "$HOME/.claude/scripts/ntfy-debouncer.sh 'Claude Code is requesting your input to move on'"
}
]
}
],
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "$HOME/.claude/scripts/ntfy-debouncer.sh 'Claude Code has finished working'"
}
]
}
]
}
}
Option 3: token security
- Create a keychain entry on your terminal
security add-generic-password -a "$USER" -s "ntfy.sh" -w "<your-token-from-step-6-above>" -U
- at
~/.claude/scripts/ntfy-debouncer.shpaste
#!/usr/bin/env bash
set -euo pipefail
NTFY_SERVER_URL="ntfy.sh"
NTFY_TOPIC="<your-topic-name-from-step-4>"
LOGFILE="/tmp/ntfy-hook.log"
exec >>"$LOGFILE" 2>&1
LOCKFILE="/tmp/claude-notify-last"
COOLDOWN=30
if [[ -f "$LOCKFILE" ]]; then
LAST="$(cat "$LOCKFILE")"
NOW="$(date +%s)"
if (( NOW - LAST < COOLDOWN )); then
exit 0
fi
fi
date +%s >"$LOCKFILE"
MSG="${1:-}"
[[ -n "$MSG" ]] || exit 2
# Storing the token
# security add-generic-password -a "$USER" -s "ntfy.sh" -w "tk_XXX" -U
TOKEN="$(security find-generic-password -a "$USER" -s "$NTFY_SERVER_URL" -w 2>/dev/null || true)"
if [[ -z "${TOKEN}" ]]; then
echo "ERROR: token not found in Keychain (service: ntfy.israelsaba.com.br, account: $USER)" >&2
exit 3
fi
curl -v \
-H "Authorization: Bearer ${TOKEN}" \
-L \
-d "$MSG" \
"https://${NTFY_SERVER_URL}/${NTFY_TOPIC}"
Roadmap
Other things I'd like to explore/write about regarding this. Let me know what you would like first. Do let me know your thoughts and any extra tips.
[X] Explore a more secure option using MacOS secrets to store the NTFY token
[ ] Write about my self-hosted instance of ntfy and how I connect it here
[ ] Explore using the "Notification" hook on Claude Code
reference docs: Claude Code hooks, NTFY
*It is important to generate a random topic name as this is a public platform. If you name it claude-code for instance, anyone who has done the same will be able to push notifications to your ntfy. That can be solved by running a self-hosted instance.
**Do check this NetworkChuck's video on the matter. It solves the same problem with n8n and Slack, and it even includes a way to answer the prompt on the go.
***Tutorial made using MacOS as base. Although shell script shebang is designed for maximum compatibility.






Top comments (7)
For the roadmap, Iβd love a secure token setup next, like pulling the bearer token from keychain/secret store instead of hardcoding it. Also maybe add a tiny payload with what permission itβs asking for, so you donβt have to tab back in just to see the prompt.
Great! I will do it and comment back here to let you know.
Added as option 3 there
Fine
That is awesome! Appreciate the time to write something practical to get the notifications!
Sure! Glad you enjoyed!
Awesome way to improve coding skills ππ»ππ»ππ»