dsh-subagent-role-router: Role-based Model Selection, Multi-Routing, and Fork Slicing for DSH Subagents

Introduction

In DeepSeek Harness (DSH), the main agent frequently delegates tasks to subagents via tools like subagent and subagent_fork. If the model is not explicitly specified during invocation, subagents often inherit the routing of the parent session. This means exploration, planning, and code modification share the same model, which either wastes quota or lacks sufficient capability when precise coding is required. Furthermore, with multiple providers, rate limiting, quota exhaustion, or key invalidation can cause the entire delegation to fail.

While there are existing community plugin concepts for “default subagent models,” maintainer 643048695 has developed a derivative work based on dingminhua/dsh-subagent-default-model (MIT), releasing dsh-subagent-role-router (current package version 4.0.0, MIT). The following section describes how it injects routing during the delegation phase and the additional capabilities it offers compared to the original work.

What is this?

dsh-subagent-role-router is a workflow-class plugin for DSH. It determines provider / model (and reasoning effort) based on configuration when creating a subagent without an explicitly specified model. All dispatches via subagent, subagent_fork, or those omitting agentOptions will pass through it. Explicitly passed agentOptions from the caller always take precedence; if the configuration is missing or incomplete, the behavior is consistent with having no plugin installed (subagents inherit the parent session routing).

Plugin Directory Page: SkillHub - dsh-subagent-role-router. Source code and documentation are subject to the GitHub README.

Core Features

Compared to the original work, this project adds four capabilities beyond default model injection, multi-model assignment, cross-provider failover, and routing visibility: Role-based Routing, Role Candidate Pools, Fork Active Window Slicing, and Agent-teams Exemption. The following summarizes only the behaviors specified in the README.

Role-based Routing (explore / plan / patch)

When roleMode is enabled, a role is selected based on what the subagent “intends to do” during dispatch, which then maps to the routing configured for that role:

Role Typical Use
explore Read-only investigation, searching, explanation, review
plan Solutions, design, task breakdown
patch Code modification, implementation, bug fixing

The role determination order is: Explicit markers in the prompt or tags (e.g., [explore], 【探索】, 规划:) → Source tags (e.g., side question michengai-btw: is treated as explore) → Keywords → Default patch (if unsure, treat as “possible code change”). If a role is not configured separately, it falls back to the models list and the assignment/failover logic of Features 2 and 3.

Multi-model Assignment and Cross-provider Failover

  • Assignment: When models contains at least 2 items, the strategy is used for assignment during dispatch—round-robin or random. This only affects “which routing the next subagent uses” and does not switch models mid-run for a single subagent.
  • Failover: failoverEnabled is enabled by default; if a subagent encounters connection, authentication, or other failure codes listed in the README, it switches routing within models (or the role candidate pool) to retry, crossing providers. After switching, it sticks to the new routing for the remainder of that run; if candidates are exhausted, the real error is thrown. The main agent loop is unaffected.

Routing Visibility

The trajectory view and conversation view can display the current provider/model (updated after failover). When injectRouteContext is enabled by default, a system line is injected into the subagent context stating its actual running routing (including provider), helping the subagent answer “which model is it running on.” This complements the host’s {{model}} variable.

Fork Active Window Slicing

forkWindowSlicing is enabled by default: For subagent_fork, only the most recent forkWindowTurns (default 3) turns are retained on the seed returned by prepareContinuable, mitigating lag caused by copying full raw events in long-session forks. If the mapping is incomplete or abnormal, the slicing is abandoned and it falls back to native host behavior; dispatches for team members with agent-teams: are not sliced.

Role Candidate Pool (4.0.0)

Each role can configure exploreModels / planModels / patchModels queues: The number of rows represents the number of subagents that can run simultaneously for that role; if busy, it moves to the next candidate, and if all are busy, it shares based on least occupancy. Failures can enter roleSlotCooldownSeconds (default 15 seconds) cooldown. Dispatches with explicitly specified models and agent-teams members do not occupy slots.

Installation and Activation

Install from GitHub via the DSH plugin command (from README):

dsh plugin --profile desktop add github:643048695/dsh-subagent-role-router

For local development, you can use the repository path as the add parameter; restart DSH Desktop after modifying code to apply changes. The plugin declares a peer range of 0.1.7 / 0.2.0 / 0.2.1 for @deepseek-ai/*, and not declared as supported for 0.3.0 onwards. The README states the currently verified host is DSH 0.2.1-rc.2. If the host and bundle are incompatible, the startup will skip the bundle, and neither the plugin nor the settings card will load.

After installation, use the Web settings card in Settings → Plugins → dsh-subagent-role-router, or edit the config section of id: dsh-subagent-role-router in cordis.patch.yml under your profile.

Typical Usage

1. Guide roles using tags (no need to change tool parameters)

Specify the role in tags or prompts during dispatch, e.g., [explore] for code search, [plan] for architecture solutions, [patch] for implementation modifications; if not specified and no semantic keywords exist, route as patch.

2. Single model or global multi-model

Minimally, only provider + model are needed; for multiple routes, configure models with strategy and failoverEnabled, for example:

config:
  models:
    - model: deepseek-v4-pro
      reasoningEffort: high
    - provider: other-provider
      model: gpt-5.6
      reasoningEffort: max
  strategy: round-robin
  failoverEnabled: true

3. Separate models by role and enable candidate pools

config:
  roleMode: true
  exploreProvider: magpie
  exploreModel: antigravity/gemini-3.8-flash
  planProvider: deepseek-official
  planModel: deepseek-v4-pro
  patchModels:
    - provider: workbuddy
      model: deepseek-v4.1-flash
      reasoningEffort: high
    - provider: magpie
      model: sensenova/kimi-k3
  roleSlotCooldownSeconds: 15
  forkWindowSlicing: true
  forkWindowTurns: 3

For the complete field table, see GitHub README “Configuration Fields”. Configuration changes take effect for the next dispatch; the README states that uninstallation restores wrapped service methods.

Use Cases and Notes

Suitable for developers who frequently use subagents on DSH Desktop, have configured multiple providers, or wish to “use fast models for exploration and strong models for code modification.” Those who require long-session forks (side questions, misunderstandings, etc.) and have experienced timeouts may keep the default fork window slicing and adjust forkWindowTurns as appropriate.

Please note:

  1. Permissions: The plugin runs in the current DSH process with the same permissions as the host. Before installation, you should read the source code and the MIT LICENSE on GitHub to confirm acceptance of the license and derivative work attribution (Original work Copyright (c) 2026 LaoDing, This project modifications Copyright (c) 2026 643048695).
  2. Ecosystem: DSH emphasizes “Everything is a plugin”; community directories like SkillHub are independent sites and have no official affiliation with DeepSeek / Hiascend. This article does not constitute official endorsement.
  3. Version: npm package version 4.0.0 introduces the role candidate pool; legacy triplet fields (e.g., patchProvider) remain compatible as single-line candidates.

Conclusion

dsh-subagent-role-router transforms subagent dispatch from “inheriting a single routing path from the parent session” into configurable role-based distribution, candidate concurrency, multi-model rotation, and failover, while mitigating the issue of oversized fork seeds by default; paths like explicit model and agent-teams still bypass the plugin according to original host semantics.

  • Directory Page: https://www.skillhub.cn/plugins/643048695/dsh-subagent-role-router
  • Repository: https://github.com/643048695/dsh-subagent-role-router
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye