{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/{owner}/multi-agent-pipeline/pipeline/schemas/conventions-output.schema.json",
  "version": "1.0.0",
  "title": "Multi-Agent Pipeline - extract-conventions.sh output",
  "description": "Contract for the JSON document emitted by pipeline/lib/extract-conventions.sh (Phase 1c convention extraction). Twelve convention fields covering the seven pattern groups C1-C7 (C2 class naming spans six fields). Every field carries the same bucket shape; an unevidenced field is an empty bucket with confidence none, never an absent key.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "folderStructure",
    "stateHolderNaming",
    "viewNaming",
    "navigatorNaming",
    "useCaseNaming",
    "repositoryNaming",
    "dtoNaming",
    "uiStateModel",
    "testMethodNaming",
    "accessibilityIdentifier",
    "localizationKey",
    "diRegistration",
    "sharedUtilities"
  ],
  "properties": {
    "folderStructure": {
      "$ref": "#/$defs/conventionBucket"
    },
    "stateHolderNaming": {
      "$ref": "#/$defs/conventionBucket"
    },
    "viewNaming": {
      "$ref": "#/$defs/conventionBucket"
    },
    "navigatorNaming": {
      "$ref": "#/$defs/conventionBucket"
    },
    "useCaseNaming": {
      "$ref": "#/$defs/conventionBucket"
    },
    "repositoryNaming": {
      "$ref": "#/$defs/conventionBucket"
    },
    "dtoNaming": {
      "$ref": "#/$defs/conventionBucket"
    },
    "uiStateModel": {
      "$ref": "#/$defs/conventionBucket"
    },
    "testMethodNaming": {
      "$ref": "#/$defs/conventionBucket"
    },
    "accessibilityIdentifier": {
      "$ref": "#/$defs/conventionBucket"
    },
    "localizationKey": {
      "$ref": "#/$defs/conventionBucket"
    },
    "diRegistration": {
      "$ref": "#/$defs/conventionBucket"
    },
    "sharedUtilities": {
      "$ref": "#/$defs/conventionBucket"
    }
  },
  "$defs": {
    "conventionBucket": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "pattern",
        "example",
        "confidence",
        "evidenceFiles",
        "alternativeCandidates"
      ],
      "properties": {
        "pattern": {
          "type": "string",
          "description": "Detected convention pattern in human-readable form; empty string when confidence is none."
        },
        "example": {
          "type": "string",
          "description": "One concrete example drawn from the repo; empty string when confidence is none."
        },
        "confidence": {
          "type": "string",
          "enum": [
            "high",
            "medium",
            "low",
            "none"
          ],
          "description": "high: 5+ examples; medium: 3-4; low: 1-2 or mixed; none: no evidence."
        },
        "evidenceFiles": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "maxItems": 5,
          "description": "Repo-relative or absolute paths backing the detection (capped at 5)."
        },
        "alternativeCandidates": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Competing patterns that were observed but lost the majority vote."
        }
      }
    }
  }
}
