Threshold is a tiny confidence-tiered human-in-the-loop routing library. It takes caller-supplied confidence signals and a policy, then returns one of three verdicts:
auto_applyroute_to_humanauto_reject
The core rule is deliberate safety: auto-apply and auto-reject are both opt-in. A default policy routes to a human.
Threshold is MIT-licensed and structured for public source consumption. Version 0.1.0 is the first release candidate.
TypeScript:
npm install @chountalas/thresholdSwiftPM:
.package(url: "https://github.com/chountalas/threshold.git", from: "0.1.0")Local verification:
cd ts && npm install && npm run verify
cd .. && swift testimport { decide } from "@chountalas/threshold/core";
const decision = decide(
{ score: 0.91 },
{ bands: { score: { highMin: 0.82, reviewMin: 0.32 } }, enableAutoApply: true },
);import Threshold
let decision = try decide(
signals: Signals(score: 0.91),
policy: Policy(bands: ["score": BandConfig(highMin: 0.82, reviewMin: 0.32)], enableAutoApply: true)
)- TypeScript:
ts/, npm package@chountalas/threshold. - Swift: root SwiftPM package with
Thresholdfor the pure core andThresholdQueuefor the optional queue target. - Shared behavior:
vectors/*.json, loaded by both test suites.
The pure core has no persistence. The optional queue layer adds item status, append-only decision events, an in-memory store, and an adapter-friendly Store protocol/interface. Apps bring their own UI and durable store.
See: