{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://example.local/yao-meta-skill/world-class-evidence-intake.schema.json",
  "title": "Yao World-Class Evidence Intake",
  "description": "Real submissions must use the canonical <evidence-key>.json filename and the runtime validator rejects nested raw prompt, output, transcript, message, credential, secret, token, and API-key fields.",
  "type": "object",
  "required": [
    "schema_version",
    "evidence_key",
    "template_only",
    "category",
    "source_type",
    "submitted_by",
    "submitted_at",
    "summary",
    "artifact_refs",
    "provenance",
    "privacy",
    "anti_overclaim",
    "attestation"
  ],
  "properties": {
    "schema_version": {
      "const": "1.0"
    },
    "evidence_key": {
      "enum": [
        "provider-holdout",
        "human-adjudication",
        "native-permission-enforcement",
        "native-client-telemetry"
      ]
    },
    "template_only": {
      "type": "boolean"
    },
    "category": {
      "enum": [
        "human",
        "external"
      ]
    },
    "source_type": {
      "type": "string",
      "minLength": 3
    },
    "submitted_by": {
      "type": "string",
      "minLength": 1
    },
    "submitted_at": {
      "type": "string",
      "minLength": 1
    },
    "summary": {
      "type": "string",
      "minLength": 1
    },
    "artifact_refs": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": [
          "path",
          "kind",
          "contains_raw_content"
        ],
        "properties": {
          "path": {
            "type": "string",
            "minLength": 1
          },
          "kind": {
            "type": "string",
            "minLength": 1
          },
          "contains_raw_content": {
            "type": "boolean"
          },
          "sha256": {
            "type": "string",
            "pattern": "^[0-9a-fA-F]{64}$"
          },
          "note": {
            "type": "string"
          }
        },
        "additionalProperties": true
      }
    },
    "provenance": {
      "type": "object",
      "additionalProperties": true
    },
    "privacy": {
      "type": "object",
      "required": [
        "raw_user_content_included",
        "raw_provider_prompt_included",
        "credentials_included",
        "secrets_included"
      ],
      "properties": {
        "raw_user_content_included": {
          "type": "boolean"
        },
        "raw_provider_prompt_included": {
          "type": "boolean"
        },
        "credentials_included": {
          "type": "boolean"
        },
        "secrets_included": {
          "type": "boolean"
        },
        "notes": {
          "type": "string"
        }
      },
      "additionalProperties": true
    },
    "anti_overclaim": {
      "type": "object",
      "required": [
        "planned_work_counts_as_evidence",
        "metadata_fallback_counts_as_native_enforcement",
        "pending_review_counts_as_human_decision",
        "local_command_runner_counts_as_provider_model"
      ],
      "properties": {
        "planned_work_counts_as_evidence": {
          "const": false
        },
        "metadata_fallback_counts_as_native_enforcement": {
          "const": false
        },
        "pending_review_counts_as_human_decision": {
          "const": false
        },
        "local_command_runner_counts_as_provider_model": {
          "const": false
        }
      },
      "additionalProperties": false
    },
    "attestation": {
      "type": "object",
      "required": [
        "real_external_or_human_evidence",
        "reviewer_or_operator_identity_present",
        "artifact_refs_reviewed",
        "privacy_contract_satisfied",
        "ledger_reviewer_approved",
        "ledger_reviewer",
        "ledger_reviewed_at"
      ],
      "properties": {
        "real_external_or_human_evidence": {
          "type": "boolean"
        },
        "reviewer_or_operator_identity_present": {
          "type": "boolean"
        },
        "artifact_refs_reviewed": {
          "type": "boolean"
        },
        "privacy_contract_satisfied": {
          "type": "boolean"
        },
        "ledger_reviewer_approved": {
          "type": "boolean"
        },
        "ledger_reviewer": {
          "type": "string"
        },
        "ledger_reviewed_at": {
          "type": "string"
        },
        "notes": {
          "type": "string"
        }
      },
      "additionalProperties": true
    }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "template_only": {
            "const": false
          }
        },
        "required": [
          "template_only"
        ]
      },
      "then": {
        "properties": {
          "submitted_at": {
            "pattern": "^\\d{4}-\\d{2}-\\d{2}(?:T\\d{2}:\\d{2}:\\d{2}Z)?$"
          },
          "submitted_by": {
            "not": {
              "enum": [
                "operator with provider credentials",
                "human reviewer",
                "target client or installer integrator",
                "Browser/Chrome/IDE/provider client integrator"
              ]
            }
          },
          "artifact_refs": {
            "items": {
              "required": [
                "path",
                "kind",
                "contains_raw_content",
                "sha256"
              ]
            }
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "template_only": {
            "const": false
          },
          "evidence_key": {
            "const": "provider-holdout"
          }
        },
        "required": [
          "template_only",
          "evidence_key"
        ]
      },
      "then": {
        "properties": {
          "artifact_refs": {
            "contains": {
              "type": "object",
              "properties": {
                "path": {
                  "const": "reports/output_execution_runs.json"
                },
                "kind": {
                  "const": "aggregate-report"
                }
              },
              "required": [
                "path",
                "kind"
              ]
            }
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "template_only": {
            "const": false
          },
          "evidence_key": {
            "const": "human-adjudication"
          }
        },
        "required": [
          "template_only",
          "evidence_key"
        ]
      },
      "then": {
        "properties": {
          "artifact_refs": {
            "allOf": [
              {
                "contains": {
                  "type": "object",
                  "properties": {
                    "path": {
                      "const": "reports/output_review_adjudication.json"
                    },
                    "kind": {
                      "const": "adjudication-report"
                    }
                  },
                  "required": [
                    "path",
                    "kind"
                  ]
                }
              },
              {
                "contains": {
                  "type": "object",
                  "properties": {
                    "path": {
                      "const": "reports/output_review_decisions.json"
                    },
                    "kind": {
                      "const": "review-decisions"
                    }
                  },
                  "required": [
                    "path",
                    "kind"
                  ]
                }
              }
            ]
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "template_only": {
            "const": false
          },
          "evidence_key": {
            "const": "native-permission-enforcement"
          }
        },
        "required": [
          "template_only",
          "evidence_key"
        ]
      },
      "then": {
        "properties": {
          "artifact_refs": {
            "allOf": [
              {
                "contains": {
                  "type": "object",
                  "properties": {
                    "path": {
                      "const": "reports/runtime_permission_probes.json"
                    },
                    "kind": {
                      "const": "runtime-probe-report"
                    }
                  },
                  "required": [
                    "path",
                    "kind"
                  ]
                }
              },
              {
                "contains": {
                  "type": "object",
                  "properties": {
                    "path": {
                      "const": "reports/install_simulation.json"
                    },
                    "kind": {
                      "const": "installer-enforcement-report"
                    }
                  },
                  "required": [
                    "path",
                    "kind"
                  ]
                }
              }
            ]
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "template_only": {
            "const": false
          },
          "evidence_key": {
            "const": "native-client-telemetry"
          }
        },
        "required": [
          "template_only",
          "evidence_key"
        ]
      },
      "then": {
        "properties": {
          "artifact_refs": {
            "allOf": [
              {
                "contains": {
                  "type": "object",
                  "properties": {
                    "path": {
                      "const": "reports/adoption_drift_report.json"
                    },
                    "kind": {
                      "const": "adoption-drift-report"
                    }
                  },
                  "required": [
                    "path",
                    "kind"
                  ]
                }
              },
              {
                "contains": {
                  "type": "object",
                  "properties": {
                    "path": {
                      "const": "reports/telemetry_hook_recipes.json"
                    },
                    "kind": {
                      "const": "hook-recipes"
                    }
                  },
                  "required": [
                    "path",
                    "kind"
                  ]
                }
              }
            ]
          }
        }
      }
    }
  ],
  "additionalProperties": true
}
