{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://machinetradecraft.com/downloads/machine-tradecraft-control-evidence-plan-schema-v1.json",
  "title": "Machine Tradecraft Control-to-Evidence Plan",
  "description": "Schema version 1.0.0 for deterministic, request-local, non-scoring control evidence plans.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "record_type",
    "site_version",
    "release_id",
    "source",
    "system_profile",
    "review_objective",
    "review_context",
    "evidence_state_summary",
    "maturity_dimensions",
    "controls",
    "applicability_conflicts",
    "external_verification_requirements",
    "non_conclusions",
    "persistence",
    "external_actions",
    "score",
    "readiness_score",
    "maturity_score",
    "severity",
    "probability",
    "pass_fail",
    "compliance_finding",
    "certification",
    "assurance_opinion",
    "intent_verdict",
    "production_authorization",
    "control_plan_id",
    "control_plan_sha256"
  ],
  "properties": {
    "schema_version": {
      "const": "1.0.0"
    },
    "record_type": {
      "const": "machine-tradecraft-control-evidence-plan"
    },
    "site_version": {
      "type": "string",
      "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"
    },
    "release_id": {
      "type": "string",
      "minLength": 1
    },
    "source": {
      "type": "object"
    },
    "system_profile": {
      "type": "object",
      "required": [
        "id",
        "label",
        "description",
        "default_owner"
      ],
      "properties": {
        "id": {
          "enum": [
            "document-ingestion",
            "web-retrieval",
            "rag-assistant",
            "browser-agent",
            "multimodal-assistant",
            "email-calendar-assistant",
            "software-ai-supply-chain"
          ]
        },
        "label": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "default_owner": {
          "type": "string"
        }
      }
    },
    "review_objective": {
      "type": "object",
      "required": [
        "id",
        "label",
        "description"
      ],
      "properties": {
        "id": {
          "enum": [
            "design-review",
            "implementation-review",
            "test-planning",
            "operational-handoff",
            "full-evidence-plan"
          ]
        },
        "label": {
          "type": "string"
        },
        "description": {
          "type": "string"
        }
      }
    },
    "review_context": {
      "type": "string",
      "maxLength": 720
    },
    "evidence_state_summary": {
      "type": "object",
      "required": [
        "total_controls",
        "counts",
        "note"
      ],
      "properties": {
        "total_controls": {
          "const": 13
        },
        "counts": {
          "type": "object",
          "required": [
            "declared",
            "locally-demonstrated",
            "externally-verified",
            "missing",
            "not-applicable",
            "unknown"
          ],
          "properties": {
            "declared": {
              "type": "integer",
              "minimum": 0,
              "maximum": 13
            },
            "locally-demonstrated": {
              "type": "integer",
              "minimum": 0,
              "maximum": 13
            },
            "externally-verified": {
              "type": "integer",
              "minimum": 0,
              "maximum": 13
            },
            "missing": {
              "type": "integer",
              "minimum": 0,
              "maximum": 13
            },
            "not-applicable": {
              "type": "integer",
              "minimum": 0,
              "maximum": 13
            },
            "unknown": {
              "type": "integer",
              "minimum": 0,
              "maximum": 13
            }
          }
        },
        "note": {
          "type": "string"
        }
      }
    },
    "maturity_dimensions": {
      "type": "array",
      "minItems": 9,
      "maxItems": 9,
      "items": {
        "type": "object"
      }
    },
    "controls": {
      "type": "array",
      "minItems": 13,
      "maxItems": 13,
      "items": {
        "type": "object",
        "required": [
          "control_id",
          "label",
          "evidence_state",
          "profile_applicability",
          "evidence_requirements",
          "existing_local_evidence",
          "external_verification",
          "evidence_gap",
          "known_limitation",
          "suggested_review_cadence"
        ],
        "properties": {
          "control_id": {
            "enum": [
              "input-acquisition",
              "type-validation",
              "canonicalization",
              "representation-comparison",
              "provenance",
              "content-sanitization",
              "model-input-construction",
              "retrieval-controls",
              "capability-isolation",
              "human-confirmation",
              "output-validation",
              "egress-controls",
              "logging-evidence-preservation"
            ]
          },
          "label": {
            "type": "string"
          },
          "evidence_state": {
            "type": "object",
            "required": [
              "id",
              "label",
              "description",
              "visitor_supplied",
              "locally_verified"
            ],
            "properties": {
              "id": {
                "enum": [
                  "declared",
                  "locally-demonstrated",
                  "externally-verified",
                  "missing",
                  "not-applicable",
                  "unknown"
                ]
              },
              "label": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "visitor_supplied": {
                "const": true
              },
              "locally_verified": {
                "const": false
              }
            }
          },
          "profile_applicability": {
            "type": "object"
          },
          "evidence_requirements": {
            "type": "object"
          },
          "existing_local_evidence": {
            "type": "object"
          },
          "external_verification": {
            "type": "array"
          },
          "evidence_gap": {
            "type": "object"
          },
          "known_limitation": {
            "type": "string"
          },
          "suggested_review_cadence": {
            "type": "array"
          }
        }
      }
    },
    "applicability_conflicts": {
      "type": "array"
    },
    "external_verification_requirements": {
      "type": "array"
    },
    "non_conclusions": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "string"
      }
    },
    "persistence": {
      "const": "none"
    },
    "external_actions": {
      "const": "none"
    },
    "score": {
      "type": "null"
    },
    "readiness_score": {
      "type": "null"
    },
    "maturity_score": {
      "type": "null"
    },
    "severity": {
      "type": "null"
    },
    "probability": {
      "type": "null"
    },
    "pass_fail": {
      "type": "null"
    },
    "compliance_finding": {
      "type": "null"
    },
    "certification": {
      "type": "null"
    },
    "assurance_opinion": {
      "type": "null"
    },
    "intent_verdict": {
      "type": "null"
    },
    "production_authorization": {
      "type": "null"
    },
    "control_plan_id": {
      "type": "string",
      "pattern": "^[A-F0-9]{12}$"
    },
    "control_plan_sha256": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$"
    }
  }
}
