dsh-router-standard
Identified★ 347Merged into dsh-routing-suite (single-repository consolidation); this repository is a historical mirror/archive — the Attention Engineering mainline v1.19.1/v34 development line has not been released. New code at github.com/yjh051108/dsh-routing-suite
dsh-router-standard
Task-aware reasoning-mode router preset: quantifies DeepSeek V4's measured "discontinuous, phase-transition" behavior along the persona axis onto stable regions (spec / react / weak), and injects the matching persona and tool surface on the first turn. Part of the
dsh-routing-suitesuite, and developed alongsidedsh-super-injector(restart-free runtime injection).📄 Research-history notes: docs/statement.md (errata statement) | docs/apology.md (apology letter)
Current Status (v1.19.1, 2026-08-24 · R&D line, not yet released)
Router Standard is on the "strict workflow" R&D line (refer to CHANGELOG; the version-line file is router-bootstrap-v34.mjs):
- Strict-phase workflow: completion-signal-driven promotion (0→1 requires clarification/plan, 1→2 requires plan lock, 2→3 requires delivery self-check),
phase 0 mandates alignment (ambiguity first
ask_user_question, complex tasks firsttodo_write); "tool name/text triggers phase skip" has been removed. - Task echo:
stageTextnow includesTask: <首条真实用户消息>— the model clearly sees what it is working on every turn, without losing focus. - Progressive disclosure: phased unlocking + two-tier pre-release + direct-reach semantics + full open at delivery;
tools_catalogfull index /tools_helpcomplete schema;all:truehas been removed (no full-open exit, and unlocked-out tools do not enter the field of view). - Standard-mode baseline: native direct calls (no PTC/run_code wrapping, no full SDK section, and the attention tax on the tool surface is substantially reduced).
- Built-in page verification:
dev_page_check= screenshot + DOM smoke + console/pageerror/title/selector/scale;{js:…}mode = local JS engine (zero external node dependencies); external evidence is a first-class citizen. - Description ⇄ behavior alignment:
presentation=nativeself-check, phase copy states only the truth, platform facts (on win32, the Git Bash private shell seam is authoritative). - Proactivity guidance: Proactivity standing section (self-check signals, not a stop command); the stress sensor has been retired.
Companion presets: router-react (v17) / router-spec (v10) (two execution presets based on standard mode, both supporting first-turn image reading); the router-pro line has been retired and removed. Full evolution: see CHANGELOG.md and docs/STANDARD-PLAN.md.
【Archived · v0.3 Era】 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 (standard routing preset) | classified persona (spec/react/weak) + full prompt sections + banded first-turn tool surface | act per classified band: react produces directly, spec reads before editing, weak routes internally (close-range guidance each turn) |
| spec (spec routing preset) | classified persona (spec/react/weak) + full prompt sections | Thunderstorm deep thinking: an ultra-long first-turn chain of thought (101K of reasoning with 0 actions is its characteristic, not a defect) |
Choice: install either of the two presets (Router Standard / Router Spec, see Usage).
dev_router_statusdisplays the current routing mode.
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:
- First-turn routing actually works (issue #13): the loop claims the inbox
BEFORE assembling the system prompt, and
inbox.claim()emits the agent-scopedagent/inbox/claimedevent synchronously — the router captures the first REAL user message there (source.kind === 'user'only), so the first request is classified instead of unconditionally falling into weak. (The captured text is CLASSIFIED, not fed to bandOf raw — the old capture path silently mapped every captured message to the spec band.) - Near-field guidance moved to
agent/pre-step(issues #34/#36/#55):session/eventnever fires inside agent-plane presets (dsh-scope filters it out of entry-local realms), so the old inbox re-append never delivered guidance — and wherever it did fire, thenext-stepappend forced a SECOND model request per user message (the 2× API-call spike). The guide is now inserted intodecision.messagesatagent/pre-step: same request as the user message, near-field, cache-neutral, zero extra round-trips. - Fixes: missing
extractText/bandOfimports in both bootstrap files (#11) — thesession/eventhandlers crashed with ReferenceError whenever they did fire;sessionModeignoring plugin-origin messages when pinning the band;router.test.mjsimport path; preset.yml YAML quoting (#53); subagent-session skip (#5); session-selected model fromassembled.variables(#9); the RL-standard mode of the spec preset now returns the assembly untouched after the first tool/call (#44). - New:
router.integration.test.mjsreplays the real claim → assemble → pre-step ordering against the actual bootstrap code.
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 same model reaches top-band scores under spec conditions on a maintenance benchmark (Project2: minimal 99/96, anchored 98/99) and under react/code conditions on a greenfield build task (Mario: 10/10), while the wrong mode scores 91 / 6 respectively — a ~10-point swing from prompt conditioning alone ("god/ghost duality").
- Persona is the dominant trigger (one-sentence swap flips the trajectory); tool-schema surface is a secondary condition; catalog text in a user message has no effect.
- Behavior is path-committed: once anchored, expanding the tool catalog perturbs at most one reasoning block and never flips the mode.
- Intermediate personas are out-of-distribution (training-distribution gap), which is the measured unstable band.
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
No-restart installation (recommended): after installing dsh-super-injector
(see the suite's scripts/install-injector.ps1), changing preset code no longer requires renaming files / restarting:
dev_reload_preset router-standard # 预设热更新:?v=N query 绕 ESM 缓存,新会话立即用新代码
Notes (hard-learned lessons):
- ESM cache: the loader caches modules by URL — overwriting file contents in place does not take effect (code changes require
dev_reload_presetor a filename change). - First session must be new: the routing mode is locked on the first request (path commitment); switching the GUI model mid-session or changing configuration does not affect a running session.
- Subagents do not route:
parentSessionsessions skip the routing layer (community #5 fix), and shell-less subagents no longer crash. - Guidance injection channel (v0.3.0): near-field guidance goes through
agent/pre-step, injecting one item per real user message (weak mode); from rc.6 on,session/eventreceives no events under standing scope, so guidance in older versions was dead. - First-turn real classification (issue #3/#13): first-turn routing reads the raw
message text from
agent/inbox/claimedand classifies it viaclassifyTask— the first turn is a real band (no more weak fallback). - Self-removal uninstall:
dev_uninject_plugin --self=truecan uninstall the injector itself (keeping the assembly chain, auto-restored on restart) — used to verify the installation closed loop.
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).
dev_router_status— current mode, band, persona, core tools, override statedev_router_mode <spec|weak|mixed|react|0-100|0.0-1.0|auto>— explicit mode (numeric inputs quantize to the three bands)dev_mode_subagent <spec|react|balanced> <task>— run one task in a DIFFERENT reasoning mode inside a fresh isolated context (its own system prompt), leaving the current trajectory untouched. Mode isolation is the only reliable way to change modes mid-session: mid-session persona switches invalidate the whole prefix cache, tail personas are ineffective (P6), and the native subagent inherits this persona.
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):
- simple tasks → fast-convergence guide (P30: 1 step, zero waste);
- complex tasks → decision-closure deep guide: "Think deeply about the architecture, edge cases, and integration points. Do not spend reasoning on the environment or tooling. Produce when your information is complete. End each reasoning block with a decision or an information need." — P30: depth +12% AND faster convergence (8.0 vs 8.3 steps), 3/3 completion.
- Rumination (environment suspicion / re-confirmation) is suppressed by the anti-runaway anchor: measured 0.0-0.3% of reasoning tokens.
Tests
node --test router.test.mjs # 11 tests: classification, bands, personas, plan-section survival
Files
preset/agent.cordis.yml— full rc.6 Standard composition + router rowpreset/router-core.mjs— pure routing logic (zero deps, unit-testable)preset/router-bootstrap.mjs— Cordis plugin (zero external imports)router.test.mjs— unit testsdocs/paper.md— the theory + experiments write-updocs/experiments.md— full data tables
Evidence & attribution
- Trajectory trigger matrix, dual-model matrices, and the 21-point phase probe:
dsh-probe(this repo's sibling scripts live in the paper's appendix tables). - Project2 evaluation data: xiaobright/modeltest (V4.1b, frozen) — minimal 99/96, standard 91, PTC 92, anchored-standard 98/99.
- Two-phase anchoring preset: xiaobright/dsh-anchored-standard
(MIT). The router's first-turn anchoring is a plugin-level port of its
tool-bootstrapmechanism. - DeepSeek Harness official
minimalpreset snapshot (sends the exact RL prompt and schemastest) — the spec persona and the RL-alignment claim.
License
MIT. preset/agent.cordis.yml derives from the DeepSeek Harness Standard
preset (MIT); original attribution in NOTICE.
Comments
Loading…
Similar plugins
by yjh051108
推荐组件(非必须):DeepSeek Harness 运行时注入器;已随 dsh-routing-suite 单仓库化保留,本仓库继续维护/发布。
★ 168
TypeScript
Oct 16, 2026
dsh plugin --profile web add @dsh-external/dsh-super-injectorby CARVIN94
An AI routing gateway that runs as a DSH plugin. Adds a Routing System sidebar panel for suppliers, account pool, fallback combos and API keys, and serves an OpenAI-compatible endpoint at http://local
★ 15
↓ 725/wk
MIT
TypeScript
Oct 28, 2026
dsh plugin --profile web add dsh-router-coreby yjh051108
dsh-routing-suite — injector + router-standard kit: install the runtime injector first, then the task-aware reasoning-mode router preset (measured P1-P23).
★ 7k
MIT
JavaScript
Sep 18, 2026
dsh plugin --profile web add @dsh-external/dsh-super-injectorby yewenyell-lang
Durable workspace-owned Workloads and Runtime Center for DeepSeek Harness
★ 0
MIT
JavaScript
Aug 21, 2026
dsh plugin --profile web add dsh-workloads-local-ui1by Yangi-252410
该仓库暂未提供项目说明。
★ 0
JavaScript
Oct 5, 2026
dsh plugin --profile web add dsh-git-toolsby neo805
DSH plugin: context-aware per-step reasoning-effort routing — classify → escalate → hysteresis → capability clamp; Auto mask in the native selector; default effort fill + wire mapping for custom llm-pi-ai models. AI-authored (kimi-k3), produced by @neo805. No Issues/PRs; forks welcome (MIT).
★ 0
NOASSERTION
JavaScript
Oct 14, 2026
dsh plugin --profile web add dsh-effort-router