/building-with-decision-models:building-with-decision-modelsfrom building-with-decision-models
Guides building with decision models (System One models) for classification, routing, triage, moderation, scoring, ranking, matching, deduplication, filtering, extraction, verification, or gating actions.
Ships in building-with-decision-models. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
A decision model (also called a System One model) takes a state plus named, typed questions and returns typed answers with probabilities. It never generates text. Code owns the workflow. The model supplies narrow snap judgments. It is not a chat or coding LLM and cannot power a coding agent.
TypeSafe's Jev started the category on 2026-09-15 with the POST /v1/systemone contract and three question types: noul, choice, and score. Every provider since uses the same three question types, so the rules below hold for all of them. Many accept Jev's body unchanged (Ollama, Kev, Laya, Strands Decider, gateways, and Microsoft-Decision-1 under an Azure path and auth). Others keep the ideas but change the wire format: Clef REST wraps the answers in result, Databricks renames the Noul answer probability, and OpenAI and Perplexity serve their own paths with their own field names. What also differs is the model names, the limits, the price, and how well the probabilities match reality.
Before you design anything new, check prior art: open prior-art/INDEX.md. It maps intents (control loop, gate, rerank, stream filter, incremental, agent memory, LLM pairing, and more) to shape files. Each shape file has a code sketch, field lessons, and a few flagship community projects, with the model each one used. The full project lists are in prior-art/projects/. Or grep prior-art/ (recursively) for a domain word. It also lists the known bad fits as one-line headlines. The evidence and links are in prior-art/bad-fits.md. Notes for one model other than Jev (limits, calibration, failures, per-shape lessons) are in models/<name>.md; models/INDEX.md lists them.
Exact request and response shapes: providers/jev.md is the reference contract. Each other file in providers/ lists how that provider differs. Patterns and the cookbook index: see patterns.md. A provider's live docs win on conflict. Do not guess field names. Check them there. If the docs cannot be reached, read the installed SDK's types, tell the user you did, and do not invent details that depend on the version.
Open-ended request ("where could AI help in this app?"): work backward from what the app should show, select, change, or hand off. Offer two or three directions from prior-art/INDEX.md and recommend one. Concrete request: pick the shape and build. Either way, keep the user's stack and scope, and add a decision model only where code needs a judgment.
Use the one the project already uses. If there is none, pick by the constraint that matters most, then open its file in providers/.
| Need | Start with | File |
|---|---|---|
| Best measured accuracy and calibration, lowest hosted price | TypeSafe Jev | providers/jev.md |
| Already on Cloudflare Workers, or the state includes images | Cloudflare Clef / Clef-flash | providers/clef.md |
| Very long state (whole documents, long transcripts) | Perplexity pplx-decider | providers/perplexity.md |
| Azure shop, Entra auth, or US/EU data-zone processing | Microsoft-Decision-1 on Microsoft Foundry (Jev body, Azure path, deployment name as model) | providers/microsoft-foundry.md |
| Decisions over rows already in a warehouse | Databricks ai_decide() | providers/databricks.md |
| Data must not leave the machine, offline, or free tests | Ollama: Nimble, Tev1, Kev | providers/ollama.md |
| Data must stay in the EU | System1 Models (1 question per request), Strom | providers/eu-hosts.md |
| One key for several providers, or switching between them | OpenRouter, Vercel AI Gateway, LLM Gateway, pydantic-ai | providers/gateways.md, providers/pydantic-ai.md |
| Smallest possible model, CPU, or a model you will fine-tune | Laya, Strands Decider, CLM-8B, SemIf, NanoJev | providers/open-weights.md |
| OpenAI shop, or images in the state | OpenAI Decisions API (gpt-6-luna, public beta, its own request format) | providers/openai-decisions.md |
"Accepts the Jev request" means the code runs. It does not mean the answers are as good. Open models trail Jev by a wide margin on out-of-domain tasks, and some are weak on large option sets. Measure on the user's own labeled cases before you commit (see "Changing models").
You get better results when you check a design against a real endpoint. A live call catches a wrong field name, and it shows when the model reads a question differently than you meant. Run a small probe before the code reaches the project:
TYPESAFE_API_KEY). One call usually costs a fraction of a cent.curl -s localhost:11434/api/version), a probe is free and needs no key. A local model's answers are not a stand-in for a hosted model's accuracy, but they do check the request shape.If no endpoint is available, design from the provider file and say that you did. Do not go looking for keys in .env files, shell profiles, or key files. Point the user to the README section "If the agent cannot see the key".
Rules for any key:
TYPESAFE_LOG_LEVEL=debug does). Turn it off before real data flows.401 means the key is wrong or rotated. Ask the user to replace it where they stored it, never in the chat.| Answer shape | Primitive | Returns | Branch on |
|---|---|---|---|
| One of an unordered set | Choice (a map of options) | choice, probabilities, confidence | choice; gate with confidence |
| Position on a spectrum you can describe | Score (an ordered list of levels) | score (0…n-1, can be fractional), legend, probabilities, confidence | threshold or sort score |
| Yes/no | Noul (optional true/false criteria) | P(yes), no confidence | P(yes) > threshold |
A Noul of 0.5 means "unsure", never "medium". Degree questions ("how strong in Python") need a Score. Several labels that can apply at once need one Noul per label, not a Choice.
Limits depend on the provider. The Jev contract allows up to 255 Choice options and 2–10 Score levels, and most copies match. Check the provider file before you rely on a large option list, a long list of questions, or a long state. Context windows vary even more: CLM-8B silently cuts the state at 2,048 tokens, and Tev1 and Laya are also small. Open the provider file before you send a long transcript.
usage.input_tokens on a real request. Write the premise into the text: "If this is a technical problem, how severe is it?". Code ignores the answers on branches it does not take.instructions."Does `ticket.messages[0].text` request a refund?". Send only what the question needs. Irrelevant state lowers accuracy. Include metadata (plan, timestamps) only when a question refers to it."Broken feature, workaround exists", not "moderate" or "2". Each level is judged alone, so "worse than the previous level" means nothing. Give each level one dimension.other / none_of_the_above. When two options get confused, make each value an object: {"what": ..., "not_for": ..., "examples": [...]}. Use the same keys on every option. Name options with words, not codes: renaming options from 0/1 to no/yes with the same rubric flipped about 70 answers in 100 in one study (arXiv:2609.26758).true to a "no" meaning.not_stated) and compare in code. For extraction, find candidates with regex or an LLM, then let the model pick among them. To count distinct items, split into candidates in code (sentences, lines). Ask two Nouls per candidate: "is this an X?" and "is this X different from those in items[0..i-1]?". Sum the answers in code. Turn hex colors, RGB triples, and raw codes into a computed number or a named bucket before the model sees them. The same goes for a safety condition you can write exactly, when a miss cannot be undone: a denylist of destructive commands, a spending limit, a protected branch. Check it in code before the model runs. The model may make that decision stricter, never looser.choice (the argmax). A confidence threshold is not needed.choice, and notify a second option whose probability is above about 0.25. Do not force a single label.score / (len(criteria) - 1), weight the results in code, and keep the raw answers.score works for thresholds and sorting only. Do not read an exact magnitude off it by interpolating between two levels.exists, stated, fits) in the same request to decide whether to act at all.providers/jev.md). It is not proof of correctness: typed output guarantees the interface, not the truth.P(q) + P(not q) = 1 across separate questions.jev-latest moves on a new release.On a model other than Jev, read models/<name>.md first (index: models/INDEX.md). It holds the limits, calibration, and failures people reported, which the shape files leave out.
The request often ports by changing the base URL, the key, and the model. The thresholds do not port, and "compatible" servers are less alike than they look. A conformance suite run against 8 open /v1/systemone servers found only 2 passing every required check. Four of them capped Choice at 26 to 128 options instead of 255. confidence meant top probability on some, the top-two margin on another, and one minus normalized entropy on a third (jevcompat). Before you switch providers or versions in code that acts on the answers:
A worked sketch of this comparison, the field lessons from people who switched, and the benchmarks that exist are in choosing-and-switching-models.md.
Look at the exact state, questions, candidates, answers, and the code that combined them, next to what actually happened. Then name the cause before you change anything:
Known weak spots for each model are in its models/ file and linked from its provider file.
| Mistake | Fix |
|---|---|
| One API call per question | Put all questions for one state in one request |
| Treating the top probability as confidence | Use confidence where the provider returns it. Noul has none: P(yes) is the answer. |
Guessing the score scale | It is 0 to n-1, weighted by level probability. Check how the provider keys legend/probabilities (Jev HTTP uses strings, its Python SDK uses ints). |
| Copying field names or paths across providers | Read the provider file. Paths, envelopes, and field names differ: Clef REST (result), Databricks and OpenAI (Noul as probability), OpenAI and Perplexity (own paths), Vercel's native API (boolean). |
| Carrying thresholds to a new model | Re-fit them on labeled cases (see "Changing models") |
| Assuming every "compatible" model supports every primitive or limit | Check the provider file for option, level, question, and context limits |
| Numeric or vague Score levels | Use concrete situations, one dimension each |
| "Analyze this and decide what to do" | Split into atomic questions and combine in code |
| Asking the model to count, do date math, or compare hex colors | Do it in code. Ask per-item Nouls. |
| Double negatives, or "does the thing it refers to have..." | Ask directly about a named state path |
| Speculative question with no stated premise | "If X, then ...?" |
| Hand-rolled 429 retry loop around an SDK | SDKs retry 429/5xx with backoff. Tune their retry policy. Raw HTTP callers need their own backoff. |
| 16+ worker thread pool on one key | Use about 8 workers or fewer unless the provider documents more |
| Holistic "is this record good?" judge | Use per-field checks, one flaw per Noul |
| API key in browser code | Keep it server-side |
| A decision model as the only check before a destructive or money-moving action | Put a code rule first: a known-bad pattern blocks whatever the model says. The model judges only what the rule does not decide. |
| Hostile text in state | Decision models do not treat state as adversarial. Keep untrusted text in its own named field. Point questions at it by path. Add an injection Noul. Never let a model answer alone authorize a side effect. |
agents/openai.yaml (opens in a new tab)choosing-and-switching-models.md (opens in a new tab)models/INDEX.md (opens in a new tab)models/clef.md (opens in a new tab)models/clm.md (opens in a new tab)models/kev.md (opens in a new tab)models/laya.md (opens in a new tab)models/luna.md (opens in a new tab)models/microsoft-decision-1.md (opens in a new tab)models/nimble.md (opens in a new tab)models/others.md (opens in a new tab)models/pplx-decider.md (opens in a new tab)models/strands-decider.md (opens in a new tab)patterns.md (opens in a new tab)prior-art/INDEX.md (opens in a new tab)prior-art/agent-context-memory.md (opens in a new tab)prior-art/bad-fits.md (opens in a new tab)prior-art/control-loops.md (opens in a new tab)prior-art/embedding-in-infrastructure.md (opens in a new tab)prior-art/gates.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
decision-models, system-one, classification, routing, triage, moderation, scoring, ranking
Other plugins' skills for the same job
npx claudepluginhub aaddrick/building-with-decision-models --plugin building-with-decision-models