vestige/hooks/synthesis-gate.sh
Sam Valladares 9936928be9
Some checks failed
CI / Test (macos-latest) (push) Has been cancelled
CI / Test (ubuntu-latest) (push) Has been cancelled
Test Suite / Unit Tests (push) Has been cancelled
Test Suite / MCP E2E Tests (push) Has been cancelled
Test Suite / Dashboard Build (push) Has been cancelled
Test Suite / Code Coverage (push) Has been cancelled
CI / Release Build (aarch64-apple-darwin) (push) Has been cancelled
CI / Release Build (x86_64-unknown-linux-gnu) (push) Has been cancelled
CI / Release Build (x86_64-apple-darwin) (push) Has been cancelled
Test Suite / User Journey Tests (push) Has been cancelled
v2.1.2 Honest Memory
Concrete search, irreversible purge, first-class contradictions tool, vestige update CLI, dense dream persistence fix, embedding-model upgrade repair, and a /dashboard/waitlist Pro early-access preview.

25 MCP tools. SQLite migration v13. Backwards compatible: 'delete' remains as a 'purge' alias.

Closes #50, #51.
2026-05-06 02:22:24 -05:00

39 lines
1.7 KiB
Bash
Executable file

#!/bin/bash
# synthesis-gate.sh — optional UserPromptSubmit hook
#
# Injects a compact synthesis contract for decision-adjacent prompts. The hook
# is intentionally generic and public-safe: it does not depend on private local
# files, personal examples, or hidden project notes.
set -euo pipefail
INPUT="$(cat)"
PROMPT="$(printf '%s' "$INPUT" | /usr/bin/python3 -c 'import sys,json;d=json.load(sys.stdin);print(d.get("prompt","") or d.get("user_prompt",""))' 2>/dev/null || printf '')"
DECISION_REGEX='(submit|submission|final|ship|launch|deploy|commit|decide|decision|recommend|should i|what should|purchase|buy|invest|architect|architecture|strategy|prep|prioriti|compose|tradeoff|trade-off|config|which (should|model|approach|one)|pick|choose|benchmark|competition|perform)'
if printf '%s' "$PROMPT" | /usr/bin/grep -qiE "$DECISION_REGEX"; then
/usr/bin/python3 <<'PYEOF'
import json
msg = (
"[VESTIGE SYNTHESIS GATE]\n\n"
"This prompt appears decision-adjacent. If Vestige is available and relevant, use the smallest retrieval plan that can change the answer.\n\n"
"Reasoning contract:\n"
"1. Retrieve evidence from adjacent topics, not only the exact topic.\n"
"2. Convert each useful memory into: fact -> implication -> action.\n"
"3. Surface contradictions or stale memories before recommending.\n"
"4. Do not list memory summaries as the final answer. Compose them into a concrete recommendation.\n"
"5. If no memory materially changes the answer, say so briefly and proceed from source evidence."
)
print(json.dumps({
"hookSpecificOutput": {
"hookEventName": "UserPromptSubmit",
"additionalContext": msg
}
}))
PYEOF
fi
exit 0