#!/usr/bin/env bash
# spool UserPromptSubmit hook (managed by `spool mcp install`).
#
# Records a "user just submitted a prompt" timestamp so other hooks
# can correlate signals to a specific prompt. R2 only writes the
# marker; R3 may add lightweight keyword recall.
set -e

SPOOL_BIN="@@SPOOL_BIN@@"
SPOOL_CONFIG="@@SPOOL_CONFIG@@"
CWD="${CLAUDE_PROJECT_DIR:-$PWD}"

if [ ! -x "$SPOOL_BIN" ]; then
  exit 0
fi

"$SPOOL_BIN" hook user-prompt --config "$SPOOL_CONFIG" --cwd "$CWD" >/dev/null 2>&1 || true
exit 0
