command-router

command-router is a command for Cursor from wangqiqi/cursor-ai-rules. It costs 25 tokens per session (5,707 once invoked), scanned A, original, MIT.

A command router that interprets a user's request and sends it to matching tools, rules, scripts, skills, workflows, or AI roles. MCP is a standard way for an AI assistant to call external tools.

In plain words
What is it for?
It helps route requests by intent, check which tools are available, run the selected capabilities, switch among configured AI roles, and combine the results.
Why use it?
It removes the need to remember separate command names and chooses available tools first for tasks such as Git operations, browser automation, and testing.

Command for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/wangqiqi/cursor-ai-rules/command-router
Clone the repo
git clone --depth 1 https://github.com/wangqiqi/cursor-ai-rules

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for command-router

README.md
[![agentmods](https://agentmods.dev/badge/commands/wangqiqi/cursor-ai-rules/command-router.svg)](https://agentmods.dev/commands/wangqiqi/cursor-ai-rules/command-router)
Your own site
<a href="https://agentmods.dev/commands/wangqiqi/cursor-ai-rules/command-router"><img src="https://agentmods.dev/badge/commands/wangqiqi/cursor-ai-rules/command-router.svg" alt="Measured on agentmods" height="20"></a>
Per session 25 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 5,707 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00025 $0.05707
Opus 5 $0.00013 $0.02854
Sonnet 5 $0.00005 $0.01141
Haiku 4.5 $0.00003 $0.00571

Measured 3d ago against content hash 22f2bf9227c5, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

command-router scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/commands/command-router.md · 841 lines

How it starts

The opening of the file, as written. The whole thing — 841 lines — stays where its author put it; the contents beside it link to each section on GitHub.

🎯 统一命令路由器 (Unified Command Router)

版本: v4.3.0 | 最后更新: {{GENERATION_TIME}} | 作者: wangqiqi (https://github.com/wangqiqi)

🧠 核心理念:意图驱动的统一执行引擎

颠覆传统调用模式:不再需要用户记忆各种规则、技能、脚本的调用语法,通过智能意图解析,自动路由到最合适的执行组合。

🎭 角色系统智能路由:支持21种AI人格的智能切换,包含昵称呼叫、角色管理和个性化体验。系统会根据用户意图自动选择最适合的人格,或通过昵称快速呼叫特定角色。

🎯 MCP优先级路由机制

核心创新:MCP Tools 优先调用

// MCP优先级检查流程
async function routeWithMCPPriority(intent: IntentAnalysis): Promise<ExecutionResult> {
  // 1. 检测MCP工具可用性
  const mcpAvailability = await checkMCPToolsAvailability(intent);

  // 2. 如果有高优先级MCP工具,直接使用
  if (mcpAvailability.hasHighPriorityTools()) {
    return await executeMCPTools(mcpAvailability.getHighPriorityTools());
  }

  // 3. 否则回退到传统能力执行
  return await executeTraditionalCapabilities(intent);
}

优先级策略:

  • 高优先级 (High): Git操作、浏览器自动化、测试执行等确定性任务
  • 中优先级 (Medium): 数据处理、文档操作等半确定性任务
  • 低优先级 (Low): 通用AI推理、复杂决策等不确定性任务

🎯 工作原理

graph TD
    A[用户输入] --> B[意图预解析]
    B --> C[MCP可用性检测]
    C --> D[上下文感知]
    D --> E[能力映射查询]
    E --> F[MCP优先级路由]
    F --> G{有可用MCP工具?}
    G -->|是| H[MCP工具执行]
    G -->|否| I[传统能力执行]
    H --> J[结果反馈]
    I --> J

    K[规则系统] --> I
    L[技能系统] --> I
    M[脚本系统] --> I
    N[钩子系统] --> I

🏗️ 系统架构

核心组件

interface UnifiedCommandRouter {
  // 意图解析
  parseIntent(input: string): IntentAnalysis;

  // 能力映射
  mapCapabilities(intent: IntentAnalysis): CapabilitySet;

  // 执行编排
  orchestrateExecution(capabilities: CapabilitySet): ExecutionPlan;

  // 智能执行
  executePlan(plan: ExecutionPlan): ExecutionResult;
}

interface IntentAnalysis {
  primaryIntent: string;        // 主要意图
  secondaryIntents: string[];   // 次要意图
  confidence: number;           // 置信度
  context: ContextData;         // 上下文信息
  parameters: Record<string, any>; // 参数提取
}

interface CapabilitySet {
  mcp_tools: MCPTool[];        // MCP工具优先级列表
  rules: string[];             // 需要激活的规则
  skills: string[];            // 需要调用的技能
  scripts: string[];           // 需要执行的脚本
  hooks: string[];             // 需要触发的钩子
  workflows: string[];         // 需要执行的工作流
}

interface MCPTool {
  intent: string;              // 意图标识
  tool: string;                // MCP工具名称
  server: string;              // MCP服务器名称
  priority: 'high' | 'medium' | 'low'; // 优先级
  available?: boolean;         // 是否可用
}

Read the full file on GitHub · 841 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 841 lines · 25 tokens per session scan A 22f2bf9227c5

Subscribe to this mod's changes

command-router is a command published in the GitHub repository wangqiqi/cursor-ai-rules (15 stars, last pushed 3mo ago), licensed MIT. It adds 25 tokens to every session and 5,707 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.