{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://ai-agent-book.local/schemas/experiment-9-10-evidence.schema.json",
  "title": "Experiment 9-10 zero-shot RGB Sim2Real evidence",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema_version", "experiment_id", "status", "upstream", "run", "stages", "artifacts", "blockers"],
  "properties": {
    "schema_version": {"const": "1.0"},
    "experiment_id": {"const": "9-10"},
    "status": {"enum": ["complete", "blocked"]},
    "upstream": {
      "type": "object",
      "additionalProperties": false,
      "required": ["repository", "commit", "guide_path", "guide_blob"],
      "properties": {
        "repository": {"const": "https://github.com/StoneT2000/lerobot-sim2real.git"},
        "commit": {"const": "87d6c1d969f6e0ca4dc5697940804e231118a63a"},
        "guide_path": {"const": "docs/zero_shot_rgb_sim2real.md"},
        "guide_blob": {"const": "844d113a726d7c3c8494700496591a2604f742e0"}
      }
    },
    "run": {
      "type": "object",
      "additionalProperties": false,
      "required": ["started_at", "ended_at", "operator", "host", "gpu", "robot_actuation_authorized"],
      "properties": {
        "started_at": {"type": ["string", "null"], "format": "date-time"},
        "ended_at": {"type": ["string", "null"], "format": "date-time"},
        "operator": {"type": ["string", "null"]},
        "host": {"type": "string", "minLength": 1},
        "gpu": {"type": ["string", "null"]},
        "robot_actuation_authorized": {"type": "boolean"}
      }
    },
    "stages": {
      "type": "array",
      "minItems": 5,
      "maxItems": 5,
      "items": {"$ref": "#/$defs/stage"}
    },
    "artifacts": {
      "type": "array",
      "items": {"$ref": "#/$defs/artifact"}
    },
    "blockers": {"type": "array", "items": {"type": "string", "minLength": 1}}
  },
  "$defs": {
    "stage": {
      "oneOf": [
        {"$ref": "#/$defs/alignment"},
        {"$ref": "#/$defs/greenscreen"},
        {"$ref": "#/$defs/randomization"},
        {"$ref": "#/$defs/training"},
        {"$ref": "#/$defs/deployment"}
      ]
    },
    "base": {
      "type": "object",
      "required": ["stage", "name", "status", "robot_actuation_required"],
      "properties": {
        "stage": {"type": "integer", "minimum": 1, "maximum": 5},
        "name": {"type": "string"},
        "status": {"enum": ["complete", "blocked", "not_run"]},
        "robot_actuation_required": {"type": "boolean"}
      }
    },
    "alignment": {
      "allOf": [
        {"$ref": "#/$defs/base"},
        {
          "type": "object",
          "additionalProperties": false,
          "required": ["stage", "name", "status", "robot_actuation_required", "simulation_config_sha256", "real_frame_sha256", "overlay_sha256", "alignment_error_px"],
          "properties": {
            "stage": {"const": 1},
            "name": {"const": "environment_alignment"},
            "status": {"enum": ["complete", "blocked", "not_run"]},
            "robot_actuation_required": {"const": true},
            "simulation_config_sha256": {"type": ["string", "null"], "pattern": "^[0-9a-f]{64}$"},
            "real_frame_sha256": {"type": ["string", "null"], "pattern": "^[0-9a-f]{64}$"},
            "overlay_sha256": {"type": ["string", "null"], "pattern": "^[0-9a-f]{64}$"},
            "alignment_error_px": {"type": ["number", "null"], "minimum": 0}
          }
        }
      ]
    },
    "greenscreen": {
      "allOf": [
        {"$ref": "#/$defs/base"},
        {
          "type": "object",
          "additionalProperties": false,
          "required": ["stage", "name", "status", "robot_actuation_required", "background_sha256", "config_sha256", "composite_sha256"],
          "properties": {
            "stage": {"const": 2},
            "name": {"const": "background_replacement"},
            "status": {"enum": ["complete", "blocked", "not_run"]},
            "robot_actuation_required": {"const": false},
            "background_sha256": {"type": ["string", "null"], "pattern": "^[0-9a-f]{64}$"},
            "config_sha256": {"type": ["string", "null"], "pattern": "^[0-9a-f]{64}$"},
            "composite_sha256": {"type": ["string", "null"], "pattern": "^[0-9a-f]{64}$"}
          }
        }
      ]
    },
    "randomization": {
      "allOf": [
        {"$ref": "#/$defs/base"},
        {
          "type": "object",
          "additionalProperties": false,
          "required": ["stage", "name", "status", "robot_actuation_required", "parameters", "real_measurements_sha256", "reset_distribution_sha256"],
          "properties": {
            "stage": {"const": 3},
            "name": {"const": "domain_randomization"},
            "status": {"enum": ["complete", "blocked", "not_run"]},
            "robot_actuation_required": {"const": false},
            "parameters": {"type": "array", "uniqueItems": true, "items": {"type": "string"}},
            "real_measurements_sha256": {"type": ["string", "null"], "pattern": "^[0-9a-f]{64}$"},
            "reset_distribution_sha256": {"type": ["string", "null"], "pattern": "^[0-9a-f]{64}$"}
          }
        }
      ]
    },
    "training": {
      "allOf": [
        {"$ref": "#/$defs/base"},
        {
          "type": "object",
          "additionalProperties": false,
          "required": ["stage", "name", "status", "robot_actuation_required", "algorithm", "rgb_only", "timesteps", "evaluation_episodes", "simulation_success_rate", "checkpoint_sha256", "metrics_sha256"],
          "properties": {
            "stage": {"const": 4},
            "name": {"const": "ppo_training"},
            "status": {"enum": ["complete", "blocked", "not_run"]},
            "robot_actuation_required": {"const": false},
            "algorithm": {"const": "PPO"},
            "rgb_only": {"type": "boolean"},
            "timesteps": {"type": "integer", "minimum": 0},
            "evaluation_episodes": {"type": "integer", "minimum": 0},
            "simulation_success_rate": {"type": ["number", "null"], "exclusiveMinimum": 0.9, "maximum": 1},
            "checkpoint_sha256": {"type": ["string", "null"], "pattern": "^[0-9a-f]{64}$"},
            "metrics_sha256": {"type": ["string", "null"], "pattern": "^[0-9a-f]{64}$"}
          }
        }
      ]
    },
    "deployment": {
      "allOf": [
        {"$ref": "#/$defs/base"},
        {
          "type": "object",
          "additionalProperties": false,
          "required": ["stage", "name", "status", "robot_actuation_required", "executed", "zero_shot", "fine_tuning_steps", "control_frequency_hz", "step_confirmation_enabled", "trials", "successes", "video_sha256", "safety"],
          "properties": {
            "stage": {"const": 5},
            "name": {"const": "real_world_deployment"},
            "status": {"enum": ["complete", "blocked", "not_run"]},
            "robot_actuation_required": {"const": true},
            "executed": {"type": "boolean"},
            "zero_shot": {"type": "boolean"},
            "fine_tuning_steps": {"type": "integer", "minimum": 0},
            "control_frequency_hz": {"type": ["number", "null"], "exclusiveMinimum": 0},
            "step_confirmation_enabled": {"type": "boolean"},
            "trials": {"type": "integer", "minimum": 0},
            "successes": {"type": "integer", "minimum": 0},
            "video_sha256": {"type": ["string", "null"], "pattern": "^[0-9a-f]{64}$"},
            "safety": {
              "type": "object",
              "additionalProperties": false,
              "required": ["robot_calibrated", "clear_workspace", "emergency_stop_ready", "human_observer_present"],
              "properties": {
                "robot_calibrated": {"type": "boolean"},
                "clear_workspace": {"type": "boolean"},
                "emergency_stop_ready": {"type": "boolean"},
                "human_observer_present": {"type": "boolean"}
              }
            }
          }
        }
      ]
    },
    "artifact": {
      "type": "object",
      "additionalProperties": false,
      "required": ["stage", "kind", "path", "sha256"],
      "properties": {
        "stage": {"type": "integer", "minimum": 1, "maximum": 5},
        "kind": {"enum": ["config", "image", "overlay", "measurements", "video", "checkpoint", "metrics", "preflight"]},
        "path": {"type": "string", "minLength": 1},
        "sha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"}
      }
    }
  }
}
