# Model Routing Instructions

Copy-paste this into your AGENTS.md or system prompt for smart model routing.

## Priority Order
1. **Local models first** (always, unless urgency is explicit)
2. **ChatGPT Auth** for urgent SQL/DAX/VBA or when user says "fast"/"urgent"
3. **OpenRouter/DeepSeek** as backup only
4. **Qwen3-235B, MiniMax M2.5/M2.7** require explicit user approval

## Urgency Detection
- "urgent", "ASAP", "fast", "quick", "need this now" → **Instant** mode
- "today", "EOD", "deadline" → **Today** mode
- "this week", "no hurry" → **This Week** mode
- "no rush", "save cost", "whenever", "cheap" → **Savings** mode (local only)

## SQL/DAX/VBA Fast Path
- Small fixes with urgency → ChatGPT Auth first
- No urgency → Qwen3-Coder-30B local first
- Always provide corrected full query/code
- No over-explaining

## Cost Guards
- Never use ChatGPT for tasks local models can handle
- Never use OpenRouter/DeepSeek as first choice
- Always show context packet before paid model calls
- Approval required for Qwen3-235B, MiniMax M2.5/M2.7

## Model Selection
- Quick coding → Qwen2.5-Coder-7B (local, port 8085)
- Complex coding → Qwen3-Coder-30B (local, port 8083)
- Hard thinking → Qwen3.6-35B (local, port 8081)
- Routing/classification → Llama-3.2-3B or SmolLM3-3B (local)
- Urgent SQL/DAX/VBA → ChatGPT Auth
- Backup → OpenRouter (qwen/qwen3-coder) or DeepSeek

## Context Packet Required
Before using any paid model, show the appropriate packet:

**Full packet:**
```
GOAL:
URGENCY:
DEADLINE:
RISK LEVEL:
TASK SIZE:
COST PRIORITY:
FILES:
ERROR:
WHAT I TRIED:
CONSTRAINTS:
EXPECTED OUTPUT:
WHY ESCALATION IS NEEDED:
MODEL RECOMMENDED:
RECOMMENDED PATH:
WHY THIS PATH:
```

**Quick SQL/DAX/VBA packet:**
```
GOAL:
QUERY/CODE:
ERROR OR ISSUE:
EXPECTED OUTPUT:
DEADLINE:
MODEL PATH:
```
