{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Plan Verification Findings Schema",
  "description": "Schema for plan verification findings output from cli-explore-agent",
  "type": "object",
  "required": [
    "session_id",
    "timestamp",
    "verification_tiers_completed",
    "findings",
    "summary"
  ],
  "properties": {
    "session_id": {
      "type": "string",
      "description": "Workflow session ID (e.g., WFS-20250127-143000)",
      "pattern": "^WFS-[0-9]{8}-[0-9]{6}$"
    },
    "timestamp": {
      "type": "string",
      "description": "ISO 8601 timestamp when verification was completed",
      "format": "date-time"
    },
    "verification_tiers_completed": {
      "type": "array",
      "description": "List of verification tiers completed (e.g., ['Tier 1', 'Tier 2'])",
      "items": {
        "type": "string",
        "enum": ["Tier 1", "Tier 2", "Tier 3", "Tier 4"]
      },
      "minItems": 1,
      "maxItems": 4
    },
    "findings": {
      "type": "array",
      "description": "Array of all findings across all dimensions",
      "items": {
        "type": "object",
        "required": [
          "id",
          "dimension",
          "dimension_name",
          "severity",
          "location",
          "summary",
          "recommendation"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique finding ID prefixed by severity (C1, H1, M1, L1)",
            "pattern": "^[CHML][0-9]+$"
          },
          "dimension": {
            "type": "string",
            "description": "Verification dimension identifier",
            "enum": ["A", "B", "C", "D", "E", "F", "G", "H"]
          },
          "dimension_name": {
            "type": "string",
            "description": "Human-readable dimension name",
            "enum": [
              "User Intent Alignment",
              "Requirements Coverage Analysis",
              "Consistency Validation",
              "Dependency Integrity",
              "Synthesis Alignment",
              "Task Specification Quality",
              "Duplication Detection",
              "Feasibility Assessment"
            ]
          },
          "severity": {
            "type": "string",
            "description": "Severity level of the finding",
            "enum": ["CRITICAL", "HIGH", "MEDIUM", "LOW"]
          },
          "location": {
            "type": "array",
            "description": "Array of locations where issue was found (e.g., 'IMPL_PLAN.md:L45', 'task:IMPL-1.2', 'synthesis:FR-03')",
            "items": {
              "type": "string"
            },
            "minItems": 1
          },
          "summary": {
            "type": "string",
            "description": "Concise summary of the issue (1-2 sentences)",
            "minLength": 10,
            "maxLength": 500
          },
          "recommendation": {
            "type": "string",
            "description": "Actionable recommendation to resolve the issue",
            "minLength": 10,
            "maxLength": 500
          }
        }
      }
    },
    "summary": {
      "type": "object",
      "description": "Aggregate summary of verification results",
      "required": [
        "critical_count",
        "high_count",
        "medium_count",
        "low_count",
        "total_findings",
        "coverage_percentage",
        "recommendation"
      ],
      "properties": {
        "critical_count": {
          "type": "integer",
          "description": "Number of critical severity findings",
          "minimum": 0
        },
        "high_count": {
          "type": "integer",
          "description": "Number of high severity findings",
          "minimum": 0
        },
        "medium_count": {
          "type": "integer",
          "description": "Number of medium severity findings",
          "minimum": 0
        },
        "low_count": {
          "type": "integer",
          "description": "Number of low severity findings",
          "minimum": 0
        },
        "total_findings": {
          "type": "integer",
          "description": "Total number of findings",
          "minimum": 0
        },
        "coverage_percentage": {
          "type": "number",
          "description": "Percentage of synthesis requirements covered by tasks (0-100)",
          "minimum": 0,
          "maximum": 100
        },
        "recommendation": {
          "type": "string",
          "description": "Quality gate recommendation",
          "enum": [
            "BLOCK_EXECUTION",
            "PROCEED_WITH_FIXES",
            "PROCEED_WITH_CAUTION",
            "PROCEED"
          ]
        }
      }
    }
  }
}
