Skip to content

chountalas/threshold

Repository files navigation

Threshold

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_apply
  • route_to_human
  • auto_reject

The core rule is deliberate safety: auto-apply and auto-reject are both opt-in. A default policy routes to a human.

Status

Threshold is MIT-licensed and structured for public source consumption. Version 0.1.0 is the first release candidate.

Install

TypeScript:

npm install @chountalas/threshold

SwiftPM:

.package(url: "https://github.com/chountalas/threshold.git", from: "0.1.0")

Local verification:

cd ts && npm install && npm run verify
cd .. && swift test

TypeScript Quickstart

import { decide } from "@chountalas/threshold/core";

const decision = decide(
  { score: 0.91 },
  { bands: { score: { highMin: 0.82, reviewMin: 0.32 } }, enableAutoApply: true },
);

Swift Quickstart

import Threshold

let decision = try decide(
    signals: Signals(score: 0.91),
    policy: Policy(bands: ["score": BandConfig(highMin: 0.82, reviewMin: 0.32)], enableAutoApply: true)
)

Packages

  • TypeScript: ts/, npm package @chountalas/threshold.
  • Swift: root SwiftPM package with Threshold for the pure core and ThresholdQueue for the optional queue target.
  • Shared behavior: vectors/*.json, loaded by both test suites.

Queue Module

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:

About

Confidence-tiered human-in-the-loop routing for TypeScript and Swift.

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors