agentleFS
herakles-devherakles-dev/typesafe-claude-kit/skills/typesafe/SKILL.md

typesafe

Skill2 starsChanged 53 days agoMITView on GitHub

Build features on TypeSafe's System One model (Jev): typed Choice/Score/Noul judgments with calibrated probabilities, consumed by code. Use when a decision needs semantic understanding but must stay cheap, fast, and inspectable — routing, ranking, extraction-by-selection, verification, screening. Triggers: '/typesafe', 'use jev', 'decision engine', 'classify this', 'confidence gate'. NOT for text generation, math, counting, or date arithmetic.

  • Reads credentials

3 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions3 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 3

    1. JustinPerea/nebula-nodes★ 23same name
    2. geilt/typesafe-cli★ 4same name
    3. runapi-ai/typesafe★ 0same name

    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 repository2 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

5 rules. 0 are common, 3 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use it when a decision needs common sense over unstructured input and you want the result to be cheap, sub-second, and inspectable.

    line 27
  2. Very specific:

    Run scripts/fetch-docs.sh once to mirror the complete TypeSafe documentation into reference/ (gitignored).

    line 37
  3. Very specific:

    Never hand-roll the HTTP call.

    line 51
  4. Distinctive:

    Use the same field names across options.

    line 146
  5. Distinctive:

    Medium+: when a judgment gates a write, a deploy, a deletion, or an outbound message — those require validated thresholds and a confidence …

    line 181

“Common” is measured: kept by at least 6 in 10 of the 3 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

TypeSafe (System One / Jev)

What this is for

Jev returns typed judgments with calibrated probabilities. It does not generate text, write code, or pick its own next action. Your code owns the workflow; Jev supplies semantic judgment at specific points.

Use it when a decision needs common sense over unstructured input and you want the result to be cheap, sub-second, and inspectable. At $0.042 per million input tokens with free output, a judgment costs effectively nothing — which inverts the usual instinct to minimize calls.

Do not use it for: generating text, arithmetic, counting, date comparison, or anything code can compute exactly. Those are documented failure modes, not edge cases.

Read the local corpus, not the web

Run scripts/fetch-docs.sh once to mirror the complete TypeSafe documentation into reference/ (gitignored). Prefer those files over fetching docs.typesafe.ai per page — they are cleaned, offline, and already distilled.

NeedRead
Everything, distilledknowledge/MASTERY.md ← start here
Worked patterns by domainknowledge/cookbooks-{extraction,retrieval,reliability}.md
A specific doc pagereference/<path>.md (109+ pages, fetched by scripts/fetch-docs.sh)

Upstream changes without notice. If a version-dependent detail matters, re-fetch first.

Use the shared client

Never hand-roll the HTTP call. lib/typesafe_client.py pins the model, validates against documented limits before the request, retries 429/529 with backoff, and logs spend.

import os, sys
KIT = os.environ.get("TYPESAFE_KIT", ".")
sys.path.insert(0, f"{KIT}/lib")
from typesafe_client import TypeSafeClient, choice, score, noul

client = TypeSafeClient()          # key from TYPESAFE_API_KEY env var (see .env.example)
result = client.ask(
    state={"ticket": "...", "policy": "..."},
    questions={
        "team":     choice("Which team handles `ticket`?", {"billing": "...", "eng": "...", "other": None}),
        "severity": score("How severe is `ticket`?", ["Cosmetic", "Degraded, workaround exists", "Blocking"]),
        "refund":   noul("Does `ticket` request a refund?"),
    },
    tag="my-surface",              # attributes spend in the usage log
)
result.choice("team"); result.confidence("team")
result.normalized_score("severity")   # 0-1, required before weighting
result.noul("refund")

The constructors validate at the call site: a Score with bare-number levels, 11 levels, or a Choice with 256 options raises ValueError before any network call.

