{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/axonflow/json-schema/axonflow-decision-explanation-schema.json",
  "title": "DecisionExplanation",
  "description": "ADR-043 decision explanation",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/axonflow-decisions-overrides-api-openapi.yml#/components/schemas/DecisionExplanation",
  "type": "object",
  "properties": {
    "decision_id": {
      "type": "string"
    },
    "timestamp": {
      "type": "string",
      "format": "date-time"
    },
    "policy_matches": {
      "type": "array",
      "description": "Always an array (`[]` when empty)",
      "items": {
        "type": "object",
        "properties": {
          "policy_id": {
            "type": "string"
          },
          "policy_name": {
            "type": "string"
          },
          "action": {
            "type": "string"
          },
          "risk_level": {
            "type": "string"
          },
          "allow_override": {
            "type": "boolean"
          },
          "policy_description": {
            "type": "string"
          }
        }
      }
    },
    "matched_rules": {
      "type": "array",
      "description": "Per-rule match detail; omitted when unavailable",
      "items": {
        "type": "object",
        "properties": {
          "policy_id": {
            "type": "string"
          },
          "rule_id": {
            "type": "string"
          },
          "rule_text": {
            "type": "string"
          },
          "matched_on": {
            "type": "string"
          }
        }
      }
    },
    "decision": {
      "type": "string",
      "description": "Verdict echoed verbatim from the audit row's policy_decision\ncolumn (not normalized), so historical spellings can appear\n"
    },
    "reason": {
      "type": "string"
    },
    "risk_level": {
      "type": "string"
    },
    "override_available": {
      "type": "boolean",
      "description": "Always false from v11.0.0: session overrides are retired (PRD v11\n§1.5, #4252), so explain offers none.\n"
    },
    "override_existing_id": {
      "type": "string",
      "description": "Not set from v11.0.0: explain offers no override, and the step\ngate no longer reads one (#4252).\n"
    },
    "historical_hit_count_session": {
      "type": "integer",
      "description": "Rolling-24h hit count for the first matched policy by this user"
    },
    "policy_source_link": {
      "type": "string"
    },
    "tool_signature": {
      "type": "string"
    },
    "policy_version_at_decision": {
      "type": "integer",
      "description": "Policy version recorded at decision time; omitted when unknown"
    },
    "latest_policy_version": {
      "type": "integer",
      "description": "Current head version of the first matched (static) policy"
    },
    "context": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "context_truncated": {
      "type": "boolean"
    }
  }
}