External Model Delegation Pattern
CommunityRoute prompts to the best model automatically.
Software Engineering#cost optimization#Claude Code hooks#model tiers#CLI scripting#prompt routing#multi-model orchestration#llm delegation
Authoralinaqi
Version1.0.0
Installs0
System Documentation
What problem does it solve?
It solves the problem of getting inconsistent quality or cost blowups when deciding which LLM to run for each user request.
Core Features & Use Cases
- Cost/Performance Tier Routing: Classifies every prompt into six tiers (QWEN, DEEPSEEK_FLASH, DEEPSEEK_PRO, KIMI, CODEX, CLAUDE) and selects a delegation command accordingly.
- Deterministic Delegation Script Contract: Requires delegator scripts to accept the prompt as the first argument, support specific flags (like deepseek flash/pro and kimi quiet), write the result to stdout, and use exit codes to signal success or failure.
- Hook-Injected Additional Context: Uses a
UserPromptSubmithook to inject delegation instructions intoadditionalContextso Claude executes the routed script and returns its output to the user.
Quick Start
Ask Claude to handle your prompt and ensure your delegation scripts are installed in ~/bin/ with the expected flags and stdout contract, then run via the UserPromptSubmit hook so it routes each prompt to the correct tier.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: External Model Delegation Pattern Download link: https://github.com/alinaqi/maggy/archive/main.zip#external-model-delegation-pattern Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.