JEV + LAYA decision systems
GiveMePrompts / routing case studies

JEV, LAYA, and the decision layer.

Three routing systems. JEV FastLoop is a fail-open decision edge layer for Jev, TypeSafe's System One model. LAYA Router Gateway is a local provider-aware OpenAI-compatible gateway. LAYA Code Router routes each Claude Code or Codex turn with a local decision model.

Read this first: Jev and Laya are different models from different teams. Jev is TypeSafe's hosted System One model. Laya is a separate open-source local System 1 decision model. These are my own independent projects, which use those two third-party models for different jobs. JEV FastLoop uses Jev and does not use Laya. The LAYA projects use Laya and do not use Jev. The gateway and code router are local builds, not hosted production services; only JEV FastLoop and LAYA Code Router have public repositories.
JEV FastLoop cover showing a fail-open skill router for AI agents
JEV FastLoop / public cover01
1,248skills indexed in the JEV router
15/15JEV FastLoop tests passing
1,000LAYA model/provider pairs
77LAYA tests passing
three projects, one design instinct

Keep judgment out of the expensive path.

All three treat a model decision as infrastructure: narrow the question, keep a deterministic policy in charge, log what happened, and make escalation a deliberate choice. Only two of them are public software.

JEV FastLoop project cover
public MIT repository · uses Jev

JEV FastLoop

A fail-open semantic edge layer for Jev, TypeSafe's System One model. It combines keyword retrieval, local embeddings, and Jev reranking over a 1,248-skill roster, then abstains when the first signal is weak. Jev is a decision model, not an LLM: it returns typed choices, scores, and yes/no with confidence.

Read the JEV FastLoop repository ↗
LAYA Router Gateway Control Center overview
local operator pilot · uses Laya

LAYA Router Gateway

An OpenAI-compatible gateway that turns preset names into healthy, provider-aware routes. Laya scores task difficulty, deterministic policy chooses the route, and the Control Center makes the decision inspectable. Local build on 127.0.0.1:4020 for the API; the captured preview ran on 4021.

See the LAYA gateway evidence below ↓
LAYA Code Router cover
public MIT repository · uses Laya

LAYA Code Router

Per-turn model routing for Claude Code and OpenAI Codex. One local Laya call per fresh user turn scores task complexity, and a deterministic score-to-tier table picks fast, balanced, or strong. The routing decision never leaves the machine. Ported from the MIT-licensed jev-router project, with the hosted Jev call replaced by a local sidecar.

Read the LAYA Code Router repository ↗
the business problem

The business problem

AI agents need a cheap answer to “which path?” before they pay for a bigger one.

JEV FastLoop answers that question for skills: retrieve candidates, rerank them with Jev, and abstain when retrieval is weak. LAYA Router Gateway answers the neighboring question for model providers: score the task, apply policy, check health, and dispatch through an endpoint-aware transport.

Neither system hides the judgment inside a giant prompt. Both keep deterministic code, a small decision model, and a visible fallback boundary separate.

the shared system

Retrieve, decide, record, escalate.

JEV FastLoop routes a skill roster. LAYA Router Gateway routes model/provider pairs. LAYA Code Router routes each turn of a coding session. The architectural pattern is deliberately similar across all three.

01 / retrieve

Cheap signals first

Keyword and local embedding legs surface candidates before an expensive model is asked to judge.

02 / decide

Narrow typed question

JEV returns choice, score, or noul-style decisions. LAYA scores task complexity, reasoning, and tool complexity.

03 / govern

Policy owns the route

Confidence, capability, health, and provenance determine what is eligible. The model does not silently become the policy.

04 / record

Make the outcome legible

Decisions, abstentions, fallbacks, and attempts become evidence that can be inspected and evaluated later.

which project is which

Same instinct, different jobs, different models.

Jev is TypeSafe’s hosted System One model. Laya is a separate local System 1 decision model. Each project below uses exactly one of them.

JEV / TypeSafe System One

JEV FastLoop

Use it when the question is “which existing skill or label fits?”

  • Hosted Jev through the OpenCode Zen gateway.
  • Three-leg skill router: keyword, local embeddings, Jev rerank.
  • Abstains when the first signal is weak instead of guessing.
  • MIT, standard-library Python, public GitHub repository.

github.com/SupremeDreamZ/jev-fastloop ↗

LAYA / local System 1 decision model

LAYA Router Gateway

