#!/bin/sh # Stop hook: how long the last turn took (macOS / Linux). Video: "You're babysitting Claude Code" by Purrfect AI Labs. # Needs the UserPromptSubmit hook that writes the start time: date +%s > /tmp/turn_start t=$(( $(date +%s) - $(cat /tmp/turn_start) )) echo "$(date '+%F %T'),$t" >> ~/.claude/turns.csv # the ding only for turns longer than 30 s (macOS sound; on Linux use: paplay /usr/share/sounds/freedesktop/stereo/complete.oga &) [ "$t" -gt 30 ] && afplay /System/Library/Sounds/Glass.aiff & printf '{"systemMessage": "took %dm %ds"}' $((t/60)) $((t%60))