- Home
- Plugins
- Models & Providers
- dsh-subagent-routing
dsh-subagent-routing
aleixrocal/dsh-subagent-routing
One routing table, shared by a skill, a slash command, a tool and a settings page, that gives the model tier, provider/model and reasoning effort for each subagent task kind or role; the tool returns the route with permission reported as unknown, and the page reads the subagent gate and can write it when its gate editor is on. Its HTTP routes have no DSH access check, so a web page open in your browser could call them.
Install
dsh plugin --profile web add github:aleixrocal/dsh-subagent-routingREADME
@aleixrocal/dsh-subagent-routing
Pick the model each subagent runs with, and check that the session allows it.
@aleixrocal/dsh-subagent-routing keeps model choice in one table: eight task kinds, three levels (flash, strong, premium) and a reasoning effort per level. The plugin serves that table to the agent as a skill, a slash command and the subagent_route tool, and gives you a configuration page under Settings → Plugins, plus an entry of its own in the Settings sidebar, to edit it.
- The
dsh-subagent-drivenskill carries the table generated from the live configuration, rebuilt every time the skill loads. /dsh-subagent-routingprints the status, lists the presets, verifies the routes against the provider catalog and pins a level.subagent_routereturns the level, theprovider/modeland the effort for a task kind. It answerspermitted: "unknown"because the session authorization is a separate question.- The configuration page edits the levels, the presets, the efforts and the toggles, and can write the whole table to the subagent gate.

Live capture of @aleixrocal/dsh-subagent-routing 0.3.0 in DeepSeek Harness Web, English interface. Settings → Plugins → Subagent routing with routing enabled: the three level rows with their model and reasoning-effort selects, saved as low, high and high. Every capture used in this README is listed with what it shows in docs/images/MANIFEST.md.
Thinking level
Each level carries an optional reasoning effort. The catalog advertises off, low, high and max for opencode-go/deepseek-v4.1-flash, and the select on that page lists model default, low, high and max. The plugin stores the id, not the label. On the page above the three levels were saved as low, high and high, and GET /api/subagent-routing/config reads them back:
{ "enabled": true, "efforts": { "flash": "low", "strong": "high", "premium": "high" } }
That is what the Save button writes to ~/.local/state/dsh-subagent-routing/settings.json, on top of the row declared in cordis.patch.yml. The effort reaches the caller in three places: reasoning_effort in the subagent_route result, an Effort column in the generated skill table, and the hint in the composer menu (opencode-go/deepseek-v4.1-flash · low). Handing it to the model is the caller's job, and the plugin does not verify that the model accepts it: verify checks routes only.

Live capture, English interface: the same page scrolled to Routes per level, where each model row shows the saved effort and the ids the host advertises.
Install
From source
git clone https://github.com/AleixRocal/dsh-subagent-routing.git
# Linux and macOS
dsh plugin --profile <profile> add link:/path/to/clone
# Windows
dsh plugin --profile <profile> add link:C:/Users/<user>/pluguins_dsh/dsh-subagent-routing
dsh plugin passes the arguments to pnpm inside the profile directory, so the link: specifier leaves a dependency that points at the checkout and code changes show up without reinstalling. Check that the bundle is listed in the profile's dsh.profile.bundles (add @aleixrocal/dsh-subagent-routing if it is not) and open a new session so the command, the skill and the page are composed.

Live capture, English interface: Settings → Plugins → Installed plugins on the same host, with the Subagent routing card.
From npm
The package is on npm as @aleixrocal/dsh-subagent-routing, and the badges at the top read its version and download counts straight from the registry:
dsh plugin --profile <profile> add @aleixrocal/dsh-subagent-routing
Requirements: DSH with the skills, commands and webServer services (the subagent_route tool is added when tools is present), and Node ≥ 22. The plugin has no runtime dependencies and no build step.
Routing table
Task kind (kind) | What it covers | Level | Route |
|---|---|---|---|
explore | explore the repo, search, read | flash | opencode-go/deepseek-v4.1-flash |
implement | scoped mechanical editing | flash | opencode-go/deepseek-v4.1-flash |
test | write or repair tests | flash | opencode-go/deepseek-v4.1-flash |
refactor | multi-file refactor | strong | opencode-go/deepseek-v4-pro |
debug | subtle bug or unknown cause | strong | opencode-go/deepseek-v4-pro |
plan | planning and design | strong | opencode-go/deepseek-v4-pro |
review | diff review or critical decision | premium | opencode-go/kimi-k3 |
migrate | high-risk migration or second opinion | premium | opencode-go/kimi-k3 |
And the three levels:
| Level | Default model | Cost | When it pays |
|---|---|---|---|
flash | DeepSeek V4.1 Flash | low, per call volume | exploration, mechanical edits, tests |
strong | DeepSeek V4 Pro | medium | refactors, subtle bugs, planning |
premium | Kimi K3 | high, spent selectively | final review, second opinion, stuck problems |
This is the default configuration, the one declared in cordis.patch.yml. What applies is the live configuration: changing a level changes the route of every kind that uses it, and the skill table is regenerated when the skill loads.

