Back to home

r600a-code

dsh-swarm-router

DSH plugin: sub-agent matrix swarm — routes heterogeneous tasks to the most suitable model (OpenRouter-like + cfgpu.com/llm/square), dispatches each via in-process subagents. 32/32 benchmark green.

Stars
0
Language
JavaScript
Created
Aug 15, 2026
Updated
Aug 15, 2026

Introduction

dsh-swarm-router

A DeepSeek Harness bundle (installable plugin) that adds a sub-agent matrix swarm: give it a batch of heterogeneous tasks, and it (1) routes each task to the most suitable model from an OpenRouter-like gateway plus the cfgpu.com/llm/square model catalog, then (2) dispatches each assignment in parallel as a real in-process subagent pinned to that model — so quick tasks land on fast/cheap models and hard tasks land on strong reasoning models.

子智能体矩阵蜂群:任务是行,候选模型是列,路由器为每一行选中一格, 然后通过 DSH 的 ctx.subagents 蜂群把每格变成一个绑定到所选模型的子智能体并行下放, 达到“按任务难度匹配模型、省时提效”的目标。

What is in the DSH plugin marketplace today

DSH's extension surface is "everything is a plugin", and it ships three intertwined mechanisms rather than one app store:

  1. Bundles — npm packages that declare "dsh": { "bundle": { "patch": "./cordis.patch.yml" } } and contribute a configuration layer. Installed into a profile with dsh plugin --profile <name> add <pkg>; a profile composes them in order. In-box bundles: @deepseek-ai/dsh-base, dsh-web-app, dsh-headless. Discoverability for third-party plugins is the GitHub topic dsh-plugin (e.g. turtle-ui).
  2. Skills — installable task-instruction packs (dsh skill) loaded by the skill capability + a catalog/loader tool; find-skills discovers them.
  3. MCP / examples overlays--patch <cordis.yml> overlays (the examples/ leaves: headless-agent, acp-agent, jsonrpc-agent, mcp-memory, web-cordis, web-schedule).

There is no central hosted registry yet — the "marketplace" is npm packages

  • the dsh-plugin GitHub topic + skills, composed per profile. This bundle is an author-side contribution to that ecosystem.

What this bundle adds

LayerRowEffect
llm-pi-ai overridecfgpu-swarm, openrouter routesRegisters the swarm's model catalog under distinct route keys, so it unions with (never clashes with) the machine's settings-driven cfgpu route
swarm-router insertthe pluginRegisters swarm_route_preview (plan, no model calls) and swarm_dispatch (plan + real parallel subagent fan-out) tools

Model sources

  • cfgpu.com/llm/square — probed live via GET .../userapi/v1/model/v1/models; 18 chat text models declared on the cfgpu-swarm route (OpenAI-compatible). 16 answered /chat/completions with HTTP 200 during capture; 2 thinking models returned a transient 502 and are demoted by the router.
  • OpenRouter-like gateway — an openrouter route (OpenAI-compatible) with a small subset drawn from openrouter.ai/api/v1/models. It needs OPENROUTER_API_KEY; without it the router reports it unavailable and never dispatches to it, so the profile still boots.

The router

Pure, zero-API: scoreModel(model, kind) gates on required capability (reasoning/coding/longContext) then ranks by kind-weighted strength/speed/cost/contextWindow. routeBatch returns assignments + a distinct-models summary (a diverse batch should fan out across several models — the matrix signal), and swarm_dispatch realizes each cell with ctx.subagents.start('spawn', { agentOptions: { provider, model, maxTokens }, toolFilter: { allow: [] } }).

Install

From a DeepSeek Harness checkout where pnpm dsh runs:

pnpm dsh plugin --profile headless add /Users/aiad/Desktop/cfel/routerAI/dsh-swarm-router
pnpm dsh --profile headless --dump-config   # see the # == dsh-swarm-router layer + the two routes

The cfgpu route needs a credential. The machine's $DSH_HOME/.credentials.yaml already carries CFGPU_API_KEY; if you are sandboxed away from ~/.dsh, run the whole profile against a workspace-local DSH_HOME seeded with that credential and a settings.yaml that declares the orchestrator cfgpu route — this is exactly how the benchmark below was run (no network, no ~/.dsh writes):

export DSH_HOME=/Users/aiad/Desktop/cfel/routerAI/.dsh-home   # seeded with .credentials.yaml + settings.yaml
pnpm dsh plugin --profile headless add /Users/aiad/Desktop/cfel/routerAI/dsh-swarm-router
pnpm dsh --profile headless --dump-config | grep -E 'cfgpu-swarm|openrouter|swarm-router'

The installed profile composes [@deepseek-ai/dsh-base, @deepseek-ai/dsh-headless, dsh-swarm-router]; the in-box packages resolve from the maintained $DSH_HOME/profiles/node_modules symlinks, and dsh-swarm-router is link:-ed.

Benchmark

benchmark/benchmark.json is the minimal subset: 5 cheap, heterogeneous tasks spanning fast, reasoning, coding, general (×2 reasoning). Success is judged by content (the expected answer substring / CJK appears), not by the run merely completing. Drive it by asking the headless agent to call swarm_dispatch once with the tasks and print the JSON:

DSH_HOME=… pnpm dsh --profile headless "$(cat benchmark/benchmark_prompt.txt)"

The recorded run (benchmark/benchmark_RESULT.json) routed 5/5 tasks across 4 distinct real cfgpu models — all 5 children returned stopReason: completed with correct answers (17×23=391, bat-and-ball=0.05, a real is_prime, an accurate CJK translation, widgets=5). Verify any run against the expectations:

node benchmark/verify_benchmark.mjs            # uses benchmark_RESULT.json
node benchmark/verify_benchmark.mjs path.json  # or any captured result

The recorded result is 32/32 green.

Files

  • package.json — the dsh.bundle manifest.
  • cordis.patch.yml — the config layer (cfgpu-swarm + openrouter routes, swarm-router row).
  • index.js — the plugin: swarm_route_preview + swarm_dispatch tools.
  • catalog.js — the capability-tagged model catalog (18 cfgpu text models, 3 real OpenRouter ids).
  • router.js — the pure, effort-matched task→model router.
  • benchmark/benchmark.json — the minimal benchmark subset + declarative expectations.
  • benchmark/benchmark_prompt.txt — the headless task that drives the swarm.
  • benchmark/benchmark_RESULT.json — the recorded real run.
  • benchmark/verify_benchmark.mjs — the content-based verifier.