shipwithjev

Catalog / Tools & apps

0400GitHub

tripwire

Runs seven checks on every LLM response in one Jev call, as AI SDK middleware or an OpenAI-compatible proxy.

noelzappy/tripwireREADME ↗
# tripwire

[](https://www.npmjs.com/package/@noelzappy/tripwire) [](https://github.com/noelzappy/tripwire/actions/workflows/ci.yml)

Judge every LLM response before the user sees it. Seven checks in one ~100 ms call to [TypeSafe's Jev](https://typesafe.ai), cheap enough to run on 100% of traffic instead of sampling 1% with a frontier judge.

- **AI SDK middleware**: `wrapLanguageModel({ model, middleware: tripwire(...) })`. Zero infra.
- **OpenAI-compatible proxy**: point any client's `baseURL` at it.
- **Policy as YAML**: which checks run, how confident Jev must be, what a block does.
- **Confidence-gated**: a check that fires with high confidence blocks; low confidence downgrades to flag, never suppresses.
- **Decision log** that is PII-free by default and doubles as your labelling dataset.
- **Eval CLI** that prints per-check precision/recall and coverage at each threshold. Run it before you trust anything.

## Status

v0.1. Middleware and proxy work end to end (29 tests, mock judge). **No accuracy numbers against real Jev yet.** The eval harness and a 27-item seed set exist so the first real run is one command. Do not put this in front of users until that run shows block precision above 95% on your own data.

## Install

```sh
npm install @noelzappy/tripwire ai     
# or: bun add @noelzappy/tripwire ai
```

The library runs on Node 20+ and Bun. The proxy server needs Bun. `ai` (v7) is a peer dependency, so tripwire uses the same copy as your app.

## Develop

```sh
bun install
cp .env.example .env     # add TYPESAFE_AI_API_KEY, or leave empty for the mock judge
bun test
bun run eval             # replay eval/dataset.jsonl through the judge
```

### Middleware

```ts
import { anthropic } from "@ai-sdk/anthropic";
import { generateText, wrapLanguageModel } from "ai";

Also filed under Tools & apps

  1. 0573

    Support chat: agent offered a human escalation path

    A frustrated customer hits a bot loop twice; the judge checks whether a human handoff was offered.

    everyai-com · Tools & apps

  2. 0572

    Subscription cancel: effective date is explicit

    An agent cancels a subscription; the judge checks the exact date the cancellation takes effect.

    everyai-com · Tools & apps

  3. 0571

    Sales quote: numbers match the official price list

    An agent quotes $29/seat against a price list; the judge checks the quote matches exactly.

    everyai-com · Tools & apps

  4. 0570

    Refund chat: agent stated the amount before issuing it

    A support agent issues a $42.50 refund; the judge checks the exact amount was stated before the refund was confirmed.

    everyai-com · Tools & apps