Live capture, English interface: the Presets per task kind table on the settings page, each kind pointing at one of the three levels.
Configuration page
| Control | What it does |
|---|---|
| Routes per level | The provider/model of flash, strong and premium, plus the reasoning effort of each |
| Custom levels | Add a name and a route, edit the route, or remove the level when no role uses it |
| Roles | Add a name, point it at a built-in or custom level, change the level or remove the role |
| Presets per task kind | Which level applies to explore, implement, test, refactor, debug, plan, review and migrate |
| Serve the table to the skill, the command and the tool | Whether they answer with the table or stay neutral |
| Generate the table inside the skill | Whether the skill embeds the generated table when it loads |
| Allow writing the model gate | Whether Apply to the gate may touch the profile's subagent policy |
| Language | Automatic follows the DSH interface locale; Catalan and English force this page's copy only |
The route selectors keep every model in the catalog and accept hand-written routes, ids with slashes included (custom/org/model). Save persists both complete maps; Apply to the gate includes the fixed and the custom routes without duplicates.
The language is saved with the rest of the configuration (language: auto, ca or en). auto follows the DSH locale the page is bound to; ca forces the Catalan source text and en serves the English copy the panel ships, falling back to Catalan for any string it does not translate. The choice covers this page only — the command keeps printing Catalan and the rest of the DSH interface is untouched. The page repaints as soon as the selector changes; the choice is written when the configuration is saved. A missing or unknown stored value reads as auto; a POST that names anything else is refused with invalid-language.
The same page mounts in four places: plugins.row.config (the configuration attached to the plugin's row in the Plugins list) and plugins.bundle.config (the bundle page), the original pair, plus settings.plugin.item (a card of its own in the Plugins list) and settings.section (a section of its own in the Settings sidebar, labelled Subagent routing and ordered with the other sections). The last two are declared lazily by the settings shell, so they register only when the host exposes slots.inject; a host that declares neither slot (or has no slots.inject) loses that mount and nothing else, and the page publishes its mount report on window.__dshSubagentRouting (mounted, skipped and failed).
A save replaces the overrides file atomically. If the write or the replacement fails, the previous content stays and the API answers with an error; the page does not announce "Saved". Only ENOENT initializes an empty configuration, and read errors (EACCES, EIO), a directory in place of the file, invalid JSON or a JSON value that is not an object block the read and the merge without overwriting unknown data. Discard my changes deletes the file; the directory moves with DSH_SUBAGENT_ROUTING_STATE.

Live capture, English interface: the same page scrolled to the profile gate and the option switches.

Live capture, English interface: the Verification block, where the three routes are checked against the catalog the host advertises.
verify tells advertised routes (✓), models missing from the advertised catalog (✗, without discarding an exact lookup) and providers or catalogs that cannot be verified (?) apart. None of those results proves session permissions.
Custom levels and roles
Beyond the three fixed levels you can declare custom levels (customLevels) and named roles (roles) that point at them. They are two ordered maps, separate from the presets per task kind:
customLevelsmaps a name to aprovider/model, adding levels to the three built-ins. A custom level is removed by omitting it, once no role or effort names it.rolesmaps a role name to a level name, so one name selects a routing preset.
subagent_route takes kind or role, never both: with role it resolves the role to its level and returns the route. Both sections are saved by full replacement, so an omitted key deletes the entry and {} clears the section, and the deletion survives a restart even when cordis.patch.yml declares the same key. The API refuses with 400 and an invalid list any edit that would leave a role pointing at a missing level (dangling-level-reference), delete a level a role still uses (level-in-use), use an unsafe or reserved name (invalid-name), collide with a built-in level or a kind, or carry a malformed route (malformed-route). Level and role names start with a lowercase letter and allow lowercase letters, digits, hyphens and underscores, up to 64 characters.
Importing Agent Teams roles
The roles Agent Teams declares can be imported instead of retyped. They are read, read-only, from the agent-teams row of this profile — profiles.<profile>.members[].role — the configuration of another plugin, which this one never writes. The row is looked up through host surfaces, most trustworthy first: settings.describe() (the row id is the namespace), then the config editor, then a tolerant walk of the loader tree. The source field says which one answered: settings, config or loader.
Each declared role is normalized to a role id this plugin can store: trimmed and lowercased, every run of characters outside [a-z0-9] becomes one hyphen, leading and trailing hyphens go, the result is cut to 64 characters and must start with a lowercase letter. A role that cannot pass that, or that would shadow another identifier, is reported in skipped and never imported:
| Reason | Meaning |
|---|---|
empty-role | the member declares no role |
invalid-name | nothing usable survives normalization |
reserved-name | the id is a prototype key (__proto__, constructor, …) |
builtin-collision | the id is a built-in level or a task kind |
Two members declaring the same role collapse into one row, which keeps every declaration as a source (profile:role).
The suggested level comes from the normalized name, the first bucket that matches, and strong when none does:
| Keyword in the role id | Suggested level |
|---|---|
review, qa, test, verif, secur, audit | premium |
plan, architect, design, debug, refactor, migrat | strong |
research, explore, docs, data, analys, write | flash |
| anything else | strong |
GET /api/subagent-routing/teams exposes the discovery read-only (200 JSON with cache-control: no-store; any other method is 405). It answers the roles already planned against the live configuration: configured is the level this profile gives that role (or null), the row's source is configured or new, and suggested is the keyword guess:
{
"ok": true,
"source": "settings",
"profiles": [{ "name": "coding", "members": [{ "name": "Aleix", "role": "Backend engineer" }] }],
"roles": [
{ "name": "backend-engineer", "configured": null, "suggested": "strong", "source": "new",
"sources": [{ "profile": "coding", "role": "Backend engineer" }] }
],
"skipped": [{ "profile": "coding", "role": "review", "reason": "builtin-collision" }],
"levels": ["flash", "strong", "premium"]
}
The top-level source is null and every list is empty when no agent-teams row can be read; an unreadable row and an absent one look the same on purpose.
The command exposes the same thing:
| Subcommand | What it does |
|---|---|
roles | configured roles, then the ones Agent Teams declares, with their state, suggested level and declarations; read-only |
import | imports every discovered role without a level, at its suggested level |
import <role> <level> | imports one role, discovered or any valid plugin name, at an existing level |
import writes through validatePatch and writeOverrides, like role: it never overwrites a role that already has a level and refuses a level this configuration does not know (dangling-level-reference). With no readable row it fails instead of guessing.
The configuration page shows the same roster in an Agent Teams roles block (the Catalan interface calls it Rols d'Agent Teams), after the roles editor, with an origin line naming the row it read and its profiles. Each role is either the level already in the draft (an already defined pill, not editable from here) or a level select defaulting to the suggestion plus an Import button; Import the suggested adds every still-missing role at once, and the skipped roles are listed with their reason. The block only adds to the draft: saving the page validates and writes it, and a role already in the draft is never overwritten. Import never creates a level — the select offers the levels this draft knows, and falls back to them when a suggestion names one it does not. A host without the route hides the block and leaves the rest of the page working.
The command
The command prints its own text in Catalan on this build, and takes one word:
| Subcommand | What it does |
|---|---|
| (no arguments) | current status |
presets | task, level and route table |
verify | checks the fixed and custom routes against the live catalog |
set <level> <route> | pins flash, strong or premium to a provider/model |
role <name> <level> | pins a role to an existing level |
roles | configured roles plus the ones Agent Teams declares, read-only |
import | imports every discovered role at its suggested level |
import <role> <level> | imports one role, discovered or any valid plugin name, at an existing level |
gate | subagent gate status and how to change it |
reset | discards my overrides |
With the default routes and a gate that allows them, the status block reads:
Routing: actiu
flash opencode-go/deepseek-v4.1-flash
strong opencode-go/deepseek-v4-pro
premium opencode-go/kimi-k3
Gate de subagents: activat · 3 ruta(es): opencode-go/deepseek-v4.1-flash, opencode-go/deepseek-v4-pro, opencode-go/kimi-k3
Presets: explore=flash implement=flash test=flash refactor=strong debug=strong plan=strong review=premium migrate=premium
The subagent gate

Live capture, English interface: the gate block of the page, with the gate value, the label naming where it was read from, and the Apply to the gate control.
Whether a route exists and whether the session allows it are two different questions. The second one is answered by the subagent-model-selection policy ({ enabled, allowedModels }), a row owned by another plugin:
- disabled: a subagent can only run with the parent's model;
- enabled: only with the routes it lists;
- not readable in this profile: the plugin says so and returns
permitted: "unknown"instead of guessing; - gate changes apply to new sessions, and both the page and
/dsh-subagent-routing gatesay so.
The plugin reads the gate through four surfaces, most trustworthy first: the settings registry, where the namespace is the row id and not the plugin name; the live subagentModelSelection service; the flat row list of the config editor; and a tolerant walk of the loader tree. The label next to each value names the surface that answered: a stored settings value, the live service, the declared row or the loader tree. With Allow writing the model gate on, Apply to the gate saves through the profile's config editor; when the profile has none, the page reports the reason and does not edit profile files by hand.
Delegating

Live capture, English interface: the composer of a real session, with the routing badge in the tool row.

Live capture, English interface: the badge open, the eight task kinds with their level, route and effort hint (opencode-go/deepseek-v4.1-flash · low).
A subagent gets the route only when the caller passes it. Ask subagent_route for the kind of work, then pass provider, model and reasoning_effort to subagent, subagent_fork or agent_teams_add_member. Without an explicit model, the subagent and every Agent Teams member run with the parent's model: creating a team does not consult this table.
| Member role | Kind of work | Level |
|---|---|---|
| explorer, investigator | explore | flash |
| implementer, fixer | implement | flash |
| whoever writes or repairs tests | test | flash |
| plan designer | plan | strong |
| subtle-bug debugger | debug | strong |
| reviewer, second opinion | review | premium |
If subagent_route answers permitted: "unknown", check list_subagent_models before you delegate explicitly. When you cannot confirm the route, leave the member on the parent's model and say so in the report.
Status
Facts you can re-run on this checkout:
| Fact | Where it comes from |
|---|---|
| Version 0.3.1 | package.json |
| Published on npm | npm view @aleixrocal/dsh-subagent-routing version answers 0.5.1 |
| CI on every push and pull request | .github/workflows/ci.yml: Node 22, npm run check, npm test, then a tarball assertion over npm pack --dry-run --json |
| Six smoke suites | npm test: config-smoke, gate-smoke, store-smoke, skill-smoke, client-smoke, teams-smoke; none needs a running Harness |
| Tarball | npm pack --dry-run: 33 files, 1.7 MB packed, with the nine captures and docs/images/MANIFEST.md inside |
| Exports | . to lib/index.js, ./client to lib/client.js, ./locale/*.json, ./icon to assets/icon.png, ./package.json |
| Scripts | check and test, both declared in package.json |
The npm counters at the top are npm's own numbers: npm/dw counts the last week and npm/dm the last month. npm's download API only starts indexing a package a day or so after its first publish, so until then the two download badges read package not found or too new; after that they track the registry.
Development
npm run check # node --check on lib/index.js, client.js, config.js, store.js, gate.js, teams.js
npm test # the six suites, chained
npm pack --dry-run # the published artifact
The suites need no running Harness and no network:
config-smokecovers the pure routing layer: defaults, malformed routes, preset resolution, verification against a fake catalog and the skill table.gate-smokecovers the four gate read surfaces, the diagnostics and the write through the editor, with fake services.store-smokecovers overrides and partial merge in a temporary directory, without touching the real state.skill-smokeproves the skill serves the package Markdown with the table marker replaced, and follows the configuration.client-smokeloads the settings bundle through a stub module loader and pins the composer badge, its kind menu and the registration contract with a fake React and a fake Cordis context.teams-smokepins the read-only Agent Teams role reader: the three read surfaces and their labels, the normalization, deduplication and skip reasons, and that no write ever reaches another plugin's row.
The tarball carries lib/, skills/, locale/, assets/ (icon.svg for the bundle and the 384×384 icon.png for the catalog), cordis.patch.yml, README.md, README-ca.md, README-zh.md, CHANGELOG.md, LICENSE and the nine captures under docs/images/en/ with docs/images/MANIFEST.md. An image the README shows but the tarball lacks is a broken image on the plugin detail page.
Repository structure
lib/
index.js host: skill, command, page API and the subagent_route tool
client.js settings page (plugins.row.config, plugins.bundle.config, settings.plugin.item and settings.section slots), panel language, composer badge and menu
config.js pure logic: levels, kinds, presets, roles, efforts, skill table, verification
gate.js subagent gate read and write
teams.js read-only Agent Teams role reader
store.js user overrides
skill.js skill provider, with the generated table
skills/dsh-subagent-driven/ skill body and REFERENCE.md
locale/ display metadata (en, ca)
assets/ SVG icon for the bundle, 384×384 PNG for the catalog
docs/images/en/ the nine live captures, listed in docs/images/MANIFEST.md
test/ smoke tests, no Harness needed
cordis.patch.yml loader row and default configuration
Contributing
Before a pull request, run npm run check && npm test. CONTRIBUTING.md holds the human workflow, and AGENTS.md holds the invariants an agent breaks first: the manifest shape, the tolerant read and strict write, the full-replacement sections, the effort rules and the single source of truth for the table.
License
MIT, the license field of package.json. Issues and proposals: github.com/AleixRocal/dsh-subagent-routing/issues.
Related plugins
dsh-our-free-model
ebony-vinyl/dsh-our-free-model
dsh-routing-suite
yjh051108/dsh-routing-suite
dsh-connect-workbuddy
dingminhua/dsh-connect-workbuddy
dsh-workbuddy-connect
corrinehu/dsh-workbuddy-connect