jevrecipes

Recipe catalog / completion-gate

Gate an agent claiming it is done

completion-gate is a Jev recipe from the jev-recipes TypeScript package. Did an agent finish task, judging report against evidence, with unproven claims, quietly narrowed scope, open questions, and unresolved errors flagged in the same call? Use it when a coding agent says it is finished and you must decide, before accepting or before letting it stop, whether the work is actually complete.

Last updated .

Explore this recipe interactively · Source and implementation guide · Markdown version

How do I use completion-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 { completionGate } from 'jev-recipes/completion-gate';

const result = await completionGate({
  "task": "Add input validation to the signup endpoint, write unit tests for the new validation, and make sure the full test suite passes.",
  "report": "I added validation for email and password fields in signup.ts and wrote three unit tests covering the new checks. All tests pass. Let me know if you want me to also validate the username field.",
  "evidence": "$ npm test\n\nTest Files  12 passed (12)\n     Tests  87 passed (87)\n\n$ git diff --stat\n src/signup.ts          | 18 ++++++++++++\n tests/signup.test.ts   | 41 +++++++++++++++++++++++++",
  "minConfidence": 0.8
});
console.log(result);

What input does completion-gate take?

FieldTypeNeeded
taskstringRequired
reportstringRequired
evidencestringOptional
minConfidencenumberOptional
Full input and result schemas
{
  "input": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "task": {
        "type": "string"
      },
      "report": {
        "type": "string"
      },
      "evidence": {
        "type": "string"
      },
      "minConfidence": {
        "type": "number",
        "minimum": 0,
        "maximum": 1
      }
    },
    "required": [
      "task",
      "report"
    ]
  },
  "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": [
          "complete",
          "incomplete",
          "unverified",
          "unclear"
        ]
      },
      "confidence": {
        "type": "number",
        "minimum": 0,
        "maximum": 1
      },
      "probabilities": {
        "type": "object",
        "propertyNames": {
          "type": "string",
          "enum": [
            "complete",
            "incomplete",
            "unverified",
            "unclear"
          ]
        },
        "additionalProperties": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "required": [
          "complete",
          "incomplete",
          "unverified",
          "unclear"
        ]
      },
      "signals": {
        "type": "object",
        "properties": {
          "claimsWithoutEvidence": {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "ready",
                  "review"
                ]
              },
              "verdict": {
                "type": "string",
                "enum": [
                  "present",
                  "absent"
                ]
              },
              "probability": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "confidence": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              }
            },
            "required": [
              "status",
              "verdict",
              "probability",
              "confidence"
            ],
            "additionalProperties": false
          },
          "scopeNarrowed": {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "ready",
                  "review"
                ]
              },
              "verdict": {
                "type": "string",
                "enum": [
                  "present",
                  "absent"
                ]
              },
              "probability": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "confidence": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              }
            },
            "required": [
              "status",
              "verdict",
              "probability",
              "confidence"
            ],
            "additionalProperties": false
          },
          "openQuestions": {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "ready",
                  "review"
                ]
              },
              "verdict": {
                "type": "string",
                "enum": [
                  "present",
                  "absent"
                ]
              },
              "probability": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "confidence": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              }
            },
            "required": [
              "status",
              "verdict",
              "probability",
              "confidence"
            ],
            "additionalProperties": false
          },
          "unresolvedErrors": {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "ready",
                  "review"
                ]
              },
              "verdict": {
                "type": "string",
                "enum": [
                  "present",
                  "absent"
                ]
              },
              "probability": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              },
              "confidence": {
                "type": "number",
                "minimum": 0,
                "maximum": 1
              }
            },
            "required": [
              "status",
              "verdict",
              "probability",
              "confidence"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "claimsWithoutEvidence",
          "scopeNarrowed",
          "openQuestions",
          "unresolvedErrors"
        ],
        "additionalProperties": false
      },
      "detected": {
        "type": "array",
        "items": {
          "type": "string",
          "enum": [
            "claimsWithoutEvidence",
            "scopeNarrowed",
            "openQuestions",
            "unresolvedErrors"
          ]
        }
      }
    },
    "required": [
      "model",
      "usage",
      "status",
      "verdict",
      "confidence",
      "probabilities",
      "signals",
      "detected"
    ],
    "additionalProperties": false
  }
}

