dsh-prewalk
jupiterwalker/dsh-prewalk
新增一个 agent preset:每个 turn 的第一步用强模型做推理并把计划立起来,之后的步骤交给弱模型执行;两个模型可在设置页从模型目录里挑,Prewalk 会话的输入区还会多出「强 / 弱」两个紧凑下拉。
安装
dsh plugin --profile web add github:jupiterwalker/dsh-prewalkREADME
dsh-prewalk
Prewalk mode for DeepSeek Harness: the first step of every turn runs on your strong model to reason and make the plan, and the following steps continue on the weak model.
中文
给 DeepSeek Harness(DSH)加一个 agent preset「Prewalk 模式」:每个 turn 的第一步用强模型做推理、打样、把计划立起来,之后的步骤交给弱模型照着做。花一份强模型的推理,省掉后面所有步骤的贵 token。
它解决什么
一个 turn 里最贵也最关键的往往只有第一步——读懂需求、想清楚怎么做、把第一刀切准。后面多数步骤是执行:改文件、跑命令、贴结果。dsh-prewalk 让这两段走不同的模型,而不需要你手动切换。
功能
- Prewalk 模式(agent preset):在会话的 preset 里选「Prewalk 模式」,之后每个 turn 自动按 强 → 弱 分工;其它模式的会话完全不受影响。
- 设置页:Settings → Prewalk,两个下拉分别选「强模型(第一步)」与「弱模型(后续步骤)」,可预览、保存或放弃修改。
- 输入区下拉:处于 Prewalk 模式的会话,在输入区模型选择器左侧多出「强 / 弱」两个紧凑下拉,改动即写回同一份配置,与设置页共用一个事实源;非 Prewalk 会话不显示、不占位。
- 中英文:界面跟随宿主语言切换(内置 en / zh 词典)。
安装
用 DSH 自带的插件管理安装本目录(绝对路径),随后刷新 Web 页面:
# 在 DSH 会话里执行
plugin_manager action=install_bundle target=/绝对路径/dsh-prewalk
装好后在会话的 preset 选择器里挑「Prewalk 模式」,再去 Settings → Prewalk 选好强/弱两个模型即可。依赖 @deepseek-ai/schemastery 从公共 npm 解析,无需额外配置。
它怎么工作
- 每个 turn 的第一步由强模型跑:在 driver 起跑(
agent/status变 running)与 turn 收尾(agent/turn-stopping)两个时机把路由切回强模型。 - 强模型的这一步结束时(
agent/pre-step),在路由已被固定的前提下把下一步切回弱模型。 - 路由切换只走
agent.model.select({ provider, model })这一条合法入口;两个模型任一未填时不做任何切换,会话按宿主默认路由运行。 - 配置是用户级(profile)的 volatile 字段:
strongProvider/strongModel/weakProvider/weakModel。
边界
- 只对本插件的 preset 生效:
presetForSession(session) === 'prewalk',其它 preset 的会话不受影响。 - 两步之间必须是「同一 turn」的前后 step;如果强模型那一步自己结束了 turn,下一个 turn 的第一步仍会走强模型。
- 依赖宿主版本的路由时机(
agent/status、agent/turn-stopping、agent/pre-step);宿主升级后如行为变化,需要跟着适配。
开发
node --check index.js # 宿主侧语法检查
node --check client.js # 浏览器侧语法检查
发布
npm pack # 产出 local-dsh-prewalk-<版本>.tgz
mkdir -p dist && cp local-dsh-prewalk-<版本>.tgz dist/dsh-prewalk.tgz
gh release create v<版本> local-dsh-prewalk-<版本>.tgz dist/dsh-prewalk.tgz
dist/dsh-prewalk.tgz 这个名字是刻意的:插件市场条目指向 releases/latest/download/dsh-prewalk.tgz,所以每次发版都要附上这个同名资产,市场会自动跟到最新版,不必再提市场 PR。
目录结构:
index.js 宿主侧插件(按 turn/step 切换模型)
client.js 浏览器侧插件(设置页 + 输入区下拉)
cordis.patch.yml 插件组成(insert @local/dsh-prewalk 与 prewalk preset)
icon.svg 插件图标
locale/en.json 设置页展示用的英文标题与说明
locale/zh.json 设置页展示用的中文标题与说明
assets/ README 与插件市场用的图标
许可
未声明许可证;如需复用请先联系作者。
English
A DeepSeek Harness (DSH) agent preset called Prewalk mode: the first step of every turn runs on your strong model to reason and lay down the plan, and the following steps continue on the weak model. You pay for strong reasoning once per turn instead of on every step.
Why
The expensive, load-bearing part of a turn is usually its first step — reading the request, deciding the approach, taking the first accurate cut. The rest is execution: edit a file, run a command, paste the result. dsh-prewalk splits those two phases across two models, without you switching models by hand.
Features
- Prewalk mode (agent preset): pick "Prewalk mode" as the session preset and every turn then runs strong → weak automatically; sessions in other presets are untouched.
- Settings page: Settings → Prewalk with two dropdowns — strong model (first step) and weak model (later steps) — plus preview, save and discard.
- Composer dropdowns: in a Prewalk session, two compact strong / weak dropdowns appear just left of the host's model picker; a change is written back to the same profile config the settings page uses, and they are absent (taking no space) in every other preset.
- Locales: follows the host language (built-in en / zh dictionaries).
Install
Install this directory (absolute path) with DSH's plugin manager, then reload the Web UI:
# inside a DSH session
plugin_manager action=install_bundle target=/absolute/path/dsh-prewalk
Then pick "Prewalk mode" in the session preset selector and choose the two models under Settings → Prewalk. The @deepseek-ai/schemastery dependency resolves from public npm, so nothing else needs configuring.
How it works
- The first step of a turn runs on the strong model: the route is switched back at driver start (
agent/statusturning running) and at turn teardown (agent/turn-stopping). - When that first step finishes (
agent/pre-step), the route for the following step is handed back to the weak model. - Routing goes through the one supported entry point,
agent.model.select({ provider, model }); if either side is unset, nothing is switched and the session keeps the host's default route. - The configuration lives in four user-level (profile) volatile fields:
strongProvider,strongModel,weakProvider,weakModel.
Boundaries
- Only this plugin's preset is affected:
presetForSession(session) === 'prewalk'. Other presets keep their own routing. - The two phases are steps within one turn; if the strong step ends the turn itself, the next turn's first step still starts on the strong model.
- It depends on host routing timings (
agent/status,agent/turn-stopping,agent/pre-step); a host upgrade that changes them needs a follow-up adaptation.
Development
node --check index.js # host half syntax check
node --check client.js # browser half syntax check
Releasing
npm pack # writes local-dsh-prewalk-<version>.tgz
mkdir -p dist && cp local-dsh-prewalk-<version>.tgz dist/dsh-prewalk.tgz
gh release create v<version> local-dsh-prewalk-<version>.tgz dist/dsh-prewalk.tgz
That stable dist/dsh-prewalk.tgz name is deliberate: the marketplace entry points at releases/latest/download/dsh-prewalk.tgz, so each release just needs to attach that same-named asset and the entry follows the newest version without another marketplace pull request.
Layout:
index.js host half (per turn/step model routing)
client.js browser half (settings page + composer dropdowns)
cordis.patch.yml composition (inserts @local/dsh-prewalk and the prewalk preset)
icon.svg plugin icon
locale/en.json English title and description for the settings page
locale/zh.json Chinese title and description for the settings page
assets/ icon used by the README and the marketplace
License
No license declared; contact the author before reuse.