Skip to content

qualm

Zero-dependency TypeScript wrapper for Jev where every typed decision has a required unsure branch the compiler enforces.

LibrarybetaMIT

Overview

qualm (@atools/qualm) is a TypeScript library for calling TypeSafe's Jev that refuses to collapse a judgment to a bare boolean or argmax. Questions are written as tagged templates (is, choice, score), answers come back typed as the literal union you declared, and every decide call must include an unsure branch, which runs when confidence falls below a bar. That branch is the natural place to hand over to a slower LLM.

The README frames this with the System 1 / System 2 distinction: a cheap typed judgment returns control to your code, and the remaining design work is the seam where fast judgment hands off. It supports TypeSafe's endpoint and Cloudflare Workers AI behind one API, reports usage and the concrete model version via onUsage, and includes retries with jittered backoff, deadlines and AbortSignal. The default confidence bar is 0.7, which the README itself calls arbitrary, and it can be raised per client or per decision.

What the decision model decides

TypeQuestionAnswers
Yes / noThis message conveys urgency—
ChoiceWhich team should handle this ticket?(inferred)—
ScoreHow severe is this?(inferred)—

How it works

  1. Create a client for TypeSafe or Cloudflare
  2. Ask choice, is and score questions about the state in one call
  3. Each decision returns top answer, confidence and distribution
  4. decide routes to your branch if confidence clears the bar, otherwise to the required unsure branch (e.g. an LLM)

Strengths

  • Compile-time guarantee that low-confidence cases are handled
  • Labels typed as literal unions catch typos
  • Zero runtime dependencies, ESM and CJS
  • Usage metering per call

Caveats

  • Default 0.7 bar is arbitrary per the README; tune it
  • Cloudflare response envelope is recorded as unverified in the docs

Getting started

npm install @atools/qualm, then client({ provider: "typesafe", apiKey }) and jev.ask(state, questions).

At a glance

Type
Library
Status
beta
Language
TypeScript
Runtime
Node / edge
Has code
yes
Has tests
yes
License
MIT

Use cases and integrations

How curated lists describe it

  • A TypeScript wrapper for Jev decisions with an explicit unsure branch.

    logicrw/awesome-jev-projects
  • Typed decisions from a System One model. An uncertain answer is a different type from a confident one — and the compiler makes you handle it.

    hellogumbo/awesome-jev

Frequently asked questions

What makes qualm different from calling the API directly?

It types answers as your label unions and forces you to write an unsure branch for low-confidence results.

Which providers does it support?

TypeSafe's own endpoint and Cloudflare Workers AI.

How do I escalate to an LLM?

Put the LLM call in the unsure branch; decide passes its promise through.

Related projects

  • Rust CLI and library that asks Jev typed questions via OpenRouter and combines the probabilities with fuzzy-logic rules into decisions.

    CLIbetaRust
  • Unofficial standard-library Go client for Jev with generic typed Choice values and local confidence thresholds.

    ProjectbetaGo
  • Rust CLI for Jev: ask yes/no, choice and rubric questions about text and branch on exit codes, JSON or MCP tools.

    MCP serverbetaRust
  • TypeScript library for typed semantic decisions via Zod schemas or native batches, defaulting to Jev, with confidence-gated policies.

    LibrarybetaTypeScript
  • Monitoring proxy and client that records Jev answer probabilities and alerts on version changes, drift, edge crowding or accuracy drops.

    ProxybetaPython
  • Composable Python toolkit for Jev: question builders, confidence gates, batch evaluator, calibration, CLI, MCP server and agent skill.

    MCP serverbetaPython