Implements external LLM routing via opencode CLI for: - GitHub Copilot (gpt-5.2, claude-sonnet-4.5, claude-haiku-4.5, o3, gemini-3-pro) - Z.AI (glm-4.7 for code generation) - OpenCode native (big-pickle) Components: - mcp/llm-router/invoke.py: Main router with task-based model selection - mcp/llm-router/delegate.py: Agent delegation helper (respects external mode) - mcp/llm-router/toggle.py: Enable/disable external-only mode - mcp/llm-router/providers/: CLI wrappers for opencode and gemini Features: - Persistent toggle via state/external-mode.json - Task routing: reasoning -> gpt-5.2, code-gen -> glm-4.7, long-context -> gemini - Claude tier mapping: opus -> gpt-5.2, sonnet -> claude-sonnet-4.5, haiku -> claude-haiku-4.5 - Session-start hook announces when external mode is active - Natural language toggle support via component registry Plan: gleaming-routing-mercury Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
173 lines
4.8 KiB
JSON
173 lines
4.8 KiB
JSON
{
|
|
"version": "1.0.0",
|
|
"description": "Cost-efficient model selection policy",
|
|
"models": {
|
|
"opus": {
|
|
"use_cases": [
|
|
"Complex reasoning and analysis",
|
|
"Cross-agent coordination",
|
|
"Policy enforcement and validation",
|
|
"Architectural decisions",
|
|
"Ambiguous or nuanced tasks"
|
|
],
|
|
"agents": [
|
|
"personal-assistant",
|
|
"master-orchestrator",
|
|
"k8s-orchestrator",
|
|
"programmer-orchestrator"
|
|
]
|
|
},
|
|
"sonnet": {
|
|
"use_cases": [
|
|
"Standard operations",
|
|
"Well-defined tasks",
|
|
"Routine automation",
|
|
"Code generation and modification",
|
|
"Troubleshooting with clear symptoms"
|
|
],
|
|
"agents": [
|
|
"linux-sysadmin",
|
|
"k8s-diagnostician",
|
|
"argocd-operator",
|
|
"prometheus-analyst",
|
|
"git-operator",
|
|
"code-planner",
|
|
"code-implementer",
|
|
"code-reviewer"
|
|
]
|
|
},
|
|
"haiku": {
|
|
"use_cases": [
|
|
"Simple queries",
|
|
"Status checks",
|
|
"Log parsing",
|
|
"Data extraction",
|
|
"Formatting and summarization"
|
|
],
|
|
"agents": [],
|
|
"delegation_note": "Any agent can delegate simple subtasks to Haiku for cost efficiency"
|
|
}
|
|
},
|
|
"escalation_rules": [
|
|
{
|
|
"from": "haiku",
|
|
"to": "sonnet",
|
|
"triggers": ["task_too_complex", "context_insufficient", "reasoning_required"]
|
|
},
|
|
{
|
|
"from": "sonnet",
|
|
"to": "opus",
|
|
"triggers": ["cross_agent_coordination", "policy_decision", "complex_analysis"]
|
|
}
|
|
],
|
|
"cost_optimization": {
|
|
"default_start": "lowest_capable",
|
|
"log_usage": true,
|
|
"review_frequency": "weekly"
|
|
},
|
|
"skill_delegation": {
|
|
"gmail": {
|
|
"description": "Tiered model selection for email operations",
|
|
"tiers": {
|
|
"haiku": {
|
|
"operations": [
|
|
"count_unread",
|
|
"list_emails",
|
|
"fetch_metadata",
|
|
"simple_search"
|
|
],
|
|
"examples": [
|
|
"How many unread emails?",
|
|
"List emails from sender X",
|
|
"Any emails with attachments?"
|
|
]
|
|
},
|
|
"sonnet": {
|
|
"operations": [
|
|
"summarize_email",
|
|
"summarize_thread",
|
|
"categorize_emails",
|
|
"extract_action_items",
|
|
"group_by_topic"
|
|
],
|
|
"examples": [
|
|
"Summarize this email",
|
|
"What are the OpenAgents notifications about?",
|
|
"Group my emails by project"
|
|
]
|
|
},
|
|
"opus": {
|
|
"operations": [
|
|
"prioritize_inbox",
|
|
"strategic_analysis",
|
|
"cross_reference_context",
|
|
"complex_reasoning"
|
|
],
|
|
"examples": [
|
|
"What should I respond to first?",
|
|
"How does this relate to my current projects?",
|
|
"What's the sentiment across these threads?"
|
|
]
|
|
}
|
|
},
|
|
"default": "haiku",
|
|
"escalate_on": ["insufficient_context", "reasoning_required", "user_dissatisfied"]
|
|
}
|
|
},
|
|
"external_models": {
|
|
"github-copilot/gpt-5.2": {
|
|
"cli": "opencode",
|
|
"cli_args": ["-m", "github-copilot/gpt-5.2"],
|
|
"use_cases": ["reasoning", "fallback"],
|
|
"tier": "opus-equivalent"
|
|
},
|
|
"github-copilot/claude-sonnet-4.5": {
|
|
"cli": "opencode",
|
|
"cli_args": ["-m", "github-copilot/claude-sonnet-4.5"],
|
|
"use_cases": ["general", "fallback"],
|
|
"tier": "sonnet-equivalent"
|
|
},
|
|
"github-copilot/claude-haiku-4.5": {
|
|
"cli": "opencode",
|
|
"cli_args": ["-m", "github-copilot/claude-haiku-4.5"],
|
|
"use_cases": ["simple"],
|
|
"tier": "haiku-equivalent"
|
|
},
|
|
"zai-coding-plan/glm-4.7": {
|
|
"cli": "opencode",
|
|
"cli_args": ["-m", "zai-coding-plan/glm-4.7"],
|
|
"use_cases": ["code-generation"],
|
|
"tier": "sonnet-equivalent"
|
|
},
|
|
"github-copilot/gemini-3-pro-preview": {
|
|
"cli": "opencode",
|
|
"cli_args": ["-m", "github-copilot/gemini-3-pro-preview"],
|
|
"use_cases": ["long-context"],
|
|
"tier": "opus-equivalent"
|
|
},
|
|
"github-copilot/o3": {
|
|
"cli": "opencode",
|
|
"cli_args": ["-m", "github-copilot/o3"],
|
|
"use_cases": ["complex-reasoning"],
|
|
"tier": "opus-equivalent"
|
|
},
|
|
"opencode/big-pickle": {
|
|
"cli": "opencode",
|
|
"cli_args": ["-m", "opencode/big-pickle"],
|
|
"use_cases": ["general"],
|
|
"tier": "sonnet-equivalent"
|
|
}
|
|
},
|
|
"claude_to_external_map": {
|
|
"opus": "github-copilot/gpt-5.2",
|
|
"sonnet": "github-copilot/claude-sonnet-4.5",
|
|
"haiku": "github-copilot/claude-haiku-4.5"
|
|
},
|
|
"task_routing": {
|
|
"reasoning": "github-copilot/gpt-5.2",
|
|
"code-generation": "zai-coding-plan/glm-4.7",
|
|
"long-context": "github-copilot/gemini-3-pro-preview",
|
|
"default": "github-copilot/claude-sonnet-4.5"
|
|
}
|
|
}
|