diff --git a/hooks/ways/check-bash-pre.sh b/hooks/ways/check-bash-pre.sh index 8c75c3b..2fc4b50 100755 --- a/hooks/ways/check-bash-pre.sh +++ b/hooks/ways/check-bash-pre.sh @@ -4,26 +4,16 @@ # The ways binary handles: command pattern matching, semantic scoring, # check curve scoring, session state, and content output. # -# The command is truncated to its semantic prefix before being passed to -# `ways scan command`. Heredoc bodies (`gh pr create --body "$(cat < # blobs from completed background agents, pointers # for tool results that exceed inline budget, and other system-reminder -# envelopes. Any of those can run multiple KB, and embedding that -# overruns the MiniLM model's position-embedding table (SIGABRT in -# ggml_compute_forward_get_rows). Cap the embed query at 1024 chars -# (~240 tokens — generous because real user prompts can legitimately -# be paragraphs of context, unlike bash commands). Anything past 1024 -# in a prompt is system-injected envelope content that carries no -# additional signal for matching the user's *intent* against ways. +# envelopes. Size bounding for the embed query is the ways binary's +# responsibility (ADR-130 sentence-salience reducer in scan/reduce.rs). +# This script passes the full combined prompt+topics through so the +# reducer can score sentence salience across the whole input. source "$(dirname "$0")/require-ways.sh" -readonly PROMPT_QUERY_MAX=1024 - INPUT=$(cat) PROMPT=$(echo "$INPUT" | jq -r '.prompt // empty' | tr '[:upper:]' '[:lower:]') SESSION_ID=$(echo "$INPUT" | jq -r '.session_id // empty') @@ -37,11 +32,8 @@ if [[ -f "$RESPONSE_STATE" ]]; then RESPONSE_TOPICS=$(jq -r '.topics // empty' "$RESPONSE_STATE" 2>/dev/null) fi -# Combined context: user prompt + Claude's recent topics, capped. -# RESPONSE_TOPICS is bounded by check-response.sh's extraction (~50 chars -# of keywords) so the cap is effectively a guard on PROMPT itself. +# Combined context: user prompt + Claude's recent topics. COMBINED="${PROMPT} ${RESPONSE_TOPICS}" -COMBINED="${COMBINED:0:$PROMPT_QUERY_MAX}" export CLAUDE_PROJECT_DIR="${PROJECT_DIR}" "${HOME}/.claude/bin/ways" scan prompt \