Remove default Vestige Stop hooks from v2.1.0

This commit is contained in:
Sam Valladares 2026-05-01 05:02:31 -05:00
parent 4f457ec2db
commit cb7ee2dcb5
5 changed files with 52 additions and 29 deletions

View file

@ -19,7 +19,7 @@ for arg in "$@"; do
cat <<'EOF'
Usage: scripts/check-sandwich-prereqs.sh [--sanhedrin]
Without flags, checks the lightweight Cognitive Sandwich hooks.
Without flags, checks the default Cognitive Sandwich preflight hooks.
With --sanhedrin, also checks the optional OpenAI-compatible verifier endpoint.
EOF
exit 0
@ -76,10 +76,19 @@ fi
# Settings hook wiring
if [ -f "$HOME/.claude/settings.json" ] && \
jq -e '.hooks.UserPromptSubmit and .hooks.Stop' "$HOME/.claude/settings.json" >/dev/null 2>&1; then
ok "settings.json hooks block present"
jq -e '.hooks.UserPromptSubmit' "$HOME/.claude/settings.json" >/dev/null 2>&1; then
ok "settings.json UserPromptSubmit hooks present"
else
warn "settings.json missing hooks block — run: install-sandwich.sh"
warn "settings.json missing UserPromptSubmit hooks — run: install-sandwich.sh"
fi
if [ "$CHECK_SANHEDRIN" -eq 0 ]; then
if [ -f "$HOME/.claude/settings.json" ] && \
jq -e 'any(.hooks.Stop[]?.hooks[]?; ((.command? // "") | contains("/.claude/hooks/veto-detector.sh") or contains("/.claude/hooks/sanhedrin.sh") or contains("/.claude/hooks/synthesis-stop-validator.sh")))' "$HOME/.claude/settings.json" >/dev/null 2>&1; then
warn "Vestige Stop hooks are still wired; run: install-sandwich.sh --force"
else
ok "no Vestige Stop hooks wired by default"
fi
fi
if [ "$CHECK_SANHEDRIN" -eq 1 ]; then
@ -134,7 +143,7 @@ fi
echo
if [ $FAIL -eq 0 ]; then
echo " Ready. Lightweight Cognitive Sandwich hooks will fire on next Claude Code prompt."
echo " Ready. Default preflight hooks will fire on next Claude Code prompt; no Vestige Stop hooks are wired."
exit 0
else
echo " Fix the items above, then re-run."

View file

@ -11,7 +11,7 @@
# 1. Verifies required local tools
# 2. Stages ~/.claude/hooks/ and ~/.claude/agents/
# 3. Copies sanitized hooks + agents
# 4. Merges the lightweight hooks block into ~/.claude/settings.json
# 4. Merges the default UserPromptSubmit hooks into ~/.claude/settings.json
# 5. Optionally enables Sanhedrin and, only with --with-launchd on Apple Silicon,
# auto-starts mlx_lm.server with Qwen3.6-35B-A3B
@ -195,19 +195,42 @@ SETTINGS_FRAGMENT="$SCRIPT_DIR/hooks/settings.fragment.json"
if [ "$ENABLE_SANHEDRIN" -eq 1 ]; then
SETTINGS_FRAGMENT="$SCRIPT_DIR/hooks/settings.sanhedrin.fragment.json"
fi
jq -s '.[0] * .[1]' "$SETTINGS" "$SETTINGS_FRAGMENT" > "$TMP_MERGE"
jq -s --arg enable_sanhedrin "$ENABLE_SANHEDRIN" '
def is_vestige_stop:
(.command? // "") as $cmd
| ($cmd | contains("/.claude/hooks/veto-detector.sh"))
or ($cmd | contains("/.claude/hooks/sanhedrin.sh"))
or ($cmd | contains("/.claude/hooks/synthesis-stop-validator.sh"));
.[0] * .[1]
| if $enable_sanhedrin == "1" then
.
else
.hooks.Stop = (
(.hooks.Stop // [])
| map(.hooks = ((.hooks // []) | map(select((is_vestige_stop | not)))))
| map(select(((.hooks // []) | length) > 0))
)
| if ((.hooks.Stop // []) | length) == 0 then del(.hooks.Stop) else . end
end
' "$SETTINGS" "$SETTINGS_FRAGMENT" > "$TMP_MERGE"
mv "$TMP_MERGE" "$SETTINGS"
say "merged hooks block into $SETTINGS (backup at .bak.pre-sandwich)"
if [ "$ENABLE_SANHEDRIN" -eq 1 ]; then
say "merged hooks block into $SETTINGS with Sanhedrin Stop hook enabled (backup at .bak.pre-sandwich)"
else
say "merged default preflight hooks into $SETTINGS; no Vestige Stop hooks are installed (backup at .bak.pre-sandwich)"
fi
# --- Next steps ---
cat <<EOF
┌──────────────────────────────────────────────────────────────┐
│ Cognitive Sandwich hooks installed. │
│ Cognitive Sandwich preflight hooks installed. │
└──────────────────────────────────────────────────────────────┘
Next steps:
1. Restart Claude Code so it picks up the new hooks.
Default installs include no Vestige Stop hooks.
2. Verify the install:
vestige health # if vestige CLI installed
curl http://127.0.0.1:$DASHBOARD_PORT/api/health