pumbleblock/dsh-subagent-model-router ↗★ 0

dsh-subagent-model-router

Model-selectable subagents with per-task reasoning effort and guided model routing setup for DeepSeek Harness 0.1.7 and 0.2.x 适合需要根据任务复杂度自动分发给不同模型及推理强度的进阶用户。

Package
dsh-subagent-model-router
Compatibility
Unverified
Harness peer range
^0.1.7-rc.2 || ^0.2.0-rc.1
Version
0.10.0
License
MIT
Last updated
Oct 18, 2026

Other repositories with this package name

Install

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:pumbleblock/dsh-subagent-model-router

DSH Subagent Model Router

Give every delegated task the right model and reasoning effort—automatically.

[!NOTE] This is the maintained continuation of CypherNaught-0x/DSH-Subagent-Model-Router, including poka-IT's DSH 0.1.7/0.2.0 port. It targets DeepSeek Harness 0.2.x and adds per-task reasoning effort. Full history and credit are preserved.

Stop using one model for every kind of work. Configure your preferred fast, affordable, specialized, and high-reasoning models once; the router gives your agent the aliases, tags, and guidance it needs to intelligently select the best route for each delegated task.

That means faster routine work, stronger results on difficult problems, better control over cost, and less model micromanagement. Subagents can run in parallel, their results are reliably joined before the parent responds, and the model chosen for each task stays visible throughout the UI.

Why use it?

  • Better results where they matter — reserve your strongest models for architecture, security, deep reasoning, or critical review.
  • Lower cost and latency — send routine searches, edits, and focused implementation work to faster or more economical routes.
  • Automatic, task-aware routing — friendly aliases, capability tags, and plain-language usage guidance help the orchestrator choose intelligently.
  • Per-task reasoning effort — the orchestrator can run the same route at low for mechanical work or xhigh for a stubborn bug, with an optional default per alias.
  • Confident parallel delegation — launch multiple specialists in the background and reliably collect every result before synthesis.
  • Clear model visibility — see which model actually handled a task in subagent headers and in the optional Better Sidebar Sub-agents tab.
  • Easy setup — configure your model team from the Web UI, through a guided skill, or directly in a Cordis patch.

[!TIP] Already using Better Sidebar? The router adds an optional Sub-agents tab through Better Sidebar's public registerTab API.

See it in action

Follow every specialist from Better Sidebar

Better Sidebar Tasks view showing delegated subagents and their selected model chips

See parallel delegated work, current status, and the selected model together in the task tree you already use.

Build your ideal model team

Subagent Model Router settings for aliases, providers, tags, token limits, and routing guidance

Define friendly routes and tell the orchestrator when each model shines—from quick, budget-friendly tasks to your most demanding work.

What it adds

  • subagent_model: a delegation tool whose model argument is restricted to user-configured aliases, with an optional reasoning_effort.
  • wait-for-subagents: a join tool that waits for this agent's outstanding continuable background children, including standard and model-routed delegations, and returns their terminal results.
  • Per-model tags and routing descriptions embedded in the tool schema and system prompt.
  • model_subagent_catalog: a read-only view of models advertised by registered LLM providers.
  • configure_subagent_models: a model-facing tool that reads or replaces only this plugin entry's configuration, without filesystem access.
  • model-subagent-setup: a guided skill for selecting routes, generating routing guidance, obtaining confirmation, and saving through the constrained configuration tool.
  • Settings → Subagent Models: a Web settings page for manually adding, editing, and removing routes.
  • A hot-reloaded plugin configuration: the config: of the - id: dsh-subagent-model-router Loader entry in a Cordis patch.
  • Foreground execution and durable continuable background subagents.
  • Configurable stale-subagent filtering for listing tools, defaulting to 20 parent/user message turns without contact.
  • An active-model chip in an opened subagent header.
  • An optional Better Sidebar Sub-agents tab, with active-model chips on its rows, registered through the public sidebar service (when installed).

With an empty models list, the catalog, configuration, and wait tools remain available alongside the settings page and setup skill, but subagent_model is not registered. This provides a bootstrap state for initial setup.

Orchestrator behavior