Use it when the question is “which healthy model/provider should serve this request?”

  • One OpenAI-compatible model contract for clients.
  • Local LAYA scoring with deterministic routing policy.
  • Provider-aware endpoint, protocol, health, and failover handling.
  • Local operator pilot with real Control Center evidence.

Read the LAYA Router Gateway evidence on this page ↓

LAYA / local System 1 decision model

LAYA Code Router

Use it when the question is “which model should serve this one user turn?”

  • One local Laya call per fresh user turn, no hosted routing API.
  • Deterministic score-to-tier table picks fast, balanced, or strong.
  • Fail-open: a Laya failure keeps the current model instead of blocking the CLI.
  • MIT, npm CLI, public GitHub repository. Ported from the MIT-licensed jev-router project.

Read the LAYA Code Router section on this page ↓

the evidence

Two projects. Real captures. No invented outcomes.

The JEV images below come from the public project evidence set. The LAYA images are real captures from the isolated Control Center during the recorded build. Counts describe that build; they are not promises of hosted scale or future availability.

JEV FastLoop / measured on jev-1.13-free

Dated numbers, on a named model, at a stated cost.

Every row below was recorded on 2026-09-19/20 against jev-1.13-free through the OpenCode Zen gateway, at $0 across all runs. That model is a limited-time free tier, so these are dated observations of a specific build, not permanent capability claims.

What was measured

  • 3-question smoke, mixed typesAll correct in a single call across the noul, choice, and score question shapes.
  • VLM describe-once, then a Jev rubric8 of 8 checks passed at 0.64s wall time.
  • Skill router over 1,248 skillsCorrect picks at 0.99 to 1.0 fused confidence, 1.0 to 1.3s, using three-leg keyword, local embedding, and Jev rerank fusion.
  • Second-signal ablationJev demoted a keyword-tied noise skill from a 2.00 keyword score to a 0.18 fused score.
  • Embedding legLocal nomic-embed-text closed the vocabulary-divergence recall gap; 1,248 vectors built in 17s.
  • Gauntlet preflight on a live page3 clear, 0 fail, 3 uncertain, with exit-code routing.

Why an edge layer, not a router

Jev's own project README argues from early ablation evidence that retrieval does the heavy lifting on routing tasks, and that fusing Jev with a first signal beats either signal alone. The same README reports that one giant free-form verdict scored materially worse than the same model decomposed into narrow typed signals combined with code.

Those comparison numbers are cited in the project as independent early evidence rather than as a measurement this case study reproduced, so treat them as the project's reasoning rather than a verified benchmark on this page.

The architectural conclusion is the durable part: put deterministic facts in code, use Jev as a second semantic signal, let policy own the confidence threshold, and treat escalation as a deliberate choice. Jev is replaceable infrastructure. Swap the backend, keep the service, and never make it the only signal on an expensive decision.

LAYA Router Gateway

The provider layer, made governable.

LAYA Router Gateway is a separate local build. It uses a local LAYA decision model to score task complexity, then lets deterministic policy choose a healthy, enabled, non-retired model/provider route. The client keeps one OpenAI-compatible contract while endpoint, protocol, authentication, health, and fallback stay behind the boundary.

1,000model/provider pairs
9provider records
4routing presets
77tests passing
PRESET

cheap-auto

Free-first with the lowest intelligence floor (14). Stays on a known-good free model whenever one clears the bar.

PRESET / DEFAULT

auto-router

Free-first with a higher floor (24). Demands more capability before accepting a free model, so it escalates sooner.

PRESET

more-brain

Paid-only, floor 36. Never selects a free model, because free is never assumed to be good enough.

PRESET

max-brain

Paid-only, floor 44. Asks for the strongest healthy model available, with the same deterministic policy shape.

Failover that knows the difference between failures

Each (model, provider) pair is tracked independently, and the error taxonomy decides whether a pair is skipped, cooled down, retried, or left alone.

  • 402 / 401 / 403Treated as exhausted or unauthorized. The pair is skipped until its TTL lapses.
  • 429Rate limited. Skipped for a short cooldown, then retried.
  • 5xxUpstream error. Skipped briefly and retried.
  • 400A bad request. Never retried anywhere, because it will fail identically everywhere.
  • HTTP 200 with an error bodySome providers report exhausted credit this way. It is treated as a failure, never as an empty completion.

Every answer explains itself

Each completion response carries a laya_router block: the preset, the model and provider that actually served it, whether it was free, the capability score, the reason, Laya's latency and confidence, and the full attempted list. If a planned free route ends up served by a paid provider, the response says so rather than hiding the cost.

