Cheap Typed Decisions Before Expensive Generation: Introducing tru-jev-harness


Most GenAI stacks pay for generation first and decide later. That is expensive when the real question is whether a passage is relevant, or whether a tool call is safe enough to run.
We are open-sourcing tru-jev-harness: a small, production-shaped TypeScript harness from TruFyre Technologies that puts TypeSafe Jev in front of two expensive agent steps. Run a cheap typed decision first. Branch in code. Call a frontier model, execute a tool, or escalate to a human only when the gate says you should.
The main README is live on GitHub now. Package license is MIT under TruFyre Technologies Pty Ltd / trufyrelabs.
For the wider architecture case for typed decisions versus chat completions, see Your Chat Model Writes Brilliant Answers. Production Needs Typed Decisions.
Jev is TypeSafe's System One model. It does not generate chat text. You give it state plus typed questions. It returns structured answers your code can branch on.
Primitives from public docs:
noul in [0, 1] (P(yes)). There is no separate confidence field on Noul.choice, probabilities, and confidence.score, legend, probabilities, and confidence.All three can be mixed in a single call via the native @typesafe-ai/sdk (TypeSafeClient.systemOne, helpers noul / choice / score). Questions run in parallel against the same state. Model alias: jev-latest. Docs: docs.typesafe.ai and typesafe.ai.
Public figures from TypeSafe: on the order of ~100 ms latency, about $0.042 per million input tokens, with output tokens free. We are not inventing benchmarks beyond those claims. Measure in your own path.
Prompts that say "be careful" are not a control plane. Australian enterprise and government buyers want thresholds they can change in code, log, and audit.
tru-jev-harness is fixtures plus gates only. No chatbot, no vector database, no LangChain. Two gates sit in front of expensive work:
allow | escalate | block.Cascade: state and typed questions -> Jev (~100 ms, ~$0.042 / M input, output free) -> typed answers -> your code branches on thresholds -> optional frontier LLM only if you still need prose.
Native client path (default in this harness): @typesafe-ai/sdk, TYPESAFE_API_KEY, POST /v1/systemone, model jev-latest. Vercel AI Gateway (typesafe-ai/jev) is documented as an alternate path, not the default, so CI does not depend on a Gateway token.

One batched Jev call: each candidate passage is a Noul ("is this relevant?"). Code keeps only passages with noul >= keepMinNoul.
await runRagGate(client, { query, passages }, { thresholds: { keepMinNoul: 0.8 } });Noul answers have no separate confidence field. The RAG gate thresholds on noul itself (P(relevant)). Defaults live in src/thresholds.ts and can be overridden per call.

The repo ships a Vite playground under ui/. After npm run ui:install, run npm run ui and open http://localhost:5173. Mock mode works with no key; with TYPESAFE_API_KEY set, the UI runs live Jev by default. The API key stays on the server; the browser never sees it.
In the loyalty coffee offer screenshot above (a different fixture path from the duplicate-GST live demo), keepMinNoul is set to 0.75. The gate keeps the spring loyalty coffee beans passage and drops GST and shipping noise: 1 of 7 kept.

Before an agent runs a side-effecting tool, Jev scores Choice (disposition), Score (risk), and Noul (policy fit). Deterministic policy in this repo maps those answers to a decision.
await runToolGate(client, { proposal, policy }, { thresholds: { allowMinConfidence: 0.9, maxAllowRisk: 1.0 } });Defaults live in src/thresholds.ts and can be overridden per call. Jev proposes; your code decides.
Fixtures are a fictional AU retailer, Bluegum Outfitters Pty Ltd (Sydney): a Brunswick VIC duplicate-GST ticket, ACL / GST knowledge-base passages, and tool proposals such as lookup_order, send_email, refund, and delete_record.
On live Jev runs against those fixtures (safe to cite as public demo behaviour):
lookup_order and send_email; escalate a mid-size duplicate refund (AUD $94.50); block a large goodwill refund and delete_record.The loyalty coffee UI screenshot above is a different fixture path (1 of 7 kept at keepMinNoul 0.75). Both paths show the same idea: cheap typed gates, then code-owned branches, before irreversible or expensive work.
Requirements: Node 24+, ESM. No API key required to explore: mock mode (--mock / JEV_MOCK=1) runs the full demos and tests with a deterministic fake client.
src/ - client wrapper, ragGate, toolGate, types, thresholdsexamples/ - rag-demo, tool-demo, AU fixturestests/ - Vitest with a mocked Jev client (never hits the live API)ui/ - Vite playground for RAG + tool gatesScripts:
npm test - Vitest, mocked Jev onlynpm run demo:rag -- --mock - RAG gate without an API keynpm run demo:tool -- --mock - tool gate without an API keynpm run ui - interactive Vite playgroundnpm run ui:install / npm run ui:build - UI install and buildnpm run typecheck / npm run build - typecheck and emit dist/TYPESAFE_API_KEY (or exit with a clear error if neither key nor --mock)Platform and GenAI teams that already have a retriever or tool path and want a typed gate before expensive generation or risky actions. If you are still shopping for a vector database, fix corpus ownership and evaluation first. If you already generate against noisy retrieval or open tool surfaces, this pattern is for you.
Practical places Australian and enterprise teams drop these gates in:
Repository: github.com/trufyrelabs/tru-jev-harness
Company: trufyre.ai | Overview: Who Is TruFyre AI? | Email: info@trufyre.ai
Star the repo, open issues, and tell us which gate you want first in your stack.
