shipwithjev

Catalog / Tools & apps

0315GitHub

wakegate

Experimental gate where Jev decides whether a timer or incoming event is worth resuming a sleeping agent's LLM; code skips only when Jev is confident and always wakes on user…

shitianfang/wakegateREADME ↗
# wakegate

Before you resume a sleeping agent, ask [Jev](https://vercel.com/ai-gateway/models/jev) whether the wakeup is worth a full LLM turn.

## Why

Long-running agents sleep. A timer fires every 30 minutes to re-check a price, or an email lands while the agent waits for one particular reply. Each wakeup usually resumes the LLM with its whole context, and many of them end in "nothing changed, back to sleep". That turn's tokens are spent anyway.

wakegate puts one Jev call in front of the resume. Jev is TypeSafe AI's judgment model: it reads JSON state and returns probabilities for typed questions without generating text. A call took about 250 ms in our runs. wakegate asks one question: given what the agent said it was waiting for, is this worth waking up for? Plain code handles everything else, including how long to sleep and when to force a wake.

## Install

Not on npm yet.

```sh
npm install github:shitianfang/wakegate ai
```

`ai` (the Vercel AI SDK, 7.0.105 or later) is a peer dependency. By default the model is `typesafe-ai/jev` on the Vercel AI Gateway, which reads `AI_GATEWAY_API_KEY`.

## Usage

```ts
import { shouldWake } from "wakegate";

// An email arrived while the agent slept.
const verdict = await shouldWake({
  waitingFor: "A reply from Dana Li (HR at Acme) about scheduling my second-round interview",
  event: { type: "email", from: "noreply@medium.com", subject: "Your Daily Digest: 7 stories about AI agents" },
  skipped: 0, // skips in a row so far: store verdict.skipped and pass it back next time
});
// { wake: false, reason: "judged", probability: 0.01, skipped: 1 }

if (verdict.wake) await resumeAgent(); // your full LLM turn
```

| Field | |
|---|---|
| `waitingFor` | What the agent said it was waiting for when it went to sleep. |
| `event` |

Also filed under Tools & apps

  1. 0616

    Jevstiller: distill Jev calls into a local model

    A self-hosted proxy that trains a local model on Jev's answers. It served 72% of Banking77 locally at 15 ms, with a 2% audit and a bound on disagreement.

    tomerglick57 · Tools & apps · 15 ms local

  2. 0611

    Scruple: code checks for what linters miss

    Semantic-aware linting with System One models: rules you can state in a sentence, checked against your code by Jev.

    @nalexpeae · Tools & apps

  3. 0606

    Algolia-style Postgres search with a Jev reranker

    Typo tolerance, typeahead, barcodes and facet counts in plain Postgres SQL, plus an optional Jev step that asks one question per top-10 result.

    @alex_forman1 · Tools & apps

  4. 0604

    Virtual Closet: outfits from closet videos

    built a virtual closet & outfit generator from raw closet videos. classification + semantic search thanks to jev 🥰. clueless closet dreams finally coming to life

    @maitreemervana · Tools & apps