Repository navigation
feat(skills): add model-task-router — automatic task-to-model routing backed by DeepSWE data #43534
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
50eeec9
78e1564
daabe6b
06007a3
c7c0947
65e25b3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,203 @@ | ||
| --- | ||
| name: model-task-router | ||
| description: Classify tasks and route to the best-fit model. Coding-heavy → delegate_task with a coding model, orchestration → current model directly, mechanical → delegate_task with default subagent model. Configure your preferred coding and architecture models below. | ||
| version: 2.0.0 | ||
| author: Sugumaran Balasubramaniyan (https://github.com/Sugumaran-Balasubramaniyan) | ||
| license: MIT | ||
| metadata: | ||
| hermes: | ||
| tags: [model-routing, task-classification, delegation, multi-model] | ||
| related_skills: [subagent-driven-development] | ||
| --- | ||
|
|
||
| # Model Task Router | ||
|
|
||
| Classify incoming user requests by task type and route to the appropriate model. No manual `/model` switches required. | ||
|
|
||
| ## Why Task-Based Routing | ||
|
|
||
| Different models have different strengths. Benchmarks like DeepSWE and Terminal-Bench show meaningful divergence across task types — a model strong at tool orchestration may not be the best choice for multi-file code generation, and vice versa. Rather than switching models manually, this skill classifies tasks and dispatches automatically. | ||
|
|
||
| ### Data Caveats | ||
|
|
||
| The benchmark data behind this skill has known limitations: | ||
|
|
||
| - **Effort tuning inconsistency**: Some models were benchmarked without the effort-level optimization applied to competitors. Scores for those models may understate capability. | ||
| - **Provider-level quirks**: OpenRouter privacy guardrails (data-training concerns) can block certain providers, causing benchmark failures unrelated to model capability. | ||
| - **Limited community replication**: Independent replications have produced varying results. The published numbers are directional, not definitive. | ||
|
|
||
| **Treat published scores as a starting point, not gospel.** If your experience with a model differs from the data, adjust the routing table below. | ||
|
|
||
| ## Published Model Performance | ||
|
|
||
| DeepSWE (real-world coding, contamination-free) and Terminal-Bench (agentic CLI) scores as of June 2026: | ||
|
|
||
| ### DeepSWE — Real-World Coding | ||
|
|
||
| | Model | SWE-bench Pro | DeepSWE | Notes | | ||
| |-------|:------------:|:-------:|-------| | ||
| | GPT-5.5 (xhigh) | 58.6% | 70% | Best-in-class | | ||
| | GPT-5.4 (xhigh) | 57.7% | 56% | Strong general coding | | ||
| | Claude Opus 4.7 | 64.3% | 54% | Competitive coding | | ||
| | Claude Sonnet 4.6 | — | 32% | Mid-tier | | ||
| | Gemini 3.5 Flash | — | 28% | Budget-aware option | | ||
| | GPT-5.4-Mini | — | 24% | Fast, cheap, delegated | | ||
| | Kimi K2.6 | — | 24% | Budget option | | ||
| | DeepSeek V4-Pro | 55.4% | ~8%* | See caveats below | | ||
|
|
||
| *\*V4-Pro was run at default effort (no tuning) and may have been affected by OpenRouter guardrail 404s. Score directionally suggests lower coding throughput, but magnitude is uncertain. Community replications report 5–8%. Awaiting re-run with proper effort tuning.* | ||
|
|
||
| ### Terminal-Bench — Agentic CLI / Tool Orchestration | ||
|
|
||
| | Model | Score | $/1M Output | | ||
| |-------|:-----:|:-----------:| | ||
| | GPT-5.5 | 82.7% | $30.00 | | ||
| | DeepSeek V4-Pro | 67.9% | $0.87 | | ||
|
|
||
| Source: [DeepSWE leaderboard](https://deepswe.datacurve.ai/), [explainx.ai DeepSWE writeup](https://explainx.ai/blog/deepswe), [Terminal-Bench](https://kilo.ai/leaderboard) | ||
|
|
||
| ## Routing Table | ||
|
|
||
| | Task Category | How | Why | | ||
| |--------------|-----|-----| | ||
| | **Code Generation** (implement, fix, refactor, PR, tests) | `delegate_task` with coding model | Coding models have proven DeepSWE results | | ||
| | **Hard Architecture** (system design, complex debugging, security) | `delegate_task` with architecture model | Highest reasoning capability | | ||
| | **Orchestration** (tools, shell, file ops, diagnostics) | Current model directly | Tool-calling efficiency | | ||
| | **Research** (web search, docs, analysis, planning) | Current model directly | Reasoning + web tools inline | | ||
| | **Mechanical** (grep, find, run tests, simple edits) | `delegate_task` (default subagent model) | Fast, cheap, delegated | | ||
|
|
||
| ### Configuring Your Models | ||
|
|
||
| Set these in your `~/.hermes/config.yaml` or adapt based on what's available: | ||
|
|
||
| ```yaml | ||
| # Coding model — used for implement/fix/refactor/PR tasks | ||
| coding_model: openrouter/openai/gpt-5.4 | ||
|
|
||
| # Architecture model — used for system design, hard debugging, security | ||
| architecture_model: openrouter/openai/gpt-5.5 | ||
|
|
||
| # Your current (orchestrator) model — handles tool calls, research, planning | ||
| # The skill uses whatever model is active; no override needed. | ||
| ``` | ||
|
|
||
| **If you don't configure these, the skill defaults to:** | ||
| - Coding: `openrouter/openai/gpt-5.4` (56% DeepSWE) | ||
| - Architecture: `openrouter/openai/gpt-5.5` (70% DeepSWE) | ||
| - Orchestration/Research: your current model (whatever is active) | ||
| - Mechanical: your configured `delegation.model` (or system default) | ||
|
|
||
| ## Decision Tree | ||
|
|
||
| Priority order: Coding > Architecture > Mechanical > Research > Orchestration. | ||
| First match wins. User can override by prefixing their message with `[route: <category>]`. | ||
|
|
||
| ``` | ||
| User says: "..." | ||
| │ | ||
| ├─ [route: code] or [route: architecture] or [route: mechanical] or [route: direct] | ||
| │ → User override — use the specified route, skip keyword classification | ||
| │ | ||
| ├─ Keywords: "implement", "build", "create", "write code", "fix bug", | ||
| │ "refactor", "add feature", "PR", "patch" | ||
| │ AND task modifies or creates source files | ||
| │ → ROUTE: Coding → delegate_task(model=coding_model, toolsets=[terminal, file, web]) | ||
| │ | ||
| ├─ Keywords: "architecture", "design system", "how would you structure", | ||
| │ "security review", "complex debugging" | ||
| │ AND task is high-stakes, multi-system, or multi-file | ||
| │ → ROUTE: Architecture → delegate_task(model=architecture_model, toolsets=[terminal, file, web]) | ||
| │ | ||
| ├─ Keywords: "search for", "find all", "grep", "list files", | ||
| │ "run tests", "check if", "what's the content of" | ||
| │ AND task is purely mechanical (read-only or single command) | ||
| │ → ROUTE: Mechanical → delegate_task with default subagent model | ||
| │ | ||
| ├─ Keywords: "research", "summarize", "what is", "explain", | ||
| │ "look up", "search the web for" | ||
| │ → ROUTE: Research → handle directly with current model | ||
| │ | ||
| └─ Everything else: tool calls, shell, navigation, diagnostics, config, planning | ||
| → ROUTE: Orchestration → handle directly with current model | ||
| ``` | ||
|
|
||
| ### User Override | ||
|
|
||
| Prefix any message with `[route: code]`, `[route: architecture]`, `[route: mechanical]`, or `[route: direct]` to override automatic classification. Example: | ||
|
|
||
| > [route: direct] Fix this typo in README.md | ||
|
|
||
| This forces direct handling even though "fix" would normally trigger a coding dispatch. Use for small one-liner fixes. | ||
|
|
||
| ## Dispatch Mechanism | ||
|
|
||
| ### For Coding Tasks → delegate_task | ||
|
|
||
| ```python | ||
| delegate_task( | ||
| goal="<full task description>", | ||
| context="""<file paths, error messages, constraints, existing code, project context>""", | ||
| model="openrouter/openai/gpt-5.4", # your coding_model | ||
| toolsets=["terminal", "file", "web"] | ||
| ) | ||
| ``` | ||
|
|
||
| ### For Architecture Tasks → delegate_task | ||
|
|
||
| ```python | ||
| delegate_task( | ||
| goal="<architecture question with full context>", | ||
| context="""<system description, constraints, trade-offs to evaluate>""", | ||
| model="openrouter/openai/gpt-5.5", # your architecture_model | ||
| toolsets=["terminal", "file", "web"] | ||
| ) | ||
| ``` | ||
|
|
||
| ### For Mechanical Tasks → delegate_task (default model) | ||
|
|
||
| ```python | ||
| delegate_task( | ||
| goal="<mechanical task>", | ||
| context="""<what to search, where, what to report back>""", | ||
| toolsets=["terminal", "file"] | ||
| ) | ||
| ``` | ||
|
|
||
| ### For Orchestration/Research → Handle Directly | ||
|
|
||
| Use your current model inline. Do NOT delegate or spawn. Handle tool calls directly. | ||
|
|
||
| See also: `subagent-driven-development` skill for the full delegation workflow (spec review → quality review → verify). | ||
|
|
||
| ## Dispatch Checklist | ||
|
|
||
| When delegating a coding or architecture task: | ||
|
|
||
| 1. **Pack all context**: The subagent has no memory of your conversation. Include file paths, error messages, constraints, and relevant code. | ||
| 2. **Verify results**: Subagents self-report "completed" when they haven't. Always read the modified file or run the test before reporting to the user. | ||
| 3. **Retry once if needed**: If the subagent fails, try once more with more specific instructions, then report the blocker. | ||
| 4. **Announce the routing**: Short message like "Routing to GPT-5.4 for implementation..." keeps the user informed. | ||
|
|
||
| ## Anti-Patterns | ||
|
|
||
| - **Do NOT delegate orchestration.** The current model handles tool-calling; delegation adds overhead for no benefit. | ||
| - **Do NOT delegate one-liner fixes.** Use `[route: direct]` for trivial edits. | ||
| - **Do NOT skip verification.** Subagents can hallucinate completion. Read files, run tests, confirm. | ||
| - **Do NOT delegate without context.** Pack every relevant detail into the `context` field. | ||
| - **Do NOT use the architecture model for routine coding.** It's overkill; save it for hard problems. | ||
|
|
||
| ## Pitfalls | ||
|
|
||
| - **`delegate_task` model parameter**: Only supported for agents with the delegation toolset. If your deployment doesn't support per-task model overrides, coding and architecture tasks will use your default subagent model — still useful, but won't get the specialized model benefit. | ||
| - **Rate limits**: Multiple models share provider-level rate limits. If one dispatch fails, try the other or fall back to the current model. | ||
| - **Context budget**: Each `delegate_task` summary adds tokens. Don't delegate trivial tasks; use `[route: direct]` instead. | ||
|
|
||
| ## Related Hermes Issues | ||
|
|
||
| - [#30652](https://github.com/NousResearch/hermes-agent/issues/30652) — Dynamic model routing based on task complexity (open, P3) | ||
| - [#16525](https://github.com/NousResearch/hermes-agent/issues/16525) — Expose model_switch as agent-callable tool (open, P3) | ||
| - [#18591](https://github.com/NousResearch/hermes-agent/issues/18591) — Per-task model override for delegate_task (open) | ||
|
|
||
| ## References | ||
|
|
||
| - `references/deepswe-routing-data.md` — Full benchmark data, cost analysis, and caveats | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| # DeepSWE Routing Data — Reference | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The "solve-rate findings retracted" headline of issue #21 is the entire load-bearing claim of this PR. Issue #21 is the only place the 8% solve rate and 12.5 attempts/solve come from — and the author of that issue has explicitly retracted the solve-rate half ("Sections discussing solve rates should be considered retracted") after reproducing the model on the same tasks and solving all three that DeepSWE marked failed. The 92% first-attempt-failure rate and "V4-Pro should not code" recommendation in this PR are built entirely on the retracted half. The cost-correction half of the issue is valid and useful, but it doesn't support a routing recommendation by itself — cost and reliability are different axes, and the issue itself flags the reliability number as not reproducible. If you keep this PR, you need either (a) a new published DeepSWE result for V4-Pro with proper effort tuning, or (b) your own reproducible benchmark, before you can recommend against V4-Pro for coding tasks. See the main review for the data-integrity breakdown. |
||
| > **Updated 2026-06-11**: Full model table with published and community-verified data. All solve-rate claims from DeepSWE issue #21 were retracted by the issue author (2026-06-08) after discovering a test-setup error. The cost-correction analysis in that issue remains valid and is included below. Treat DeepSWE scores as directional — effort tuning, provider routing, and limited replication all introduce uncertainty. | ||
|
|
||
| ## The Evidence | ||
|
|
||
| DeepSWE ([deepswe.datacurve.ai](https://deepswe.datacurve.ai)) is a contamination-free, real-complexity coding benchmark. Tasks are written from scratch, require ~5.5x more code than SWE-bench Pro, and span 91 repositories across 5 languages. | ||
|
|
||
| ## Full DeepSWE Results (Published + Community) | ||
|
|
||
| | Model | SWE-bench Pro | DeepSWE | Delta | Notes | | ||
| |-------|:------------:|:-------:|:-----:|-------| | ||
| | GPT-5.5 (xhigh) | 58.6% | **70%** | +11 | Best-in-class | | ||
| | GPT-5.4 (xhigh) | 57.7% | **56%** | −2 | Strong general coding | | ||
| | Claude Opus 4.7 | 64.3% | **54%** | −10 | Competitive coding | | ||
| | Claude Sonnet 4.6 | — | 32% | — | Mid-tier | | ||
| | Gemini 3.5 Flash | — | 28% | — | Budget-aware | | ||
| | GPT-5.4-Mini | — | 24% | — | Fast, cheap, delegated | | ||
| | Kimi K2.6 | — | 24% | — | Budget option | | ||
| | DeepSeek V4-Pro | 55.4% | ~8%* | −47 | See caveats below | | ||
|
|
||
| ### V4-Pro Caveats | ||
|
|
||
| The ~8% DeepSWE score for V4-Pro comes with significant methodological concerns documented in [DeepSWE issue #21](https://github.com/datacurve-ai/deep-swe/issues/21): | ||
|
|
||
| 1. **No effort tuning**: V4-Pro was run at `reasoning_effort: null` while all other models had tuned effort levels (xhigh, max, medium). Thinking mode was left on but unoptimized. | ||
| 2. **OpenRouter guardrail 404s**: OpenRouter blocks DeepSeek by default (data-training privacy concern). API calls may have returned 404 errors rather than model failures. | ||
| 3. **Limited replication**: Community member `ivanfioravanti` ran an independent test via direct DeepSeek API and got ~5.3% (similar direction). No independent confirmation with proper effort tuning exists yet. | ||
| 4. **Solve-rate claims from issue #21 retracted**: The issue author retracted their own solve-rate analysis after discovering a test-setup error. | ||
|
|
||
| **Bottom line**: V4-Pro likely underperforms GPT-5.4/5.5 on coding tasks, but the magnitude of the gap is uncertain pending a re-run with proper effort tuning. Configure your routing accordingly. | ||
|
|
||
| ## Cost Analysis (from DeepSWE Issue #21 — Valid) | ||
|
|
||
| DeepSeek V4-Pro pricing includes cache-hit rates at $0.0036/M (99.2% off cache-miss). DeepSWE's reported costs billed all tokens at the miss rate ($0.435/M). In real-world agent runs, ~78% of tokens are cache hits. | ||
|
|
||
| ### Corrected Cost per Task (Cache-Adjusted) | ||
|
|
||
| | Model | DeepSWE | Reported Cost | Corrected Cost | Factor | | ||
| |-------|:-------:|:------------:|:--------------:|:------:| | ||
| | GPT-5.5 | 70% | $6.61/task | — | — | | ||
| | GPT-5.4 | 56% | $4.38/task | — | — | | ||
| | GPT-5.4-Mini | 24% | $2.08/task | — | — | | ||
| | DeepSeek V4-Pro | 8% | $4.22/task | ~$0.30/task | ~14× inflation | | ||
|
|
||
| Source: Reproducible analysis script in issue #21 by `agentecobuilder`. Verified independently. | ||
|
|
||
| **Key finding**: V4-Pro's per-task cost was inflated ~14× by ignoring cache-hit pricing. The real cost is very low (~$0.30/task). However, cost-per-task ignores solve rate — if a model requires many retries, the effective cost-per-solve may be higher despite low per-token pricing. Since the solve rate is uncertain (see caveats), cost-per-solve calculations are withheld pending a proper re-benchmark. | ||
|
|
||
| ### Additional Cost Considerations | ||
|
|
||
| - **OpenRouter 5% fee** for high-usage accounts adds to all OpenRouter-routed models | ||
| - **Reasoning tokens**: Thinking-mode models generate hidden reasoning tokens that are billed but not shown in output token counts | ||
| - **Provider pricing volatility**: DeepSeek and other providers adjust pricing frequently; verify current rates | ||
|
|
||
| ## Terminal-Bench (Agentic CLI) | ||
|
|
||
| | Model | Score | $/1M Output | | ||
| |-------|:-----:|:-----------:| | ||
| | GPT-5.5 | 82.7% | $30.00 | | ||
| | DeepSeek V4-Pro | 67.9% | $0.87 | | ||
|
|
||
| V4-Pro is competitive at tool orchestration and CLI tasks — a different skill set from code generation. This supports the routing strategy: coding → specialized coding models, orchestration → efficient orchestrator. | ||
|
|
||
| ## Routing Principles | ||
|
|
||
| 1. **Route based on task type, not model brand loyalty.** Different models excel at different things. | ||
| 2. **Treat published benchmarks as directional.** Real-world experience with your actual tasks is the best calibration. | ||
| 3. **Configure coding/architecture models explicitly.** Don't rely on the orchestrator model for code generation if there's a stronger option. | ||
| 4. **Verify subagent results.** No benchmark score guarantees a correct implementation. Always read the output. | ||
|
|
||
| ## Sources | ||
|
|
||
| - DeepSWE Leaderboard: https://deepswe.datacurve.ai/ | ||
| - DeepSWE Issue #21 (cost correction, caveats): https://github.com/datacurve-ai/deep-swe/issues/21 | ||
| - explainx.ai DeepSWE analysis: https://explainx.ai/blog/deepswe | ||
| - Terminal-Bench / Kilo Leaderboard: https://kilo.ai/leaderboard | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The orchestration routing is hardcoded as
Current (V4-Pro). Anyone running Hermes on Claude, Gemini, MiniMax M3, or any other model is silently misrouted — the orchestrator is the user's own current model, not V4-Pro. Read the active model from environment / config and only override for tasks where the routing data is strong (which, per the rest of this review, is currently not the case for any task).