$npx skillfedfor your agent
REPO

gargpratyush/jev-router

The cost problem with AI coding assistants is real and boring to solve manually: Opus-class models are overkill for renaming a variable, and Haiku is wrong for a multi-file refactor. jev-router automates that judgment at the per-turn level, sitting between you and whichever CLI you already use.

The mechanism is a loopback proxy. Launch jev-claude or jev-codex and the real upstream CLI starts normally — your existing login, tools, sessions, and permissions untouched. For each fresh user turn, one call goes to TypeSafe's routing API, which scores the prompt across four dimensions: task complexity, reasoning required, tool complexity, and context size. The result maps to an abstract tier — Fast, Balanced, Strong, or Long — and the proxy rewrites the outgoing model field accordingly. Tool-loop continuations inherit the tier chosen at turn start and add zero extra latency. Routing failure is fail-open: if TypeSafe is unreachable, the current model stays.

The policy layer in src/policy.mjs handles the edge cases that naive routing ignores. Low confidence never downgrades and caps upgrades at the balanced tier. Large conversations refuse downgrades that would waste more prompt-cache work than the cheaper model saves. Explicit user overrides — typing "use opus" or "use strong" — win unconditionally. Unavailable tiers step upward rather than silently falling back to something weaker. The Long tier (Fable / gpt-6-astra) is off by default and requires JEV_ALLOW_FABLE=1, presumably because the cost delta there is severe enough to warrant an explicit opt-in.

The explainability story is better than most routing tools bother with. Running /jev-explain in Claude Code or $jev-explain in Codex renders a local report — built from the saved request and response, not a fresh API call — showing each scoring dimension as a decimal, the recommended tier, the selected model, and a confidence percentage. Up to 20 recent decisions are kept per session in a temp file readable only by the current user (mode 700 directory, 600 files), auto-deleted after 7 days.

The honest limitations are worth noting. Your prompt text goes to TypeSafe for every routing decision — nothing else, per the README, but that is still a data-sharing choice worth understanding before deploying on proprietary codebases. The Claude Code and Codex wire formats are undocumented contracts; the README flags this directly and provides JEV_DUMP for diagnosing breakage when upstream changes. Development and testing happened on Windows against Claude Code v2.1.101 and OpenAI Codex v0.154.0, so behavior on other platforms is less battle-tested. And the TypeSafe API key is a new dependency with its own availability and pricing surface.

For teams already paying for Claude or Codex subscriptions and watching token costs climb, the value proposition is straightforward: let a cheap classifier decide when you need the expensive model rather than defaulting to it every turn.

A loopback proxy that routes each coding-assistant turn to the cheapest model that can handle it — with explainability and sensible fallback rules built in.

Install it

Sources & links