Skip to content

discern

Effect library turning Jev Choice, Noul and Score answers into typed branches with a compiler-enforced Uncertain case.

LibrarybetaMIT

Overview

Discern provides uncertainty-aware semantic control flow for Effect, the TypeScript library. Effect v4 has provider-neutral Decision and DecisionModel types; Discern is to them what Match is to predicates. A Discern pattern matches semantic evidence produced by a decision model, such as classifying a change's public API impact or the probability of regression.

Thresholds are supplied by the caller, and an answer below them takes an explicit Uncertain branch that the compiler forces you to handle instead of rounding to the top label. Routable procedures filter candidates with deterministic predicates first and skip the model call when only one candidate survives. Recording, replay, caching and call budgets are available as DecisionModel middleware. It is provider-neutral and reaches Jev through @effect/ai-typesafe. A silent explainer video walks through the stack.

What the decision model decides

TypeQuestionAnswers
ChoiceClassify the public API impact of this changenone · additive · behavioral · breaking
Yes / noDoes this change carry regression risk?(inferred)yes · no

How it works

  1. Define decisions over a schema with Discern.on(...)
  2. Match on answers with caller thresholds
  3. Handle the Uncertain branch explicitly
  4. Route procedures, skipping the model when predicates leave one candidate

Strengths

  • Type system forces handling of low-confidence answers
  • Avoids model calls when deterministic filters suffice
  • Replay, caching and budgets as middleware

Caveats

  • Requires Effect v4
  • Unofficial library

Getting started

Install @doeixd/discern with @effect/ai-typesafe and provide a TypeSafeDecisionModel layer.

At a glance

Type
Library
Status
beta
Language
TypeScript
Runtime
Effect library
Has code
yes
License
MIT

Use cases and integrations

How curated lists describe it

  • TypeScript ecosystem: Effect library where a Jev `Choice`, `Noul` or `Score` answer becomes a typed branch under caller-supplied thresholds, anything below them takes an `Uncertain` case the compiler forces you to handle, and procedure routing skips the model call entirely when deterministic predicates leave one candidate.

    yibie/awesome-jev
  • Unofficial Effect library: Choice / Noul / Score answers become typed patterns with an explicit `Uncertain` branch you must handle, plus routable procedures, with recording, replay, caching and call budgets as `DecisionModel` middleware. Provider-neutral; reaches Jev through `@effect/ai-typesafe`

    AnotiaWang/awesome-decision-models
  • A semantic control-flow library for Effect: Jev's \`Choice\` / \`Noul\` / \`Score\` answers become typed branches. Thresholds are caller-supplied, and an answer below them takes an explicit \`Uncertain\` branch the compiler forces you to handle rather than being rounded up to the top label. Procedure routing filters candidates with deterministic predicates first and skips the model call entirely when one candidate survives.

    logicrw/awesome-jev-projects
  • TypeScript library for Effect: Jev's Choice, Noul, and Score answers become typed patterns with an explicit `Uncertain` branch, and procedure routing, with recording, replay, caching, and call budgets as `DecisionModel` middleware.

    cobanov/awesome-jev
  • Uncertainty-aware control flow for Effect: Jev's Choice, Noul and Score answers become typed patterns with an explicit Uncertain branch, plus routable procedures, recording, replay, caching and call budgets.

    hellogumbo/awesome-jev
  • Semantic control flow for Effect: patterns, policies and routable procedures built on typed decisions, where an uncertain answer is a branch you must handle.

    MrJev/awesome-jev

Frequently asked questions

What is the Uncertain branch?

The path taken when an answer is below your threshold; the compiler requires you to handle it.

Is it tied to Jev?

No, it works with any Effect DecisionModel; Jev is reached via @effect/ai-typesafe.

Can it avoid model calls?

Yes, procedure routing skips the call when deterministic predicates leave one candidate.

Related projects

  • Ax, a DSPy-style multi-language LLM framework, listed with a native TypeSafe provider for Boolean, Choice, Score and raw Jev questions.

    PluginproductionTypeScript
  • Effect TypeScript library whose @effect/ai-typesafe package maps classify, probability and rating operations to Jev questions.

    ProjectproductionTypeScript
  • PHP monorepo whose Polyglot module adds a TypeSafe driver for typed Noul, Choice and Score decisions alongside LLM inference.

    ProjectproductionPHP
  • Elixir library for unified LLM calls across providers, with an evaluate interface that calls Jev via TypeSafe or OpenRouter.

    ProjectproductionElixir
  • Self-hosted multi-tenant AI agent platform listed as including optional TypeSafe client tools for classification, scoring and yes/no.

    LibraryproductionPython
  • Provider-agnostic TypeScript AI SDK; per list sources, an @tanstack/ai-typesafe adapter exposes Jev decisions through decide().

    ServiceproductionTypeScript