dsh-router-standard README

The project's README from github.com/yjh051108/dsh-router-standard. As one markdown file: README.md.

dsh-router-standard

任务感知思维模式路由预设:把 DeepSeek V4 在 persona 轴上"非连续、分相变"的实测特性, 量化到稳定区(spec / react / weak),在首轮注入匹配的 persona 与工具面。 属于 dsh-routing-suite 套装,与 dsh-super-injector (免重启运行时注入)配合开发。

📄 研究史说明:docs/statement.md(勘误声明)| docs/apology.md(道歉函)


当前状态(v1.19.1,2026-08-24 · 研发线,尚未发布)

Router Standard 处于「严格 workflow」研发线(以 CHANGELOG 为准,版本线文件 router-bootstrap-v34.mjs):

配套预设:router-react(v17)/ router-spec(v10)(基于标准模式的两大执行预设,均支持首轮读图); router-pro 线已退役删除。完整演进:见 CHANGELOG.md 与 docs/STANDARD-PLAN.md。


【历史文档 · v0.3 时代】 Task-aware reasoning-mode router for DeepSeek Harness. One preset, two routing modes (v0.2.0 naming), plus the measured three-band axis behind them:

routing mode first request thinking shape
standard(标准路由预设) 分类 persona(spec/react/weak)+ 完整 prompt sections + 分带首轮工具面 按分类带行动:react 直接产出、spec 先读后改、weak 内路由(每轮近距离引导)
spec(spec 路由预设) 分类 persona(spec/react/weak)+ 完整 prompt sections 雷霆大思考:首轮超长思维链(101K 推理 0 行动是其特征,不是缺陷)

选择:安装两个预设之一(Router Standard / Router Spec,见 Usage)。 dev_router_status 显示当前路由模式。

This is a research artifact. It encodes a measured property of DeepSeek V4 Pro / V4 Flash: model behavior along the persona axis is not a continuum — it collapses into a few stable regions separated by phase transitions. The router therefore quantizes to the stable regions instead of pretending the axis is continuously tunable.

v0.3.0 — real-assembly-chain fixes

v0.2.x shipped routing logic that was validated against bare-API probes but was broken on the REAL DeepSeek Harness assembly chain. v0.3.0 fixes all of it, verified against @deepseek-ai/dsh-agent-loop (0.1.0-rc.7) event ordering:

What it does

router-standard: reads the session's first REAL user message, classifies the task (build → react / fix → spec / ambiguous → weak), and on the first model request injects the matching persona while keeping the full prompt sections; the first-turn core tool surface follows the band (spec=read/edit/glob/grep, react=read/write/edit, weak=read/write/edit, each plus the platform shell). Weak-band sessions also get a near-field routing guide in the SAME request as every real user message.

router-spec: same routing core with the deep-think-first branding; keeps the v0.2.0 dual-mode code path (routerMode), so a copy configured with routerMode: standard still gets the RL-interface first turn (RL sentence + shell/str_replace_editor) with full sections restored after the first durable tool/call.

After the first durable tool call the full Standard catalog is exposed and the router stops touching anything. The mode is derived from durable session events, so resume/reload keeps it. The plan-mode prompt section is preserved, so plan boundaries do not reset the model's focus.

The three measured behavior bands

Fine-grained probing (21 mode points × n=2, official API, reasoning_effort=max) on V4 Pro shows behavior along the persona axis collapses into three bands:

band mode measured behavior
spec 0 – 0.19 stable plan-collective (We trajectories, let-me ≈ 0)
mixed 0.2 – 0.49 transition trap: unstable mixing of We/The/Let
react 0.5 – 1.0 stable doer (The/Let first-person, we ≈ 0) — 11 mode values behave alike

V4 Flash is threshold-like (0–0.5 all spec side, jumps at 0.75+). The numeric dev_router_mode interface is kept, but it quantizes to the three bands — the transition band is never selected automatically.

Why: dual-attractor RL policy

Evidence across projects (see docs/paper.md and docs/experiments.md):

The model cannot self-route: P3 (same persona, task swap → trajectory unchanged), P5 (router personas → doer attractor absorbs the instruction) and P8 (domain-overlap scan) show the only internal-routing window is a WEAK persona + few-shot routing instruction (lean, not flip; discrimination +2.3..+3.3). There is no reward signal for switching modes mid session, and the behavior phase transition means the model commits on the first request. Mode selection must come from outside — a human (the "streamer"), a heuristic classifier, or a learned router. This preset is the automated version of that external routing.

Usage

Two presets (v0.3.0; the router-pro line was retired): install one or more under ~/.dsh/.agent-presets/:

# 标准路由预设(RL 接口还原,默认推荐)
$target = Join-Path $env:USERPROFILE '.dsh\.agent-presets\router-standard'
Copy-Item -Recurse .\preset\router-standard $target

# spec 路由预设(深度思考优先)
$target = Join-Path $env:USERPROFILE '.dsh\.agent-presets\router-spec'
Copy-Item -Recurse .\preset\router-spec $target

免重启安装(推荐):装好 dsh-super-injector 后(见套件 scripts/install-injector.ps1),改预设代码不再需要换文件名/重启:

dev_reload_preset router-standard   # 预设热更新:?v=N query 绕 ESM 缓存,新会话立即用新代码

