Recipe catalog / priority-compare
Compare two tasks for priority
Which of firstTask and secondTask should be done first under criteria?
A planner or agent must order two competing tasks and the team has written down how priority should be decided.
Explore this recipe interactively ยท Source and implementation guide
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);
Input contract
| Field | Type | Needed |
|---|---|---|
| criteria | string | Required |
| firstTask | string | Required |
| secondTask | string | Required |
| minConfidence | number | Optional |
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
}
}Saved example result
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
}
}
Evaluation evidence
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.
Limitations
- Orders two tasks under the criteria as written. It does not check that the criteria are sensible or complete, and it does not know about tasks outside the pair.
- A neither verdict means the criteria rule both tasks out; it does not mean they are impossible or harmful.
Related recipes
- action-compare: Use action-compare to choose which of two next steps better advances a goal rather than which of two tasks to schedule first.
- task-dependency: Use task-dependency to establish whether one task must finish before the other can start, which is a hard ordering rather than a priority call.