When model-selectable delegation is available, the system prompt tells the orchestrator not to duplicate work it delegated. After issuing all intended background delegations, it must call wait-for-subagents before synthesizing the child results or giving a final answer. While a same-session completion goal is active, the orchestrator must not merely report that another model is handling the task and end its turn with background subagents still outstanding: ending the turn triggers immediate goal continuation and can race child tracking. Waiting joins the outstanding work so the orchestrator can synthesize the results and continue or complete the goal. The wait tool joins every continuable background child started by that parent through subagent, subagent_fork, subagent_model, or auto_agent_run; it remains useful when no model routes are configured. It reserves standard, forked, and project-specialist delegation calls before they can publish a child, and after plugin reload it discovers direct continuable children when their durable descriptors confirm their mode and the live Agent is either running or interrupted with parked input (reported separately as paused). It preserves every terminal content block and drops retained records when the parent is disposed, while foreground one-shot runs and job-backed non-continuable delegations remain outside this join because their owning tool already returns or collects the result.

Direct human steering must not leave the parent blocked in an old join. When a committed agent/inbox/spliced event inserts a source.kind: user message at next-step for that parent, an active wait returns { kind: "interrupted", pending: [...] } without cancelling or consuming any child. Each pending entry carries the exact child and run identity when available. The DSH agent loop does not automatically schedule a second tool call after the parent answers. Instead, the plugin's system prompt, tool description, and interruption result explicitly require the parent to answer the steering message first and then call wait-for-subagents again before final synthesis. That second call resumes the retained records and returns their eventual terminal output; queued next-turn input, model-authored context, cancellations, and events for other sessions do not trigger this outcome. A simultaneous child completion remains retained for the resumed wait.

The continuation manager's durable settlement notice triggers immediate reconciliation when a terminal lifecycle event was missed. Recovery requires matching post-boundary evidence in both the retained child epoch log and the parent notice, so an absent registry entry or an idle/resumable child is never treated as success by itself. For an ordinary tracked start, the record remains bound to the exact child and run identity. After plugin reload, a genuinely running child can instead be discovered without a published run id; its exact retained Agent object plus child and parent log boundaries identify that observed activation safely. A ten-second watchdog provides the same reconciliation as a fallback if the live notice event was also missed. Cancellation still rejects the active tool call without consuming records, and parent disposal still releases tracked children and active waits. If another plugin already owns or scope-shadows the wait-for-subagents name, this plugin leaves it untouched and suppresses its wait-specific guidance and tracking for the affected agents.

An interrupted child can be idle with queued input that will not run until explicitly resumed. The wait returns { kind: "paused", pending: [...], paused: [...] } for an exact live child with parked input and an aborted activation suffix, including when discovered after reload. It does not settle the child, discard its queue, or wake it automatically. Address the paused state explicitly: if work should continue, use send_message with appropriate instructions, then call the wait again; otherwise report the pause and request direction. Do not blindly restart intentionally interrupted work or repeatedly re-wait. All pending records remain joinable. An idle child without parked input, or a child still running, is not classified this way.

As a defense in depth for Harness versions affected by the continuable ownership-hold ordering bug, the router rejects a model tool call that uses send_message to target its own calling agent id. The rejection happens in the public tools/execute waterfall before the built-in tool calls the subagent service, and a resident child receives its direct parent id in the error hint. This deliberately narrow guard does not replace the core fix: it cannot protect direct subagent-service callers, reject every other invalid resident relationship, or repair ownership state already corrupted in the current host process. Deploying this source requires the normal plugin rebuild/reload (or a host restart); an already-corrupted process still requires a host restart.

listingInactivityTurns keeps old continuable children from crowding model-facing discovery. For each direct parent, the router counts incoming human messages (or parent-agent relay messages for nested agents) and resets a child's window whenever that child receives a parent/user message. Once the configured number of turns passes without contact, list_agents omits that child. This is presentation-only: the durable child is not deleted, unloaded, or made unaddressable, so a known id still works with send_message and can reappear after contact. Set the option to 0 to disable filtering. After a router reload, children without reliable process-local contact history receive a fresh visibility window rather than being hidden on incomplete evidence.

If a committed manager settlement notice exists but the exact retained result is unavailable, corrupt, or inconsistent, watchdog reconciliation reports a diagnostic error rather than fabricating output or waiting forever. The immediate notice path leaves room for the normal terminal event to arrive first. Plugin unload explicitly rejects active waits and releases tracker state and watchdog timers.

