← 返回
未分类 中文

Query Router

Unified query router combining content-type detection, complexity scoring, and prefix-based routing. Routes queries to the optimal model with safety features...
统一查询路由器,融合内容类型检测、复杂度评分和前缀路由,将查询导向最优模型,并具备安全特性。
walterwkchoy walterwkchoy 来源
未分类 clawhub v1.1.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 369
下载
💾 0
安装
1
版本
#latest

概述

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.

版本历史

共 1 个版本

  • v1.1.0 当前
    2026-05-07 05:41 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-agent

self-improving agent

pskoett
记录自身发现以实现自我改进的技能
★ 4,130 📥 891,186
ai-agent

Skill Vetter

spclaudehome
AI智能体技能安全预审工具。安装ClawdHub、GitHub等来源技能前,检查风险信号、权限范围及可疑模式。
★ 1,245 📥 271,955
ai-agent

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,423 📥 326,080