jevrecipes

Recipe catalog / priority-compare

Compare two tasks for priority

priority-compare is a Jev recipe from the jev-recipes TypeScript package. Which of firstTask and secondTask should be done first under criteria? Use it when a planner or agent must order two competing tasks and the team has written down how priority should be decided.

Last updated .

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

How do I use priority-compare 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 { priorityCompare } from 'jev-recipes/priority-compare';

const result = await priorityCompare({
  "criteria": "Customer-facing outages come first. Then anything blocking another team. Internal refactors are scheduled last and only when nothing else is waiting.",
  "firstTask": "Rename the internal config helpers for consistency across the billing service.",
  "secondTask": "Fix the checkout page returning a 500 for customers paying with a saved card.",
  "minConfidence": 0.8
});
console.log(result);

What input does priority-compare take?

FieldTypeNeeded
criteriastringRequired
firstTaskstringRequired
secondTaskstringRequired
minConfidencenumberOptional
Full input and result schemas
{
  "input": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "criteria": {
        "type": "string"
      },
      "firstTask": {
        "type": "string"
      },
      "secondTask": {
        "type": "string"
      },
      "minConfidence": {
        "type": "number",
        "minimum": 0,
        "maximum": 1
      }
    },
    "required": [
      "criteria",
      "firstTask",
      "secondTask"
    ]
  },
  "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": [
          "first",
          "second",
          "tie",
          "neither",
          "unclear"
        ]
      },
      "confidence": {
        "type": "number",
        "minimum": 0,
        "maximum": 1
      },
      "probabilities": {
        "type": "object",
        "propertyNames": {
          "type": "string",
          "enum": [
            "first",
            "second",
            "tie",
            "neither",
            "unclear"
          ]
        },
        "additionalProperties": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        },
        "required": [
          "first",
          "second",
          "tie",
          "neither",
          "unclear"
        ]
      }
    },
    "required": [
      "model",
      "usage",
      "status",
      "verdict",
      "confidence",
      "probabilities"
    ],
    "additionalProperties": false
  }
}

What does a priority-compare 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 priority-compare.

{
  "model": "demo-fixture",
  "usage": {
    "input_tokens": 0,
    "output_tokens": 0
  },
  "status": "ready",
  "verdict": "second",
  "confidence": 0.93,
  "probabilities": {
    "first": 0.02,
    "second": 0.93,
    "tie": 0.02,
    "neither": 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.

Result

verdict is first, second, tie, neither, or unclear. first and second name the task that should be done first. tie means the criteria do not distinguish the two, so either order is fine. neither means the criteria rule both tasks out, which usually signals that neither belongs on the current plan.

A result is ready when confidence meets minConfidence and the verdict is not unclear. probabilities covers all five outcomes.

Reuse and calls

Uses the shared comparison helper, which fixes the five outcomes and tells Jev that presentation order is irrelevant. This folder owns the question wording and the four outcome descriptions. A live invocation makes one logical Jev request.

Limits

The recipe orders two tasks under the criteria as written. It does not judge whether the criteria are wise or complete, and it knows nothing about tasks outside the pair, so building a full ranking means running many pairs or a dedicated ranking step. neither reports that the criteria exclude both tasks, not that they are impossible or harmful. For whether one task must finish before the other can start, use task-dependency; for which of two next steps better advances a goal, use action-compare.

Example input

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

How accurate is priority-compare?

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 priority-compare?