#12459: feat(session-memory): add model config for slug generation
stale
Cluster:
Model Configuration Enhancements
## Summary
Allow users to specify a dedicated model for slug generation in the `session-memory` hook, avoiding the use of expensive primary models for trivial slug generation.
## Changes
- **`src/hooks/llm-slug-generator.ts`**: Accept optional `model` parameter and pass it to `runEmbeddedPiAgent`
- **`src/hooks/bundled/session-memory/handler.ts`**: Read `model` from hook config and forward to `generateSlugViaLLM`
- **`src/hooks/bundled/session-memory/HOOK.md`**: Document the new `model` config option
## Configuration
```json
{
"hooks": {
"internal": {
"entries": {
"session-memory": {
"model": "google/gemini-3-flash"
}
}
}
}
}
```
When not specified, the default primary model is used (backward compatible).
## Motivation
The slug generation prompt is trivial ("generate a 1-2 word filename slug") — any small model handles it well. Users with expensive primary models (Opus, GPT-4) are currently spending premium tokens on this.
Closes #12458
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR adds an optional `model` override to the bundled `session-memory` hook so slug generation can run on a cheaper model than the primary/default. The hook handler reads `model` from `hooks.internal.entries["session-memory"]` config, forwards it into `generateSlugViaLLM`, and `llm-slug-generator` passes it through to `runEmbeddedPiAgent`. Documentation (`HOOK.md`) is updated to describe the new config option and show an example.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk.
- Changes are small and localized: a new optional config field is plumbed through to an existing agent runner parameter, with sane defaulting when omitted. I verified `runEmbeddedPiAgent` already supports a `model` parameter and defaults are preserved, and no other behavior is changed beyond selecting the model used for slug generation.
- No files require special attention
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#4793: hooks: use configured model for slug generator
by yoyooyooo · 2026-01-30
87.0%
#15574: fix(hooks): use configured model for llm slug generation (#15510)
by TsekaLuk · 2026-02-13
85.5%
#5945: fix: use configured model for slug generator (AI-assisted)
by HEDELKA · 2026-02-01
83.5%
#23286: fix: use configured model in llm-slug-generator instead of hardcoded …
by wsman · 2026-02-22
80.7%
#13401: fix: slug generator should use agent's primary model instead of har...
by pahud · 2026-02-10
80.4%
#9080: Fix: Use configured model for memory file slug generation
by vishaltandale00 · 2026-02-04
80.3%
#18867: fix: route slug generator LLM call through configured provider
by Celegormhenry · 2026-02-17
76.5%
#14647: feat(plugins): allow before_agent_start hook to override model (#14...
by lailoo · 2026-02-12
74.5%
#13376: fix: pass model directly to agent for sub-agent runs
by jrbobbyhansen-pixel · 2026-02-10
74.3%
#17614: feat: allow before_agent_start hook to override model selection
by plc · 2026-02-16
73.4%