AI Task Router for Openclaw

A regex-based intelligent dispatcher that routes AI tasks to the most cost-effective model based on prompt complexity.

theshadowrose
v1.0.0
Mar 12, 2026
0
1.4k
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install task-complexity-router

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install task-complexity-router using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is AI Task Router?

The AI Task Router is a specialized tool designed to solve the problem of escalating API costs in AI-driven workflows. By utilizing a tiered model architecture, it analyzes incoming prompts and directs them to the most appropriate engine. This approach ensures that basic interactions are handled by free, local resources while high-stakes reasoning is reserved for premium models.

Integrating this logic into your Openclaw Skills allows you to maintain high performance and intelligence without the linear cost scaling usually associated with high-end LLMs. It bridges the gap between local privacy and cloud-based power, providing a hybrid solution that is both fast and economical.

AI Task Router Use Cases

  • Automatically routing basic greetings and administrative queries to local Ollama instances to save tokens.
  • Identifying code review or debugging requests and escalating them to premium models like Claude Opus.
  • Managing mid-tier creative writing or data analysis tasks by dispatching them to balanced models like Claude Sonnet.
  • Building cost-aware automation pipelines that prioritize local processing for sensitive or repetitive data tasks using Openclaw Skills.

How AI Task Router Works

  1. The prompt is intercepted by the Task Router before reaching an LLM provider.
  2. The system runs a series of regex-based pattern matching rules to identify the task's complexity level.
  3. The router classifies the task into one of three categories: Simple, Moderate, or Complex.
  4. Based on the classification, the task is dispatched to the pre-configured model endpoint (Local, Mid-tier, or Premium).
  5. The system returns the model's response along with routing metadata, such as the reason for the selection and confidence scores.

AI Task Router Setup

To get started with the AI Task Router within your Openclaw Skills environment, follow these steps:

# Navigate to your skill directory
cd your-openclaw-project/skills

# Clone or download the task router source
npm install ./ai-task-router

Initialize the router in your main application logic:

const { TaskRouter } = require('./src/task-router');

const router = new TaskRouter({
  defaultModel: 'local',
  escalationModel: 'sonnet',
  heavyModel: 'opus'
});

AI Task Router Data Schema & Taxonomy

The skill utilizes a structured rule system to determine routing. You can view and modify the schema in the configuration file:

Attribute Description Data Type
name Descriptive name of the routing rule String
pattern The regular expression used to match the prompt RegExp
model The identifier of the model to be used if matched String
reason Explanation for why this specific model was chosen String
confidence The weight or priority assigned to this rule Float

AI Task Router Advanced Features

  • Custom Regex Rules: Power users can inject domain-specific patterns to ensure industry-specific terminology is always routed to high-reasoning models.
  • Cost Optimization Analytics: Built-in logic to track the distribution of tasks across local and cloud providers.
  • Dynamic Escalation: Capability to re-route a task if the initial local model response does not meet specific quality or length thresholds.
  • Multi-Agent Integration: Seamlessly works alongside other Openclaw Skills to provide a unified, cost-aware AI assistant interface.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*