{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Harness RSI Evidence Dataset record",
  "type": "object",
  "required": [
    "id",
    "key",
    "domain",
    "category",
    "sections",
    "sources",
    "benchmarks",
    "annotation_status",
    "selection_protocol",
    "controlled_variables",
    "signals"
  ],
  "properties": {
    "id": {
      "type": "string"
    },
    "key": {
      "type": "string"
    },
    "domain": {
      "type": "string"
    },
    "category": {
      "type": "string"
    },
    "category_id": {
      "type": "string"
    },
    "title": {
      "type": "string"
    },
    "evidence_status": {
      "type": "string"
    },
    "sections": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "label",
          "text"
        ]
      }
    },
    "sources": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": [
          "name",
          "url",
          "locator"
        ]
      }
    },
    "benchmarks": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "role"
        ]
      }
    },
    "annotation_status": {
      "enum": [
        "record_screened",
        "not_reviewed"
      ]
    },
    "selection_protocol": {
      "type": [
        "string",
        "null"
      ]
    },
    "controlled_variables": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "string"
      }
    },
    "signals": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "outcome",
          "retention",
          "attribution",
          "components",
          "benchmark_ids",
          "scope",
          "summary",
          "section",
          "evidence_quote",
          "source_index",
          "primary_source"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "outcome": {
            "enum": [
              "improvement",
              "regression",
              "no_gain",
              "mixed",
              "not_assessed"
            ]
          },
          "retention": {
            "enum": [
              "retained",
              "rejected",
              "rolled_back",
              "not_reported",
              "not_assessed"
            ]
          },
          "attribution": {
            "enum": [
              "illustrative_case",
              "full_system_comparison",
              "reported_proposal_test",
              "usage_observation",
              "component_ablation",
              "not_assessed"
            ]
          },
          "components": {
            "type": "array",
            "items": {
              "enum": [
                "instructions",
                "tools",
                "context",
                "memory",
                "control"
              ]
            },
            "minItems": 1
          },
          "benchmark_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "scope": {
            "type": "string"
          },
          "summary": {
            "type": "string"
          },
          "section": {
            "type": "string"
          },
          "evidence_quote": {
            "type": "string"
          },
          "source_index": {
            "type": "integer",
            "minimum": 0
          },
          "primary_source": {
            "type": "object",
            "required": [
              "name",
              "url",
              "locator"
            ]
          }
        }
      }
    }
  }
}