Sessions stay stable; subagents route independently

The gateway pins one model per session using x-router-session, metadata.session_id, or user. Turn two of a conversation reuses that model with no Laya call, so a prompt cache is never thrown away mid-conversation. A new session, including each delegated subagent, gets its own fresh decision. If a pinned provider dies mid-session, the pin is dropped and the gateway re-decides for that one call instead of failing the turn.

Virtual keys, real credential isolation

The gateway issues its own client key, restricted to an allow-list of model names. Only a SHA-256 hash of each key is stored, and provider credentials stay in macOS Keychain and the server process. The UI and API never return an existing provider secret. Admin endpoints are loopback-only and can require ROUTER_ADMIN_TOKEN.

LAYA Code Router / public MIT repository

Simple work goes fast. Hard work goes strong.

The same local-difficulty idea as the gateway, applied one turn at a time to a real coding CLI. A launcher starts a loopback proxy and a long-lived Laya sidecar, launches the actual Claude Code or Codex binary, and forwards the CLI's own authorization headers without reading, storing, or modifying them. The routing decision is local; the model call is not.

TIER / SCORE

≥ 0.62 → strong

Auth redesigns and whole-repo migrations land here. Selects the strongest tier, such as Opus or gpt-5.6-sol.

TIER / SCORE

< 0.18 → fast

Trivial turns drop to the cheapest tier, such as Haiku or gpt-5.6-luna.

TIER / SCORE

between → balanced

Everything between the thresholds lands on the middle tier, such as Sonnet or gpt-5.6-terra.

SAFETY

Fail-open by design

A Laya failure, timeout, or sidecar crash keeps the current model instead of blocking the CLI. An explicit request always wins.

Calibration, published honestly

Measured 2026-09-23 on an M2 Max with the default checkpoint:

  • Laya's N-way choice head is uncalibrated for wide option sets: 7-option confidence sat at 0.02 to 0.03 with a near-flat distribution. The N-way pick drives the explanation display only. The score rubric carries the actual routing decision.
  • The score rubric separates genuinely hard work upward at 0.62 and above, but does not distinguish trivial from ordinary prompts, which both landed at 0.44 to 0.51. The saving comes from the no-router baseline that would otherwise pin a whole session to the strongest model.
  • The confidence gate is calibrated to the observed 0.16 to 0.44 distribution. The upstream 0.3 default would have capped nearly every upgrade with this checkpoint.
  • A laya-typed-decisions variant measured worse, with fully overlapping classes at 0.54 to 0.67, and is not the default. A different checkpoint drops in through an environment variable with no protocol change.

What it costs and where it runs

Routing has no key and no hosted call, because the decision model runs locally. The first decision of a session pays a roughly 40-second model load, which the launcher pre-warms while the CLI starts, so interactive use rarely waits. The first routing decision typically lands in about 40 to 50ms once warm.

Only the routing decision stays local. The coding model itself still runs at Anthropic or OpenAI, and the gateway's paid tiers still pay for upstream models by design. Do not read "nothing leaves the machine" as an offline guarantee for the work itself; it is a guarantee about the routing decision.

Claude Code and Codex request formats are not public contracts, so an environment flag dumps request bodies for diagnosis when an upstream format changes.

Read the LAYA Code Router repository ↗

the honest boundary

Useful because the limits are explicit.

  • JEV and LAYA are different modelsJev is TypeSafe's hosted System One model. Laya is a separate local System 1 decision model by a different team. JEV FastLoop uses Jev and does not use Laya. The LAYA projects use Laya and do not use Jev. These are my own independent projects built on two third-party models.
  • JEV is a signal, not the whole routerJEV FastLoop's own README says retrieval does the first pass and Jev reranks what retrieval surfaces.
  • LAYA is a local operator pilotThe gateway evidence is a real local build. This public page is the evidence hub; it is not a claim of public hosted scale or an installed signed application.
  • Configured is not healthyThe LAYA roster distinguishes provider records from providers that are usable right now.
  • Unknown stays unknownFree, price, retirement, and expiration claims stay provenance-aware instead of being inferred from missing metadata.
  • Credentials stay virtualManagement surfaces are loopback and token-gated. Provider secrets are not returned in browser responses or published with this case study.
build the layer beneath the model choice

If your product depends on several models or skills, give the decision path a boundary.

I build governed decision, routing, and provider-aware systems for products and teams that need the layer to be inspectable.