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

Release date:
September 18, 2026
Hero Vector
Abstract editorial illustration in deep indigo, coral and warm bone showing a cascade from connected nodes through a gate panel to branching outcome panels
Vector ImageVector ImageVector Image
Blog detail
Vector ImageVector ImageVector Image

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.

What TypeSafe Jev is (and is not)

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 - is this statement true? Returns noul in [0, 1] (P(yes)). There is no separate confidence field on Noul.
  • Choice - which option? Returns choice, probabilities, and confidence.
  • Score - where on this rubric? Returns 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.

Cascade overview

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:

  1. RAG relevance gate. Score candidate passages with Jev Noul and keep only high-relevance chunks before any LLM generation.
  2. Tool risk gate. Score a tool proposal with Choice + Score + Noul, then let your code return 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.

RAG relevance gate architecture

RAG relevance gate architecture: query and candidate passages through Jev Noul and keepMinNoul threshold
RAG relevance gate: query and candidate passages become state, Jev returns one Noul per passage, code keeps only those at or above keepMinNoul.

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.

RAG gate in practice

tru-jev-harness RAG relevance gate UI showing keep and drop verdicts on Bluegum support passages
Interactive Vite UI: Bluegum loyalty coffee offer scenario at keepMinNoul 0.75, keeping 1 of 7 passages (spring loyalty coffee beans) and dropping GST/shipping noise.

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.

Tool risk gate architecture

Tool risk gate architecture: Jev Choice Score and Noul into allow escalate or block
Tool risk gate: proposal plus policy into Jev Choice, Score, and Noul; decideToolAction maps thresholds to allow, escalate, or block.

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.

Live fixture behaviour

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):

  • RAG (duplicate-charge path): kept high-relevance AU support passages on duplicate charge / ACL / GST; dropped shipping, loyalty, and NBN noise.
  • Tool: allow 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.

Repo layout and scripts

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, thresholds
  • examples/ - rag-demo, tool-demo, AU fixtures
  • tests/ - Vitest with a mocked Jev client (never hits the live API)
  • ui/ - Vite playground for RAG + tool gates

Scripts:

  • npm test - Vitest, mocked Jev only
  • npm run demo:rag -- --mock - RAG gate without an API key
  • npm run demo:tool -- --mock - tool gate without an API key
  • npm run ui - interactive Vite playground
  • npm run ui:install / npm run ui:build - UI install and build
  • npm run typecheck / npm run build - typecheck and emit dist/
  • Live demos need TYPESAFE_API_KEY (or exit with a clear error if neither key nor --mock)

Who this is for

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.

Use cases

Practical places Australian and enterprise teams drop these gates in:

  • Support RAG. Filter knowledge-base passages before answer generation so the frontier model only sees chunks that clear keepMinNoul.
  • Agent tool control. Put refunds, outbound email, and deletes behind allow / escalate / block, with human review on the middle path.
  • Cost control. Cut junk context tokens before the expensive LLM call; pay for generation only on kept passages.
  • Policy and compliance. Keep thresholds in code (and logs), not buried in prompts that drift across releases.
  • Shadow / canary. Run the gate in shadow mode beside your current path, compare decisions, then cut over when confidence in the thresholds is solid.
  • Multi-tenant. Different keepMinNoul and tool-risk thresholds per client or product line without forking prompts.

Get the code and talk to us

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.

BG Image
Vector ImageVector ImageVector Image
We’re here to help
Vector ImageVector ImageVector Image

Ready to put AI to work in your business?

Talk to an AI expert about your goals.
Arrow Icon
Smart process automation
Arrow Icon
Direct access to our team. No bots.
Arrow Icon
We ask smart questions fast.

Book a Discovery Call

Your form has been submitted successfully. Thank you!
Please double-check your information and try again. If the issue continues, email us at info@trufyre.ai