What does a completion-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 completion-gate.

{
  "model": "demo-fixture",
  "usage": {
    "input_tokens": 0,
    "output_tokens": 0
  },
  "status": "ready",
  "verdict": "complete",
  "confidence": 0.9,
  "probabilities": {
    "complete": 0.9,
    "incomplete": 0.05,
    "unverified": 0.03,
    "unclear": 0.02
  },
  "signals": {
    "claimsWithoutEvidence": {
      "status": "ready",
      "verdict": "absent",
      "probability": 0.06,
      "confidence": 0.94
    },
    "scopeNarrowed": {
      "status": "ready",
      "verdict": "absent",
      "probability": 0.08,
      "confidence": 0.92
    },
    "openQuestions": {
      "status": "ready",
      "verdict": "absent",
      "probability": 0.12,
      "confidence": 0.88
    },
    "unresolvedErrors": {
      "status": "ready",
      "verdict": "absent",
      "probability": 0.03,
      "confidence": 0.97
    }
  },
  "detected": []
}

Input

See shared options and behavior for client configuration, validation, and errors. Types are inferred from this folder's Zod 4 schemas.

task is the original assignment. report is the agent's final message. evidence is the record that can prove the report: test output, a diff summary, command results, or the tail of the transcript. Without evidence, the recipe judges the report alone and treats its bare assertions as unverified.

Result

verdict is complete, incomplete, unverified, or unclear, with confidence and probabilities. Only complete should let the agent stop without a second look.

signals carries four independent checks made in the same request: claimsWithoutEvidence, scopeNarrowed, openQuestions, and unresolvedErrors, each with its own verdict, probability, confidence, and status. detected lists the signals judged present. Use them to decide what to send back to the agent: an openQuestions signal usually means the agent should make the decision itself, while unresolvedErrors means it should keep working.

A result is ready when the decision confidence meets minConfidence and the verdict is not unclear. Otherwise it is review.

Reuse and calls

Uses the shared choice-with-labels fan-out helper. One live invocation makes one Jev request carrying five questions. This folder owns the completion instruction, the verdict criteria, and the signal definitions.

Limits

Supply real evidence. A report that says "all tests pass" with no test output is unverified by design. When the transcript is long, pass its final portion plus any command output that bears on the task.

The recipe does not judge code quality or correctness beyond what the evidence shows. Pair it with a review step for that.

Example input

demo.json contains editable input and a hand-authored response. After installing jev-recipes, npx jev-recipes demo completion-gate shows an offline illustration, not an accuracy measurement. Use npx jev-recipes describe completion-gate to inspect the input and result schemas.

Decision boundary

Use unclear when the required scope cannot be established, incomplete when a known requirement remains unfinished, and unverified when completion is claimed without supporting evidence. The caller decides what evidence is sufficient for its workflow.

How accurate is completion-gate?

Current mixed-source measurement

jev-1.13.0 / 2026-10-04 / 144 development cases

Scoring revision 2.

98%All-case accuracy
53Sent for review
0Failed calls / cases

91 ready decisions, with 100% accuracy among those decisions.

95% case-level interval: 94% to 99%. Related synthetic cases are correlated.

This measures the recorded dataset, not general readiness. Label sources: unspecified: Existing repository labels; independent review and original authorship were not recorded.; author-synthetic: AI-authored synthetic boundary cases for jev-recipes; labels have not had independent human review.

Use the evaluation guide to measure this decision on your own labeled cases.

What are the limits of completion-gate?