{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://autorouter.com/scorecard/task-spec.schema.json",
  "title": "Coding agent benchmark task spec",
  "description": "One file of benchmark tasks for AutoRouter's open coding agent benchmark scorecard. Guide: https://autorouter.com/blog/coding-agent-benchmark-scorecard",
  "type": "object",
  "required": ["scorecard_version", "tasks"],
  "additionalProperties": false,
  "properties": {
    "scorecard_version": {
      "description": "Version of the scorecard format this file follows.",
      "const": "1.0"
    },
    "tasks": {
      "type": "array",
      "minItems": 1,
      "items": { "$ref": "#/$defs/task" }
    }
  },
  "$defs": {
    "task": {
      "type": "object",
      "required": [
        "id",
        "illustrative",
        "source_pr_url",
        "workflow",
        "repo",
        "parent_commit",
        "prompt",
        "setup",
        "grading",
        "pass_criteria",
        "time_limit_minutes"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "description": "Stable task id, used as task_id in runs.csv.",
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9._-]*$"
        },
        "illustrative": {
          "description": "true for made-up example tasks, false for real ones.",
          "type": "boolean"
        },
        "source_pr_url": {
          "description": "The merged pull request the task comes from.",
          "type": "string",
          "format": "uri"
        },
        "workflow": {
          "description": "The kind of work, so results can be split by workflow.",
          "type": "string",
          "examples": [
            "bug-fix",
            "feature",
            "refactor",
            "test-writing",
            "migration",
            "code-review"
          ]
        },
        "repo": {
          "description": "Repository the task runs in, as owner/name or a clone URL.",
          "type": "string",
          "minLength": 1
        },
        "parent_commit": {
          "description": "The commit before the change: the pull request's base. Agents start here.",
          "type": "string",
          "pattern": "^[0-9a-f]{7,40}$"
        },
        "prompt": {
          "description": "The original request, as the engineer gave it to the agent or wrote it in the issue.",
          "type": "string",
          "minLength": 1
        },
        "setup": {
          "description": "Commands run before the agent starts, in order (install, seed data, start services).",
          "type": "array",
          "items": { "type": "string", "minLength": 1 }
        },
        "grading": { "$ref": "#/$defs/grading" },
        "pass_criteria": {
          "description": "What counts as a pass, in one or two sentences.",
          "type": "string",
          "minLength": 1
        },
        "time_limit_minutes": {
          "description": "Wall-clock limit for one run, or null for none.",
          "type": ["number", "null"],
          "exclusiveMinimum": 0
        },
        "validation": { "$ref": "#/$defs/validation" }
      }
    },
    "grading": {
      "type": "object",
      "required": ["method"],
      "additionalProperties": false,
      "properties": {
        "method": {
          "description": "tests: run a command; rubric: a person scores against written criteria; llm-judge: a model scores against the rubric.",
          "enum": ["tests", "rubric", "llm-judge"]
        },
        "command": {
          "description": "Exact command that grades the run. Exit code 0 means pass.",
          "type": "string",
          "minLength": 1
        },
        "fail_to_pass": {
          "description": "Tests that fail at the parent commit and must pass after the agent's change.",
          "type": "array",
          "items": { "type": "string" }
        },
        "pass_to_pass": {
          "description": "Tests that pass at the parent commit and must still pass.",
          "type": "array",
          "items": { "type": "string" }
        },
        "rubric": {
          "description": "Criteria written before any run, each checkable as met or not met.",
          "type": "array",
          "minItems": 1,
          "items": { "type": "string", "minLength": 1 }
        },
        "judge_model": {
          "description": "Model and setting used as the judge, for llm-judge.",
          "type": "string",
          "minLength": 1
        }
      },
      "allOf": [
        {
          "if": { "properties": { "method": { "const": "tests" } } },
          "then": { "required": ["command"] }
        },
        {
          "if": { "properties": { "method": { "const": "rubric" } } },
          "then": { "required": ["rubric"] }
        },
        {
          "if": { "properties": { "method": { "const": "llm-judge" } } },
          "then": { "required": ["rubric", "judge_model"] }
        }
      ]
    },
    "validation": {
      "description": "The task half of the validation checklist, filled in once per task.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "fails_before_fix": {
          "description": "The grader fails at the parent commit.",
          "type": "boolean"
        },
        "passes_after_fix": {
          "description": "The grader passes with the merged change applied.",
          "type": "boolean"
        },
        "gold_patch_hidden": {
          "description": "The agent can't reach the merged change: no later commits, branches, tags or test changes in its copy.",
          "type": "boolean"
        },
        "checked_on": {
          "description": "Date the checks above were run.",
          "type": "string",
          "format": "date"
        }
      }
    }
  }
}
