[claude] Implement three-tier metabolic LLM router (#966) #1160
Reference in New Issue
Block a user
Delete Branch "claude/issue-966"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #966
What was done
MetabolicRouterinsrc/infrastructure/router/metabolic.pythat routes LLM tasks to the cheapest-sufficient model tier (T1/T2/T3)classify_complexity(task, state)uses keyword matching and game state signals (stuck, active_quests, dialogue_active, combat_active) to pick the right tierbuild_prompt(state, ui_state, text, visual_context)assembles OpenAI-compatible message lists from game contextworld.act(CommandInput("pause"))and always unpauses in afinallyblock — graceful if no world adapter is wiredget_metabolic_router()infrastructure/router/__init__.pypytestmark = pytest.mark.unitso tests run intox -e unitTest results