cd /news/ai-agents/claude-code-slack-stop-hook-json · home › topics › ai-agents › article
[ARTICLE · art-151685] src=gist.github.com ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

claude-code-slack-stop-hook.json

A developer published a Claude Code hook that posts a Slack notification when an agent turn runs longer than two minutes, letting users step away from long runs and be pulled back when they finish. The hook uses UserPromptSubmit to stamp a turn's start time to /tmp and a Stop hook to read it back, firing a Slack incoming webhook with a member mention when the elapsed time meets a configurable threshold (default 120 seconds). The Stop hook runs async so it adds no latency, and missing stamp files from /clear, resume, or compact cause it to exit quietly.

by read1 min views4 publishedOct 16, 2026

A Claude Code hook that posts to Slack when a turn takes longer than two minutes, so you can walk away from long agent runs and get pulled back when they're done.

  1. Save 1-notify-long-turn.sh to~/.claude/hooks/notify-long-turn.sh , thenchmod +x it.
  2. Create a Slack incoming webhook and export the URL asSLACK_WEBHOOK_URL .
  3. Set MENTION in the script to your own Slack member ID (Slack profile -> More -> Copy member ID). Without the mention the message is silent -- the mention is what makes Slack actually notify you.
  4. Merge 2-settings-snippet.json into~/.claude/settings.json , replacing the paths with absolute ones.settings.json does not expand$HOME .

Requires jq and curl.

UserPromptSubmit stamps the turn's start time to /tmp. Stop reads it back,

and if the turn ran >= THRESHOLD_SECS (default 120) it posts to the webhook. A missing stamp file means the Stop came from /clear, a resume, or a compact, so there's nothing to time and the hook exits quietly.

The Stop hook is async, so it never adds latency to your turn.

  • THRESHOLD_SECS -- raise it if you get pinged too often.
  • Stamp files are per-session in /tmp ; a session that dies without aStop leaves one behind. Harmless, butrm /tmp/claude-turn-start-* clears them.

The webhook call is fire-and-forget: output is discarded, so the hook reports success whether or not Slack accepted the post. Fine for a personal nudge, but don't debug Slack delivery by trusting that message.

── more in #ai-agents 4 stories · sorted by recency
── more on @claude code 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/claude-code-slack-st…] indexed:0 read:1min 2026-10-16 · —