{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://aomsites.com/schemas/decision-record.schema.json",
  "title": "Agent Optimization decision record 1.1",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "record_type",
    "artifact_revision",
    "method_reference",
    "recommendation",
    "task",
    "scope_and_version",
    "current_authorization",
    "required_checks",
    "decision",
    "decision_reason",
    "next_authorized_action",
    "stop_or_recovery",
    "limitations"
  ],
  "properties": {
    "schema_version": {
      "const": "1.1"
    },
    "record_type": {
      "enum": [
        "blank_template",
        "fictional_illustration",
        "task_record"
      ]
    },
    "artifact_revision": {
      "type": "string",
      "maxLength": 4000,
      "description": "Record template/build provenance. The actual task or deliverable version belongs in scope_and_version."
    },
    "method_reference": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "guide_id",
        "build_revision",
        "source_sha256"
      ],
      "properties": {
        "guide_id": {
          "type": "string",
          "maxLength": 4000
        },
        "build_revision": {
          "type": "string",
          "maxLength": 4000
        },
        "source_sha256": {
          "type": "string",
          "pattern": "^([0-9a-f]{64})?$",
          "description": "Copy from the exact guide JSON. Digest of normalized build-input source record, not downloadable file bytes."
        }
      }
    },
    "recommendation": {
      "enum": [
        "keep",
        "change",
        "skip",
        "investigate"
      ]
    },
    "required_checks": {
      "type": "array",
      "minItems": 1,
      "maxItems": 100,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "check",
          "observed_evidence",
          "evidence_reference",
          "status"
        ],
        "properties": {
          "check": {
            "type": "string",
            "maxLength": 4000
          },
          "observed_evidence": {
            "type": "string",
            "maxLength": 4000
          },
          "evidence_reference": {
            "type": "string",
            "maxLength": 4000
          },
          "status": {
            "enum": [
              "pass",
              "fail",
              "unavailable"
            ]
          }
        }
      }
    },
    "decision": {
      "enum": [
        "accept",
        "reject",
        "unknown"
      ]
    },
    "limitations": {
      "type": "array",
      "minItems": 1,
      "maxItems": 20,
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 4000
      }
    },
    "task": {
      "type": "string",
      "maxLength": 4000
    },
    "scope_and_version": {
      "type": "string",
      "maxLength": 4000
    },
    "current_authorization": {
      "type": "string",
      "maxLength": 4000
    },
    "decision_reason": {
      "type": "string",
      "maxLength": 4000
    },
    "next_authorized_action": {
      "type": "string",
      "maxLength": 4000
    },
    "stop_or_recovery": {
      "type": "string",
      "maxLength": 4000
    }
  }
}
