jevrecipes

Recipe catalog / instruction-clarity

Grade instruction clarity

instruction-clarity is a Jev recipe from the jev-recipes TypeScript package. How unambiguous is instruction for a delegate who has only context, on a five-level rubric? Use it when you need to grade an instruction before sending it to a sub-agent or teammate, so an orchestrator can rewrite it or ask a question instead of letting the delegate guess.

Last updated .

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

How do I use instruction-clarity 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 { instructionClarity } from 'jev-recipes/instruction-clarity';

const result = await instructionClarity({
  "instruction": "Clean up the flaky tests in the payments module and make sure CI is green.",
  "context": "The payments module has 214 tests across 18 files. Three tests were quarantined last week with a skip marker and a link to issue #882. CI currently fails on main because of an unrelated lint error in the docs build.",
  "minConfidence": 0.8
});
console.log(result);

What input does instruction-clarity take?

FieldTypeNeeded
instructionstringRequired
contextstringOptional
minConfidencenumberOptional
Full input and result schemas
{
  "input": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "instruction": {
        "type": "string"
      },
      "context": {
        "type": "string"
      },
      "minConfidence": {
        "type": "number",
        "minimum": 0,
        "maximum": 1
      }
    },
    "required": [
      "instruction"
    ]
  },
  "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"
        ]
      },
      "score": {
        "type": "number",
        "minimum": 0
      },
      "level": {
        "type": "integer",
        "minimum": 0,
        "maximum": 9007199254740991
      },
      "confidence": {
        "type": "number",
        "minimum": 0,
        "maximum": 1
      },
      "probabilities": {
        "type": "object",
        "propertyNames": {
          "type": "string"
        },
        "additionalProperties": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        }
      },
      "clarity": {
        "type": "string",
        "enum": [
          "unusable",
          "ambiguous",
          "gappy",
          "clear",
          "precise"
        ]
      }
    },
    "required": [
      "model",
      "usage",
      "status",
      "score",
      "level",
      "confidence",
      "probabilities",
      "clarity"
    ],
    "additionalProperties": false
  }
}

What does a instruction-clarity 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 instruction-clarity.

{
  "model": "demo-fixture",
  "usage": {
    "input_tokens": 0,
    "output_tokens": 0
  },
  "status": "ready",
  "score": 1.99,
  "level": 2,
  "confidence": 0.83,
  "probabilities": {
    "0": 0.01,
    "1": 0.08,
    "2": 0.83,
    "3": 0.07,
    "4": 0.01
  },
  "clarity": "gappy"
}

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

clarity is one of unusable, ambiguous, gappy, clear, or precise, taken from the most likely rubric level. level is that level's index from 0 to 4. score is Jev's expected value across the rubric and can fall between levels; use it to decide whether to rewrite, ask, or send.

A result is ready when confidence meets minConfidence. Otherwise it is review and still carries the graded values. probabilities is keyed by level index.

Reuse and calls

Uses the shared score helper. This folder owns the clarity question, the rubric wording, and the review policy. A live invocation makes one logical Jev request.

Limits

The grade is taken from the delegate's point of view using only instruction and context. Knowledge the delegate has that is not written into context cannot raise the grade, and knowledge it lacks cannot lower it. The recipe reports how clear the instruction is, not whether the work it asks for is sensible or within the delegate's abilities. To enumerate the open questions behind a low grade, follow up with clarify.

Example input

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

How accurate is instruction-clarity?

Fixture only

No verified live accuracy measurement is available. Evaluate representative cases before using this decision in your workflow.

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

What are the limits of instruction-clarity?