model-routing
Skill2 starsChanged 5 months agoApache-2.0View on GitHub
Extend the routing layer, add provider adapters, change the resolution algorithm, or add new model families in src/domain/routing/.
30 other projects use a version of this.
Adopted by
Most recently taken up by
- cveralyon/axel-setuptheir own version, first seen Nov 8, 2026
- naman10parikh/pennytheir own version, first seen Nov 8, 2026
- weedmo/skillstheir own version, first seen Nov 8, 2026
- naman10parikh/wikimemtheir own version, first seen Nov 8, 2026
- fal-ai-community/skillstheir own version, first seen Nov 7, 2026
- ArcReel/ArcReeltheir own version, first seen Nov 1, 2026
Used with
Projects with it also use ecosystem-reference, fractal-delegation and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
naman10parikhSkillecosystem-reference
Quick-access directory of Claude Code ecosystem repos, skills, plugins, MCPs, and patterns. Use when improving the harness.
Also in 5 projects that use this
naman10parikhSkillfractal-delegation
Also in 5 projects that use this
KirchliveSkillskill-routing
Decides which of the installed skills a task needs and loads them before the work starts. This skill should be used at the beginning of any multi-step task — build, fix, refactor, migrate, review, plan, release, research, write, design, video — and again at every phase change, after context compaction, and when work moves into a different part of the codebase. Use it for requests like "let's build X", "fix this bug", "refactor Y", "plan the migration", "review this", and also when the user asks which skill applies, why a skill did not fire, or asks to check what is available.
Also in 5 projects that use this
sublimotionSkillagent-runtime
Launch and manage detached agent runs on EKS via the agent-runner CLI. Use when the user says "launch an agent run", "agent runtime", "agent-runner", "run this spec on the cluster", "check run status", "agent run logs", or "stop a run". Do NOT use for writing the agent-runner code itself (edit the sibling ../agent-runner repo), Terraform of the foundation (use terraform-automation), or GPU serving deployments (use infra-deployer).
Also in 5 projects that use this
GoZippySkillrepo-scout
Also in 5 projects that use this
BenjaminGSkillharness-review
Turn one PR's review comments into harness fixes — classify each cause by the most solid place it can live (codebase, lint, rules, skill), then draft the fixes in a separate PR.
Also in 5 projects that use this
- +6 more from naman10parikh
Other versions30 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 30
- ArcReel/ArcReel★ 6.6ksame name
- alinaqi/maggy★ 711same name
- alinaqi/claude-bootstrap★ 708same name
- fal-ai-community/skills★ 265same name
- NoobyGains/godmode★ 120same name
- nahid-sparktales/agent-dispatcher★ 59same name
- echo-of-machines/fable-advisor★ 27same name
- frankxai/agentic-creator-os★ 10same name
- FaisalAlqarni/sp-ecc★ 9same name
- naman10parikh/agentgrid★ 9same name
20 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository16 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- boundariesSkill
- cli-view-layerSkill
- effect-servicesSkill
- find-docsSkill
- infrastructure-adaptersSkill
- observabilitySkill
- phax-cliSkill
- phax-decide-planSkill
- phax-decide-reviewSkill
- phax-decide-specSkill
- phax-planningSkill
- phax-reviewSkill
- phax-specSkill
- state-machinesSkill
- validation-boundariesSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. 0 are common, 1 is distinctive, and 12 are very specific to this project.
0
Common
Most of the 29 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
12
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Use this skill when extending the routing layer, adding provider adapters, changing the resolution algorithm, or adding new model families.
- Very specific: line 77
If the provider serves the plan family, resolve natively from its catalog (relationship exact or equivalent if effort is clamped).
- Very specific: line 83
Add the literal to ProviderId in src/domain/routing/types.ts.
- Very specific: line 84
Add the corresponding literal to ProviderIdSchema in src/schemas/modelRouting.ts.
- Very specific: line 85
Add equivalence edges in DEFAULT_MODEL_ROUTING.equivalence (in defaults.ts) for each of the provider's model ids and efforts, anchoring …
- Very specific: line 86
Add a ProviderEntry in DEFAULT_PROVIDER_CONFIG.providers with a families record and per-model models arrays.
- Very specific: line 87
Create src/infra/providers/<newProvider>.ts with runNewProviderAgent + resume variant returning AgentRunResult.
- Very specific: line 89
Add tests in tests/unit/providers/<newProvider>.test.ts (no real CLI — mock the spawn).
- Very specific: line 93
Add the literal to ModelFamily in types.ts and ModelFamilySchema in modelRouting.ts.
- Very specific: line 94
Add requestedModelNormalization entries for known versioned ids in DEFAULT_MODEL_ROUTING.
- Very specific: line 95
Add the family's models arrays (with per-entry efforts and status) to the relevant provider entry in DEFAULT_PROVIDER_CONFIG.
- Very specific: line 96
If the family belongs to a spoke provider, add equivalence edges in DEFAULT_MODEL_ROUTING.equivalence.
- Very specific: line 97
Update docs/model-routing.md family table.
“Common” is measured: kept by at least 6 in 10 of the 29 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
model-routing skill
Use this skill when extending the routing layer, adding provider adapters, changing the resolution algorithm, or adding new model families.
Architecture overview
src/domain/routing/ ← PURE — no IO, no Effect, no infra imports
types.ts ← ProviderId, ModelFamily, EffortLevel, ThinkingLevel, Relationship literals
defaults.ts ← DEFAULT_MODEL_ROUTING, DEFAULT_PROVIDER_CONFIG constants
catalog.ts ← pure catalog helpers: familyOfId, entryFor, effortsFor, isDeprecated, nearestEfforts, equivalentFor, isClaudeFamily
resolve.ts ← resolveModel(request, routing, providerCfg, securityFilter?): RoutingResolution (total, pure)
preflight.ts ← preflightPhaseModels(phases, routing, providerConfig): { failures } (pure)
src/schemas/
modelRouting.ts ← Effect Schema for ~/.phax/model-routing.json (version 2); re-exports literal schemas
providerConfig.ts ← Effect Schema for ~/.phax/providers.json (versioned catalog with per-entry efforts and status)
vibeConfig.ts ← VibeBaseModel schema + extractBaseModel + renderPhaxAliasBlocks
src/app/
loadRouting.ts ← FileSystem-port loaders; falls back to defaults when files absent
vibeSetup.ts ← append-only Vibe alias installer (atomic write + backup)
src/infra/providers/ ← ONLY place that may spawn provider binaries
claudeCode.ts ← claude spawn logic
mistralVibe.ts ← vibe spawn logic (VIBE_ACTIVE_MODEL env)
codexCli.ts ← codex spawn logic
sessionWriter.ts ← shared atomic session-id writer
dispatcher.ts ← makeNodeBackendLayer(providerConfig) — selects adapter by options.provider
src/cli/definitions/agent.ts ← phax agent models|resolve|probe|setup commandsKey invariants
Domain stays pure: nothing under src/domain/routing/ may import Effect, @opentelemetry/*, the FileSystem port, or any infra/ module. resolveModel is a total pure function — it never throws. An architectural guard in tests/unit/architecturalGuards.test.ts enforces this.
Only src/infra/providers/ may spawn: the spawn("claude"…), spawn("vibe"…), spawn("codex"…) calls live exclusively in the corresponding adapter files. The architectural guard forbids these patterns anywhere else in src/.
Schemas use onExcessProperty: "error": config files are validated strictly. Config version 2 rejects tiers, normalization, and defaultTier fields — there is no back-compat shim. New fields must be added to the schema first.
No back-compat shims: new required fields are required, not optional for legacy files.
allowDowngrade is the sole policy knob: cross-family substitutions with downgrade or no_equivalent relation are skipped when allowDowngrade: false. Same-family resolution is always permitted.
Efforts are per catalog entry: each versioned model id has its own efforts array. There is no family-wide effort set. The preflight validates that a phase's effort is in its entry's supported set before any agent spawns.
Terminal claude-code fallback: resolveModel is total. If no provider in providerPriority resolves, the function falls through to claude-code — natively for Claude families, via the equivalence hub for non-Claude families.
Telemetry never fails a run: the agent.model.resolved event is emitted via telemetry.recordEvent and errors are swallowed.
Atomic writes + backup: vibeSetup.ts and the session writer use temp + rename; vibeSetup.ts backs up ~/.vibe/config.toml before appending.
Catalog helpers (catalog.ts)
| Export | Purpose |
familyOfId | Look up the ModelFamily for a versioned id; undefined if not in catalog |
entryFor | CatalogLocation (provider + family + entry) for a versioned id |
effortsFor | The efforts array for a versioned id |
isDeprecated | True when the entry's status is "deprecated" |
nearestEfforts | Efforts sorted by proximity to a requested effort; used by preflight |
equivalentFor | Star-lookup through the Claude hub (hub→spoke, spoke→hub, spoke→spoke) |
isClaudeFamily | True for claude-haiku, claude-sonnet, claude-opus |
equivalentFor semantics: equivalence table edges are stated hub-centric. Hub → spoke uses the stored relation of the exact (claude, effort) edge; without one it takes the nearest-effort edge anchored on the same Claude id (ties prefer the lower) and records the shift as upgrade or downgrade (never for ultracode); spoke → hub inverts the relation (downgrade ↔ upgrade); spoke → spoke composes two hops.
Resolution pipeline
- Derive plan family from
request.model: catalog lookup →requestedModelNormalization→ substring heuristic → defaultclaude-sonnet. - Walk
routing.providerPriority; skip disabled providers and security-filtered providers. - If the provider serves the plan family, resolve natively from its catalog (relationship
exactorequivalentif effort is clamped). - Otherwise translate through the Claude hub via
equivalentFor; skip whenallowDowngrade: falseand relation isdowngradeorno_equivalent. - Terminal
claude-code: same-family natively, or spoke → hub via equivalence table. Relationshipno_equivalenton a complete miss.
Adding a new provider
- Add the literal to
ProviderIdinsrc/domain/routing/types.ts. - Add the corresponding literal to
ProviderIdSchemainsrc/schemas/modelRouting.ts. - Add equivalence edges in
DEFAULT_MODEL_ROUTING.equivalence(indefaults.ts) for each of the provider's model ids and efforts, anchoring each to its Claude hub peer. - Add a
ProviderEntryinDEFAULT_PROVIDER_CONFIG.providerswith afamiliesrecord and per-modelmodelsarrays. - Create
src/infra/providers/<newProvider>.tswithrunNewProviderAgent+ resume variant returningAgentRunResult. - Wire the new branch in
src/infra/providers/dispatcher.ts. - Add tests in
tests/unit/providers/<newProvider>.test.ts(no real CLI — mock the spawn).
Adding a new model family
- Add the literal to
ModelFamilyintypes.tsandModelFamilySchemainmodelRouting.ts. - Add
requestedModelNormalizationentries for known versioned ids inDEFAULT_MODEL_ROUTING. - Add the family's
modelsarrays (with per-entryeffortsandstatus) to the relevant provider entry inDEFAULT_PROVIDER_CONFIG. - If the family belongs to a spoke provider, add equivalence edges in
DEFAULT_MODEL_ROUTING.equivalence. - Update
docs/model-routing.mdfamily table.
Per-invocation provider priority override
Both phax run and phax resume accept --provider-priority <list> to override providerPriority for that invocation without touching any config file:
phax run --provider-priority mistral-vibe,claude-code
phax resume my-run --yes --provider-priority codex-cli,claude-codeValid ids: claude-code, mistral-vibe, codex-cli. The list is parsed by parseProviderPriority in src/domain/routing/priorityOverride.ts (deduped, trimmed, validated; fails fast on empty/unknown). The override is applied by applyProviderPriorityOverride which returns a new ModelRouting with only providerPriority replaced.
Caveat: claude-code remains the guaranteed terminal fallback in resolveModel regardless of the override.
Worked examples
| Request | Priority | allowDowngrade | Result |
claude-sonnet-4-6 / medium | claude-code only | — | claude-code, claude-sonnet-4-6, medium, exact |
claude-sonnet-4-6 / medium | mistral-vibe first | — | mistral-vibe, phax-mistral-medium-3.5-high, high, upgrade (nearest edge) |
gpt-5.5 / xhigh | codex-cli first | — | codex-cli, gpt-5.5, xhigh, exact |
gpt-5.5 / xhigh (codex disabled) | — | true | claude-code, claude-opus-4-8, medium, equivalent (hub translation) |
claude-opus-4-8 / ultracode | any | any | claude-code, claude-opus-4-8, ultracode, exact |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