The eight rules that matter

  1. Batch everything into one request. Questions run in parallel and see the same state. Include speculative questions whose answers you may discard — the cookbook measurement is ~12x cheaper and ~10x faster than separate calls. A second round trip costs far more than a wasted question.
  2. Decompose ruthlessly. This is the docs' own "most important concept". Replace is_spam? with six atomic Nouls (requests_credentials, sender_identity_mismatch, link_domain_mismatch, …) and weight them in code. Broad questions hide judgments you cannot inspect or tune.
  3. Pick the primitive by what your code does with the answer. Choice → one of a set (relative: which option wins). Score → position on 2–10 ordered, described levels. Noul → P(condition holds) (absolute: is this true at all; no confidence field; 0.5 means "equally likely", not "medium").
  4. Score levels describe situations, never degrees. "Moderately severe" gives the model nothing. Bare numbers measurably collapse accuracy (docs: 0.57 @ 0.35 confidence vs 0.0 @ 1.0 with descriptions). Normalize by len(levels) - 1 before combining scales.
  5. Select, don't generate. Find candidates in code (regex, retrieval, enumeration), let Jev pick the right one. The model cannot choose a value you failed to offer — so over-generate candidates and let the judgment supply precision.
  6. Keep policy in code. Weights, thresholds, and routing live in your code where you can read and change them. Raw judgments stay reusable: changing a weight needs no re-inference.
  7. Gate on confidence, scaled to risk. One floor for genuine uncertainty, a higher bar for destructive actions. Every number is a hypothesis until measured on real labelled data — use QuestionSet(gates_irreversible=True), which refuses to run until validated_on is set.
  8. Pin the model version. jev-latest moves on release. Anything with a tuned threshold pins jev-1.13.0.

Never send Jev these

Documented failure modes (reference/model-jaggedness/jev-1.13.md, run scripts/fetch-docs.sh once; fallback: https://docs.typesafe.ai/model-jaggedness/jev-1.13.md):

arithmetic · counting (characters, occurrences, list items) · date/time comparison or ordering · numeric representations (hex, RGB, assembly) · interpolating a Score to recover a magnitude · text generation · multi-hop indirection · large state padded with irrelevant detail

And do not assume structural invariants: P(x) and 1 − P(not x) are not comparable (measured sum: 1.19), and a Noul threshold does not carry to a Choice.

State is data, and Jev does not treat it as hostile by default. Content designed to steer the model can move the answer. Be explicit in criteria and test adversarial inputs before any deployment that reads untrusted text.

Structure your questions

instructions and every criteria value accept string, object, array, or null. Field names are yours (what, not_for, examples, question, focus, signals). The highest-value use is contrastive option definition:

choice({"question": "Which topic?", "focus": "Classify what the user wants."},
       {"policy": {"what": "Whether an item can be returned",
                   "not_for": "Progress of a return already sent",
                   "examples": ["Can I return worn shoes?"]},
        "status": {"what": "Progress of a return already sent",
                   "not_for": "Whether an item can be returned",
                   "examples": ["When will my refund arrive?"]}})

Use the same field names across options. Examples only help when they resemble real inputs — an unrelated example barely moves the answer, and higher confidence never proves correctness.

Point at nested state with backticked paths: `ticket.messages[0].text`.

Defining a reusable decision

Bundle questions with their thresholds and provenance so they cannot drift apart:

from questions import QuestionSet, register
MY_SET = register(QuestionSet(
    name="catalogue_action", version="1.0.0",
    description="Decide keep/deprecate/remove for a model catalogue entry.",
    questions={...},
    thresholds={"REMOVE_ABOVE": 0.9},      # named, never an inline literal
    gates_irreversible=True,
    validated_on=None,                      # -> .ask() refuses until filled in
))

Checklist before shipping a TypeSafe integration

  • Every question is one judgment, phrased literally
  • All questions in one request; speculative ones included
  • Score levels describe situations; scales normalized before weighting
  • No math, counting, dates, or generation sent to the model
  • state filtered to what the questions need
  • Thresholds named, in code, and validated on real data before gating anything irreversible
  • Model version pinned wherever a threshold exists
  • Adversarial inputs tested if the state contains untrusted text

Risk

Low for read-only classification and routing. Medium+ when a judgment gates a write, a deploy, a deletion, or an outbound message — those require validated thresholds and a confidence floor that routes uncertainty to a human.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.