{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://ainumbers.co/research/engineering-decision-schema/schemas/run-manifest.schema.json",
  "title": "Run Manifest",
  "description": "Everything needed to identify one flow run: the design commit, the PDK commit, the tool versions, and the sha256 of the inputs. Generated by the flow runner, never hand-written. All hash fields are lowercase hex sha256.",
  "type": "object",
  "required": [
    "design",
    "environment",
    "pdk",
    "inputs",
    "run_id",
    "started_at",
    "host"
  ],
  "additionalProperties": false,
  "properties": {
    "$schema": {
      "type": "string",
      "description": "Optional self-identifying reference to this schema. Lets edi-validate pick the document kind without an explicit --type."
    },
    "design": {
      "type": "object",
      "required": ["name", "rtl_commit"],
      "additionalProperties": false,
      "properties": {
        "name": { "type": "string", "minLength": 1 },
        "rtl_commit": { "type": "string", "minLength": 1 }
      }
    },
    "environment": {
      "type": "object",
      "required": ["librelane_version", "openroad_version", "yosys_version"],
      "additionalProperties": false,
      "properties": {
        "librelane_version": { "type": "string", "minLength": 1 },
        "openroad_version": { "type": "string", "minLength": 1 },
        "yosys_version": { "type": "string", "minLength": 1 },
        "nix_flake_lock_hash": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$",
          "description": "sha256 of the pinned flake.lock providing the tool environment."
        }
      }
    },
    "pdk": {
      "type": "object",
      "required": ["name", "commit"],
      "additionalProperties": false,
      "properties": {
        "name": { "type": "string", "minLength": 1 },
        "commit": { "type": "string", "minLength": 1 }
      }
    },
    "inputs": {
      "type": "object",
      "required": ["config_hash"],
      "additionalProperties": false,
      "properties": {
        "config_hash": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$",
          "description": "sha256 of the flow configuration file."
        },
        "sdc_hash": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$",
          "description": "sha256 of the constraints (SDC) file, when one was supplied."
        }
      }
    },
    "run_id": {
      "type": "string",
      "minLength": 1,
      "description": "Identifier of the run directory, e.g. RUN_2026-08-28_11-42-18."
    },
    "started_at": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601 timestamp of run start, with timezone offset."
    },
    "host": {
      "type": "object",
      "required": ["os", "cpu"],
      "additionalProperties": false,
      "properties": {
        "os": { "type": "string", "minLength": 1 },
        "cpu": { "type": "string", "minLength": 1 }
      }
    }
  }
}
