Recipe catalog / wake-gate
Decide whether an event should wake a waiting agent
wake-gate is a Jev recipe from the jev-recipes TypeScript package. Should event wake an agent that is paused until waitingFor happens: wake now, keep waiting, or ignore it as unrelated? Use it when a paused or sleeping agent receives a timer tick, webhook, message, or file change and you must decide whether to resume its model loop.
Last updated .
Explore this recipe interactively · Source and implementation guide · Markdown version
How do I use wake-gate in TypeScript?
Install with npm install jev-recipes. Requires Node.js 22.9 or newer and ES modules. Set TYPESAFE_API_KEY in your server environment for live calls, which send input to TypeSafe and use API quota. See the installation guide.
import { wakeGate } from 'jev-recipes/wake-gate';
const result = await wakeGate({
"waitingFor": "The CI pipeline for pull request #418 finishes, so the agent can read the results and either merge or fix failures.",
"event": "GitHub webhook: check_suite completed for PR #418 with conclusion \"failure\". 2 of 14 jobs failed: unit-tests (node 22) and lint.",
"context": "The agent opened PR #418 twenty minutes ago and paused until CI completes.",
"minConfidence": 0.8
});
console.log(result);
What input does wake-gate take?
| Field | Type | Needed |
|---|---|---|
| waitingFor | string | Required |
| event | string | Required |
| context | string | Optional |
| minConfidence | number | Optional |
Full input and result schemas
{
"input": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"waitingFor": {
"type": "string"
},
"event": {
"type": "string"
},
"context": {
"type": "string"
},
"minConfidence": {
"type": "number",
"minimum": 0,
"maximum": 1
}
},
"required": [
"waitingFor",
"event"
]
},
"result": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"model": {
"type": "string"
},
"usage": {
"type": "object",
"properties": {
"input_tokens": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"output_tokens": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
}
},
"required": [
"input_tokens",
"output_tokens"
],
"additionalProperties": false
},
"status": {
"type": "string",
"enum": [
"ready",
"review"
]
},
"verdict": {
"type": "string",
"enum": [
"wake",
"not_yet",
"unrelated",
"unclear"
]
},
"confidence": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"probabilities": {
"type": "object",
"propertyNames": {
"type": "string",
"enum": [
"wake",
"not_yet",
"unrelated",
"unclear"
]
},
"additionalProperties": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"required": [
"wake",
"not_yet",
"unrelated",
"unclear"
]
}
},
"required": [
"model",
"usage",
"status",
"verdict",
"confidence",
"probabilities"
],
"additionalProperties": false
}
}What does a wake-gate result look like?
This hand-authored response demonstrates the contract. It is not a model accuracy measurement. Run it without an API key: npx jev-recipes demo wake-gate.
{
"model": "demo-fixture",
"usage": {
"input_tokens": 0,
"output_tokens": 0
},
"status": "ready",
"verdict": "wake",
"confidence": 0.95,
"probabilities": {
"wake": 0.95,
"not_yet": 0.02,
"unrelated": 0.01,
"unclear": 0.02
}
}
Input
See shared options and behavior for client configuration, validation, and errors. Types are inferred from this folder's Zod 4 schemas. context is optional and is omitted from the request when absent.
Result
verdict is wake, not_yet, unrelated, or unclear. A wake result means the resumed agent should read the event and re-plan; not_yet means keep sleeping; unrelated means the event can be dropped without touching the agent. Only unclear and low-confidence results are review; treat review as not_yet unless the event is cheap to inspect.
Reuse and calls
Uses the shared choice helper for the Jev call and response parsing. This folder owns its question, verdict criteria, and review policy. A live invocation makes one logical Jev request.
Limits
Pass one event per call. Batch pending events in your own code, or combine them into one event text when they arrive together. If the wait condition has a deadline, include the current time and the deadline in context; the recipe does not track time on its own.
Example input
demo.json contains editable input and a hand-authored response. After installing jev-recipes, npx jev-recipes demo wake-gate shows an offline illustration, not an accuracy measurement. Use npx jev-recipes describe wake-gate to inspect the input and result schemas.
How accurate is wake-gate?
jev-1.13.0 / 2026-10-04 / 44 development cases
Scoring revision 2.
33 ready decisions, with 97% accuracy among those decisions.
95% case-level interval: 76% to 95%. Related synthetic cases are correlated.
This measures the recorded dataset, not general readiness. Label sources: unspecified: Not recorded by the dataset author.
Use the evaluation guide to measure this decision on your own labeled cases.
What are the limits of wake-gate?
- Judges only the supplied event against the stated wait condition. It does not know about earlier events or the agent's full history unless context supplies them.
- A wake verdict means the condition appears met or materially changed; the resumed agent still has to verify the actual state.
Which recipes are related to wake-gate?
- goal-drift: Use goal-drift to check whether a resumed agent's next step still serves its goal.
- progress-stall: Use progress-stall to detect an agent that keeps waking without making progress.