jevrecipes

Recipe catalog / task-complexity

Grade task complexity

task-complexity is a Jev recipe from the jev-recipes TypeScript package. How complex is task, from a single lookup to open-ended work, on a five-level rubric? Use it when you need to size a task before choosing a model, a plan depth, a time budget, or whether to ask for help.

Last updated .

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

How do I use task-complexity 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 { taskComplexity } from 'jev-recipes/task-complexity';

const result = await taskComplexity({
  "task": "Migrate the billing service from the legacy payments API to the new provider, keeping existing subscriptions active and reconciling any invoices that fail during the cutover.",
  "context": "The service has 40,000 active subscriptions and no staging replica of production data.",
  "minConfidence": 0.8
});
console.log(result);

What input does task-complexity take?

FieldTypeNeeded
taskstringRequired
contextstringOptional
minConfidencenumberOptional
Full input and result schemas
{
  "input": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "task": {
        "type": "string"
      },
      "context": {
        "type": "string"
      },
      "minConfidence": {
        "type": "number",
        "minimum": 0,
        "maximum": 1
      }
    },
    "required": [
      "task"
    ]
  },
  "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
        }
      },
      "complexity": {
        "type": "string",
        "enum": [
          "trivial",
          "simple",
          "moderate",
          "complex",
          "open-ended"
        ]
      }
    },
    "required": [
      "model",
      "usage",
      "status",
      "score",
      "level",
      "confidence",
      "probabilities",
      "complexity"
    ],
    "additionalProperties": false
  }
}

What does a task-complexity 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 task-complexity.

{
  "model": "demo-fixture",
  "usage": {
    "input_tokens": 0,
    "output_tokens": 0
  },
  "status": "ready",
  "score": 3.04,
  "level": 3,
  "confidence": 0.84,
  "probabilities": {
    "0": 0,
    "1": 0.01,
    "2": 0.09,
    "3": 0.84,
    "4": 0.06
  },
  "complexity": "complex"
}

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

complexity is one of trivial, simple, moderate, complex, or open-ended, 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 order tasks or pick a budget tier.

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 complexity question, the rubric wording, and the review policy. A live invocation makes one logical Jev request.

Limits

The grade describes the work as written. It does not know your tools, data access, or team, so the same task can be easier or harder in practice. Application code maps levels to concrete budgets, model choices, or escalation rules. The recipe does not decide whether the task should be done.

Example input

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

How accurate is task-complexity?

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 task-complexity?