From c3574124f3ab696df23747fb077e84a62ee08923 Mon Sep 17 00:00:00 2001 From: lile2 Date: Sat, 2 May 2026 15:10:34 +0800 Subject: [PATCH] fix(plugins): make stop hook summary model configurable via [llm] config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The stop hook hardcoded `--model haiku` when calling `claude -p` for session summarization. This breaks for users who cannot directly access Claude API endpoints (e.g. users in China behind proxies using ANTHROPIC_BASE_URL to route to alternative models). The project already has a [llm] config section used by compact.py, but stop.sh ignored it. Now reads model from [llm].model config, falling back to haiku when unset — fully backwards compatible, no behavior change for existing users. Co-Authored-By: Claude Opus 4.7 --- plugins/claude-code/hooks/stop.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/claude-code/hooks/stop.sh b/plugins/claude-code/hooks/stop.sh index 2a7a0e0c..a39d3f16 100755 --- a/plugins/claude-code/hooks/stop.sh +++ b/plugins/claude-code/hooks/stop.sh @@ -99,10 +99,17 @@ fi # Summarize the last turn into structured bullet points. # Default: use claude -p (plugin's own agent). If [llm] is configured, still # use claude -p since it's the most reliable path for Claude Code plugin. +# Model priority: [llm].model config > haiku (default). +_SUMMARY_MODEL="" +if [ -n "$MEMSEARCH_CMD" ]; then + _SUMMARY_MODEL=$($MEMSEARCH_CMD config get llm.model 2>/dev/null || true) +fi +: "${_SUMMARY_MODEL:=haiku}" + SUMMARY="" if command -v claude &>/dev/null; then SUMMARY=$(printf '%s' "$PARSED" | MEMSEARCH_NO_WATCH=1 CLAUDECODE= claude -p \ - --model haiku \ + --model "$_SUMMARY_MODEL" \ --no-session-persistence \ --no-chrome \ --system-prompt "$SYSTEM_PROMPT" \