#!/bin/bash
# PostUserPromptSubmit hook - capture important user requests

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"

cd "$PROJECT_ROOT"

PROMPT="${CLAUDE_USER_PROMPT:-}"

# Only capture substantial prompts (not just short queries)
if [ -n "$PROMPT" ] && [ ${#PROMPT} -gt 30 ]; then
  npx tsx src/index.ts cli remember --content "User request: ${PROMPT}" --scope session --type pattern --importance 5 2>/dev/null || true
fi

exit 0