diff --git a/scripts/hooks/run-with-flags-shell.sh b/scripts/hooks/run-with-flags-shell.sh index 4b064c32..227b8fc7 100755 --- a/scripts/hooks/run-with-flags-shell.sh +++ b/scripts/hooks/run-with-flags-shell.sh @@ -29,4 +29,8 @@ if [[ ! -f "$SCRIPT_PATH" ]]; then exit 0 fi -printf '%s' "$INPUT" | "$SCRIPT_PATH" +# Extract phase prefix from hook ID (e.g., "pre:observe" -> "pre", "post:observe" -> "post") +# This is needed by scripts like observe.sh that behave differently for PreToolUse vs PostToolUse +HOOK_PHASE="${HOOK_ID%%:*}" + +printf '%s' "$INPUT" | "$SCRIPT_PATH" "$HOOK_PHASE"