Repository navigation
DSH | dsh-model-pin | Keep every session and subagent on the models your machine can actually hold #5152
d3vmeh
started this conversation in
Show Your Plugins!
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Project URL:
https://github.com/d3vmeh/dsh-model-pin
npm:
https://www.npmjs.com/package/dsh-model-pin
Introduction
This one comes from #3199, where someone asked for a global single-model mode: their machine can only keep one local model loaded, but dsh lets every chat pick its own, and background helpers can request yet another one. Each stray request either fails or evicts the loaded model, which on local hardware means minutes of reloading and a lost prompt cache. zoahdev sketched the right approach in the replies: enforce it at the resolution layer, not the UI, and only switch at turn boundaries.
That's basically what dsh-model-pin does, generalized a little. Per provider you list the models your machine can serve. Every request gets resolved against that list at dsh's own
agent/requestwaterfall (its docs literally call returning a replacement "the sanctioned switch path"): allowed models pass, anything else is redirected to a fallback, or refused with a clear error if you prefer. A one-entry list is exactly the single-model mode from #3199.Two problems turned out to be fixed by the same mechanism:
There's also a llama.cpp-specific extra: a warning line whenever consecutive requests change model on a provider, because on a
--models-max 1router that means a full unload, reload, and a cold prompt cache.How it integrates with DSH
A host-side cordis plugin, one file, no UI, works headless. One waterfall listener for enforcement and one passthrough stream observer for the warning. It never rewrites persisted session data, and reject mode fails the turn with a readable message that dsh's retry cannot loop on (checked against the agent loop source). Tested end to end through dsh headless against a stub server that logs which model each request carries: redirected requests arrived as the fallback model, including dsh's own session-title call.
What you should know
MIT License. Feedback welcome, especially from anyone running a --models-max 1 router.
> Unofficial project, independently developed and maintained by community members.
All reactions