Skip to content

fix(plugins): make stop hook summary model configurable#524

Open
lemon-li wants to merge 1 commit intozilliztech:mainfrom
lemon-li:fix/configurable-summary-model
Open

fix(plugins): make stop hook summary model configurable#524
lemon-li wants to merge 1 commit intozilliztech:mainfrom
lemon-li:fix/configurable-summary-model

Conversation

@lemon-li
Copy link
Copy Markdown

@lemon-li lemon-li commented May 2, 2026

Summary

  • 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

Why

Users in regions with restricted Claude API access often configure ANTHROPIC_BASE_URL to route through a proxy, and may need to use a different model instead of haiku. The hardcoded haiku made this impossible — the only workaround was to edit the hook script locally, which is fragile across updates.

The [llm] config section already exists for compact.py summarization. Using it here is consistent and requires no new config surface.

Usage

Set the model in ~/.memsearch/config.toml:

[llm]
model = "glm-5.1"

Or via CLI: memsearch config set llm.model glm-5.1

Unset = haiku (no behavior change for existing users).

Test plan

  • Verified diff is minimal (8 insertions, 1 deletion)
  • Change is shell-only, no Python lint/test impact
  • Manual: set llm.model to a non-haiku value, verify stop.sh uses it → outputs configured model name
  • Manual: leave llm.model unset, verify fallback to haiku works → outputs haiku

🤖 Generated with Claude Code

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 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant