/building-with-typesafe-jev:building-with-typesafe-jevfrom building-with-typesafe-jev
Helps build with TypeSafe Jev, a System One model that returns typed answers with calibrated probabilities for classification, routing, scoring, extraction, and gating tasks. Guides on shape selection, SDK usage, and live API testing.
Ships in building-with-typesafe-jev. 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.
Jev is a System One model: it takes a state plus named, typed questions and returns typed answers with calibrated probabilities. It never generates text. Code owns the workflow. Jev supplies narrow snap judgments. It is not a chat or coding LLM and cannot power a coding agent.
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 linked community projects. Or grep prior-art/ for a domain word. It also lists the known bad fits.
Exact request/response shapes, SDK signatures, limits, and errors: see api-reference.md. It ends with a map of which live docs page to read for which task. Patterns and the cookbook index: see patterns.md. The live docs win on conflict: fetch https://docs.typesafe.ai/llms.txt, and append .md to any page path. 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 Jev only where code needs a judgment.
You get better results when you check a design against the real endpoint. A live call catches a wrong field name, and it shows when Jev reads a question differently than you meant. If TYPESAFE_API_KEY is set in your shell, run a small probe before the code reaches the project. One call costs a fraction of a cent (input tokens only, 4.2 cents per million). If the key is not set, design from api-reference.md and say that you did. Do not go looking for the key in .env files, shell profiles, or key files. Point the user to the README section "If the agent cannot see the key".
Rules for the key:
api_key= in code. Let the SDK read TYPESAFE_API_KEY. Keep it server-side.TYPESAFE_LOG_LEVEL=debug logs request bodies without redaction. Headers stay redacted.401 or TypeSafeAuthenticationError 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 (≤255 options, map) | choice, probabilities, confidence | choice; gate with confidence |
| Position on a spectrum you can describe | Score (2–10 levels, ordered list) | score (0…n-1, can be fractional), legend, probabilities, confidence | threshold or sort score |
| Yes/no | Noul (optional true/false criteria) | noul = P(yes), no confidence | noul > 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.
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.true to a "no" meaning.not_stated) and compare in code. For extraction, find candidates with regex or an LLM, then let Jev 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 Jev 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 Jev runs. Jev 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.(n·top − 1)/(n − 1) over n options (measured: top 0.92 of 3, confidence 0.88), so it depends only on the top probability and the option count. Score confidence also counts how far the rest of the probability sits from the top level: spread onto a neighboring level costs little, and mass at the far end costs a lot. See api-reference.md. Neither is proof of correctness: typed output guarantees the interface, not the truth. Tune thresholds on labeled data from the user, and plot confidence against accuracy to check them. Treat cookbook numbers as examples only.P(q) + P(not q) = 1 across separate questions.jev-1.13.0 when thresholds were tuned against it. Log response.model.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:
RetryPolicy, not by rewording the question.Known weak spots in jev-1.13: https://docs.typesafe.ai/model-jaggedness/jev-1.13.md.
| Mistake | Fix |
|---|---|
| One API call per question | Put all questions in one system_one call |
| Treating the top probability as confidence | Use .confidence. It is computed for you and is never higher than the top probability. |
Guessing the score scale | It is 0 to n-1, weighted by level probability. Python keys legend/probabilities by int; HTTP keys them by string. |
Score.criteria as a dict keyed by int | Use an ordered list (SDK ≥ 0.6.0) |
| 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 Jev 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 | The SDKs retry 429/5xx with backoff. Tune with RetryPolicy. |
| 16+ worker thread pool on one key | Use about 8 workers or fewer. Above that, the endpoint rate-limits. |
| Holistic "is this record good?" judge | Use per-field checks, one flaw per Noul |
| API key in browser code | Keep it server-side. JS needs dangerouslyAllowBrowser for a reason. |
| Jev as the only check before a destructive or money-moving action | Put a code rule first: a known-bad pattern blocks whatever Jev says. Jev judges only what the rule does not decide. |
| Hostile text in state | Jev does 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 Jev answer alone authorize a side effect. |
agents/openai.yaml (opens in a new tab)api-reference.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/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)prior-art/incremental-realtime.md (opens in a new tab)prior-art/judges-and-evals.md (opens in a new tab)prior-art/llm-pairing.md (opens in a new tab)prior-art/ranking-and-matching.md (opens in a new tab)prior-art/research-and-features.md (opens in a new tab)prior-art/select-from-candidates.md (opens in a new tab)prior-art/stream-filters.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
typesafe-jev, system-one, classification, routing, ai-judgment
npx claudepluginhub aaddrick/building-with-typesafe-jev --plugin building-with-typesafe-jevOther plugins' skills for the same job