{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Agent Harness Benchmark Run",
  "description": "A machine-readable record for a paired project-harness evaluation. Protocol: https://nimbalyst.com/harness/benchmark/",
  "type": "object",
  "required": [
    "task_id",
    "condition",
    "run_order",
    "repository_commit",
    "model",
    "fixed_inputs",
    "harness_delta",
    "evidence",
    "scores"
  ],
  "properties": {
    "task_id": { "type": "string" },
    "condition": {
      "type": "string",
      "enum": ["tool_only_baseline", "project_harness"]
    },
    "run_order": { "type": "integer", "minimum": 1 },
    "repository_commit": { "type": "string" },
    "model": {
      "type": "object",
      "required": ["provider", "identifier", "settings"],
      "properties": {
        "provider": { "type": "string" },
        "identifier": { "type": "string" },
        "settings": { "type": "object" }
      }
    },
    "fixed_inputs": {
      "type": "object",
      "required": ["task_prompt", "tool_permissions", "token_limit", "time_limit_seconds"],
      "properties": {
        "task_prompt": { "type": "string" },
        "tool_permissions": { "type": "array", "items": { "type": "string" } },
        "token_limit": { "type": "integer", "minimum": 1 },
        "cost_limit_usd": { "type": "number", "minimum": 0 },
        "time_limit_seconds": { "type": "integer", "minimum": 1 },
        "environment_manifest_url": { "type": "string", "format": "uri" }
      }
    },
    "harness_delta": {
      "type": "array",
      "description": "Every project-harness capability added to or withheld from this condition.",
      "items": { "type": "string" }
    },
    "evidence": {
      "type": "object",
      "required": ["trace_url", "patch_url", "test_output_url"],
      "properties": {
        "trace_url": { "type": "string", "format": "uri" },
        "patch_url": { "type": "string", "format": "uri" },
        "test_output_url": { "type": "string", "format": "uri" },
        "screenshots": { "type": "array", "items": { "type": "string", "format": "uri" } },
        "review_notes_url": { "type": "string", "format": "uri" }
      }
    },
    "scores": {
      "type": "object",
      "required": [
        "task_correctness",
        "verification_quality",
        "policy_adherence",
        "context_efficiency",
        "recovery_behavior",
        "provenance"
      ],
      "properties": {
        "task_correctness": { "type": "integer", "minimum": 0, "maximum": 40 },
        "verification_quality": { "type": "integer", "minimum": 0, "maximum": 20 },
        "policy_adherence": { "type": "integer", "minimum": 0, "maximum": 15 },
        "context_efficiency": { "type": "integer", "minimum": 0, "maximum": 10 },
        "recovery_behavior": { "type": "integer", "minimum": 0, "maximum": 10 },
        "provenance": { "type": "integer", "minimum": 0, "maximum": 5 }
      },
      "additionalProperties": false
    },
    "disqualifying_failure": { "type": ["string", "null"] },
    "tokens_used": { "type": "integer", "minimum": 0 },
    "cost_usd": { "type": "number", "minimum": 0 },
    "elapsed_seconds": { "type": "number", "minimum": 0 },
    "protocol_deviations": { "type": "array", "items": { "type": "string" } }
  },
  "additionalProperties": false
}
