#!/bin/bash input=$(cat) transcript_path=$(echo "$input" | jq -r '.transcript_path') if [[ -z "$transcript_path" || "$transcript_path" == "null" || ! -f "$transcript_path" ]]; then echo '{"continue": false}' exit 0 fi recent=$(tail -30 "$transcript_path") hooks_dir="$(dirname "$0")" # Plan task → review plan if echo "$recent" | grep -qiE "(## Plan|Plan for|plan mode|EnterPlanMode|ExitPlanMode|implementation plan)"; then exec "$hooks_dir/review-plan.sh" "$transcript_path" fi # Coding task → ensure tested exec "$hooks_dir/ensure-work-was-tested.sh" "$transcript_path"