Reasoning effort

subagent_model accepts an optional reasoning_effort, matching the built-in DSH subagent tool. Effort ids are adapter-owned: each exact route advertises its own levels (for example none, low, medium, high, xhigh, max), so the router does not hard-code a list.

  • Precedence: the call's reasoning_effort, then the alias's reasoningEffort, then the selected model's own default. The parent's effort is never inherited, because an alias names its own route (DSH applies the same rule when a subagent call changes route).
  • Preflight: an explicit or alias-default effort is validated with the LLM runtime's resolveCallConfig before any child is created. An unsupported level fails immediately and the error lists the supported ones.
  • Discovery: the router reads each configured route's levels with resolveModelInfo and shows them in the tool description and system prompt, for example {default effort: low; efforts: none|low|medium*|high|xhigh|max}, where * marks the model default. Lookups re-run when the configuration or the registered LLM adapters change; a route that cannot be resolved is shown without levels and never blocks registration.
  • Resume: the effort becomes part of the child's Agent options, so a continuable child resumed with send_message keeps it.

To expose one model at two efforts with different routing guidance, configure two aliases on the same route:

      - alias: luna-quick
        provider: cliproxy-openai
        model: gpt-6-luna
        reasoningEffort: low
        description: Mechanical edits, test runs and scouting.
      - alias: luna-deep
        provider: cliproxy-openai
        model: gpt-6-luna
        reasoningEffort: xhigh
        description: Stubborn bugs and subtle refactors.

Model identity chips

The opened subagent header and every row of the Better Sidebar Sub-agents tab show the configured friendly display name for the latest adapter-resolved request, falling back to the model id when that route is not in the current router settings. Hover and accessible text expose the complete provider/model route. The plugin resets the route at the child's own descriptor so a fork cannot inherit its ancestor's model, and it omits the chip until the child records an authoritative request route.

The native subagent catalog in the session header (subagent-catalog) belongs to DSH and shows no model chip; the router no longer replaces it.

When Better Sidebar is installed, the router registers a single-instance Sub-agents tab with betterSidebar.registerTab({ id, title, component, single, order }). The tab reads each parent's subagentCatalog Session projection from the Sessions service list, loads it with sessions.refreshProjections() for the root and every expanded branch while visible, renders nested children with model identities, and opens a child through uiWorkspace.openSession(). Registration is scoped with ctx.inject(['betterSidebar'], ...), so the native router never waits for the optional service; late service load and unload are handled automatically. The native Better Sidebar controls which tab is selected and currently restores its Start page after refresh; use the + menu to reopen Sub-agents. (The optional bottom workbench has separate persistence semantics.) When the service is absent, the integration is inert.

Compatibility

Plugin versionDeepSeek HarnessConfiguration store
0.10.00.1.7-rc.2 through 0.2.x (verified daily on 0.2.0-rc.2)Loader entry config: in a Cordis patch
0.9.00.1.7-rc.2 and later 0.1.7 buildsLoader entry config: in a Cordis patch
0.8.0 and earlier0.1.0-rc.6 to 0.1.6subagent-model-router section of ~/.dsh/settings.yaml

DSH 0.1.7 removed settings.yaml and the ctx.settings.register()/get()/watch() API. A plugin now declares a Config schema whose fields are .volatile(): DSH commits a changed value into the running plugin and emits loader/volatile-update instead of remounting it, and the Settings service (ctx.settings) exposes those fields as a form addressed by the plugin's Loader entry id. This release therefore:

  • declares every setting as a volatile Config field and reloads its routes on loader/volatile-update;
  • writes through ctx.settings.replace('dsh-subagent-model-router', …), which persists into the active profile's cordis.patch.yml;
  • takes @deepseek-ai/schemastery as a peer dependency, because DSH resolves only peer dependencies of a linked plugin root from the running installation and .volatile() exists only in the 0.1.7 copy;
  • leaves the session-header subagent catalog to DSH, which now renders it from the subagentCatalog projection.

On first boot, DSH 0.1.7 renames ~/.dsh/settings.yaml to settings.yaml.imported and imports each section into the entry whose id matches the section name. The old subagent-model-router section does not match the entry id dsh-subagent-model-router, so it is not imported: move it by hand into a Cordis patch as shown in Configure through a Cordis patch.