diff --git a/internal/db/db.go b/internal/db/db.go index b05fce6b..7b200cf4 100644 --- a/internal/db/db.go +++ b/internal/db/db.go @@ -203,21 +203,72 @@ func (db *DB) RunMigrations() error { // Seed default model groups defaultGroups := []struct { - id, strategy, targets, selectorModel string + id, strategy, targets, selectorModel, heuristicRules string complexityThreshold, logicLevel *int primaryUse *string }{ - {"deepseek-auto", "heuristic", `["deepseek-chat","deepseek-reasoner"]`, "", nil, nil, nil}, - {"openai-auto", "heuristic", `["gpt-4o-mini","gpt-4o"]`, "", nil, nil, nil}, - {"gemini-auto", "heuristic", `["gemini-3.5-flash-lite","gemini-3.1-flash-lite","gemini-2.5-flash"]`, "", nil, nil, nil}, - {"heavy-logic", "heuristic", `["grok-4.3","kimi-k2.6","deepseek-v4-pro"]`, "", nil, intPtr(9), strPtr("Complex Coding, Logic, Agents.")}, - {"standard-pro", "heuristic", `["gpt-5.4-mini","gemini-3.5-flash-lite"]`, "", nil, intPtr(5), strPtr("General Assistant, Long Docs.")}, - {"fast-flow", "heuristic", `["deepseek-v4-flash","gpt-5.4-nano"]`, "", nil, intPtr(2), strPtr("Classification, JSON, Basic Q&A.")}, - {"dispatcher", "classifier", `["fast-flow","standard-pro","heavy-logic"]`, "gpt-5.4-nano", intPtr(10), nil, strPtr("Auto-dispatches to tier groups by complexity.")}, + {"deepseek-auto", "heuristic", `["deepseek-chat","deepseek-reasoner"]`, "", "", nil, nil, nil}, + {"openai-auto", "heuristic", `["gpt-4o-mini","gpt-4o"]`, "", "", nil, nil, nil}, + {"gemini-auto", "heuristic", `["gemini-3.5-flash-lite","gemini-3.1-flash-lite","gemini-2.5-flash"]`, "", "", nil, nil, nil}, + {"heavy-logic", "heuristic", `["grok-4.3","kimi-k2.6","deepseek-v4-pro"]`, "", "", nil, intPtr(9), strPtr("Complex Coding, Logic, Agents.")}, + {"standard-pro", "heuristic", `["gpt-5.4-mini","gemini-3.5-flash-lite"]`, "", "", nil, intPtr(5), strPtr("General Assistant, Long Docs.")}, + {"fast-flow", "heuristic", `["deepseek-v4-flash","gpt-5.4-nano"]`, "", "", nil, intPtr(2), strPtr("Classification, JSON, Basic Q&A.")}, + {"dispatcher", "classifier", `["fast-flow","standard-pro","heavy-logic"]`, "gpt-5.4-nano", "", intPtr(10), nil, strPtr("Auto-dispatches to tier groups by complexity.")}, + {"dustins_stack", "heuristic", `["mimo-v2.5","deepseek-v4-pro","grok-4.3","mimo-v2.5-pro","deepseek-v4-flash","kimi-2.6"]`, "", `[ + { + "rule_id": "multimodal_tier", + "description": "Multimodal input routes to high-throughput multimodal models.", + "conditions": { "has_multimodal_input": true }, + "primary_model": "mimo-v2.5", + "fallback_model": "mimo-v2.5-pro" + }, + { + "rule_id": "ultra_long_context", + "description": "Massive context/document processing (>128k tokens) routes to long-context specialists.", + "conditions": { "min_input_tokens": 128000 }, + "primary_model": "kimi-2.6", + "fallback_model": "deepseek-v4-pro" + }, + { + "rule_id": "agentic_code_and_tools", + "description": "Tool-heavy agent loops (MCP, repo editing, SWE) to MiMo Pro.", + "conditions": { "requires_tool_calling": true, "any_of_tags": ["swe-bench", "tool-heavy"] }, + "primary_model": "mimo-v2.5-pro", + "fallback_model": "deepseek-v4-pro" + }, + { + "rule_id": "reasoning_heavy", + "description": "Deep reasoning, architecture, system design, and math.", + "conditions": { "requires_reasoning": true }, + "primary_model": "deepseek-v4-pro", + "fallback_model": "grok-4.3" + }, + { + "rule_id": "realtime_and_creative", + "description": "Real-time web search, open-ended synthesis, or high-creativity tasks.", + "conditions": { "any_of_tags": ["realtime-search", "creative", "synthesis"] }, + "primary_model": "grok-4.3", + "fallback_model": "mimo-v2.5-pro" + }, + { + "rule_id": "fast_flow_tier", + "description": "Short simple text, no reasoning, no tools.", + "conditions": { "max_input_tokens_lt": 16000, "requires_reasoning": false, "requires_tool_calling": false }, + "primary_model": "deepseek-v4-flash", + "fallback_model": "mimo-v2.5" + }, + { + "rule_id": "regional_fallback_general", + "description": "Catch-all default rule.", + "conditions": { "is_default_fallback": true }, + "primary_model": "deepseek-v4-pro", + "fallback_model": "deepseek-v4-flash" + } +]`, nil, nil, strPtr("Dustin's personal agent stack. No Gemini.")}, } for _, g := range defaultGroups { - db.Exec(`INSERT OR IGNORE INTO model_groups (id, strategy, targets, selector_model, complexity_threshold, logic_level, primary_use) VALUES (?, ?, ?, ?, ?, ?, ?)`, - g.id, g.strategy, g.targets, nilStr(g.selectorModel), g.complexityThreshold, g.logicLevel, g.primaryUse) + db.Exec(`INSERT OR IGNORE INTO model_groups (id, strategy, targets, selector_model, heuristic_rules, complexity_threshold, logic_level, primary_use) VALUES (?, ?, ?, ?, ?, ?, ?, ?)`, + g.id, g.strategy, g.targets, nilStr(g.selectorModel), nilStr(g.heuristicRules), g.complexityThreshold, g.logicLevel, g.primaryUse) } return nil