注意事项(实测血泪):

  1. ESM 缓存:loader 按 URL 缓存模块——原地覆盖文件内容不生效(改代码必须 dev_reload_preset 或换文件名)。
  2. 首次会话必须新开:路由模式在首个请求锁定(路径承诺),中途切 GUI 模型/ 改配置不影响已运行会话。
  3. 子代理不路由:parentSession 会话跳过路由层(社区 #5 修复),shell-less 子代理不再崩溃。
  4. 引导注入通道(v0.3.0):近场引导走 agent/pre-step,每个真实用户消息 注入一条(weak 模式);rc.6 起 session/event 在 standing scope 收不到事件, 旧版本引导是死的。
  5. 首轮真实分类(issue #3/#13):首轮路由读 agent/inbox/claimed 的原始 消息文本并经 classifyTask 分类——首轮即真实 band(不再 weak 兜底)。
  6. 自举卸载:dev_uninject_plugin --self=true 可卸载注入器自身(保留 装配链,重启自动恢复)——用于验证安装闭环。

Restart DSH (or install via the suite script for zero-touch), start a new session, pick Router Standard (experimental) (RL-interface, think-act loops), Router Spec (experimental) (deep-think-first, the long first-turn chain is the point) or Router Pro (V4 Pro measured optimum).

One preset, auto-matched per model. There is no Pro/Flash split to configure: personaFor(mode, modelId) reads the session's model route and selects the measured optimum automatically — Pro → w6c (spec sentence + classify instruction, no anchors; 24/24 = 100% routing, P24), Flash → w7 + recall/anti-runaway anchors (96% routing; 100% single-task completion, P23). The model is fixed at the first request (path commitment), so the persona is locked for the session; switching the GUI model starts a new session with the matching configuration.

Depth-adaptive guidance (v20, thinking efficiency). Per-message guidance is dispatched by task complexity (isComplexTask: length or architecture keywords):

Tests

node --test router.test.mjs   # 11 tests: classification, bands, personas, plan-section survival

Files

Evidence & attribution

License

MIT. preset/agent.cordis.yml derives from the DeepSeek Harness Standard preset (MIT); original attribution in NOTICE.

dsh-router-standard (yjh051108/dsh-router-standard)

Searching Database…

349 ·GitHub
archived
Что это?Router Standard — это пресет-роутер режимов рассуждения, учитывающий задачу, для DeepSeek Harness: он классифицирует первое настоящее пользовательское сообщение сессии по диапазону персоны (spec / react / weak) и внедряет соответствующую персону и набор инструментов первого хода для моделей DeepSeek V4.
Это отдельное приложение или плагин для чего-то другого?Это плагин/пресет Cordis, который кладётся в папку пресетов DeepSeek Harness, а не отдельная программа; он работает в паре с сопутствующим плагином dsh-super-injector для горячей перезагрузки.
Как установить и активировать этот пресет?Скопируйте пресет в ~/.dsh/.agent-presets/ (или используйте скрипт install-injector из набора для установки без возни), перезапустите DSH, начните новую сессию и выберите Router Standard, Router Spec или Router Pro.
Что должно работать, чтобы это заработало?Нужна рабочая установка DeepSeek Harness (dsh) с Node >=22; если сначала установить сопутствующий плагин dsh-super-injector, можно править код пресета без переименования файлов и перезапусков.
Этот репозиторий ещё поддерживается?Нет — он заархивирован и хранит только историю; активная разработка переехала в единый репозиторий dsh-routing-suite, а режим маршрутизации фиксируется в самом первом запросе сессии, так что смена модели/конфигурации посреди сессии на него не влияет.
Он работает на Windows так же, как на Linux/macOS?Да — это обычный код на Node.js, работающий везде, где работает DeepSeek Harness, при этом Windows поддерживается через отдельную интеграцию с оболочкой Git Bash.
Что за три измеренных диапазона персоны?Прощупывание DeepSeek V4 по 21 режимной точке показало, что поведение сворачивается в три стабильных диапазона: spec (стабильный plan-first, 0-0.19), нестабильная смешанная переходная зона (0.2-0.49) и react (стабильный режим деятеля, 0.5-1.0) — роутер автоматически выбирает только один из двух стабильных диапазонов.
В чём разница между Router Standard и Router Spec?Router Standard классифицирует задачу и внедряет соответствующую персону, постепенно открывая каталог инструментов; Router Spec использует то же ядро маршрутизации, но всегда начинает с сверхдлинной цепочки рассуждения на первый ход (deep-think-first), прежде чем восстановить полный каталог после первого вызова инструмента.
Зачем автор это построил, вместо того чтобы позволить модели самой выбирать стиль?Тесты показали, что поведение DeepSeek V4 вдоль оси персоны не настраивается непрерывно — оно сворачивается в несколько стабильных областей с фазовыми переходами, — поэтому модель не может надёжно маршрутизировать себя посреди задачи, и этот пресет автоматизирует внешнюю классификацию, которую иначе пришлось бы делать человеку.
Можно переключить режим рассуждения посреди сессии?Напрямую нет — режим фиксируется на первом запросе (path commitment). Вместо этого используйте devmodesubagent, чтобы выполнить одну задачу в другом режиме внутри изолированного контекста субагента.
Creator
yjh051108
Size
0.9 MB
Stars
349
Age
2mo
Commits · 90 Days