query-router

Unified query router combining content-type detection, complexity scoring, and prefix-based routing. Routes queries to the optimal model with safety features (lock protection, verify-after-switch, rollback, audit logs). Use when: route this query, which model should I use, classify this, route to optimal model, query type, auto-select model, @codex, @mini, @cl, @q.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "query-router" with this command: npx skills add walterwkchoy/query-router

Query Router

Routes every query to its best-fit model using three routing strategies combined:

  1. Prefix routing — explicit user intent (@codex, @mini, etc.)
  2. Content-type detection — auto-detect vision/voice/tool/code/reasoning/qa
  3. Complexity scoring — simple/moderate/complex tier routing

Usage

Classify only

python3 skills/query-router/scripts/classify.py [--json] [--attachment .ext] <query>

Route (classify + switch model)

python3 skills/query-router/scripts/router.py [--json] [--dry-run] [--attachment .ext] <query>

Safety & Audit

python3 skills/query-router/scripts/router.py --check           # list available models
python3 skills/query-router/scripts/router.py --audit            # show recent routing log
python3 skills/query-router/scripts/router.py --no-lock          # disable lock protection
python3 skills/query-router/scripts/router.py --dry-run --no-verify  # preview without verify

Library usage

from router import route_query

result = route_query(
    query="@codex write a complex python script",
    has_attachment=False,
    attachment_ext="",
    dry_run=True,       # True = preview, False = actually switch
    enable_lock=True,   # prevent concurrent routing
    enable_verify=True, # readback verify after switch
    enable_rollback=True,  # revert on failure
)
print(result["action"])        # route | recommend | skip | blocked
print(result["to_model"])      # recommended model name
print(result["classification"]) # full classification details

Routing Priority

PrioritySignalExampleBehavior
1Prefix@codex write a scriptForce switch to @codex model
2Content-type (≥60%% conf)describe this imageAuto-switch to vision model
3Complexity (<60%% conf)analyze Q3 dataRoute by complexity tier
4Skip (<30%% conf)hi how are youKeep current model

Prefix Routing

PrefixModelAliases
@codexopenai-codex/gpt-5.3-codex@c
@miniminimax-m2.7:cloudCloud primary
@clqwen3-coder-next:cloudCloud code
@qminimax-m2.7:cloudCloud fast Q&A
@llavaqwen3.5:cloudCloud vision
@whisperwhisper

Content Types

TypeDetected ByBest Model
visionImage attachment or "describe/identify"qwen3.5:cloud
voiceAudio file or "transcribe/speech-to-text"whisper
toolrun, fetch, send, check, syncminimax-m2.7:cloud
codescript, function, import, debugqwen3-coder-next:cloud
reasoninganalyze, compare, plan, thinkminimax-m2.7:cloud
qawhat is, how does, defineminimax-m2.7:cloud

Complexity Tiers

TierPatternModel
simplegreetings, one-liners, short questionsminimax-m2.7:cloud
moderateemails, analysis, search, translateminimax-m2.7:cloud
complexmulti-file code, deep research, architectminimax-m2.7:cloud

Safety Features

  • Lock protection — prevents concurrent routing ops (fcntl)
  • Verify-after-switch — confirms model actually changed
  • Rollback — reverts to previous model on failure
  • Audit log — JSONL log at scripts/.logs/router.log.jsonl

Merged Approaches

SourceTechnique
openclaw-model-router-skillPrefix syntax @codex/@mini, lock + verify + rollback
task-complexity-routerComplexity tier scoring (simple/moderate/complex)
query-router (original)Content-type detection (vision/voice/tool/code/qa)

All three combined into one unified router with confidence-based priority.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

Gigo Lobster Resume

🦞 GIGO · gigo-lobster-resume: 续跑入口:v2 stable 当前会清理旧 checkpoint 并从头重跑;保留此 slug 作为旧 checkpoint 兼容入口。 Triggers: 继续试吃 / 恢复评测 / resume tasting / continue lobster...

Registry SourceRecently Updated
General

YiHui CONTEXT MODE

context-mode is an MCP server that saves 98% of your context window by sandboxing tool outputs. It routes large file reads, shell outputs, and web fetches th...

Registry SourceRecently Updated
General

xinyi-drink

Use when users ask about 新一好喝/新一咖啡 drinks, stores, menu, activities, Skill用户大礼包, today drink recommendations, afternoon tea, feeling sleepy, or personalized...

Registry SourceRecently Updated
General

vedic-destiny

吠陀命盘分析中文入口。用于完整命盘研判、命主盘 Rashi chart 与九分盘 Navamsha chart 联读、既往事件回看、出生时间稳定度判断、事业主题、婚姻主题、时空盘专题,以及基于 Jagannatha Hora PDF、星盘截图或文本命盘数据的系统拆盘。当用户提到完整星盘、事业方向、婚姻问题、关系窗...

Registry SourceRecently Updated