Model Routing System

Route user prompts to AI model tiers with cascading classifier fallbacks.

705|56|Updated Dec 26, 2025
One-click install
npx skills add https://github.com/alinaqi/maggy --skill model-routing-system
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Model Routing System
Source: https://github.com/alinaqi/maggy/tree/main/skills/model-routing
Command: npx skills add https://github.com/alinaqi/maggy --skill model-routing-system

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It solves the problem of getting consistently good, cost-aware answers by automatically classifying each user prompt and delegating it to an appropriate model with cascading fallbacks and verification when the classifier or tools fail.

Core Features & Use Cases

  • 9-tier cost/complexity routing: assigns a tiered model choice based on prompt type, including cheap local classification first and escalation to higher-quality models when needed.
  • Classifier fallback + cached recovery: retries classification across multiple backends and uses a routing cache so routing continues even if Ollama is temporarily unavailable after context compaction.
  • Tool fallback protocol with research evaluation: swaps to external backends (e.g., multi-backend research) and can auto-evaluate results to select better-performing options.
  • Integration with Maggy routing rules: enforces task-type overrides (e.g., security/architecture to Claude, bulk to Gemini Flash-Lite) while mirroring the same tier structure in Maggy.

Quick Start

Ask Claude Code to handle your request normally and let the route-task hook classify the prompt, delegate to the selected tiered model, and fall back automatically if routing or tools fail.

Frequently Asked Questions about Model Routing System

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
What is multi-model routing and how does it manage AI inference costs?

Multi-model routing classifies each prompt by cost and complexity, delegating it to the appropriate AI model tier. This ensures cost-aware inference by using cheaper local classification first and escalating to higher-quality models only when needed.

How do I route prompts to different AI models in Claude Code?

You route prompts to different AI models in Claude Code by submitting your request normally. A hook automatically classifies the prompt through a 9-tier pipeline, delegates it to the selected model, and applies cascading fallbacks if routing or tools fail.

Does the model routing system support fallback recovery after context compaction?

Yes, the model routing system supports fallback recovery after context compaction. It uses a routing cache to maintain routing continuity and retries classification across multiple backends if local tools like Ollama become temporarily unavailable.

Can I use specific AI models for security architecture and bulk extraction tasks?

Yes, you can use specific models for tasks like security architecture and bulk extraction. The system enforces task-type overrides, routing security and architecture prompts to Claude while delegating bulk extraction tasks to Gemini Flash-Lite.

What happens when the prompt classifier fails during multi-model routing?

When the prompt classifier fails during multi-model routing, the system executes a tool fallback protocol. It swaps to external research backends and can auto-evaluate results to select the better-performing option, ensuring reliable output.