From cb7ee2dcb57a1f7478631a08f806b14dadf35f5e Mon Sep 17 00:00:00 2001 From: Sam Valladares Date: Fri, 1 May 2026 05:02:31 -0500 Subject: [PATCH] Remove default Vestige Stop hooks from v2.1.0 --- CHANGELOG.md | 6 +++--- docs/COGNITIVE_SANDWICH.md | 17 ++++++++--------- hooks/settings.fragment.json | 8 -------- scripts/check-sandwich-prereqs.sh | 19 ++++++++++++++----- scripts/install-sandwich.sh | 31 +++++++++++++++++++++++++++---- 5 files changed, 52 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 33145d6..d9ed241 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 The Sanhedrin Executioner — Vestige's veto layer for Claude Code responses — can run against a local MLX model (`mlx-community/Qwen3.6-35B-A3B-4bit`) when explicitly enabled. Combined with four pre-cognitive UserPromptSubmit hooks (synthesis-preflight, cwd-state-injector, vestige-pulse-daemon, preflight-swarm), Vestige now ships a complete "Cognitive Sandwich" — Vestige memories injected before the model thinks, optional Sanhedrin veto after the model speaks. -> 2026-05-01 hotfix: Sanhedrin is optional by default. The default installer no longer wires the Sanhedrin Stop hook, no longer starts MLX, and removes the old v2.1.0 MLX launchd job on reinstall. Users who want Sanhedrin can opt in with `--enable-sanhedrin`; Apple Silicon local MLX autostart is a separate `--with-launchd` flag, and x86 users can point `--sanhedrin-endpoint` at any OpenAI-compatible `/v1/chat/completions` endpoint. +> 2026-05-01 hotfix: Sanhedrin and all Vestige Stop hooks are optional by default. The default installer wires UserPromptSubmit preflight hooks only, removes old Vestige Stop hooks from previous v2.1.0 installs, no longer starts MLX, and removes the old v2.1.0 MLX launchd job on reinstall. Users who want Sanhedrin can opt in with `--enable-sanhedrin`; Apple Silicon local MLX autostart is a separate `--with-launchd` flag, and x86 users can point `--sanhedrin-endpoint` at any OpenAI-compatible `/v1/chat/completions` endpoint. ### Added @@ -23,7 +23,7 @@ The Sanhedrin Executioner — Vestige's veto layer for Claude Code responses — - `synthesis-stop-validator.sh` — Stop hook regex against forbidden hedging patterns. - `veto-detector.sh` — fast 50ms regex pre-screen against `veto`-tagged Vestige memories. - `synthesis-gate.sh` — legacy v1 trigger (kept for backward compat). - - `settings.fragment.json` — lightweight JSON snippet merged into `~/.claude/settings.json` by the default installer. + - `settings.fragment.json` — default UserPromptSubmit-only JSON snippet merged into `~/.claude/settings.json` by the installer. - `settings.sanhedrin.fragment.json` — opt-in JSON snippet used only with `--enable-sanhedrin`. - **Dashboard `/api/changelog` endpoint** — bounded REST event feed for recent `DreamCompleted` and `ConnectionDiscovered` events, used by the Pulse hook to inject fresh synthesis into Claude Code context. - **`agents/`** — `executioner.md` (legacy/fallback Haiku 4.5 path), `lateral-thinker.md`, `synthesis-composer.md`. @@ -35,7 +35,7 @@ The Sanhedrin Executioner — Vestige's veto layer for Claude Code responses — ### Changed -- **Sanhedrin is optional by default.** Default installs run on x86 and low-memory machines without downloading or starting the 19 GB MLX model. Reinstalling the default v2.1.0 hotfix removes the old mandatory `com.vestige.mlx-server` launchd job if it exists. +- **Sanhedrin and all Vestige Stop hooks are optional by default.** Default installs run on x86 and low-memory machines without wiring any Vestige Stop hook, downloading the 19 GB MLX model, or starting MLX. Reinstalling the default v2.1.0 hotfix removes the old Vestige Stop hooks and the old mandatory `com.vestige.mlx-server` launchd job if they exist. - **Sanhedrin Executioner backend swapped from Anthropic Haiku 4.5 → OpenAI-compatible endpoint, with local `mlx_lm.server` + Qwen3.6-35B-A3B-4bit as the Apple Silicon opt-in path.** Anthropic API key no longer required for the post-cognitive layer. The `executioner.md` agent definition is retained as manual/fallback only when invoked explicitly via `Task(subagent_type='executioner')`. - **All hooks sanitized for public release** — replaced hardcoded personal absolute paths with `$HOME` / `$VESTIGE_*` env vars; removed personal regex tokens. - **NPM binary installer now follows package version** — `vestige-mcp-server@2.1.0` downloads release assets from `v2.1.0` instead of a stale hardcoded binary tag, while local workspace installs skip the release-asset download before the tag exists. diff --git a/docs/COGNITIVE_SANDWICH.md b/docs/COGNITIVE_SANDWICH.md index 9463627..1f74fb8 100644 --- a/docs/COGNITIVE_SANDWICH.md +++ b/docs/COGNITIVE_SANDWICH.md @@ -2,7 +2,7 @@ **Vestige's defense-in-depth safety architecture for Claude Code.** -The Cognitive Sandwich wraps every Claude Code response in two layers of cognitive scaffolding: +The default Cognitive Sandwich installs the preflight layer only. The Stop-hook layer is explicit opt-in: ``` ┌────────────────────────────────────────────────┐ @@ -15,14 +15,13 @@ The Cognitive Sandwich wraps every Claude Code response in two layers of cogniti ├────────────────────────────────────────────────┤ │ 🥩 MEAT — Claude Code reasons │ ├────────────────────────────────────────────────┤ -│ 🥪 BOTTOM BREAD — Stop hooks │ -│ • Veto-detector (fast 50ms regex pre-screen) │ -│ • Sanhedrin Executioner (optional verifier) │ -│ • Synthesis stop validator (hedge detector) │ +│ 🥪 OPTIONAL BOTTOM BREAD — Stop hooks │ +│ • Veto-detector / synthesis validator │ +│ • Sanhedrin Executioner verifier │ └────────────────────────────────────────────────┘ ``` -Sanhedrin is optional. The default installer wires the lightweight preflight and stop hooks only; it does not start MLX, require a 19 GB model download, or require 20+ GB of RAM. Users who want the post-response semantic verifier can opt in and point it at any OpenAI-compatible `/v1/chat/completions` endpoint. On Apple Silicon, an additional `--with-launchd` flag can auto-start the local MLX Qwen backend. +Sanhedrin and all Vestige Stop hooks are optional. The default installer wires UserPromptSubmit preflight hooks only; it does not install any Vestige Stop hook, start MLX, require a 19 GB model download, or require 20+ GB of RAM. Users who want the post-response verifier can opt in and point it at any OpenAI-compatible `/v1/chat/completions` endpoint. On Apple Silicon, an additional `--with-launchd` flag can auto-start the local MLX Qwen backend. --- @@ -36,7 +35,7 @@ Sanhedrin is optional. The default installer wires the lightweight preflight and - `vestige-pulse-daemon.sh` — injects fresh Vestige dream insights from the past 20 min into the next prompt context - `preflight-swarm.sh` — spawns the `lateral-thinker` subagent in fresh context to surface cross-disciplinary structural parallels 3. **Claude reads the assembled context and generates a draft.** -4. **Stop hooks fire serially** (any can VETO with `exit 2`, forcing a rewrite): +4. **By default, no Vestige Stop hooks are installed.** If explicitly enabled, Stop hooks fire serially (any can VETO with `exit 2`, forcing a rewrite): - `veto-detector.sh` — fast regex against `veto`-tagged Vestige memories (~50ms) - `sanhedrin.sh` → `sanhedrin-local.py` — optional single-shot semantic verdict - `synthesis-stop-validator.sh` — regex against forbidden patterns (hedging, summary-instead-of-composition) @@ -126,7 +125,7 @@ Optional Apple Silicon local Sanhedrin backend: 1. Verifies prereqs (warnings for missing tools, fatal only on jq/python3). 2. Copies hooks to `~/.claude/hooks/`, agents to `~/.claude/agents/`. -3. Backs up existing `~/.claude/settings.json` to `.bak.pre-sandwich`, then `jq`-merges the lightweight hooks block. +3. Backs up existing `~/.claude/settings.json` to `.bak.pre-sandwich`, then `jq`-merges the default UserPromptSubmit hooks block and removes old Vestige Stop hooks from previous v2.1.0 installs. 4. With `--enable-sanhedrin`, writes `~/.claude/hooks/vestige-sanhedrin.env` and merges a Sanhedrin-enabled hooks block. 5. With `--enable-sanhedrin --with-launchd` on Apple Silicon, renders and loads `launchd/com.vestige.mlx-server.plist.template`. @@ -180,7 +179,7 @@ Full architecture memory: search Vestige for `god-tier-plan` or `cognitive-sandw The base hook harness runs on x86. The launchd MLX helper is macOS-arm64-only. On Linux, Windows under WSL, or Intel Mac: -- Run `scripts/install-sandwich.sh` normally for lightweight hooks. +- Run `scripts/install-sandwich.sh` normally for default preflight hooks with no Vestige Stop hooks. - If you want Sanhedrin, run an OpenAI-compatible endpoint such as vLLM, Ollama, llama.cpp server, or a remote MLX/vLLM box. - Install with `--enable-sanhedrin --sanhedrin-endpoint= --sanhedrin-model=`. - If the endpoint is unreachable, Sanhedrin fails open and does not block Claude Code. diff --git a/hooks/settings.fragment.json b/hooks/settings.fragment.json index 3ff09a9..7a0d829 100644 --- a/hooks/settings.fragment.json +++ b/hooks/settings.fragment.json @@ -9,14 +9,6 @@ { "type": "command", "command": "$HOME/.claude/hooks/preflight-swarm.sh", "timeout": 45 } ] } - ], - "Stop": [ - { - "hooks": [ - { "type": "command", "command": "$HOME/.claude/hooks/veto-detector.sh", "timeout": 6 }, - { "type": "command", "command": "$HOME/.claude/hooks/synthesis-stop-validator.sh", "timeout": 6 } - ] - } ] } } diff --git a/scripts/check-sandwich-prereqs.sh b/scripts/check-sandwich-prereqs.sh index 80a0b79..1e5f4b7 100755 --- a/scripts/check-sandwich-prereqs.sh +++ b/scripts/check-sandwich-prereqs.sh @@ -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." diff --git a/scripts/install-sandwich.sh b/scripts/install-sandwich.sh index 89fec30..4f1a331 100755 --- a/scripts/install-sandwich.sh +++ b/scripts/install-sandwich.sh @@ -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 <