{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://okstra.dev/schemas/final-report-v3.0.json",
  "title": "OKSTRA Final Report Data (v3.0)",
  "description": "Published final-report record assembled once from role-owned inputs after every required input validates.",
  "type": "object",
  "required": [
    "schemaVersion",
    "humanSummary",
    "meta",
    "frontmatter",
    "header",
    "verdictCard",
    "rationale",
    "summary",
    "executionStatus",
    "tokenUsage",
    "crossVerification",
    "finalVerdict",
    "evidence",
    "missingInformation",
    "clarificationItems",
    "recommendedNextSteps",
    "followUpTasks"
  ],
  "additionalProperties": false,
  "properties": {
    "schemaVersion": {
      "const": "3.0",
      "description": "Schema version. Renderer refuses to process unknown versions."
    },
    "executionIdentityVersion": {
      "type": "integer",
      "enum": [1, 2]
    },
    "executionRoles": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "roleExecutionRef",
          "role",
          "executionLabel"
        ],
        "properties": {
          "roleExecutionRef": {"type": "string"},
          "role": {"type": "string"},
          "provider": {"type": "string"},
          "modelRef": {"type": ["string", "null"]},
          "ordinal": {"type": "integer"},
          "executionLabel": {"type": "string"},
          "status": {"type": "string"}
        },
        "additionalProperties": true
      }
    },
    "humanSummary": {
      "$ref": "#/$defs/HumanSummary"
    },
    "meta": {
      "type": "object",
      "additionalProperties": true,
      "required": [
        "reportLanguage"
      ],
      "properties": {
        "reportLanguage": {
          "type": "string",
          "enum": [
            "en",
            "ko"
          ],
          "description": "Resolved language used for prose + i18n dictionary. 'auto' must be resolved to 'en' or 'ko' before report assembly publishes data.json."
        }
      }
    },
    "frontmatter": {
      "type": "object",
      "required": [
        "title",
        "id",
        "tags",
        "status",
        "aliases",
        "date",
        "taskId",
        "taskGroup",
        "projectId",
        "taskType",
        "workerId",
        "approved"
      ],
      "additionalProperties": false,
      "properties": {
        "title": {
          "type": "string",
          "minLength": 1
        },
        "id": {
          "type": "string",
          "minLength": 1
        },
        "tags": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "minItems": 1
        },
        "status": {
          "enum": [
            "in-progress",
            "completed",
            "draft"
          ]
        },
        "aliases": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "date": {
          "type": "string",
          "description": "ISO 8601 date or datetime. Renderer emits verbatim."
        },
        "taskId": {
          "type": "string",
          "minLength": 1
        },
        "taskGroup": {
          "type": "string",
          "minLength": 1
        },
        "projectId": {
          "type": "string",
          "minLength": 1
        },
        "taskType": {
          "$ref": "#/$defs/TaskType"
        },
        "workerId": {
          "const": "report-writer"
        },
        "approved": {
          "type": "boolean",
          "description": "사용자 승인 플래그. report-writer 는 항상 false 로 발행하고, 사용자가 `--approve` 또는 직접 편집으로 true 로 토글합니다. `implementation` task-type 의 prepare 단계가 `--approved-plan` 으로 지정된 보고서의 이 필드를 읽어 진입 여부를 결정합니다. 다른 task-type 에서는 의미 없이 false 로 유지됩니다."
        },
        "implementationOption": {
          "type": "string",
          "description": "유저가 implementation-planning final-report 에서 고른 Option Candidate 이름. report-writer 는 항상 빈 문자열로 발행하고, 사용자가 `--implementation-option <name>` 또는 직접 편집으로 채웁니다. `implementation` task-type 이 이 값으로 진행하며, 비어 있으면 plan 의 `Recommended Option` 으로 폴백합니다. 다른 task-type 에서는 의미 없이 빈 값으로 유지됩니다."
        },
        "selectedDirectionRef": {
          "type": "string",
          "minLength": 1,
          "description": "selected-direction implementation-planning reports only: project-relative path to instruction-set/selected-direction.json."
        }
      }
    },
    "header": {
      "type": "object",
      "required": [
        "taskKey",
        "createdAt",
        "taskType",
        "reportOwner",
        "reportAuthor",
        "leadModel",
        "okstraVersion"
      ],
      "additionalProperties": false,
      "properties": {
        "taskKey": {
          "type": "string",
          "minLength": 1
        },
        "createdAt": {
          "type": "string",
          "minLength": 1
        },
        "taskType": {
          "$ref": "#/$defs/TaskType"
        },
        "reportOwner": {
          "const": "Okstra lead"
        },
        "reportAuthor": {
          "enum": [
            "Report writer worker",
            "Okstra lead"
          ],
          "description": "Lead-authored fallback is only valid for release-handoff or recorded report-writer dispatch failure."
        },
        "leadAuthoredFallback": {
          "type": "object",
          "description": "Why this run took the lead-authored fallback and who permitted it. Present exactly when reportAuthor is `Okstra lead` on a task type other than release-handoff. The approval passes the gate but does not retire it: this block is what a later reader sees, so the run does not read as a normal report-writer run once the sidecar is out of view.",
          "required": [
            "dispatchFailureReason",
            "approvalSidecar"
          ],
          "additionalProperties": false,
          "properties": {
            "dispatchFailureReason": {
              "type": "string",
              "minLength": 1,
              "description": "The reason recorded on the failed report-writer dispatch row, verbatim."
            },
            "approvalSidecar": {
              "type": "string",
              "minLength": 1,
              "description": "Project-relative path of the user-responses sidecar carrying the approving `## REPORT AUTHORING` block."
            }
          }
        },
        "leadModel": {
          "type": "string",
          "minLength": 1
        },
        "okstraVersion": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "agentActivity": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/AgentActivityRow"
      }
    },
    "verificationScope": {
      "enum": [
        "whole-task",
        "single-stage"
      ]
    },
    "clarificationCarryIn": {
      "type": "object",
      "description": "RENDER_IF non-empty. Carry-in clarifications from the previous run.",
      "required": [
        "sourceFile"
      ],
      "additionalProperties": false,
      "properties": {
        "sourceFile": {
          "type": "string",
          "minLength": 1,
          "description": "Project-relative path to the prior run's clarification-response sidecar."
        }
      }
    },
    "verdictCard": {
      "type": "object",
      "description": "Top-of-report at-a-glance card. It carries no verdict token — the token lives once, in finalVerdict. `direction` and `nextStep` MUST byte-match finalVerdict and recommendedNextSteps[0].",
      "required": [
        "finalConclusion",
        "direction",
        "approvalRequired",
        "nextStep"
      ],
      "additionalProperties": false,
      "properties": {
        "finalConclusion": {
          "type": "string",
          "minLength": 1,
          "description": "Conclusion SSOT for the whole report: at most 3 sentences. Other prose blocks reference this instead of restating it."
        },
        "direction": {
          "$ref": "#/$defs/Direction"
        },
        "approvalRequired": {
          "type": "boolean"
        },
        "nextStep": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "rationale": {
      "type": "object",
      "description": "## 작업 배경과 근거 — reviewer-facing narrative answering the four questions in order. Each field is prose (not a table) and MUST carry at least one evidence reference (path:line, a report ID such as C-001/F-013/§5.4, or another cited source) OR an explicit insufficiency marker (e.g. '근거 불충분'). validate-run.py fails a field with neither. Required for every task-type. Prose budget: at most 2 sentences per field; reference verdictCard.finalConclusion and row IDs instead of restating them.",
      "required": [
        "motivation",
        "problem",
        "approach",
        "justification"
      ],
      "additionalProperties": false,
      "properties": {
        "motivation": {
          "type": "string",
          "minLength": 1,
          "description": "왜 이 작업을 하는가 — 목표·맥락. ≤2 sentences."
        },
        "problem": {
          "type": "string",
          "minLength": 1,
          "description": "왜 이게 문제인가 — 현재 상태의 결함을 증거로. ≤2 sentences."
        },
        "approach": {
          "type": "string",
          "minLength": 1,
          "description": "그래서 어떤 작업이 필요한가 — 택한 방향. ≤2 sentences."
        },
        "justification": {
          "type": "string",
          "minLength": 1,
          "description": "왜 이게 합리적 선택인가 — 대안 대비 근거. ≤2 sentences."
        }
      }
    },
    "summary": {
      "type": "array",
      "description": "## Summary of the Problem or Verification Target. 3-5 rows.",
      "minItems": 1,
      "maxItems": 8,
      "items": {
        "$ref": "#/$defs/SummaryRow"
      }
    },
    "ticketCoverage": {
      "oneOf": [
        {
          "type": "object",
          "description": "Single-ticket run: one-line `- Single ticket run: <ticket>`.",
          "required": [
            "singleTicket"
          ],
          "additionalProperties": false,
          "properties": {
            "singleTicket": {
              "type": "string",
              "minLength": 1
            }
          }
        },
        {
          "type": "object",
          "description": "Multi-ticket run: reverse index table.",
          "required": [
            "rows"
          ],
          "additionalProperties": false,
          "properties": {
            "rows": {
              "type": "array",
              "minItems": 1,
              "items": {
                "$ref": "#/$defs/TicketCoverageRow"
              }
            }
          }
        },
        {
          "type": "object",
          "description": "Omit Ticket Coverage entirely (release-handoff / final-verification).",
          "required": [
            "omit"
          ],
          "additionalProperties": false,
          "properties": {
            "omit": {
              "const": true
            }
          }
        }
      ]
    },
    "executionStatus": {
      "type": "array",
      "description": "## Execution Status by Agent. One row per worker incl. lead. Token cells stay null until Phase 7 token-usage step fills them.",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/ExecutionStatusRow"
      }
    },
    "tokenUsage": {
      "type": "object",
      "description": "## Token Usage Summary. All numeric cells are null in Phase 6 and filled by Phase 7 token-usage step.",
      "required": [
        "lead",
        "worker",
        "grand",
        "cli"
      ],
      "additionalProperties": false,
      "properties": {
        "lead": {
          "$ref": "#/$defs/TokenUsageRow"
        },
        "worker": {
          "$ref": "#/$defs/TokenUsageRow"
        },
        "grand": {
          "$ref": "#/$defs/TokenUsageRow"
        },
        "workerDetails": {
          "type": "array",
          "description": "Optional Phase 7 expansion rows rendered under the Worker subtotal.",
          "items": {
            "$ref": "#/$defs/TokenUsageWorkerDetailRow"
          }
        },
        "cli": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "costUsd"
          ],
          "properties": {
            "costUsd": {
              "oneOf": [
                {
                  "type": "number",
                  "minimum": 0
                },
                {
                  "type": "null"
                }
              ]
            }
          }
        },
        "taskCumulative": {
          "$ref": "#/$defs/TokenUsageTaskCumulative"
        }
      }
    },
    "crossVerification": {
      "type": "object",
      "required": [
        "consensus",
        "differences"
      ],
      "additionalProperties": false,
      "properties": {
        "roundHistory": {
          "oneOf": [
            {
              "type": "object",
              "description": "Convergence-enabled run.",
              "required": [
                "rounds",
                "round2SkippedReason"
              ],
              "additionalProperties": false,
              "properties": {
                "rounds": {
                  "type": "array",
                  "items": {
                    "$ref": "#/$defs/RoundHistoryRow"
                  }
                },
                "round2SkippedReason": {
                  "enum": [
                    "queue-empty",
                    "max-rounds-1",
                    "all-reverify-non-result",
                    "not-skipped",
                    "convergence-disabled",
                    "single-analyser-only"
                  ]
                }
              }
            },
            {
              "type": "object",
              "description": "Convergence disabled (omit the sub-table entirely).",
              "required": [
                "disabled"
              ],
              "additionalProperties": false,
              "properties": {
                "disabled": {
                  "const": true
                }
              }
            }
          ]
        },
        "criticGaps": {
          "type": "object",
          "description": "Coverage-critic gap accounting. `proposed - merged - unverified` is the count the voters judged and rejected, so a gap that vanished shows up as a mismatch instead of as nothing. Every `unverified` gap needs a matching `missingInformation` row with source `critic-unverified` (prompts/lead/convergence.md \"Gap verification\").",
          "required": [
            "proposed",
            "merged",
            "unverified"
          ],
          "additionalProperties": false,
          "properties": {
            "proposed": {
              "type": "integer",
              "minimum": 0
            },
            "merged": {
              "type": "integer",
              "minimum": 0
            },
            "unverified": {
              "type": "integer",
              "minimum": 0
            }
          }
        },
        "consensus": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ConsensusRow"
          }
        },
        "differences": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DifferenceRow"
          }
        }
      }
    },
    "finalVerdict": {
      "type": "object",
      "required": [
        "finalConclusion",
        "verdictToken",
        "direction",
        "rationaleRowIds",
        "nextStep"
      ],
      "additionalProperties": false,
      "properties": {
        "finalConclusion": {
          "type": "string",
          "minLength": 1
        },
        "verdictToken": {
          "$ref": "#/$defs/VerdictToken"
        },
        "direction": {
          "$ref": "#/$defs/Direction"
        },
        "rationaleRowIds": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "minItems": 1
        },
        "nextStep": {
          "type": "string",
          "minLength": 1
        },
        "conditionalAcceptanceConditions": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ConditionalAcceptanceConditionRow"
          }
        }
      }
    },
    "evidence": {
      "type": "object",
      "required": [
        "primary"
      ],
      "additionalProperties": false,
      "properties": {
        "primary": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/PrimaryEvidenceRow"
          }
        },
        "secondary": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/SecondaryEvidenceRow"
          }
        }
      }
    },
    "endStateCoverage": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/EndStateCoverageRow"
      },
      "description": "One row per brief end-state id. Optional at the schema layer; validate-run.py requires it when the run's brief carries the end-state sections."
    },
    "missingInformation": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/RiskRow"
      }
    },
    "requirementsDiscovery": {
      "$ref": "#/$defs/RequirementsDiscovery"
    },
    "improvementDiscovery": {
      "$ref": "#/$defs/ImprovementDiscovery"
    },
    "errorAnalysis": {
      "$ref": "#/$defs/ErrorAnalysis"
    },
    "analysisCommon": {
      "$ref": "#/$defs/AnalysisCommon"
    },
    "projectAnalysis": {
      "$ref": "#/$defs/ProjectAnalysis"
    },
    "featureAnalysis": {
      "$ref": "#/$defs/FeatureAnalysis"
    },
    "changeImpactAnalysis": {
      "$ref": "#/$defs/ChangeImpactAnalysis"
    },
    "implementationOptionSelection": {
      "$ref": "#/$defs/ImplementationOptionSelection"
    },
    "implementationPlanning": {
      "type": "object",
      "description": "RENDER_IF taskType == implementation-planning. §5.5 deliverables.",
      "additionalProperties": false,
      "oneOf": [
        {
          "description": "Legacy implementation-option planning contract.",
          "required": [
            "optionCandidates",
            "tradeoffMatrix",
            "recommendedOption",
            "stageMap",
            "stages",
            "dependencyMigrationRisk",
            "validationChecklist",
            "rollbackStrategy",
            "requirementCoverage",
            "planBodyVerification",
            "crossProjectDependencies",
            "decisionDrafts",
            "skippedAdrCandidates",
            "variationPointAnalysis",
            "userNarrative"
          ],
          "properties": {
            "requirementCoverage": {
              "type": "array",
              "minItems": 1,
              "items": {
                "$ref": "#/$defs/ImplementationRequirementCoverageRow"
              }
            }
          },
          "allOf": [
            {"not": {"required": ["planningContract"]}},
            {"not": {"required": ["outcome"]}},
            {"not": {"required": ["selectedDirectionRef"]}},
            {"not": {"required": ["directionRealization"]}},
            {"not": {"required": ["directionInvalidation"]}},
            {"not": {"required": ["routing"]}},
            {"not": {"required": ["coverageSummary"]}}
          ]
        },
        {
          "description": "A detailed plan for one direction selected by implementation-option-selection.",
          "required": [
            "planningContract",
            "outcome",
            "selectedDirectionRef"
          ],
          "properties": {
            "planningContract": {"const": "selected-direction"}
          },
          "allOf": [
            {"not": {"required": ["optionCandidates"]}},
            {"not": {"required": ["tradeoffMatrix"]}},
            {"not": {"required": ["recommendedOption"]}}
          ],
          "oneOf": [
            {
              "description": "The selected direction is fully realized as an executable plan.",
              "required": [
                "directionRealization",
                "stageMap",
                "stages",
                "designPreparation",
                "dependencyMigrationRisk",
                "validationChecklist",
                "rollbackStrategy",
                "requirementCoverage",
                "coverageSummary",
                "variationPointAnalysis",
                "planBodyVerification"
              ],
              "properties": {
                "outcome": {"const": "plan-ready"},
                "requirementCoverage": {
                  "type": "array",
                  "minItems": 1,
                  "items": {
                    "$ref": "#/$defs/SelectedDirectionRequirementCoverage"
                  }
                }
              },
              "allOf": [
                {"not": {"required": ["directionInvalidation"]}},
                {"not": {"required": ["routing"]}}
              ]
            },
            {
              "description": "Planning evidence invalidated the selected direction and routes back to option selection.",
              "required": [
                "directionInvalidation",
                "routing"
              ],
              "properties": {
                "outcome": {"const": "direction-invalidated"},
                "routing": {"const": "implementation-option-selection"}
              },
              "allOf": [
                {"not": {"required": ["directionRealization"]}},
                {"not": {"required": ["stageMap"]}},
                {"not": {"required": ["stages"]}},
                {"not": {"required": ["designPreparation"]}},
                {"not": {"required": ["dependencyMigrationRisk"]}},
                {"not": {"required": ["validationChecklist"]}},
                {"not": {"required": ["rollbackStrategy"]}},
                {"not": {"required": ["requirementCoverage"]}},
                {"not": {"required": ["coverageSummary"]}},
                {"not": {"required": ["variationPointAnalysis"]}},
                {"not": {"required": ["planBodyVerification"]}},
                {"not": {"required": ["stepwiseExecution"]}},
                {"not": {"required": ["supersessionLedger"]}},
                {"not": {"required": ["crossProjectDependencies"]}},
                {"not": {"required": ["decisionDrafts"]}},
                {"not": {"required": ["skippedAdrCandidates"]}},
                {"not": {"required": ["incrementalDecision"]}},
                {"not": {"required": ["userNarrative"]}}
              ]
            }
          ]
        }
      ],
      "properties": {
        "planningContract": {
          "const": "selected-direction"
        },
        "outcome": {
          "enum": [
            "plan-ready",
            "direction-invalidated"
          ]
        },
        "selectedDirectionRef": {
          "$ref": "#/$defs/SelectedDirectionRef"
        },
        "directionRealization": {
          "$ref": "#/$defs/DirectionRealization"
        },
        "directionInvalidation": {
          "$ref": "#/$defs/DirectionInvalidation"
        },
        "routing": {
          "const": "implementation-option-selection"
        },
        "optionCandidates": {
          "type": "array",
          "minItems": 2,
          "items": {
            "$ref": "#/$defs/OptionCandidate"
          }
        },
        "tradeoffMatrix": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/TradeoffRow"
          }
        },
        "recommendedOption": {
          "$ref": "#/$defs/RecommendedOption"
        },
        "userNarrative": {
          "$ref": "#/$defs/PlanningUserNarrative"
        },
        "stageMap": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/StageMapRow"
          }
        },
        "stages": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/ImplementationPlanStage"
          }
        },
        "designPreparation": {
          "$ref": "#/$defs/DesignPreparation"
        },
        "variationPointAnalysis": {
          "$ref": "#/$defs/VariationPointAnalysis"
        },
        "stepwiseExecution": {
          "description": "Legacy flat summary kept for compatibility only. New reports use stageMap/stages.",
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/StepRow"
          }
        },
        "dependencyMigrationRisk": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DependencyRow"
          }
        },
        "validationChecklist": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/ValidationCheckRow"
          }
        },
        "rollbackStrategy": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/RollbackRow"
          }
        },
        "requirementCoverage": {
          "type": "array"
        },
        "coverageSummary": {
          "$ref": "#/$defs/SelectedDirectionCoverageSummary"
        },
        "planBodyVerification": {
          "$ref": "#/$defs/PlanBodyVerification"
        },
        "supersessionLedger": {
          "type": "array",
          "description": "One entry per clarification this run answered, recording which plan statements the answer invalidated. Incorporating an answer by adding the new decision while leaving the contradicting sentence in place is what produces two opposite instructions for the same symbol in one plan.",
          "items": {
            "$ref": "#/$defs/SupersessionEntry"
          }
        },
        "crossProjectDependencies": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/CrossProjectDependency"
          }
        },
        "decisionDrafts": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DecisionDraft"
          }
        },
        "skippedAdrCandidates": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/SkippedAdrCandidate"
          }
        },
        "incrementalDecision": {
          "type": "object",
          "description": "Verbatim `okstra incremental-scope` output for a clarification re-run. Present only when this implementation-planning run scoped itself against a prior run; drives the Section 0 incremental audit block.",
          "required": [
            "mode",
            "reverifyStages",
            "carryStages",
            "reason"
          ],
          "additionalProperties": false,
          "properties": {
            "mode": {
              "type": "string",
              "enum": [
                "incremental",
                "full"
              ]
            },
            "reverifyStages": {
              "type": "array",
              "items": {
                "type": "integer"
              }
            },
            "carryStages": {
              "type": "array",
              "items": {
                "type": "integer"
              }
            },
            "reason": {
              "type": "string",
              "minLength": 1
            }
          }
        }
      }
    },
    "releaseHandoff": {
      "type": "object",
      "description": "RENDER_IF taskType == release-handoff. §5.6 deliverables.",
      "required": [
        "handoffScope",
        "featureBranchState",
        "userSelections",
        "localCheckoutOutcome",
        "executedCommands",
        "commitList",
        "mergeConflictProbe",
        "pullRequestOutcome",
        "routingRecommendation",
        "userNarrative"
      ],
      "additionalProperties": false,
      "allOf": [
        {
          "if": {
            "properties": {
              "handoffScope": {
                "properties": {
                  "mode": {
                    "const": "stage-group"
                  }
                },
                "required": [
                  "mode"
                ]
              }
            },
            "required": [
              "handoffScope"
            ]
          },
          "then": {
            "required": [
              "sourceVerificationReports"
            ]
          },
          "else": {
            "required": [
              "sourceVerificationReport"
            ]
          }
        }
      ],
      "properties": {
        "handoffScope": {
          "type": "object",
          "required": [
            "mode"
          ],
          "additionalProperties": false,
          "description": "Which shape of handoff this was. 'whole-task' turns the verified task branch into one PR; 'stage-group' merges a user-selected subset of verified stages into a collector branch and opens the PR from that. Without it a reader cannot tell one report from the other, and in stage-group mode cannot tell which stages shipped — the branch name alone does not say.",
          "properties": {
            "mode": {
              "enum": [
                "whole-task",
                "stage-group"
              ]
            },
            "stages": {
              "type": "array",
              "items": {
                "type": "integer",
                "minimum": 1
              }
            },
            "collectorBranch": {
              "type": "string"
            },
            "mergeCommits": {
              "type": "array",
              "description": "Assemble's merge commit SHAs, in the order the stages were merged into the collector branch. Without them the collector branch's contents cannot be traced back to the stages that produced them once the branch moves on.",
              "items": {
                "type": "string",
                "minLength": 7
              }
            },
            "dependencyClosureVerdict": {
              "type": "string",
              "minLength": 1,
              "description": "Whether the selected stages are closed under their dependencies, and on what basis. A stage-group PR that ships a stage without its predecessor is the failure this records."
            }
          }
        },
        "sourceVerificationReport": {
          "type": "object",
          "description": "whole-task mode: the one final-verification report this handoff ships. Required unless handoffScope.mode is stage-group.",
          "required": [
            "path",
            "verdictTokenQuote"
          ],
          "additionalProperties": false,
          "properties": {
            "path": {
              "type": "string",
              "minLength": 1
            },
            "verdictTokenQuote": {
              "type": "string",
              "minLength": 1
            }
          }
        },
        "sourceVerificationReports": {
          "type": "array",
          "description": "stage-group mode: one row per selected stage, because that handoff ships several verified stages and a single report path cannot say which stage each verdict belongs to.",
          "minItems": 1,
          "items": {
            "type": "object",
            "required": [
              "stage",
              "path",
              "verdictTokenQuote"
            ],
            "additionalProperties": false,
            "properties": {
              "stage": {
                "type": "integer",
                "minimum": 1
              },
              "path": {
                "type": "string",
                "minLength": 1
              },
              "verdictTokenQuote": {
                "type": "string",
                "minLength": 1
              }
            }
          }
        },
        "localCheckoutOutcome": {
          "type": "object",
          "description": "What the `local checkout` action did, including when it was not taken. `removedWorktree` is the command's own field: a non-empty path means the okstra worktree was removed, an empty string means it was already gone and the branch survived. Recording a removal that did not happen is the error this shape exists to prevent.",
          "required": [
            "status"
          ],
          "additionalProperties": false,
          "properties": {
            "status": {
              "enum": [
                "not-run",
                "checked-out"
              ]
            },
            "branch": {
              "type": "string"
            },
            "mainWorktreePath": {
              "type": "string"
            },
            "removedWorktree": {
              "type": "string"
            }
          }
        },
        "featureBranchState": {
          "type": "object",
          "required": [
            "branchName",
            "gitStatusShort",
            "existingPrUrl"
          ],
          "additionalProperties": false,
          "properties": {
            "branchName": {
              "type": "string",
              "minLength": 1
            },
            "gitStatusShort": {
              "type": "string"
            },
            "existingPrUrl": {
              "type": "string"
            }
          }
        },
        "userSelections": {
          "type": "object",
          "required": [
            "h1",
            "h2b",
            "h3"
          ],
          "additionalProperties": false,
          "properties": {
            "h1": {
              "enum": [
                "local checkout",
                "push + PR",
                "skip"
              ]
            },
            "h1c": {
              "type": "string"
            },
            "h2": {
              "type": "string"
            },
            "h2b": {
              "enum": [
                "not-run",
                "clean",
                "proceed anyway",
                "change base branch",
                "cancel"
              ]
            },
            "h3": {
              "description": "The PR title/body confirmation. `not-run` when H1 was `local checkout` or `skip` — those routes never reach the question, and inventing an answer for a question that was never asked is the failure this value prevents.",
              "enum": [
                "not-run",
                "use as-is",
                "edit then proceed",
                "cancel"
              ]
            }
          }
        },
        "executedCommands": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ExecutedCommandRow"
          }
        },
        "commitList": {
          "oneOf": [
            {
              "type": "array",
              "items": {
                "$ref": "#/$defs/CommitRow"
              }
            },
            {
              "type": "object",
              "required": [
                "empty"
              ],
              "additionalProperties": false,
              "properties": {
                "empty": {
                  "const": true
                }
              }
            }
          ]
        },
        "mergeConflictProbe": {
          "type": "object",
          "required": [
            "kind"
          ],
          "additionalProperties": false,
          "properties": {
            "kind": {
              "enum": [
                "not-run",
                "clean",
                "conflicts"
              ]
            },
            "baseBranch": {
              "type": "string"
            },
            "baseSha": {
              "type": "string"
            },
            "userChoice": {
              "type": "string"
            },
            "conflictingPaths": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        },
        "pullRequestOutcome": {
          "type": "object",
          "required": [
            "kind"
          ],
          "additionalProperties": false,
          "properties": {
            "kind": {
              "enum": [
                "no-action",
                "created",
                "reused",
                "skipped"
              ]
            },
            "url": {
              "type": "string"
            },
            "title": {
              "type": "string"
            },
            "baseBranch": {
              "type": "string"
            },
            "reason": {
              "type": "string"
            }
          }
        },
        "routingRecommendation": {
          "type": "string",
          "minLength": 1
        },
        "userNarrative": {
          "$ref": "#/$defs/ReleaseHandoffUserNarrative"
        }
      }
    },
    "implementation": {
      "type": "object",
      "description": "RENDER_IF taskType == implementation. §5.7 deliverables.",
      "required": [
        "approvedPlanReference",
        "commitList",
        "diffSummary",
        "outOfPlanEdits",
        "stageSidecarEvidence",
        "validationEvidence",
        "verifierResults",
        "rollbackVerification",
        "manualUserTest",
        "requirementCoverage",
        "routingRecommendation",
        "userNarrative"
      ],
      "additionalProperties": false,
      "properties": {
        "approvedPlanReference": {
          "type": "object",
          "required": [
            "planFile",
            "approvalEvidence",
            "executorWorktreePath",
            "baseRefSha"
          ],
          "additionalProperties": false,
          "properties": {
            "planFile": {
              "type": "string",
              "minLength": 1
            },
            "approvalEvidence": {
              "type": "string",
              "minLength": 1
            },
            "executorWorktreePath": {
              "type": "string",
              "minLength": 1
            },
            "baseRefSha": {
              "type": "string",
              "minLength": 1
            }
          }
        },
        "commitList": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/CommitWithStepRow"
          }
        },
        "diffSummary": {
          "type": "object",
          "required": [
            "rawStat",
            "files"
          ],
          "additionalProperties": false,
          "properties": {
            "rawStat": {
              "type": "string"
            },
            "files": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/DiffFileRow"
              }
            }
          },
          "$comment": "rawStat(git diff --stat 원문)이 비어있지 않으면(=변경 있음) files 표는 최소 1행이어야 한다. 변경을 stat 으로는 보고하면서 files 표를 비워 미선언-surface conformance 게이트를 우회하는 fail-open(SUSP-1)을 차단. 0파일 변경은 rawStat 이 빈 문자열이라 허용된다.",
          "if": {
            "required": [
              "rawStat"
            ],
            "properties": {
              "rawStat": {
                "minLength": 1
              }
            }
          },
          "then": {
            "properties": {
              "files": {
                "minItems": 1
              }
            }
          }
        },
        "outOfPlanEdits": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/OutOfPlanEditRow"
          }
        },
        "stageSidecarEvidence": {
          "$ref": "#/$defs/StageSidecarEvidence"
        },
        "validationEvidence": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/ValidationEvidenceRow"
          }
        },
        "verifierResults": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/VerifierResultBlock"
          }
        },
        "rollbackVerification": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/RollbackVerificationRow"
          }
        },
        "manualUserTest": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "applicable"
          ],
          "properties": {
            "applicable": {
              "type": "boolean"
            },
            "exemptionReason": {
              "type": "string"
            },
            "items": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "target",
                  "environmentSetup",
                  "steps",
                  "expectedResult"
                ],
                "properties": {
                  "target": {
                    "type": "string"
                  },
                  "environmentSetup": {
                    "type": "string"
                  },
                  "steps": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "expectedResult": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "requirementCoverage": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/ImplementationRequirementCoverageRow"
          }
        },
        "routingRecommendation": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "target",
            "rationale"
          ],
          "properties": {
            "target": {
              "enum": [
                "final-verification",
                "error-analysis",
                "implementation-planning",
                "implementation"
              ]
            },
            "rationale": {
              "type": "string",
              "minLength": 1
            }
          }
        },
        "userNarrative": {
          "$ref": "#/$defs/ImplementationUserNarrative"
        }
      }
    },
    "finalVerification": {
      "type": "object",
      "description": "RENDER_IF taskType == final-verification. §5.8 deliverables.",
      "required": [
        "sourceImplementationReport",
        "addedSurfaceAudit",
        "acceptanceBlockers",
        "residualRisk",
        "validationEvidence",
        "readonlyCommandLog",
        "manualUserTest",
        "routingRecommendation",
        "userNarrative"
      ],
      "additionalProperties": false,
      "properties": {
        "sourceImplementationReport": {
          "type": "object",
          "required": [
            "path",
            "commitListQuote",
            "diffSummaryQuote",
            "worktreePath",
            "implementationBaseRef",
            "capturedHeadSha",
            "gitStatusShort",
            "gitDiffStat"
          ],
          "additionalProperties": false,
          "properties": {
            "path": {
              "type": "string"
            },
            "commitListQuote": {
              "type": "string"
            },
            "diffSummaryQuote": {
              "type": "string"
            },
            "worktreePath": {
              "type": "string"
            },
            "implementationBaseRef": {
              "type": "string"
            },
            "capturedHeadSha": {
              "type": "string"
            },
            "gitStatusShort": {
              "type": "string"
            },
            "gitDiffStat": {
              "type": "string"
            }
          }
        },
        "stageReports": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "stage",
              "reportPath"
            ],
            "properties": {
              "stage": {
                "type": "integer"
              },
              "reportPath": {
                "type": "string"
              }
            }
          }
        },
        "addedSurfaceAudit": {
          "type": "array",
          "description": "Over-delivery axis. One row per identifier / module / configuration entry the merged diff ADDS, each traced to the brief requirement it serves. An empty array states the diff added no such surface; it is not a licence to skip the enumeration.",
          "items": {
            "$ref": "#/$defs/AddedSurfaceRow"
          }
        },
        "acceptanceBlockers": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AcceptanceBlockerRow"
          }
        },
        "residualRisk": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ResidualRiskRow"
          }
        },
        "validationEvidence": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/RequirementCoverageRow"
          }
        },
        "readonlyCommandLog": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ReadonlyCommandRow"
          }
        },
        "manualUserTest": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "applicable"
          ],
          "properties": {
            "applicable": {
              "type": "boolean"
            },
            "exemptionReaffirm": {
              "type": "string"
            },
            "results": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "target",
                  "performed",
                  "result",
                  "observed"
                ],
                "properties": {
                  "target": {
                    "type": "string"
                  },
                  "performed": {
                    "type": "string"
                  },
                  "result": {
                    "enum": [
                      "pass",
                      "fail",
                      "blocked"
                    ]
                  },
                  "observed": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "routingRecommendation": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "target",
            "rationale"
          ],
          "properties": {
            "target": {
              "enum": [
                "release-handoff",
                "release-handoff(stage-group)",
                "error-analysis",
                "implementation-option-selection",
                "implementation-planning",
                "implementation",
                "done"
              ]
            },
            "rationale": {
              "type": "string",
              "minLength": 1
            }
          }
        },
        "userNarrative": {
          "$ref": "#/$defs/FinalVerificationUserNarrative"
        }
      }
    },
    "fixCycle": {
      "type": "object",
      "description": "RENDER_IF fixCycle present — the post-release bug-fix cycle this run belongs to.",
      "required": [
        "cycle",
        "targetReport",
        "symptom"
      ],
      "additionalProperties": false,
      "properties": {
        "cycle": {
          "type": "string",
          "pattern": "^fc-[0-9]{2,}$"
        },
        "targetReport": {
          "type": "string"
        },
        "symptom": {
          "type": "string"
        },
        "runs": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "taskType",
              "runSeq"
            ],
            "additionalProperties": false,
            "properties": {
              "taskType": {
                "type": "string"
              },
              "runSeq": {
                "type": "integer"
              },
              "runManifest": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "clarificationItems": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ClarificationRow"
      }
    },
    "recommendedNextSteps": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/RecommendedStep"
      }
    },
    "followUpTasks": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/FollowUpRow"
      }
    }
  },
  "allOf": [
    {
      "description": "Frontmatter approval input matches the implementation-planning contract.",
      "if": {
        "properties": {
          "implementationPlanning": {
            "properties": {
              "planningContract": {
                "const": "selected-direction"
              }
            },
            "required": [
              "planningContract"
            ]
          }
        },
        "required": [
          "implementationPlanning"
        ]
      },
      "then": {
        "properties": {
          "frontmatter": {
            "required": [
              "selectedDirectionRef"
            ],
            "not": {
              "required": [
                "implementationOption"
              ]
            }
          }
        }
      },
      "else": {
        "properties": {
          "frontmatter": {
            "required": [
              "implementationOption"
            ],
            "not": {
              "required": [
                "selectedDirectionRef"
              ]
            }
          }
        }
      }
    },
    {
      "description": "requirements-discovery requires a structured requirements block.",
      "if": {
        "properties": {
          "header": {
            "properties": {
              "taskType": {
                "const": "requirements-discovery"
              }
            }
          }
        },
        "required": [
          "header"
        ]
      },
      "then": {
        "required": [
          "requirementsDiscovery"
        ]
      }
    },
    {
      "description": "improvement-discovery requires a structured improvement block.",
      "if": {
        "properties": {
          "header": {
            "properties": {
              "taskType": {
                "const": "improvement-discovery"
              }
            }
          }
        },
        "required": [
          "header"
        ]
      },
      "then": {
        "required": [
          "improvementDiscovery"
        ]
      }
    },
    {
      "description": "error-analysis task-type requires a structured diagnosis block.",
      "if": {
        "properties": {
          "header": {
            "properties": {
              "taskType": {
                "const": "error-analysis"
              }
            }
          }
        },
        "required": [
          "header"
        ]
      },
      "then": {
        "required": [
          "errorAnalysis"
        ]
      }
    },
    {
      "description": "project-analysis requires analysisCommon and only projectAnalysis.",
      "if": {
        "properties": {
          "header": {
            "properties": {
              "taskType": {
                "const": "project-analysis"
              }
            }
          }
        },
        "required": [
          "header"
        ]
      },
      "then": {
        "required": [
          "analysisCommon",
          "projectAnalysis"
        ],
        "allOf": [
          {
            "not": {
              "required": [
                "featureAnalysis"
              ]
            }
          },
          {
            "not": {
              "required": [
                "changeImpactAnalysis"
              ]
            }
          }
        ]
      }
    },
    {
      "description": "feature-analysis requires analysisCommon and only featureAnalysis.",
      "if": {
        "properties": {
          "header": {
            "properties": {
              "taskType": {
                "const": "feature-analysis"
              }
            }
          }
        },
        "required": [
          "header"
        ]
      },
      "then": {
        "required": [
          "analysisCommon",
          "featureAnalysis"
        ],
        "allOf": [
          {
            "not": {
              "required": [
                "projectAnalysis"
              ]
            }
          },
          {
            "not": {
              "required": [
                "changeImpactAnalysis"
              ]
            }
          }
        ]
      }
    },
    {
      "description": "change-impact-analysis requires analysisCommon and only changeImpactAnalysis.",
      "if": {
        "properties": {
          "header": {
            "properties": {
              "taskType": {
                "const": "change-impact-analysis"
              }
            }
          }
        },
        "required": [
          "header"
        ]
      },
      "then": {
        "required": [
          "analysisCommon",
          "changeImpactAnalysis"
        ],
        "allOf": [
          {
            "not": {
              "required": [
                "projectAnalysis"
              ]
            }
          },
          {
            "not": {
              "required": [
                "featureAnalysis"
              ]
            }
          }
        ]
      }
    },
    {
      "description": "implementation-option-selection requires its structured comparison block.",
      "if": {
        "properties": {
          "header": {
            "properties": {
              "taskType": {
                "const": "implementation-option-selection"
              }
            }
          }
        },
        "required": [
          "header"
        ]
      },
      "then": {
        "required": [
          "implementationOptionSelection"
        ]
      }
    },
    {
      "description": "implementation-planning task-type requires §5.5 block.",
      "if": {
        "properties": {
          "header": {
            "properties": {
              "taskType": {
                "const": "implementation-planning"
              }
            }
          }
        },
        "required": [
          "header"
        ]
      },
      "then": {
        "required": [
          "implementationPlanning"
        ]
      }
    },
    {
      "description": "release-handoff task-type requires §5.6 block.",
      "if": {
        "properties": {
          "header": {
            "properties": {
              "taskType": {
                "const": "release-handoff"
              }
            }
          }
        },
        "required": [
          "header"
        ]
      },
      "then": {
        "required": [
          "releaseHandoff"
        ]
      }
    },
    {
      "description": "implementation task-type requires §5.7 block.",
      "if": {
        "properties": {
          "header": {
            "properties": {
              "taskType": {
                "const": "implementation"
              }
            }
          }
        },
        "required": [
          "header"
        ]
      },
      "then": {
        "required": [
          "implementation"
        ]
      }
    },
    {
      "description": "final-verification task-type requires §5.8 block.",
      "if": {
        "properties": {
          "header": {
            "properties": {
              "taskType": {
                "const": "final-verification"
              }
            }
          }
        },
        "required": [
          "header"
        ]
      },
      "then": {
        "required": [
          "finalVerification"
        ]
      }
    },
    {
      "description": "Non-terminal task-types MUST emit one phase-continuation row in followUpTasks.",
      "if": {
        "properties": {
          "header": {
            "properties": {
              "taskType": {
                "enum": [
                  "requirements-discovery",
                  "project-analysis",
                  "feature-analysis",
                  "change-impact-analysis",
                  "implementation-option-selection",
                  "implementation-planning",
                  "error-analysis",
                  "implementation",
                  "final-verification"
                ]
              }
            }
          }
        },
        "required": [
          "header"
        ]
      },
      "then": {
        "properties": {
          "followUpTasks": {
            "type": "array",
            "minItems": 1,
            "contains": {
              "type": "object",
              "properties": {
                "origin": {
                  "const": "phase-continuation"
                }
              },
              "required": [
                "origin"
              ]
            }
          }
        }
      }
    },
    {
      "description": "Analysis verdict tokens describe analysis completeness, not user acceptance.",
      "if": {
        "properties": {
          "header": {
            "properties": {
              "taskType": {
                "enum": [
                  "project-analysis",
                  "feature-analysis",
                  "change-impact-analysis"
                ]
              }
            }
          }
        },
        "required": [
          "header"
        ]
      },
      "then": {
        "properties": {
          "finalVerdict": {
            "not": {
              "required": [
                "conditionalAcceptanceConditions"
              ]
            },
            "properties": {
              "verdictToken": {
                "enum": [
                  "analysis-complete",
                  "analysis-partial",
                  "blocked"
                ]
              }
            }
          }
        }
      }
    },
    {
      "description": "final-verification verdict token must be one of accepted / conditional-accept / blocked and must explicitly list conditional acceptance conditions.",
      "if": {
        "properties": {
          "header": {
            "properties": {
              "taskType": {
                "const": "final-verification"
              }
            }
          }
        },
        "required": [
          "header"
        ]
      },
      "then": {
        "properties": {
          "finalVerdict": {
            "required": [
              "conditionalAcceptanceConditions"
            ],
            "properties": {
              "verdictToken": {
                "enum": [
                  "accepted",
                  "conditional-accept",
                  "blocked"
                ]
              }
            }
          }
        }
      }
    },
    {
      "description": "Non-analysis, non-final-verification verdict token must be `not-applicable`.",
      "if": {
        "properties": {
          "header": {
            "properties": {
              "taskType": {
                "enum": [
                  "requirements-discovery",
                  "error-analysis",
                  "implementation-option-selection",
                  "implementation-planning",
                  "implementation",
                  "release-handoff",
                  "quick"
                ]
              }
            }
          }
        },
        "required": [
          "header"
        ]
      },
      "then": {
        "properties": {
          "finalVerdict": {
            "not": {
              "required": [
                "conditionalAcceptanceConditions"
              ]
            },
            "properties": {
              "verdictToken": {
                "const": "not-applicable"
              }
            }
          }
        }
      }
    },
    {
      "description": "The implementation-option-selection block is mutually exclusive with every other task deliverable.",
      "if": {
        "required": [
          "implementationOptionSelection"
        ]
      },
      "then": {
        "allOf": [
          {"not": {"required": ["requirementsDiscovery"]}},
          {"not": {"required": ["improvementDiscovery"]}},
          {"not": {"required": ["errorAnalysis"]}},
          {"not": {"required": ["projectAnalysis"]}},
          {"not": {"required": ["featureAnalysis"]}},
          {"not": {"required": ["changeImpactAnalysis"]}},
          {"not": {"required": ["implementationPlanning"]}},
          {"not": {"required": ["implementation"]}},
          {"not": {"required": ["finalVerification"]}},
          {"not": {"required": ["releaseHandoff"]}}
        ]
      }
    }
  ],
  "oneOf": [
    {
      "required": [
        "requirementsDiscovery"
      ],
      "allOf": [
        {
          "not": {
            "required": [
              "improvementDiscovery"
            ]
          }
        },
        {
          "not": {
            "required": [
              "errorAnalysis"
            ]
          }
        },
        {
          "not": {
            "required": [
              "projectAnalysis"
            ]
          }
        },
        {
          "not": {
            "required": [
              "featureAnalysis"
            ]
          }
        },
        {
          "not": {
            "required": [
              "changeImpactAnalysis"
            ]
          }
        },
        {
          "not": {
            "required": [
              "implementationPlanning"
            ]
          }
        },
        {
          "not": {
            "required": [
              "implementation"
            ]
          }
        },
        {
          "not": {
            "required": [
              "finalVerification"
            ]
          }
        },
        {
          "not": {
            "required": [
              "releaseHandoff"
            ]
          }
        }
      ]
    },
    {
      "required": [
        "improvementDiscovery"
      ],
      "allOf": [
        {
          "not": {
            "required": [
              "requirementsDiscovery"
            ]
          }
        },
        {
          "not": {
            "required": [
              "errorAnalysis"
            ]
          }
        },
        {
          "not": {
            "required": [
              "projectAnalysis"
            ]
          }
        },
        {
          "not": {
            "required": [
              "featureAnalysis"
            ]
          }
        },
        {
          "not": {
            "required": [
              "changeImpactAnalysis"
            ]
          }
        },
        {
          "not": {
            "required": [
              "implementationPlanning"
            ]
          }
        },
        {
          "not": {
            "required": [
              "implementation"
            ]
          }
        },
        {
          "not": {
            "required": [
              "finalVerification"
            ]
          }
        },
        {
          "not": {
            "required": [
              "releaseHandoff"
            ]
          }
        }
      ]
    },
    {
      "required": [
        "errorAnalysis"
      ],
      "allOf": [
        {
          "not": {
            "required": [
              "requirementsDiscovery"
            ]
          }
        },
        {
          "not": {
            "required": [
              "improvementDiscovery"
            ]
          }
        },
        {
          "not": {
            "required": [
              "projectAnalysis"
            ]
          }
        },
        {
          "not": {
            "required": [
              "featureAnalysis"
            ]
          }
        },
        {
          "not": {
            "required": [
              "changeImpactAnalysis"
            ]
          }
        },
        {
          "not": {
            "required": [
              "implementationPlanning"
            ]
          }
        },
        {
          "not": {
            "required": [
              "implementation"
            ]
          }
        },
        {
          "not": {
            "required": [
              "finalVerification"
            ]
          }
        },
        {
          "not": {
            "required": [
              "releaseHandoff"
            ]
          }
        }
      ]
    },
    {
      "required": [
        "projectAnalysis"
      ],
      "allOf": [
        {
          "not": {
            "required": [
              "requirementsDiscovery"
            ]
          }
        },
        {
          "not": {
            "required": [
              "improvementDiscovery"
            ]
          }
        },
        {
          "not": {
            "required": [
              "errorAnalysis"
            ]
          }
        },
        {
          "not": {
            "required": [
              "featureAnalysis"
            ]
          }
        },
        {
          "not": {
            "required": [
              "changeImpactAnalysis"
            ]
          }
        },
        {
          "not": {
            "required": [
              "implementationPlanning"
            ]
          }
        },
        {
          "not": {
            "required": [
              "implementation"
            ]
          }
        },
        {
          "not": {
            "required": [
              "finalVerification"
            ]
          }
        },
        {
          "not": {
            "required": [
              "releaseHandoff"
            ]
          }
        }
      ]
    },
    {
      "required": [
        "featureAnalysis"
      ],
      "allOf": [
        {
          "not": {
            "required": [
              "requirementsDiscovery"
            ]
          }
        },
        {
          "not": {
            "required": [
              "improvementDiscovery"
            ]
          }
        },
        {
          "not": {
            "required": [
              "errorAnalysis"
            ]
          }
        },
        {
          "not": {
            "required": [
              "projectAnalysis"
            ]
          }
        },
        {
          "not": {
            "required": [
              "changeImpactAnalysis"
            ]
          }
        },
        {
          "not": {
            "required": [
              "implementationPlanning"
            ]
          }
        },
        {
          "not": {
            "required": [
              "implementation"
            ]
          }
        },
        {
          "not": {
            "required": [
              "finalVerification"
            ]
          }
        },
        {
          "not": {
            "required": [
              "releaseHandoff"
            ]
          }
        }
      ]
    },
    {
      "required": [
        "changeImpactAnalysis"
      ],
      "allOf": [
        {
          "not": {
            "required": [
              "requirementsDiscovery"
            ]
          }
        },
        {
          "not": {
            "required": [
              "improvementDiscovery"
            ]
          }
        },
        {
          "not": {
            "required": [
              "errorAnalysis"
            ]
          }
        },
        {
          "not": {
            "required": [
              "projectAnalysis"
            ]
          }
        },
        {
          "not": {
            "required": [
              "featureAnalysis"
            ]
          }
        },
        {
          "not": {
            "required": [
              "implementationPlanning"
            ]
          }
        },
        {
          "not": {
            "required": [
              "implementation"
            ]
          }
        },
        {
          "not": {
            "required": [
              "finalVerification"
            ]
          }
        },
        {
          "not": {
            "required": [
              "releaseHandoff"
            ]
          }
        }
      ]
    },
    {
      "required": [
        "implementationOptionSelection"
      ],
      "allOf": [
        {"not": {"required": ["requirementsDiscovery"]}},
        {"not": {"required": ["improvementDiscovery"]}},
        {"not": {"required": ["errorAnalysis"]}},
        {"not": {"required": ["projectAnalysis"]}},
        {"not": {"required": ["featureAnalysis"]}},
        {"not": {"required": ["changeImpactAnalysis"]}},
        {"not": {"required": ["implementationPlanning"]}},
        {"not": {"required": ["implementation"]}},
        {"not": {"required": ["finalVerification"]}},
        {"not": {"required": ["releaseHandoff"]}}
      ]
    },
    {
      "required": [
        "implementationPlanning"
      ],
      "allOf": [
        {
          "not": {
            "required": [
              "requirementsDiscovery"
            ]
          }
        },
        {
          "not": {
            "required": [
              "improvementDiscovery"
            ]
          }
        },
        {
          "not": {
            "required": [
              "errorAnalysis"
            ]
          }
        },
        {
          "not": {
            "required": [
              "projectAnalysis"
            ]
          }
        },
        {
          "not": {
            "required": [
              "featureAnalysis"
            ]
          }
        },
        {
          "not": {
            "required": [
              "changeImpactAnalysis"
            ]
          }
        },
        {
          "not": {
            "required": [
              "implementation"
            ]
          }
        },
        {
          "not": {
            "required": [
              "finalVerification"
            ]
          }
        },
        {
          "not": {
            "required": [
              "releaseHandoff"
            ]
          }
        }
      ]
    },
    {
      "required": [
        "implementation"
      ],
      "allOf": [
        {
          "not": {
            "required": [
              "requirementsDiscovery"
            ]
          }
        },
        {
          "not": {
            "required": [
              "improvementDiscovery"
            ]
          }
        },
        {
          "not": {
            "required": [
              "errorAnalysis"
            ]
          }
        },
        {
          "not": {
            "required": [
              "projectAnalysis"
            ]
          }
        },
        {
          "not": {
            "required": [
              "featureAnalysis"
            ]
          }
        },
        {
          "not": {
            "required": [
              "changeImpactAnalysis"
            ]
          }
        },
        {
          "not": {
            "required": [
              "implementationPlanning"
            ]
          }
        },
        {
          "not": {
            "required": [
              "finalVerification"
            ]
          }
        },
        {
          "not": {
            "required": [
              "releaseHandoff"
            ]
          }
        }
      ]
    },
    {
      "required": [
        "finalVerification"
      ],
      "allOf": [
        {
          "not": {
            "required": [
              "requirementsDiscovery"
            ]
          }
        },
        {
          "not": {
            "required": [
              "improvementDiscovery"
            ]
          }
        },
        {
          "not": {
            "required": [
              "errorAnalysis"
            ]
          }
        },
        {
          "not": {
            "required": [
              "projectAnalysis"
            ]
          }
        },
        {
          "not": {
            "required": [
              "featureAnalysis"
            ]
          }
        },
        {
          "not": {
            "required": [
              "changeImpactAnalysis"
            ]
          }
        },
        {
          "not": {
            "required": [
              "implementationPlanning"
            ]
          }
        },
        {
          "not": {
            "required": [
              "implementation"
            ]
          }
        },
        {
          "not": {
            "required": [
              "releaseHandoff"
            ]
          }
        }
      ]
    },
    {
      "required": [
        "releaseHandoff"
      ],
      "allOf": [
        {
          "not": {
            "required": [
              "requirementsDiscovery"
            ]
          }
        },
        {
          "not": {
            "required": [
              "improvementDiscovery"
            ]
          }
        },
        {
          "not": {
            "required": [
              "errorAnalysis"
            ]
          }
        },
        {
          "not": {
            "required": [
              "projectAnalysis"
            ]
          }
        },
        {
          "not": {
            "required": [
              "featureAnalysis"
            ]
          }
        },
        {
          "not": {
            "required": [
              "changeImpactAnalysis"
            ]
          }
        },
        {
          "not": {
            "required": [
              "implementationPlanning"
            ]
          }
        },
        {
          "not": {
            "required": [
              "implementation"
            ]
          }
        },
        {
          "not": {
            "required": [
              "finalVerification"
            ]
          }
        }
      ]
    }
  ],
  "$defs": {
    "ActivityCommand": {
      "type": "object",
      "required": [
        "command",
        "cwd",
        "exitCode",
        "outputSummary"
      ],
      "additionalProperties": false,
      "properties": {
        "command": {
          "type": "string"
        },
        "cwd": {
          "type": "string"
        },
        "exitCode": {
          "type": "integer"
        },
        "outputSummary": {
          "type": "string"
        }
      }
    },
    "AgentActivityRow": {
      "type": "object",
      "required": [
        "activityId",
        "kind",
        "agent",
        "summary",
        "planItemIds",
        "resultPath",
        "commands",
        "evidenceRefs",
        "outcome"
      ],
      "additionalProperties": false,
      "properties": {
        "activityId": {
          "type": "string",
          "pattern": "^A-\\d{3,}$"
        },
        "kind": {
          "type": "string",
          "enum": [
            "worker-dispatched",
            "worker-completed",
            "verification-round-completed",
            "self-fix-applied",
            "user-decision-required",
            "user-decision-evaluated"
          ]
        },
        "agent": {
          "type": "string",
          "minLength": 1
        },
        "summary": {
          "type": "string",
          "minLength": 1
        },
        "planItemIds": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "clarificationRefs": {
          "type": "array",
          "uniqueItems": true,
          "items": {
            "type": "string",
            "pattern": "^C-\\d{3,}$"
          }
        },
        "resultPath": {
          "type": "string"
        },
        "commands": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ActivityCommand"
          }
        },
        "evidenceRefs": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "outcome": {
          "type": "string",
          "enum": [
            "pending",
            "completed",
            "failed",
            "blocked",
            "resolved"
          ]
        }
      }
    },
    "ImplementationOptionSelection": {
      "type": "object",
      "description": "Read-only comparison or validation of implementation directions before detailed planning.",
      "required": [
        "mode",
        "decisionContext",
        "evaluationCriteria",
        "candidateAudit",
        "rankedOptions",
        "recommendedOptionId",
        "preselectedDirection",
        "routing",
        "userNarrative"
      ],
      "additionalProperties": false,
      "properties": {
        "mode": {
          "enum": [
            "candidate-comparison",
            "preselected-validation"
          ]
        },
        "decisionContext": {
          "$ref": "#/$defs/ImplementationOptionDecisionContext"
        },
        "evaluationCriteria": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ImplementationOptionEvaluationCriterion"
          }
        },
        "candidateAudit": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ImplementationOptionCandidateAudit"
          }
        },
        "rankedOptions": {
          "type": "array",
          "maxItems": 3,
          "items": {
            "$ref": "#/$defs/ImplementationRankedOption"
          }
        },
        "recommendedOptionId": {
          "type": [
            "string",
            "null"
          ],
          "pattern": "^IO-[0-9]{3}$"
        },
        "preselectedDirection": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/ImplementationOptionPreselectedDirection"
            }
          ]
        },
        "routing": {
          "enum": [
            "pending-direction-selection",
            "implementation-planning",
            "blocked"
          ]
        },
        "userNarrative": {
          "$ref": "#/$defs/ImplementationOptionSelectionUserNarrative"
        }
      }
    },
    "ImplementationOptionDecisionContext": {
      "type": "object",
      "required": [
        "originalRequirementIds",
        "leadingCauseRefs",
        "upstreamDecisionRefs"
      ],
      "additionalProperties": false,
      "properties": {
        "originalRequirementIds": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": {
            "type": "string",
            "pattern": "^(EB|PB|EO)-[0-9]{3}$"
          }
        },
        "leadingCauseRefs": {
          "type": "array",
          "uniqueItems": true,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "upstreamDecisionRefs": {
          "type": "array",
          "uniqueItems": true,
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      }
    },
    "ImplementationOptionEvaluationCriterion": {
      "type": "object",
      "required": [
        "criterion",
        "weight",
        "rationale"
      ],
      "additionalProperties": false,
      "properties": {
        "criterion": {
          "$ref": "#/$defs/ImplementationOptionCriterion"
        },
        "weight": {
          "type": "integer",
          "minimum": 1,
          "maximum": 5
        },
        "rationale": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "ImplementationOptionCandidateAudit": {
      "type": "object",
      "required": [
        "id",
        "name",
        "proposedBy",
        "goal",
        "coreMechanism",
        "architectureBoundaries",
        "expectedChangeAreas",
        "disposition",
        "mergedInto",
        "reason",
        "evidence",
        "requirementCoverage",
        "scopeCommitments",
        "coverageSummary",
        "criterionScores",
        "weightedScore",
        "feasibilityVotes",
        "safetyBlockers",
        "unresolvedFeasibilityFacts"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "$ref": "#/$defs/ImplementationOptionId"
        },
        "name": {
          "type": "string",
          "minLength": 1
        },
        "proposedBy": {
          "type": "string",
          "minLength": 1
        },
        "goal": {
          "type": "string",
          "minLength": 1
        },
        "coreMechanism": {
          "type": "string",
          "minLength": 1
        },
        "architectureBoundaries": {
          "$ref": "#/$defs/ImplementationOptionNonEmptyStrings"
        },
        "expectedChangeAreas": {
          "$ref": "#/$defs/ImplementationOptionNonEmptyStrings"
        },
        "disposition": {
          "enum": [
            "merged",
            "rejected"
          ]
        },
        "mergedInto": {
          "type": [
            "string",
            "null"
          ],
          "pattern": "^IO-[0-9]{3}$"
        },
        "reason": {
          "type": "string",
          "minLength": 1
        },
        "evidence": {
          "$ref": "#/$defs/ImplementationOptionEvidenceRefs"
        },
        "requirementCoverage": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/ImplementationOptionRequirementCoverage"
          }
        },
        "scopeCommitments": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/ImplementationOptionScopeCommitment"
          }
        },
        "coverageSummary": {
          "$ref": "#/$defs/ImplementationOptionCoverageSummary"
        },
        "criterionScores": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/ImplementationOptionCriterionScore"
          }
        },
        "weightedScore": {
          "type": "number",
          "minimum": 1,
          "maximum": 5
        },
        "feasibilityVotes": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/ImplementationOptionFeasibilityVote"
          }
        },
        "safetyBlockers": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ImplementationOptionSafetyBlocker"
          }
        },
        "unresolvedFeasibilityFacts": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ImplementationOptionUnresolvedFact"
          }
        }
      }
    },
    "ImplementationRankedOption": {
      "type": "object",
      "required": [
        "id",
        "name",
        "proposedBy",
        "goal",
        "coreMechanism",
        "architectureBoundaries",
        "expectedChangeAreas",
        "codeEvidence",
        "requirementCoverage",
        "scopeCommitments",
        "coverageSummary",
        "criterionScores",
        "weightedScore",
        "feasibilityVotes",
        "safetyBlockers",
        "unresolvedFeasibilityFacts",
        "planningInvariants"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "$ref": "#/$defs/ImplementationOptionId"
        },
        "name": {
          "type": "string",
          "minLength": 1,
          "pattern": "^(?![\\s\\S]*[\\r\\n])(?=[\\s\\S]*[^\\u0009\\u000a\\u000b\\u000c\\u000d\\u001c\\u001d\\u001e\\u001f\\u0020\\u0085\\u00a0\\u1680\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff])[\\s\\S]+$"
        },
        "proposedBy": {
          "type": "string",
          "minLength": 1
        },
        "goal": {
          "type": "string",
          "minLength": 1
        },
        "coreMechanism": {
          "type": "string",
          "minLength": 1
        },
        "architectureBoundaries": {
          "$ref": "#/$defs/ImplementationOptionNonEmptyStrings"
        },
        "expectedChangeAreas": {
          "$ref": "#/$defs/ImplementationOptionNonEmptyStrings"
        },
        "codeEvidence": {
          "$ref": "#/$defs/ImplementationOptionEvidenceRefs"
        },
        "requirementCoverage": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/ImplementationOptionRequirementCoverage"
          }
        },
        "scopeCommitments": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/ImplementationOptionScopeCommitment"
          }
        },
        "coverageSummary": {
          "$ref": "#/$defs/ImplementationOptionExactCoverageSummary"
        },
        "criterionScores": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/ImplementationOptionCriterionScore"
          }
        },
        "weightedScore": {
          "type": "number",
          "minimum": 1,
          "maximum": 5
        },
        "feasibilityVotes": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/ImplementationOptionFeasibilityVote"
          }
        },
        "safetyBlockers": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ImplementationOptionSafetyBlocker"
          }
        },
        "unresolvedFeasibilityFacts": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ImplementationOptionUnresolvedFact"
          }
        },
        "planningInvariants": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ImplementationOptionPlanningInvariant"
          }
        }
      }
    },
    "ImplementationOptionRequirementCoverage": {
      "type": "object",
      "required": [
        "requirementId",
        "satisfaction",
        "evidence",
        "expectedVerification",
        "status"
      ],
      "additionalProperties": false,
      "properties": {
        "requirementId": {
          "type": "string",
          "pattern": "^(EB|PB|EO)-[0-9]{3}$"
        },
        "satisfaction": {
          "type": "string",
          "minLength": 1
        },
        "evidence": {
          "$ref": "#/$defs/ImplementationOptionEvidenceRefs"
        },
        "expectedVerification": {
          "type": "string",
          "minLength": 1
        },
        "status": {
          "enum": [
            "covered",
            "not-covered",
            "contradicted"
          ]
        }
      }
    },
    "ImplementationOptionScopeCommitment": {
      "type": "object",
      "required": [
        "id",
        "commitment",
        "kind",
        "requirementIds",
        "evidence"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^IC-[0-9]{3}$"
        },
        "commitment": {
          "type": "string",
          "minLength": 1
        },
        "kind": {
          "enum": [
            "user-behavior",
            "code-change",
            "migration",
            "operational-change",
            "preserved-behavior",
            "derived-work"
          ]
        },
        "requirementIds": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": {
            "type": "string",
            "pattern": "^(EB|PB|EO)-[0-9]{3}$"
          }
        },
        "evidence": {
          "$ref": "#/$defs/ImplementationOptionEvidenceRefs"
        }
      }
    },
    "ImplementationOptionCoverageSummary": {
      "type": "object",
      "required": [
        "coveragePercent",
        "scopePrecisionPercent",
        "coveredCount",
        "totalCount",
        "unmappedCommitments",
        "contradictedRequirements",
        "coverageVerdict"
      ],
      "additionalProperties": false,
      "properties": {
        "coveragePercent": {
          "type": "number",
          "minimum": 0,
          "maximum": 100
        },
        "scopePrecisionPercent": {
          "type": "number",
          "minimum": 0,
          "maximum": 100
        },
        "coveredCount": {
          "type": "integer",
          "minimum": 0
        },
        "totalCount": {
          "type": "integer",
          "minimum": 1
        },
        "unmappedCommitments": {
          "type": "array",
          "uniqueItems": true,
          "items": {
            "type": "string",
            "pattern": "^IC-[0-9]{3}$"
          }
        },
        "contradictedRequirements": {
          "type": "array",
          "uniqueItems": true,
          "items": {
            "type": "string",
            "pattern": "^(EB|PB|EO)-[0-9]{3}$"
          }
        },
        "coverageVerdict": {
          "enum": [
            "exact",
            "under",
            "over",
            "contradicted"
          ]
        }
      }
    },
    "ImplementationOptionExactCoverageSummary": {
      "type": "object",
      "required": [
        "coveragePercent",
        "scopePrecisionPercent",
        "coveredCount",
        "totalCount",
        "unmappedCommitments",
        "contradictedRequirements",
        "coverageVerdict"
      ],
      "additionalProperties": false,
      "properties": {
        "coveragePercent": {
          "const": 100
        },
        "scopePrecisionPercent": {
          "const": 100
        },
        "coveredCount": {
          "type": "integer",
          "minimum": 1
        },
        "totalCount": {
          "type": "integer",
          "minimum": 1
        },
        "unmappedCommitments": {
          "type": "array",
          "maxItems": 0
        },
        "contradictedRequirements": {
          "type": "array",
          "maxItems": 0
        },
        "coverageVerdict": {
          "const": "exact"
        }
      }
    },
    "ImplementationOptionCriterionScore": {
      "type": "object",
      "required": [
        "criterion",
        "score",
        "rationale"
      ],
      "additionalProperties": false,
      "properties": {
        "criterion": {
          "$ref": "#/$defs/ImplementationOptionCriterion"
        },
        "score": {
          "type": "integer",
          "minimum": 1,
          "maximum": 5
        },
        "rationale": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "ImplementationOptionFeasibilityVote": {
      "type": "object",
      "required": [
        "worker",
        "verdict",
        "rationale",
        "counterevidence",
        "evidence"
      ],
      "additionalProperties": false,
      "properties": {
        "worker": {
          "type": "string",
          "minLength": 1
        },
        "verdict": {
          "enum": [
            "feasible",
            "not-feasible",
            "uncertain"
          ]
        },
        "rationale": {
          "type": "string",
          "minLength": 1
        },
        "counterevidence": {
          "type": "string",
          "minLength": 1
        },
        "evidence": {
          "$ref": "#/$defs/ImplementationOptionEvidenceRefs"
        }
      }
    },
    "ImplementationOptionSafetyBlocker": {
      "type": "object",
      "required": [
        "category",
        "statement",
        "evidence"
      ],
      "additionalProperties": false,
      "properties": {
        "category": {
          "enum": [
            "data-loss",
            "security-violation",
            "irreversible-migration"
          ]
        },
        "statement": {
          "type": "string",
          "minLength": 1
        },
        "evidence": {
          "$ref": "#/$defs/ImplementationOptionEvidenceRefs"
        }
      }
    },
    "ImplementationOptionUnresolvedFact": {
      "type": "object",
      "required": [
        "fact",
        "whyItMatters",
        "evidence"
      ],
      "additionalProperties": false,
      "properties": {
        "fact": {
          "type": "string",
          "minLength": 1
        },
        "whyItMatters": {
          "type": "string",
          "minLength": 1
        },
        "evidence": {
          "$ref": "#/$defs/ImplementationOptionEvidenceRefs"
        }
      }
    },
    "ImplementationOptionPlanningInvariant": {
      "type": "object",
      "required": [
        "id",
        "statement",
        "requirementIds",
        "evidence"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^PI-[0-9]{3}$"
        },
        "statement": {
          "type": "string",
          "minLength": 1
        },
        "requirementIds": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": {
            "type": "string",
            "pattern": "^(EB|PB|EO)-[0-9]{3}$"
          }
        },
        "evidence": {
          "$ref": "#/$defs/ImplementationOptionEvidenceRefs"
        }
      }
    },
    "ImplementationOptionPreselectedDirection": {
      "type": "object",
      "required": [
        "optionId",
        "direction",
        "confirmationEvidence",
        "citation"
      ],
      "additionalProperties": false,
      "properties": {
        "optionId": {
          "$ref": "#/$defs/ImplementationOptionId"
        },
        "direction": {
          "type": "string",
          "minLength": 1
        },
        "confirmationEvidence": {
          "type": "string",
          "minLength": 1
        },
        "citation": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "ImplementationOptionSelectionUserNarrative": {
      "type": "object",
      "required": [
        "comparisonOverview",
        "rankingExplanation",
        "selectionGuidance"
      ],
      "additionalProperties": false,
      "properties": {
        "comparisonOverview": {
          "$ref": "#/$defs/HumanNarrative"
        },
        "rankingExplanation": {
          "$ref": "#/$defs/HumanNarrative"
        },
        "selectionGuidance": {
          "$ref": "#/$defs/HumanNarrative"
        }
      }
    },
    "ImplementationOptionId": {
      "type": "string",
      "pattern": "^IO-[0-9]{3}$"
    },
    "ImplementationOptionCriterion": {
      "enum": [
        "requirement-fit",
        "architecture-fit",
        "change-locality",
        "implementation-complexity",
        "correctness-risk",
        "reversibility",
        "verification-cost",
        "rollout-cost"
      ]
    },
    "ImplementationOptionEvidenceRefs": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "string",
        "minLength": 1
      }
    },
    "ImplementationOptionNonEmptyStrings": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "string",
        "minLength": 1
      }
    },
    "SelectedDirectionRef": {
      "type": "object",
      "required": [
        "sourceReport",
        "sourceDataSha256",
        "optionId",
        "snapshotPath",
        "snapshotSha256"
      ],
      "additionalProperties": false,
      "properties": {
        "sourceReport": {
          "type": "string",
          "minLength": 1
        },
        "sourceDataSha256": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        },
        "optionId": {
          "$ref": "#/$defs/ImplementationOptionId"
        },
        "snapshotPath": {
          "type": "string",
          "minLength": 1
        },
        "snapshotSha256": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        }
      }
    },
    "DirectionRealization": {
      "type": "object",
      "required": [
        "goal",
        "coreMechanism",
        "architectureBoundaries",
        "expectedChangeAreas",
        "fileStructure",
        "interfaces",
        "blastRadius",
        "testSeams",
        "assumptions",
        "planningInvariants",
        "userConstraints"
      ],
      "additionalProperties": false,
      "properties": {
        "goal": {
          "type": "string",
          "minLength": 1
        },
        "coreMechanism": {
          "type": "string",
          "minLength": 1
        },
        "architectureBoundaries": {
          "$ref": "#/$defs/ImplementationOptionNonEmptyStrings"
        },
        "expectedChangeAreas": {
          "$ref": "#/$defs/ImplementationOptionNonEmptyStrings"
        },
        "fileStructure": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/SelectedDirectionFileChange"
          }
        },
        "interfaces": {
          "type": "string",
          "minLength": 1
        },
        "blastRadius": {
          "type": "string",
          "minLength": 1
        },
        "testSeams": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/SelectedDirectionTestSeam"
          }
        },
        "assumptions": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "planningInvariants": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ImplementationOptionPlanningInvariant"
          }
        },
        "userConstraints": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      }
    },
    "SelectedDirectionFileChange": {
      "type": "object",
      "required": [
        "id",
        "ticketId",
        "action",
        "path",
        "summary"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^OF-\\d{3,}$"
        },
        "ticketId": {
          "$ref": "#/$defs/TicketId"
        },
        "action": {
          "enum": [
            "Create",
            "Modify",
            "Delete"
          ]
        },
        "path": {
          "type": "string",
          "minLength": 1
        },
        "summary": {
          "type": "string",
          "minLength": 1,
          "maxLength": 120
        },
        "details": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "SelectedDirectionTestSeam": {
      "type": "object",
      "required": [
        "boundary",
        "injectedAs",
        "replacedInTest"
      ],
      "additionalProperties": false,
      "properties": {
        "boundary": {
          "type": "string",
          "minLength": 1
        },
        "injectedAs": {
          "type": "string",
          "minLength": 1
        },
        "replacedInTest": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "SelectedDirectionRequirementCoverage": {
      "type": "object",
      "required": [
        "originalRequirementId",
        "stageRefs",
        "stepRefs",
        "validationRefs",
        "fileRefs",
        "status"
      ],
      "additionalProperties": false,
      "properties": {
        "originalRequirementId": {
          "type": "string",
          "pattern": "^(EB|PB|EO)-[0-9]{3}$"
        },
        "stageRefs": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": {
            "type": "integer",
            "minimum": 1
          }
        },
        "stepRefs": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "validationRefs": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "fileRefs": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "status": {
          "enum": [
            "covered",
            "not-covered"
          ]
        }
      }
    },
    "SelectedDirectionCoverageSummary": {
      "type": "object",
      "required": [
        "coveragePercent",
        "scopePrecisionPercent",
        "coverageVerdict",
        "unmappedStages",
        "unmappedFileChanges"
      ],
      "additionalProperties": false,
      "properties": {
        "coveragePercent": {
          "const": 100
        },
        "scopePrecisionPercent": {
          "const": 100
        },
        "coverageVerdict": {
          "const": "exact"
        },
        "unmappedStages": {
          "type": "array",
          "maxItems": 0,
          "items": {
            "type": "integer",
            "minimum": 1
          }
        },
        "unmappedFileChanges": {
          "type": "array",
          "maxItems": 0,
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      }
    },
    "DirectionInvalidation": {
      "type": "object",
      "required": [
        "reasons",
        "codeEvidence"
      ],
      "additionalProperties": false,
      "properties": {
        "reasons": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "codeEvidence": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      }
    },
    "TaskType": {
      "enum": [
        "requirements-discovery",
        "improvement-discovery",
        "error-analysis",
        "project-analysis",
        "feature-analysis",
        "change-impact-analysis",
        "implementation-option-selection",
        "implementation-planning",
        "implementation",
        "final-verification",
        "release-handoff"
      ]
    },
    "HumanSummary": {
      "type": "object",
      "required": [
        "headline",
        "outcome",
        "whyItMatters",
        "decisions",
        "actions",
        "blockers"
      ],
      "additionalProperties": false,
      "properties": {
        "headline": {
          "type": "string",
          "minLength": 1
        },
        "outcome": {
          "type": "string",
          "minLength": 1
        },
        "whyItMatters": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "decisions": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "actions": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "blockers": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      }
    },
    "HumanNarrative": {
      "type": "object",
      "required": [
        "text",
        "evidenceRefs"
      ],
      "additionalProperties": false,
      "properties": {
        "text": {
          "type": "string",
          "minLength": 1
        },
        "evidenceRefs": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      }
    },
    "ProjectUserNarrative": {
      "type": "object",
      "required": [
        "projectOverview",
        "architectureExplanation",
        "hotspotExplanation",
        "qualityExplanation"
      ],
      "additionalProperties": false,
      "properties": {
        "projectOverview": {
          "$ref": "#/$defs/HumanNarrative"
        },
        "architectureExplanation": {
          "$ref": "#/$defs/HumanNarrative"
        },
        "hotspotExplanation": {
          "$ref": "#/$defs/HumanNarrative"
        },
        "qualityExplanation": {
          "$ref": "#/$defs/HumanNarrative"
        }
      }
    },
    "RequirementsUserNarrative": {
      "type": "object",
      "required": [
        "requestUnderstanding",
        "confirmedRequirements",
        "unresolvedRequirements",
        "routingExplanation"
      ],
      "additionalProperties": false,
      "properties": {
        "requestUnderstanding": {
          "$ref": "#/$defs/HumanNarrative"
        },
        "confirmedRequirements": {
          "$ref": "#/$defs/HumanNarrative"
        },
        "unresolvedRequirements": {
          "$ref": "#/$defs/HumanNarrative"
        },
        "routingExplanation": {
          "$ref": "#/$defs/HumanNarrative"
        }
      }
    },
    "ImprovementUserNarrative": {
      "type": "object",
      "required": [
        "opportunityOverview",
        "prioritizationExplanation",
        "selectionGuidance"
      ],
      "additionalProperties": false,
      "properties": {
        "opportunityOverview": {
          "$ref": "#/$defs/HumanNarrative"
        },
        "prioritizationExplanation": {
          "$ref": "#/$defs/HumanNarrative"
        },
        "selectionGuidance": {
          "$ref": "#/$defs/HumanNarrative"
        }
      }
    },
    "ErrorUserNarrative": {
      "type": "object",
      "required": [
        "symptomExplanation",
        "causeExplanation",
        "uncertaintyExplanation",
        "diagnosticGuidance"
      ],
      "additionalProperties": false,
      "properties": {
        "symptomExplanation": {
          "$ref": "#/$defs/HumanNarrative"
        },
        "causeExplanation": {
          "$ref": "#/$defs/HumanNarrative"
        },
        "uncertaintyExplanation": {
          "$ref": "#/$defs/HumanNarrative"
        },
        "diagnosticGuidance": {
          "$ref": "#/$defs/HumanNarrative"
        }
      }
    },
    "FeatureUserNarrative": {
      "type": "object",
      "required": [
        "userBehaviorExplanation",
        "flowExplanation",
        "rulesAndStateExplanation",
        "testGapExplanation"
      ],
      "additionalProperties": false,
      "properties": {
        "userBehaviorExplanation": {
          "$ref": "#/$defs/HumanNarrative"
        },
        "flowExplanation": {
          "$ref": "#/$defs/HumanNarrative"
        },
        "rulesAndStateExplanation": {
          "$ref": "#/$defs/HumanNarrative"
        },
        "testGapExplanation": {
          "$ref": "#/$defs/HumanNarrative"
        }
      }
    },
    "ChangeImpactUserNarrative": {
      "type": "object",
      "required": [
        "changeExplanation",
        "impactExplanation",
        "unaffectedExplanation",
        "planningReadiness"
      ],
      "additionalProperties": false,
      "properties": {
        "changeExplanation": {
          "$ref": "#/$defs/HumanNarrative"
        },
        "impactExplanation": {
          "$ref": "#/$defs/HumanNarrative"
        },
        "unaffectedExplanation": {
          "$ref": "#/$defs/HumanNarrative"
        },
        "planningReadiness": {
          "$ref": "#/$defs/HumanNarrative"
        }
      }
    },
    "PlanningUserNarrative": {
      "type": "object",
      "required": [
        "optionExplanation",
        "recommendationExplanation",
        "stageStrategy",
        "validationAndRollback"
      ],
      "additionalProperties": false,
      "properties": {
        "optionExplanation": {
          "$ref": "#/$defs/HumanNarrative"
        },
        "recommendationExplanation": {
          "$ref": "#/$defs/HumanNarrative"
        },
        "stageStrategy": {
          "$ref": "#/$defs/HumanNarrative"
        },
        "validationAndRollback": {
          "$ref": "#/$defs/HumanNarrative"
        }
      }
    },
    "ImplementationUserNarrative": {
      "type": "object",
      "required": [
        "deliveredOutcome",
        "changeExplanation",
        "validationExplanation",
        "remainingIssues"
      ],
      "additionalProperties": false,
      "properties": {
        "deliveredOutcome": {
          "$ref": "#/$defs/HumanNarrative"
        },
        "changeExplanation": {
          "$ref": "#/$defs/HumanNarrative"
        },
        "validationExplanation": {
          "$ref": "#/$defs/HumanNarrative"
        },
        "remainingIssues": {
          "$ref": "#/$defs/HumanNarrative"
        }
      }
    },
    "FinalVerificationUserNarrative": {
      "type": "object",
      "required": [
        "verdictExplanation",
        "coverageExplanation",
        "blockerExplanation",
        "releaseReadiness"
      ],
      "additionalProperties": false,
      "properties": {
        "verdictExplanation": {
          "$ref": "#/$defs/HumanNarrative"
        },
        "coverageExplanation": {
          "$ref": "#/$defs/HumanNarrative"
        },
        "blockerExplanation": {
          "$ref": "#/$defs/HumanNarrative"
        },
        "releaseReadiness": {
          "$ref": "#/$defs/HumanNarrative"
        }
      }
    },
    "ReleaseHandoffUserNarrative": {
      "type": "object",
      "required": [
        "handoffOutcome",
        "branchAndPrExplanation",
        "conflictExplanation",
        "nextAction"
      ],
      "additionalProperties": false,
      "properties": {
        "handoffOutcome": {
          "$ref": "#/$defs/HumanNarrative"
        },
        "branchAndPrExplanation": {
          "$ref": "#/$defs/HumanNarrative"
        },
        "conflictExplanation": {
          "$ref": "#/$defs/HumanNarrative"
        },
        "nextAction": {
          "$ref": "#/$defs/HumanNarrative"
        }
      }
    },
    "RequirementDiscoveryRow": {
      "type": "object",
      "required": [
        "id",
        "statement",
        "evidenceRefs"
      ],
      "additionalProperties": true,
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "statement": {
          "type": "string",
          "minLength": 1
        },
        "evidenceRefs": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      }
    },
    "RequirementsRejectionCriteria": {
      "type": "object",
      "required": [
        "source",
        "statement"
      ],
      "additionalProperties": false,
      "description": "The delivered outcome that would make this work wrong — the reporter's own line, never inferred. It decides classification and routing: work that must not change existing behaviour routes differently from work that may. `source` says where the line came from, because a line the reporter wrote and a line raised as a question carry different authority. 'absent-not-material' is the one case with no statement to quote: the criteria were missing and would not have changed the routing.",
      "properties": {
        "source": {
          "enum": [
            "brief-desired-outcome",
            "brief-out-of-scope",
            "brief-source-material",
            "clarification-raised",
            "absent-not-material"
          ]
        },
        "statement": {
          "type": "string"
        },
        "clarificationId": {
          "type": "string",
          "pattern": "^C-\\d+$"
        },
        "evidenceRefs": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      }
    },
    "RequirementsDomainAlignment": {
      "type": "object",
      "required": [
        "glossaryConsulted",
        "decisionsConsulted",
        "terms"
      ],
      "additionalProperties": false,
      "description": "The terminology this phase settled before routing. A term that means two things in the brief means two things in every later phase, so each one resolves to a single canonical form here, with the source that decided it.",
      "properties": {
        "glossaryConsulted": {
          "type": "boolean"
        },
        "decisionsConsulted": {
          "type": "boolean"
        },
        "terms": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "raw",
              "canonical",
              "resolvedBy"
            ],
            "additionalProperties": false,
            "properties": {
              "raw": {
                "type": "string",
                "minLength": 1
              },
              "canonical": {
                "type": "string",
                "minLength": 1
              },
              "resolvedBy": {
                "enum": [
                  "glossary",
                  "decision-record",
                  "brief",
                  "clarification"
                ]
              },
              "evidenceRefs": {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1
                }
              }
            }
          }
        }
      }
    },
    "RequirementsDiscovery": {
      "type": "object",
      "required": [
        "requestVerbatim",
        "systemInterpretation",
        "classification",
        "confirmedRequirements",
        "unresolvedRequirements",
        "routing",
        "taskDependencies",
        "userNarrative"
      ],
      "additionalProperties": false,
      "properties": {
        "requestVerbatim": {
          "type": "string",
          "minLength": 1
        },
        "systemInterpretation": {
          "type": "string",
          "minLength": 1
        },
        "rejectionCriteria": {
          "$ref": "#/$defs/RequirementsRejectionCriteria"
        },
        "domainAlignment": {
          "$ref": "#/$defs/RequirementsDomainAlignment"
        },
        "classification": {
          "type": "object",
          "required": [
            "requestKind",
            "scope",
            "complexity"
          ],
          "additionalProperties": false,
          "properties": {
            "requestKind": {
              "type": "string",
              "minLength": 1
            },
            "scope": {
              "type": "string",
              "minLength": 1
            },
            "complexity": {
              "type": "string",
              "minLength": 1
            }
          }
        },
        "confirmedRequirements": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/RequirementDiscoveryRow"
          }
        },
        "unresolvedRequirements": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/RequirementDiscoveryRow"
          }
        },
        "routing": {
          "type": "object",
          "required": [
            "nextTaskType",
            "readyWhen",
            "rationale"
          ],
          "additionalProperties": false,
          "properties": {
            "nextTaskType": {
              "enum": [
                "error-analysis",
                "implementation-option-selection"
              ]
            },
            "readyWhen": {
              "type": "string",
              "minLength": 1
            },
            "rationale": {
              "type": "string",
              "minLength": 1
            }
          }
        },
        "taskDependencies": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "fromTaskKey",
              "toTaskKey",
              "relation",
              "evidenceRefs"
            ],
            "additionalProperties": false,
            "properties": {
              "fromTaskKey": {
                "type": "string",
                "minLength": 1
              },
              "toTaskKey": {
                "type": "string",
                "minLength": 1
              },
              "relation": {
                "type": "string",
                "minLength": 1
              },
              "evidenceRefs": {
                "type": "array",
                "minItems": 1,
                "items": {
                  "type": "string",
                  "minLength": 1
                }
              }
            }
          }
        },
        "userNarrative": {
          "$ref": "#/$defs/RequirementsUserNarrative"
        }
      }
    },
    "ImprovementCandidate": {
      "type": "object",
      "required": [
        "id",
        "lens",
        "title",
        "scope",
        "severity",
        "effort",
        "consensus",
        "sourceWorkers",
        "recommendedNextPhase",
        "expectedBehaviorAfter",
        "evidence"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^I-[0-9]{3}$"
        },
        "lens": {
          "type": "array",
          "minItems": 1,
          "maxItems": 2,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "title": {
          "type": "string",
          "minLength": 1
        },
        "scope": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "severity": {
          "enum": [
            "high",
            "medium",
            "low"
          ]
        },
        "effort": {
          "enum": [
            "S",
            "M",
            "L",
            "XL"
          ]
        },
        "consensus": {
          "enum": [
            "full",
            "partial",
            "contested",
            "worker-unique"
          ]
        },
        "sourceWorkers": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "recommendedNextPhase": {
          "enum": [
            "requirements-discovery",
            "implementation-option-selection",
            "error-analysis"
          ]
        },
        "expectedBehaviorAfter": {
          "type": "string",
          "minLength": 1
        },
        "evidence": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      }
    },
    "ImprovementDiscovery": {
      "type": "object",
      "required": [
        "candidates",
        "lensCoverage",
        "selectionLimit",
        "userNarrative"
      ],
      "additionalProperties": false,
      "properties": {
        "candidates": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ImprovementCandidate"
          }
        },
        "lensCoverage": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "required": [
              "lens",
              "status",
              "rationale",
              "evidence"
            ],
            "additionalProperties": false,
            "properties": {
              "lens": {
                "type": "string",
                "minLength": 1
              },
              "status": {
                "enum": [
                  "candidate-found",
                  "no-candidate"
                ]
              },
              "rationale": {
                "type": "string",
                "minLength": 1
              },
              "evidence": {
                "type": "array",
                "minItems": 1,
                "items": {
                  "type": "string",
                  "minLength": 1
                }
              }
            }
          }
        },
        "selectionLimit": {
          "type": "integer",
          "minimum": 1
        },
        "userNarrative": {
          "$ref": "#/$defs/ImprovementUserNarrative"
        }
      }
    },
    "VerdictToken": {
      "enum": [
        "accepted",
        "conditional-accept",
        "analysis-complete",
        "analysis-partial",
        "blocked",
        "not-applicable"
      ]
    },
    "Direction": {
      "enum": [
        "continue-investigation",
        "begin-option-selection",
        "begin-planning",
        "begin-implementation",
        "approve",
        "reject",
        "hold"
      ]
    },
    "ErrorAnalysis": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "symptomVerbatim",
        "observableFailure",
        "reproduction",
        "causeCandidates",
        "nextDiagnostic",
        "routing",
        "userNarrative"
      ],
      "properties": {
        "symptomVerbatim": {
          "type": "string"
        },
        "userNarrative": {
          "$ref": "#/$defs/ErrorUserNarrative"
        },
        "observableFailure": {
          "type": "string"
        },
        "reproduction": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "status",
            "evidence",
            "blockedReason"
          ],
          "properties": {
            "status": {
              "enum": [
                "reproduced",
                "not-reproduced",
                "blocked-before-repro"
              ]
            },
            "evidence": {
              "type": "array",
              "minItems": 1,
              "items": {
                "type": "string"
              }
            },
            "blockedReason": {
              "type": "string"
            }
          }
        },
        "causeCandidates": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "id",
              "statement",
              "supportingEvidence",
              "falsifyingEvidenceChecked",
              "confidence",
              "disproveWith"
            ],
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^EA-\\d{3,}$"
              },
              "statement": {
                "type": "string"
              },
              "supportingEvidence": {
                "type": "array",
                "minItems": 1,
                "items": {
                  "type": "string"
                }
              },
              "falsifyingEvidenceChecked": {
                "type": "array",
                "minItems": 1,
                "items": {
                  "type": "string"
                }
              },
              "confidence": {
                "enum": [
                  "low",
                  "medium",
                  "high"
                ]
              },
              "disproveWith": {
                "type": "string",
                "minLength": 1
              },
              "downstreamOf": {
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^EA-\\d{3,}$"
                }
              }
            }
          }
        },
        "nextDiagnostic": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "action",
            "confirmingSignal",
            "rejectingSignal"
          ],
          "properties": {
            "action": {
              "type": "string",
              "minLength": 1
            },
            "confirmingSignal": {
              "type": "string",
              "minLength": 1
            },
            "rejectingSignal": {
              "type": "string",
              "minLength": 1
            }
          }
        },
        "routing": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "nextTaskType",
            "leadingCauseId",
            "rationale"
          ],
          "properties": {
            "nextTaskType": {
              "enum": [
                "error-analysis",
                "implementation-option-selection"
              ]
            },
            "leadingCauseId": {
              "type": "string"
            },
            "rationale": {
              "type": "string",
              "minLength": 1
            }
          }
        }
      }
    },
    "TicketId": {
      "type": "string",
      "minLength": 1,
      "description": "Ticket key (external) or task-fallback (task-id verbatim) or literal `unknown` when truly unidentified. Empty string is never valid."
    },
    "Priority": {
      "enum": [
        "P0",
        "P1",
        "P2"
      ]
    },
    "FollowUpOrigin": {
      "enum": [
        "phase-continuation",
        "out-of-plan",
        "verifier-concern",
        "scope-boundary",
        "open-question",
        "manual"
      ]
    },
    "ClarificationKind": {
      "enum": [
        "material",
        "decision",
        "data-point"
      ]
    },
    "ClarificationBlocks": {
      "enum": [
        "approval",
        "next-phase",
        "none"
      ]
    },
    "ClarificationStatus": {
      "enum": [
        "open",
        "answered",
        "resolved",
        "obsolete"
      ]
    },
    "ClarificationReach": {
      "enum": [
        "in-repo",
        "cross-repo"
      ]
    },
    "ClarificationScopeEffect": {
      "enum": [
        "new-schema",
        "deferrable"
      ]
    },
    "ClarificationOrigin": {
      "enum": [
        "worker-finding",
        "material-gap",
        "lead-directed"
      ]
    },
    "ClarificationUserConfirmation": {
      "enum": [
        "asked-and-answered",
        "asked-awaiting",
        "deferred-no-interactive-session"
      ]
    },
    "ApprovalDisposition": {
      "enum": [
        "select",
        "accept-risk",
        "request-revision",
        "reject"
      ]
    },
    "ApprovalResolution": {
      "type": "object",
      "required": [
        "disposition",
        "userText",
        "checkRefs"
      ],
      "additionalProperties": false,
      "properties": {
        "disposition": {
          "$ref": "#/$defs/ApprovalDisposition"
        },
        "userText": {
          "type": "string",
          "minLength": 1
        },
        "checkRefs": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "pattern": "^A-\\d{3,}$"
          }
        }
      }
    },
    "ApprovalContext": {
      "type": "object",
      "required": [
        "classification",
        "unblockCondition",
        "recommendedDisposition"
      ],
      "additionalProperties": false,
      "properties": {
        "classification": {
          "enum": [
            "user-decision",
            "noncritical-dissent",
            "correctness-critical"
          ]
        },
        "unblockCondition": {
          "type": "string",
          "minLength": 1
        },
        "recommendedDisposition": {
          "$ref": "#/$defs/ApprovalDisposition"
        }
      }
    },
    "ClarificationOption": {
      "type": "object",
      "required": [
        "role",
        "answer",
        "rationale",
        "disposition",
        "reach",
        "addedWork",
        "directionChange"
      ],
      "additionalProperties": false,
      "properties": {
        "role": {
          "enum": [
            "recommended",
            "alternative"
          ]
        },
        "answer": {
          "type": "string",
          "minLength": 1
        },
        "rationale": {
          "type": "string",
          "minLength": 1
        },
        "disposition": {
          "$ref": "#/$defs/ApprovalDisposition"
        },
        "reach": {
          "$ref": "#/$defs/ClarificationReach"
        },
        "scopeEffects": {
          "type": "array",
          "uniqueItems": true,
          "items": {
            "$ref": "#/$defs/ClarificationScopeEffect"
          }
        },
        "addedWork": {
          "type": "string",
          "minLength": 1
        },
        "directionChange": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "WorkerStatus": {
      "enum": [
        "completed",
        "error",
        "timeout",
        "not-run",
        "synthesis-only"
      ]
    },
    "CurrentCodeEvidence": {
      "type": "object",
      "required": [
        "path",
        "line",
        "claim"
      ],
      "additionalProperties": false,
      "properties": {
        "path": {
          "type": "string",
          "minLength": 1
        },
        "line": {
          "type": "integer",
          "minimum": 1
        },
        "claim": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "AnalysisEvidenceInput": {
      "type": "object",
      "required": [
        "taskKey",
        "taskType",
        "reportPath",
        "runSeq",
        "sourceCommit",
        "relation",
        "freshness",
        "reviewStatus"
      ],
      "additionalProperties": false,
      "properties": {
        "taskKey": {
          "type": "string",
          "minLength": 1
        },
        "taskType": {
          "enum": [
            "project-analysis",
            "feature-analysis"
          ]
        },
        "reportPath": {
          "type": "string",
          "minLength": 1
        },
        "runSeq": {
          "type": "string",
          "pattern": "^[0-9]{3}$"
        },
        "sourceCommit": {
          "type": "string",
          "pattern": "^[0-9a-f]{40}$"
        },
        "relation": {
          "enum": [
            "project-context",
            "feature-baseline"
          ]
        },
        "freshness": {
          "enum": [
            "exact",
            "stale"
          ]
        },
        "reviewStatus": {
          "enum": [
            "accepted",
            "user-unverified"
          ]
        }
      }
    },
    "AnalysisRepresentativeEntryPoint": {
      "type": "object",
      "required": [
        "path",
        "symbol"
      ],
      "additionalProperties": false,
      "properties": {
        "path": {
          "type": "string",
          "minLength": 1
        },
        "symbol": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "AnalysisFeatureIndexRow": {
      "type": "object",
      "required": [
        "id",
        "name",
        "description",
        "representativeEntryPoint",
        "componentIds",
        "currentCodeEvidence"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^PF-[0-9]{3}$"
        },
        "name": {
          "type": "string",
          "minLength": 1
        },
        "description": {
          "type": "string",
          "minLength": 1
        },
        "representativeEntryPoint": {
          "$ref": "#/$defs/AnalysisRepresentativeEntryPoint"
        },
        "componentIds": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^PC-[0-9]{3}$"
          }
        },
        "currentCodeEvidence": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/CurrentCodeEvidence"
          }
        }
      }
    },
    "AnalysisResolvedTarget": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "inputMode": {
          "enum": [
            "feature-index",
            "free-text"
          ]
        },
        "requestedValue": {
          "type": "string",
          "minLength": 1
        },
        "feature": {
          "$ref": "#/$defs/AnalysisFeatureIndexRow"
        }
      },
      "allOf": [
        {
          "if": {
            "required": [
              "inputMode"
            ]
          },
          "then": {
            "required": [
              "requestedValue"
            ],
            "allOf": [
              {
                "if": {
                  "properties": {
                    "inputMode": {
                      "const": "feature-index"
                    }
                  },
                  "required": [
                    "inputMode"
                  ]
                },
                "then": {
                  "required": [
                    "feature"
                  ]
                },
                "else": {
                  "not": {
                    "required": [
                      "feature"
                    ]
                  }
                }
              }
            ]
          },
          "else": {
            "allOf": [
              {
                "not": {
                  "required": [
                    "requestedValue"
                  ]
                }
              },
              {
                "not": {
                  "required": [
                    "feature"
                  ]
                }
              }
            ]
          }
        }
      ]
    },
    "AnalysisScope": {
      "type": "object",
      "required": [
        "includedPaths",
        "excludedPaths",
        "unscannedPaths",
        "resolvedTarget"
      ],
      "additionalProperties": false,
      "properties": {
        "includedPaths": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "excludedPaths": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "unscannedPaths": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "resolvedTarget": {
          "$ref": "#/$defs/AnalysisResolvedTarget"
        }
      }
    },
    "AnalysisReviewResolution": {
      "type": "object",
      "required": [
        "affectedId",
        "outcome",
        "resolution",
        "evidence"
      ],
      "additionalProperties": false,
      "properties": {
        "affectedId": {
          "type": "string",
          "pattern": "^[A-Z]{2}-[0-9]{3}$"
        },
        "outcome": {
          "enum": [
            "revised",
            "retained-with-evidence",
            "removed",
            "still-unresolved"
          ]
        },
        "resolution": {
          "type": "string",
          "minLength": 1
        },
        "evidence": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      }
    },
    "AnalysisConfirmedFact": {
      "type": "object",
      "required": [
        "id",
        "statement",
        "currentCodeEvidence"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^AF-[0-9]{3}$"
        },
        "statement": {
          "type": "string",
          "minLength": 1
        },
        "currentCodeEvidence": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/CurrentCodeEvidence"
          }
        },
        "sourceReportRefs": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      }
    },
    "AnalysisInference": {
      "type": "object",
      "required": [
        "id",
        "statement",
        "evidenceIds",
        "confidence"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^AI-[0-9]{3}$"
        },
        "statement": {
          "type": "string",
          "minLength": 1
        },
        "evidenceIds": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "confidence": {
          "enum": [
            "high",
            "medium",
            "low"
          ]
        }
      }
    },
    "AnalysisUnknown": {
      "type": "object",
      "required": [
        "id",
        "question",
        "reason",
        "affectsVerdict"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^AU-[0-9]{3}$"
        },
        "question": {
          "type": "string",
          "minLength": 1
        },
        "reason": {
          "type": "string",
          "minLength": 1
        },
        "affectsVerdict": {
          "type": "boolean"
        }
      }
    },
    "AnalysisCommon": {
      "type": "object",
      "required": [
        "runSeq",
        "sourceCommit",
        "scope",
        "evidenceInputs",
        "confirmedFacts",
        "inferences",
        "unknowns",
        "analysisReviewResolution"
      ],
      "additionalProperties": false,
      "properties": {
        "runSeq": {
          "type": "string",
          "pattern": "^[0-9]{3}$"
        },
        "sourceCommit": {
          "type": "string",
          "pattern": "^[0-9a-f]{40}$"
        },
        "scope": {
          "$ref": "#/$defs/AnalysisScope"
        },
        "evidenceInputs": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AnalysisEvidenceInput"
          }
        },
        "confirmedFacts": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AnalysisConfirmedFact"
          }
        },
        "inferences": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AnalysisInference"
          }
        },
        "unknowns": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AnalysisUnknown"
          }
        },
        "analysisReviewResolution": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AnalysisReviewResolution"
          }
        }
      }
    },
    "ProjectComponent": {
      "type": "object",
      "required": [
        "id",
        "name",
        "responsibility",
        "paths",
        "currentCodeEvidence"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^PC-[0-9]{3}$"
        },
        "name": {
          "type": "string",
          "minLength": 1
        },
        "responsibility": {
          "type": "string",
          "minLength": 1
        },
        "paths": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "currentCodeEvidence": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/CurrentCodeEvidence"
          }
        }
      }
    },
    "ProjectDependency": {
      "type": "object",
      "required": [
        "fromComponentId",
        "toComponentId",
        "direction",
        "currentCodeEvidence"
      ],
      "additionalProperties": false,
      "properties": {
        "fromComponentId": {
          "type": "string",
          "pattern": "^PC-[0-9]{3}$"
        },
        "toComponentId": {
          "type": "string",
          "pattern": "^PC-[0-9]{3}$"
        },
        "direction": {
          "type": "string",
          "minLength": 1
        },
        "currentCodeEvidence": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/CurrentCodeEvidence"
          }
        }
      }
    },
    "ProjectEntryPoint": {
      "type": "object",
      "required": [
        "kind",
        "path",
        "symbol",
        "role",
        "currentCodeEvidence"
      ],
      "additionalProperties": false,
      "properties": {
        "kind": {
          "type": "string",
          "minLength": 1
        },
        "path": {
          "type": "string",
          "minLength": 1
        },
        "symbol": {
          "type": "string",
          "minLength": 1
        },
        "role": {
          "type": "string",
          "minLength": 1
        },
        "currentCodeEvidence": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/CurrentCodeEvidence"
          }
        }
      }
    },
    "ProjectDataStore": {
      "type": "object",
      "required": [
        "name",
        "ownerComponentId",
        "readBoundary",
        "writeBoundary",
        "currentCodeEvidence"
      ],
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1
        },
        "ownerComponentId": {
          "type": "string",
          "pattern": "^PC-[0-9]{3}$"
        },
        "readBoundary": {
          "type": "string",
          "minLength": 1
        },
        "writeBoundary": {
          "type": "string",
          "minLength": 1
        },
        "currentCodeEvidence": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/CurrentCodeEvidence"
          }
        }
      }
    },
    "ProjectExternalSystem": {
      "type": "object",
      "required": [
        "name",
        "adapter",
        "direction",
        "currentCodeEvidence"
      ],
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1
        },
        "adapter": {
          "type": "string",
          "minLength": 1
        },
        "direction": {
          "type": "string",
          "minLength": 1
        },
        "currentCodeEvidence": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/CurrentCodeEvidence"
          }
        }
      }
    },
    "ProjectScanCoverage": {
      "type": "object",
      "required": [
        "scannedPathCount",
        "unscannedPathCount",
        "reason"
      ],
      "additionalProperties": false,
      "properties": {
        "scannedPathCount": {
          "type": "integer",
          "minimum": 0
        },
        "unscannedPathCount": {
          "type": "integer",
          "minimum": 0
        },
        "reason": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "ProjectLanguage": {
      "type": "object",
      "required": [
        "name",
        "version",
        "versionSource"
      ],
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1
        },
        "version": {
          "type": "string",
          "minLength": 1
        },
        "versionSource": {
          "$ref": "#/$defs/ProjectVersionSource"
        },
        "fileCount": {
          "type": "integer",
          "minimum": 0
        },
        "lineCount": {
          "type": "integer",
          "minimum": 0
        },
        "currentCodeEvidence": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/CurrentCodeEvidence"
          }
        }
      }
    },
    "ProjectVersionSource": {
      "enum": [
        "manifest-range",
        "lockfile-pinned",
        "container-image",
        "runtime-config",
        "declared-doc"
      ],
      "description": "Where the version was read, which decides how much it can be trusted. 'manifest-range' — a range in a manifest (`^1.17.0`), so the installed version is not this one. 'lockfile-pinned' — the exact version a lockfile resolves to. 'container-image' — the tag an image is built from. 'runtime-config' — a value the running service reports or a config fixes. 'declared-doc' — prose in a document, with nothing enforcing it. A range and a pin must never be recorded the same way: a mismatch between them is a real compatibility risk."
    },
    "ProjectFramework": {
      "type": "object",
      "required": [
        "name",
        "version",
        "versionSource",
        "role"
      ],
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1
        },
        "version": {
          "type": "string",
          "minLength": 1
        },
        "versionSource": {
          "$ref": "#/$defs/ProjectVersionSource"
        },
        "role": {
          "type": "string",
          "minLength": 1
        },
        "currentCodeEvidence": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/CurrentCodeEvidence"
          }
        }
      }
    },
    "ProjectTool": {
      "type": "object",
      "required": [
        "kind",
        "name"
      ],
      "additionalProperties": false,
      "properties": {
        "kind": {
          "enum": [
            "packageManager",
            "build",
            "test",
            "lint",
            "typecheck",
            "format",
            "ci",
            "container"
          ]
        },
        "name": {
          "type": "string",
          "minLength": 1
        },
        "version": {
          "type": "string"
        },
        "versionSource": {
          "$ref": "#/$defs/ProjectVersionSource"
        },
        "command": {
          "type": "string"
        },
        "currentCodeEvidence": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/CurrentCodeEvidence"
          }
        }
      }
    },
    "ProjectTechStack": {
      "type": "object",
      "required": [
        "languages"
      ],
      "additionalProperties": false,
      "description": "What the project is written in and built with. Record only what a file states — a language with no version in any manifest, lockfile or image is still recorded, with the version left to the source that does declare it.",
      "properties": {
        "languages": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/ProjectLanguage"
          }
        },
        "frameworks": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ProjectFramework"
          }
        },
        "toolchain": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ProjectTool"
          }
        }
      }
    },
    "ProjectInternalInterface": {
      "type": "object",
      "required": [
        "id",
        "name",
        "kind",
        "ownerComponentId",
        "signature"
      ],
      "additionalProperties": false,
      "description": "A seam inside the project that other components call across. `kind` is what the seam is, not where its file sits: a `port` is the abstraction a domain declares, an `adapter` the implementation that satisfies one.",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^II-[0-9]{3}$"
        },
        "name": {
          "type": "string",
          "minLength": 1
        },
        "kind": {
          "enum": [
            "port",
            "adapter",
            "service-api",
            "module-export",
            "event"
          ]
        },
        "ownerComponentId": {
          "type": "string",
          "minLength": 1
        },
        "signature": {
          "type": "string",
          "minLength": 1
        },
        "consumers": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "currentCodeEvidence": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/CurrentCodeEvidence"
          }
        }
      }
    },
    "ProjectWorkflowStep": {
      "type": "object",
      "required": [
        "order",
        "action",
        "componentId"
      ],
      "additionalProperties": false,
      "properties": {
        "order": {
          "type": "integer",
          "minimum": 1
        },
        "action": {
          "type": "string",
          "minLength": 1
        },
        "componentId": {
          "type": "string",
          "minLength": 1
        },
        "externalSystem": {
          "type": "string"
        },
        "currentCodeEvidence": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/CurrentCodeEvidence"
          }
        }
      }
    },
    "ProjectWorkflow": {
      "type": "object",
      "required": [
        "id",
        "name",
        "trigger",
        "steps"
      ],
      "additionalProperties": false,
      "description": "One run of work through the system, start to finish — what sets it off and which component does what, in order. This is the only block that says how the parts are used rather than how they are arranged.",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^PW-[0-9]{3}$"
        },
        "name": {
          "type": "string",
          "minLength": 1
        },
        "trigger": {
          "type": "string",
          "minLength": 1
        },
        "outcome": {
          "type": "string"
        },
        "steps": {
          "type": "array",
          "minItems": 2,
          "items": {
            "$ref": "#/$defs/ProjectWorkflowStep"
          }
        }
      }
    },
    "ProjectHotspot": {
      "type": "object",
      "required": [
        "id",
        "title",
        "impact",
        "risk",
        "reason",
        "evidenceRefs"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^PH-[0-9]{3}$"
        },
        "title": {
          "type": "string",
          "minLength": 1
        },
        "impact": {
          "enum": [
            "high",
            "medium",
            "low"
          ]
        },
        "risk": {
          "enum": [
            "high",
            "medium",
            "low"
          ]
        },
        "reason": {
          "type": "string",
          "minLength": 1
        },
        "evidenceRefs": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      }
    },
    "ProjectQualityCoverage": {
      "type": "object",
      "required": [
        "id",
        "area",
        "status",
        "summary",
        "evidenceRefs"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^PQ-[0-9]{3}$"
        },
        "area": {
          "type": "string",
          "minLength": 1
        },
        "status": {
          "enum": [
            "covered",
            "partial",
            "gap",
            "risk"
          ],
          "description": "How far the area's tests actually protect it. 'covered' — tests exercise the area and a regression fails them. 'partial' — tests exist but leave part of the area unexercised. 'gap' — no test exercises the area. 'risk' — tests exist and run, but passing them does not prove the area works (they skip, assert nothing, or gate on a condition that is never met). 'risk' is not a weaker 'gap': it is the more dangerous state, because the suite reports success."
        },
        "summary": {
          "type": "string",
          "minLength": 1
        },
        "evidenceRefs": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      }
    },
    "ProjectAnalysis": {
      "type": "object",
      "required": [
        "components",
        "dependencies",
        "entryPoints",
        "dataStores",
        "externalSystems",
        "featureIndex",
        "scanCoverage",
        "rankedHotspots",
        "qualityCoverage",
        "userNarrative"
      ],
      "additionalProperties": false,
      "properties": {
        "components": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ProjectComponent"
          }
        },
        "dependencies": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ProjectDependency"
          }
        },
        "techStack": {
          "$ref": "#/$defs/ProjectTechStack"
        },
        "internalInterfaces": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ProjectInternalInterface"
          }
        },
        "workflows": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ProjectWorkflow"
          }
        },
        "entryPoints": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ProjectEntryPoint"
          }
        },
        "dataStores": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ProjectDataStore"
          }
        },
        "externalSystems": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ProjectExternalSystem"
          }
        },
        "featureIndex": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AnalysisFeatureIndexRow"
          }
        },
        "rankedHotspots": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/ProjectHotspot"
          }
        },
        "qualityCoverage": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/ProjectQualityCoverage"
          }
        },
        "scanCoverage": {
          "$ref": "#/$defs/ProjectScanCoverage"
        },
        "userNarrative": {
          "$ref": "#/$defs/ProjectUserNarrative"
        }
      }
    },
    "FeatureTarget": {
      "type": "object",
      "required": [
        "inputMode",
        "requestedValue",
        "entryPoints"
      ],
      "additionalProperties": false,
      "properties": {
        "inputMode": {
          "enum": [
            "feature-index",
            "free-text"
          ]
        },
        "requestedValue": {
          "type": "string",
          "minLength": 1
        },
        "featureId": {
          "type": "string",
          "pattern": "^PF-[0-9]{3}$"
        },
        "entryPoints": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/AnalysisRepresentativeEntryPoint"
          }
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "inputMode": {
                "const": "feature-index"
              }
            },
            "required": [
              "inputMode"
            ]
          },
          "then": {
            "required": [
              "featureId"
            ]
          },
          "else": {
            "not": {
              "required": [
                "featureId"
              ]
            }
          }
        }
      ]
    },
    "FeatureFlowStep": {
      "type": "object",
      "required": [
        "sequence",
        "action"
      ],
      "additionalProperties": false,
      "properties": {
        "sequence": {
          "type": "integer",
          "minimum": 1
        },
        "action": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "FeatureFlow": {
      "type": "object",
      "required": [
        "id",
        "kind",
        "steps",
        "currentCodeEvidence"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^FF-[0-9]{3}$"
        },
        "kind": {
          "enum": [
            "normal",
            "alternative",
            "failure"
          ]
        },
        "steps": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/FeatureFlowStep"
          }
        },
        "currentCodeEvidence": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/CurrentCodeEvidence"
          }
        },
        "sourceReportRefs": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      }
    },
    "FeatureDomainRule": {
      "type": "object",
      "required": [
        "id",
        "condition",
        "outcome",
        "currentCodeEvidence"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^FR-[0-9]{3}$"
        },
        "condition": {
          "type": "string",
          "minLength": 1
        },
        "outcome": {
          "type": "string",
          "minLength": 1
        },
        "currentCodeEvidence": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/CurrentCodeEvidence"
          }
        },
        "sourceReportRefs": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      }
    },
    "FeatureStateChange": {
      "type": "object",
      "required": [
        "id",
        "dataStore",
        "field",
        "change",
        "sideEffects",
        "currentCodeEvidence"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^FS-[0-9]{3}$"
        },
        "dataStore": {
          "type": "string",
          "minLength": 1
        },
        "field": {
          "type": "string",
          "minLength": 1
        },
        "change": {
          "type": "string",
          "minLength": 1
        },
        "sideEffects": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "currentCodeEvidence": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/CurrentCodeEvidence"
          }
        },
        "sourceReportRefs": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      }
    },
    "FeatureExternalInteraction": {
      "type": "object",
      "required": [
        "target",
        "input",
        "output",
        "failureHandling",
        "currentCodeEvidence"
      ],
      "additionalProperties": false,
      "properties": {
        "target": {
          "type": "string",
          "minLength": 1
        },
        "input": {
          "type": "string",
          "minLength": 1
        },
        "output": {
          "type": "string",
          "minLength": 1
        },
        "failureHandling": {
          "type": "string",
          "minLength": 1
        },
        "currentCodeEvidence": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/CurrentCodeEvidence"
          }
        }
      }
    },
    "FeatureTestCoverage": {
      "type": "object",
      "required": [
        "id",
        "targetIds",
        "testPaths",
        "gaps"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^FT-[0-9]{3}$"
        },
        "targetIds": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "pattern": "^F[FRS]-[0-9]{3}$"
          }
        },
        "testPaths": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "gaps": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      }
    },
    "FeatureConcern": {
      "type": "object",
      "required": [
        "description",
        "currentCodeEvidence"
      ],
      "additionalProperties": false,
      "properties": {
        "description": {
          "type": "string",
          "minLength": 1
        },
        "currentCodeEvidence": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/CurrentCodeEvidence"
          }
        }
      }
    },
    "FeatureAnalysis": {
      "type": "object",
      "required": [
        "target",
        "flows",
        "domainRules",
        "stateChanges",
        "externalInteractions",
        "testCoverage",
        "actors",
        "preconditions",
        "postconditions",
        "permissionsAndFlags",
        "nonFunctionalConcerns",
        "userNarrative"
      ],
      "additionalProperties": false,
      "properties": {
        "target": {
          "$ref": "#/$defs/FeatureTarget"
        },
        "userNarrative": {
          "$ref": "#/$defs/FeatureUserNarrative"
        },
        "flows": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/FeatureFlow"
          }
        },
        "domainRules": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/FeatureDomainRule"
          }
        },
        "stateChanges": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/FeatureStateChange"
          }
        },
        "externalInteractions": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/FeatureExternalInteraction"
          }
        },
        "testCoverage": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/FeatureTestCoverage"
          }
        },
        "actors": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/FeatureConcern"
          }
        },
        "preconditions": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/FeatureConcern"
          }
        },
        "postconditions": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/FeatureConcern"
          }
        },
        "permissionsAndFlags": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/FeatureConcern"
          }
        },
        "nonFunctionalConcerns": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/FeatureConcern"
          }
        }
      }
    },
    "ChangeRequest": {
      "type": "object",
      "required": [
        "summary",
        "briefEvidence"
      ],
      "additionalProperties": false,
      "properties": {
        "summary": {
          "type": "string",
          "minLength": 1
        },
        "briefEvidence": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "PreservedBehavior": {
      "type": "object",
      "required": [
        "statement",
        "currentCodeEvidence"
      ],
      "additionalProperties": false,
      "properties": {
        "statement": {
          "type": "string",
          "minLength": 1
        },
        "currentCodeEvidence": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/CurrentCodeEvidence"
          }
        }
      }
    },
    "ChangeImpactItem": {
      "type": "object",
      "required": [
        "id",
        "target",
        "impactKind",
        "level",
        "confidence",
        "sourceReportRefs",
        "currentCodeEvidence"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^CI-[0-9]{3}$"
        },
        "target": {
          "type": "string",
          "minLength": 1
        },
        "impactKind": {
          "type": "string",
          "minLength": 1
        },
        "level": {
          "enum": [
            "high",
            "medium",
            "low"
          ]
        },
        "confidence": {
          "enum": [
            "high",
            "medium",
            "low"
          ]
        },
        "sourceReportRefs": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "currentCodeEvidence": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/CurrentCodeEvidence"
          }
        }
      }
    },
    "DependencyBlastRadius": {
      "type": "object",
      "required": [
        "sourceImpactId",
        "affectedTarget",
        "direction",
        "currentCodeEvidence"
      ],
      "additionalProperties": false,
      "properties": {
        "sourceImpactId": {
          "type": "string",
          "pattern": "^CI-[0-9]{3}$"
        },
        "affectedTarget": {
          "type": "string",
          "minLength": 1
        },
        "direction": {
          "type": "string",
          "minLength": 1
        },
        "currentCodeEvidence": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/CurrentCodeEvidence"
          }
        }
      }
    },
    "ChangeTestImpact": {
      "type": "object",
      "required": [
        "scope",
        "action",
        "testPaths",
        "currentCodeEvidence"
      ],
      "additionalProperties": false,
      "properties": {
        "scope": {
          "type": "string",
          "minLength": 1
        },
        "action": {
          "enum": [
            "preserve",
            "modify",
            "add"
          ]
        },
        "testPaths": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "currentCodeEvidence": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/CurrentCodeEvidence"
          }
        }
      }
    },
    "OperationalImpact": {
      "type": "object",
      "required": [
        "area",
        "impact",
        "currentCodeEvidence"
      ],
      "additionalProperties": false,
      "properties": {
        "area": {
          "type": "string",
          "minLength": 1
        },
        "impact": {
          "type": "string",
          "minLength": 1
        },
        "currentCodeEvidence": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/CurrentCodeEvidence"
          }
        }
      }
    },
    "AnalysisPlanningInput": {
      "type": "object",
      "required": [
        "constraint",
        "unknown"
      ],
      "additionalProperties": false,
      "properties": {
        "constraint": {
          "type": "string",
          "minLength": 1
        },
        "unknown": {
          "type": "boolean"
        }
      }
    },
    "ChangeImpactConcern": {
      "type": "object",
      "required": [
        "summary",
        "currentCodeEvidence"
      ],
      "additionalProperties": false,
      "properties": {
        "summary": {
          "type": "string",
          "minLength": 1
        },
        "currentCodeEvidence": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/CurrentCodeEvidence"
          }
        }
      }
    },
    "ChangeImpactAnalysis": {
      "type": "object",
      "required": [
        "changeRequest",
        "preservedBehaviors",
        "impactItems",
        "dependencyBlastRadius",
        "testImpact",
        "operationalImpact",
        "planningInputs",
        "unaffectedBoundaries",
        "compatibilityImpact",
        "migrationImpact",
        "rollbackImpact",
        "securityAndPerformanceImpact",
        "userNarrative"
      ],
      "additionalProperties": false,
      "properties": {
        "changeRequest": {
          "$ref": "#/$defs/ChangeRequest"
        },
        "userNarrative": {
          "$ref": "#/$defs/ChangeImpactUserNarrative"
        },
        "preservedBehaviors": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/PreservedBehavior"
          }
        },
        "impactItems": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ChangeImpactItem"
          }
        },
        "dependencyBlastRadius": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DependencyBlastRadius"
          }
        },
        "testImpact": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ChangeTestImpact"
          }
        },
        "operationalImpact": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/OperationalImpact"
          }
        },
        "planningInputs": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AnalysisPlanningInput"
          }
        },
        "unaffectedBoundaries": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ChangeImpactConcern"
          }
        },
        "compatibilityImpact": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ChangeImpactConcern"
          }
        },
        "migrationImpact": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ChangeImpactConcern"
          }
        },
        "rollbackImpact": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ChangeImpactConcern"
          }
        },
        "securityAndPerformanceImpact": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ChangeImpactConcern"
          }
        }
      }
    },
    "SourceItem": {
      "type": "string",
      "pattern": "^[a-z][a-z-]*:[A-Za-z0-9._-]+$",
      "description": "Source-item reference in the form `<worker>:<item-id>`, e.g. `claude:F-001`, `codex:1.1`, `lead:mcp-1`. Bare worker-name lists are deprecated; every source must carry its origin item ID."
    },
    "SummaryRow": {
      "type": "object",
      "required": [
        "id",
        "ticketId",
        "summary",
        "source"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^P-\\d{3,}$"
        },
        "ticketId": {
          "$ref": "#/$defs/TicketId"
        },
        "summary": {
          "type": "string",
          "minLength": 1
        },
        "source": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "TicketCoverageRow": {
      "type": "object",
      "required": [
        "ticketId",
        "sections",
        "relatedIds"
      ],
      "additionalProperties": false,
      "properties": {
        "ticketId": {
          "$ref": "#/$defs/TicketId"
        },
        "sections": {
          "type": "string",
          "minLength": 1
        },
        "relatedIds": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "ExecutionStatusRow": {
      "type": "object",
      "required": [
        "agent",
        "role",
        "model",
        "status",
        "summary"
      ],
      "additionalProperties": false,
      "properties": {
        "agent": {
          "enum": [
            "Claude Code",
            "Codex",
            "Antigravity",
            "Grok",
            "Kimi"
          ]
        },
        "role": {
          "type": "string",
          "minLength": 1
        },
        "model": {
          "type": "string",
          "minLength": 1
        },
        "status": {
          "$ref": "#/$defs/WorkerStatus"
        },
        "summary": {
          "type": "string",
          "minLength": 1
        },
        "totalTokens": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": 0
            },
            {
              "type": "null"
            }
          ]
        },
        "cacheReadTokens": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": 0
            },
            {
              "type": "null"
            }
          ]
        },
        "billableTokens": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": 0
            },
            {
              "type": "null"
            }
          ]
        },
        "costUsd": {
          "oneOf": [
            {
              "type": "number",
              "minimum": 0
            },
            {
              "type": "null"
            }
          ]
        },
        "cliTotalTokens": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": 0
            },
            {
              "type": "null"
            }
          ]
        },
        "cliCostUsd": {
          "oneOf": [
            {
              "type": "number",
              "minimum": 0
            },
            {
              "type": "null"
            }
          ]
        },
        "durationMs": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": 0
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "TokenUsageRow": {
      "type": "object",
      "required": [
        "totalTokens",
        "billableTokens",
        "costUsd"
      ],
      "additionalProperties": false,
      "properties": {
        "totalTokens": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": 0
            },
            {
              "type": "null"
            }
          ]
        },
        "cacheReadTokens": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": 0
            },
            {
              "type": "null"
            }
          ]
        },
        "billableTokens": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": 0
            },
            {
              "type": "null"
            }
          ]
        },
        "costUsd": {
          "oneOf": [
            {
              "type": "number",
              "minimum": 0
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "TokenUsageWorkerDetailRow": {
      "type": "object",
      "required": [
        "label",
        "totalTokens",
        "billableTokens",
        "costUsd",
        "cliTotalTokens",
        "cliCostUsd"
      ],
      "additionalProperties": false,
      "properties": {
        "label": {
          "type": "string",
          "minLength": 1
        },
        "totalTokens": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": 0
            },
            {
              "type": "null"
            }
          ]
        },
        "cacheReadTokens": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": 0
            },
            {
              "type": "null"
            }
          ]
        },
        "billableTokens": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": 0
            },
            {
              "type": "null"
            }
          ]
        },
        "costUsd": {
          "oneOf": [
            {
              "type": "number",
              "minimum": 0
            },
            {
              "type": "null"
            }
          ]
        },
        "cliTotalTokens": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": 0
            },
            {
              "type": "null"
            }
          ]
        },
        "cliCostUsd": {
          "oneOf": [
            {
              "type": "number",
              "minimum": 0
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "RoundHistoryRow": {
      "type": "object",
      "required": [
        "round",
        "inputQueueSize",
        "resolvedCount",
        "carriedForwardCount",
        "dispatches",
        "skippedWorkers"
      ],
      "additionalProperties": false,
      "properties": {
        "round": {
          "type": "integer",
          "minimum": 0
        },
        "inputQueueSize": {
          "type": "integer",
          "minimum": 0
        },
        "resolvedCount": {
          "type": "integer",
          "minimum": 0
        },
        "carriedForwardCount": {
          "type": "integer",
          "minimum": 0
        },
        "dispatches": {
          "type": "string"
        },
        "skippedWorkers": {
          "type": "string"
        }
      }
    },
    "ConsensusRow": {
      "type": "object",
      "required": [
        "id",
        "ticketId",
        "statement",
        "sourceItems",
        "evidence"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^C-\\d{3,}$"
        },
        "ticketId": {
          "$ref": "#/$defs/TicketId"
        },
        "statement": {
          "type": "string",
          "minLength": 1
        },
        "sourceItems": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/SourceItem"
          }
        },
        "evidence": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "DifferenceRow": {
      "type": "object",
      "required": [
        "id",
        "ticketId",
        "disagreement",
        "workersPosition",
        "evidence"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^D-\\d{3,}$"
        },
        "ticketId": {
          "$ref": "#/$defs/TicketId"
        },
        "disagreement": {
          "type": "string",
          "minLength": 1
        },
        "workersPosition": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "required": [
              "worker",
              "itemId",
              "position"
            ],
            "additionalProperties": false,
            "properties": {
              "worker": {
                "type": "string",
                "minLength": 1
              },
              "itemId": {
                "type": "string"
              },
              "position": {
                "type": "string",
                "minLength": 1
              }
            }
          }
        },
        "evidence": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "PrimaryEvidenceRow": {
      "type": "object",
      "required": [
        "id",
        "ticketId",
        "evidence",
        "sourceItems",
        "source"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^E-\\d{3,}$"
        },
        "ticketId": {
          "$ref": "#/$defs/TicketId"
        },
        "evidence": {
          "type": "string",
          "minLength": 1
        },
        "sourceItems": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/SourceItem"
          }
        },
        "source": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "SecondaryEvidenceRow": {
      "type": "object",
      "required": [
        "id",
        "ticketId",
        "hypothesis",
        "confidence"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^S-\\d{3,}$"
        },
        "ticketId": {
          "$ref": "#/$defs/TicketId"
        },
        "hypothesis": {
          "type": "string",
          "minLength": 1
        },
        "confidence": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "RiskRow": {
      "type": "object",
      "required": [
        "id",
        "ticketId",
        "item",
        "risk",
        "owner"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^R-\\d{3,}$"
        },
        "ticketId": {
          "$ref": "#/$defs/TicketId"
        },
        "item": {
          "type": "string",
          "minLength": 1
        },
        "risk": {
          "type": "string",
          "minLength": 1
        },
        "owner": {
          "type": "string",
          "minLength": 1
        },
        "source": {
          "type": "string"
        }
      }
    },
    "OptionCandidate": {
      "type": "object",
      "required": [
        "name",
        "fileStructure",
        "interfaces",
        "blastRadius"
      ],
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1
        },
        "fileStructure": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "id",
              "ticketId",
              "action",
              "path",
              "summary"
            ],
            "additionalProperties": false,
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^OF-\\d{3,}$"
              },
              "ticketId": {
                "$ref": "#/$defs/TicketId"
              },
              "action": {
                "enum": [
                  "Create",
                  "Modify",
                  "Delete"
                ]
              },
              "path": {
                "type": "string",
                "minLength": 1
              },
              "summary": {
                "type": "string",
                "minLength": 1,
                "maxLength": 120
              },
              "details": {
                "type": "string",
                "minLength": 1
              }
            }
          }
        },
        "interfaces": {
          "type": "string"
        },
        "blastRadius": {
          "type": "string"
        }
      }
    },
    "TradeoffRow": {
      "type": "object",
      "required": [
        "option",
        "complexity",
        "risk",
        "reversibility",
        "testCoverageCost",
        "rolloutCost"
      ],
      "additionalProperties": false,
      "properties": {
        "option": {
          "type": "string",
          "minLength": 1
        },
        "complexity": {
          "type": "string",
          "minLength": 1
        },
        "risk": {
          "type": "string",
          "minLength": 1
        },
        "reversibility": {
          "type": "string",
          "minLength": 1
        },
        "testCoverageCost": {
          "type": "string",
          "minLength": 1
        },
        "rolloutCost": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "RecommendedOption": {
      "type": "object",
      "required": [
        "name",
        "coreReason",
        "rationale",
        "rejectedSummary",
        "testSeams"
      ],
      "additionalProperties": false,
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1
        },
        "coreReason": {
          "type": "string",
          "minLength": 1
        },
        "rationale": {
          "type": "string",
          "minLength": 1
        },
        "rejectedSummary": {
          "type": "string",
          "minLength": 1
        },
        "testSeams": {
          "type": "array",
          "description": "Boundaries a test injects and replaces. An empty array is a deliberate declaration that no seam is needed (the plan body must justify it).",
          "items": {
            "type": "object",
            "required": [
              "boundary",
              "injectedAs",
              "replacedInTest"
            ],
            "additionalProperties": false,
            "properties": {
              "boundary": {
                "type": "string",
                "minLength": 1
              },
              "injectedAs": {
                "type": "string",
                "minLength": 1
              },
              "replacedInTest": {
                "type": "string",
                "minLength": 1
              }
            }
          }
        }
      }
    },
    "VariationPointAnalysis": {
      "type": "object",
      "required": [
        "hasMultipleImplementations",
        "noVariationRationale",
        "points"
      ],
      "additionalProperties": false,
      "properties": {
        "hasMultipleImplementations": {
          "type": "boolean"
        },
        "noVariationRationale": {
          "type": "string",
          "description": "Why no variation point exists when hasMultipleImplementations is false. Empty string when it is true."
        },
        "points": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/VariationPoint"
          }
        }
      }
    },
    "VariationPoint": {
      "type": "object",
      "required": [
        "behavior",
        "implementations",
        "evidence",
        "extractionDecision"
      ],
      "additionalProperties": false,
      "properties": {
        "behavior": {
          "type": "string",
          "minLength": 1
        },
        "implementations": {
          "type": "array",
          "minItems": 2,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "evidence": {
          "type": "string",
          "minLength": 1
        },
        "extractionDecision": {
          "type": "object",
          "required": [
            "extract",
            "interfaceKind",
            "coveredBy",
            "rationale"
          ],
          "additionalProperties": false,
          "properties": {
            "extract": {
              "type": "boolean"
            },
            "interfaceKind": {
              "type": "string"
            },
            "coveredBy": {
              "type": "string"
            },
            "rationale": {
              "type": "string",
              "minLength": 1
            }
          }
        }
      }
    },
    "StageMapRow": {
      "type": "object",
      "required": [
        "stage",
        "title",
        "dependsOn",
        "stepCount",
        "exitContractSummary"
      ],
      "additionalProperties": false,
      "properties": {
        "stage": {
          "type": "integer",
          "minimum": 1
        },
        "title": {
          "type": "string",
          "minLength": 1
        },
        "dependsOn": {
          "type": "string",
          "minLength": 1,
          "description": "Literal Stage Map depends-on cell: `(none)` or a comma-separated stage number list."
        },
        "stepCount": {
          "type": "integer",
          "minimum": 0,
          "maximum": 6
        },
        "exitContractSummary": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "DesignPreparation": {
      "type": "object",
      "required": [
        "mode",
        "reason",
        "items"
      ],
      "additionalProperties": false,
      "properties": {
        "mode": {
          "enum": [
            "assessed",
            "no-design-inputs"
          ]
        },
        "reason": {
          "type": "string",
          "minLength": 1
        },
        "items": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DesignPrepItem"
          }
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "mode": {
                "const": "no-design-inputs"
              }
            }
          },
          "then": {
            "properties": {
              "items": {
                "maxItems": 0
              }
            }
          }
        }
      ]
    },
    "DesignPrepKnownFact": {
      "type": "object",
      "required": [
        "statement",
        "evidence"
      ],
      "additionalProperties": false,
      "properties": {
        "statement": {
          "type": "string",
          "minLength": 1
        },
        "evidence": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "DesignPrepProposal": {
      "type": "object",
      "required": [
        "summary",
        "details",
        "assumptions",
        "evidence",
        "confidence"
      ],
      "additionalProperties": false,
      "properties": {
        "summary": {
          "type": "string",
          "minLength": 1
        },
        "details": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "assumptions": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "evidence": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "confidence": {
          "enum": [
            "low",
            "medium",
            "high"
          ]
        }
      }
    },
    "DesignPrepHumanConfirmation": {
      "type": "object",
      "required": [
        "required",
        "reason",
        "suggestedAction"
      ],
      "additionalProperties": false,
      "properties": {
        "required": {
          "type": "boolean"
        },
        "reason": {
          "type": "string",
          "minLength": 1
        },
        "suggestedAction": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "DesignPrepReviewPoint": {
      "type": "object",
      "required": [
        "phase"
      ],
      "additionalProperties": false,
      "properties": {
        "phase": {
          "enum": [
            "implementation",
            "final-verification"
          ]
        },
        "stage": {
          "type": "integer",
          "minimum": 1
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "phase": {
                "const": "implementation"
              }
            }
          },
          "then": {
            "required": [
              "stage"
            ]
          }
        }
      ]
    },
    "DesignPrepItem": {
      "type": "object",
      "required": [
        "id",
        "kind",
        "title",
        "stageRefs",
        "status",
        "need",
        "knownFacts",
        "openQuestions",
        "aiProposal",
        "humanConfirmation"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^PREP-[0-9]{3}$"
        },
        "kind": {
          "enum": [
            "domain-contract",
            "persistence-schema",
            "external-interface",
            "transaction-consistency",
            "transformation-mapping",
            "lifecycle-state-machine",
            "rollout-observability",
            "manual-user-test",
            "other"
          ]
        },
        "title": {
          "type": "string",
          "minLength": 1
        },
        "stageRefs": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": {
            "type": "integer",
            "minimum": 1
          }
        },
        "status": {
          "enum": [
            "ready",
            "provisional",
            "blocked",
            "not-applicable"
          ]
        },
        "need": {
          "type": "string",
          "minLength": 1
        },
        "knownFacts": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DesignPrepKnownFact"
          }
        },
        "openQuestions": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "aiProposal": {
          "$ref": "#/$defs/DesignPrepProposal"
        },
        "humanConfirmation": {
          "$ref": "#/$defs/DesignPrepHumanConfirmation"
        },
        "workingAssumption": {
          "type": "string",
          "minLength": 1
        },
        "guardrails": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "reviewAt": {
          "$ref": "#/$defs/DesignPrepReviewPoint"
        },
        "ifStillOpen": {
          "enum": [
            "block",
            "follow-up"
          ]
        },
        "requestPath": {
          "type": "string",
          "pattern": "^design-prep-requests/design-prep-request-[0-9]+-PREP-[0-9]{3}\\.md$"
        },
        "blockReason": {
          "type": "string",
          "minLength": 1
        },
        "requiredDecision": {
          "type": "string",
          "minLength": 1
        },
        "notApplicableReason": {
          "type": "string",
          "minLength": 1
        },
        "replanTriggerFields": {
          "type": "array",
          "uniqueItems": true,
          "items": {
            "type": "string",
            "pattern": "^[^.\\s]+(\\.[^.\\s]+)*$"
          }
        }
      },
      "oneOf": [
        {
          "properties": {
            "status": {
              "const": "ready"
            }
          },
          "allOf": [
            {
              "not": {
                "required": [
                  "workingAssumption"
                ]
              }
            },
            {
              "not": {
                "required": [
                  "blockReason"
                ]
              }
            },
            {
              "not": {
                "required": [
                  "requiredDecision"
                ]
              }
            },
            {
              "not": {
                "required": [
                  "notApplicableReason"
                ]
              }
            },
            {
              "not": {
                "required": [
                  "requestPath"
                ]
              }
            }
          ]
        },
        {
          "properties": {
            "status": {
              "const": "provisional"
            }
          },
          "required": [
            "workingAssumption",
            "guardrails",
            "reviewAt",
            "ifStillOpen",
            "requestPath"
          ],
          "allOf": [
            {
              "not": {
                "required": [
                  "blockReason"
                ]
              }
            },
            {
              "not": {
                "required": [
                  "requiredDecision"
                ]
              }
            },
            {
              "not": {
                "required": [
                  "notApplicableReason"
                ]
              }
            }
          ]
        },
        {
          "properties": {
            "status": {
              "const": "blocked"
            },
            "humanConfirmation": {
              "properties": {
                "required": {
                  "const": true
                }
              }
            }
          },
          "required": [
            "blockReason",
            "requiredDecision",
            "reviewAt",
            "ifStillOpen",
            "requestPath"
          ],
          "allOf": [
            {
              "not": {
                "required": [
                  "workingAssumption"
                ]
              }
            },
            {
              "not": {
                "required": [
                  "guardrails"
                ]
              }
            },
            {
              "not": {
                "required": [
                  "notApplicableReason"
                ]
              }
            }
          ]
        },
        {
          "properties": {
            "status": {
              "const": "not-applicable"
            }
          },
          "required": [
            "notApplicableReason"
          ],
          "allOf": [
            {
              "not": {
                "required": [
                  "workingAssumption"
                ]
              }
            },
            {
              "not": {
                "required": [
                  "guardrails"
                ]
              }
            },
            {
              "not": {
                "required": [
                  "reviewAt"
                ]
              }
            },
            {
              "not": {
                "required": [
                  "ifStillOpen"
                ]
              }
            },
            {
              "not": {
                "required": [
                  "blockReason"
                ]
              }
            },
            {
              "not": {
                "required": [
                  "requiredDecision"
                ]
              }
            },
            {
              "not": {
                "required": [
                  "requestPath"
                ]
              }
            }
          ]
        }
      ]
    },
    "TriggerEvidence": {
      "type": "object",
      "required": [
        "step",
        "field",
        "match"
      ],
      "additionalProperties": false,
      "properties": {
        "step": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 1
        },
        "field": {
          "enum": [
            "files",
            "action"
          ]
        },
        "match": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "InlineDesignContract": {
      "type": "object",
      "required": [
        "summary",
        "details",
        "evidence"
      ],
      "additionalProperties": false,
      "properties": {
        "summary": {
          "type": "string",
          "minLength": 1
        },
        "details": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "evidence": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      }
    },
    "EndStateCoverageRow": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "disposition"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^(EB|PB|EO)-\\d{3}$",
          "description": "The brief end-state id this row accounts for."
        },
        "disposition": {
          "type": "string",
          "enum": [
            "addressed",
            "deferred",
            "not-applicable",
            "blocked"
          ]
        },
        "coveredBy": {
          "type": "string",
          "description": "Anchor in THIS phase's deliverable that accounts for the id — a routing decision, a root-cause candidate, an R-NNN row, or a C-NNN clarification."
        },
        "evidence": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "path:line references backing the mapping."
        },
        "rationale": {
          "type": "string",
          "description": "Required when disposition is not `addressed`: why this phase does not account for the id."
        }
      }
    },
    "DesignSurfaceCoverage": {
      "type": "object",
      "required": [
        "kind",
        "triggerEvidence",
        "disposition"
      ],
      "additionalProperties": false,
      "properties": {
        "kind": {
          "enum": [
            "domain-contract",
            "persistence-schema",
            "external-interface",
            "transaction-consistency",
            "transformation-mapping",
            "lifecycle-state-machine",
            "rollout-observability",
            "manual-user-test",
            "other"
          ]
        },
        "triggerEvidence": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/TriggerEvidence"
          }
        },
        "disposition": {
          "enum": [
            "inline-contract",
            "prep-item",
            "not-applicable"
          ]
        },
        "inlineContract": {
          "$ref": "#/$defs/InlineDesignContract"
        },
        "prepItemId": {
          "type": "string",
          "pattern": "^PREP-[0-9]{3}$"
        },
        "prepItemIds": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": {
            "type": "string",
            "pattern": "^PREP-[0-9]{3}$"
          }
        },
        "rationale": {
          "type": "string",
          "minLength": 1
        }
      },
      "oneOf": [
        {
          "properties": {
            "disposition": {
              "const": "inline-contract"
            }
          },
          "required": [
            "inlineContract"
          ],
          "allOf": [
            {
              "not": {
                "required": [
                  "prepItemId"
                ]
              }
            },
            {
              "not": {
                "required": [
                  "prepItemIds"
                ]
              }
            },
            {
              "not": {
                "required": [
                  "rationale"
                ]
              }
            }
          ]
        },
        {
          "properties": {
            "disposition": {
              "const": "prep-item"
            }
          },
          "allOf": [
            {
              "not": {
                "required": [
                  "inlineContract"
                ]
              }
            },
            {
              "not": {
                "required": [
                  "rationale"
                ]
              }
            }
          ],
          "oneOf": [
            {
              "required": [
                "prepItemId"
              ],
              "not": {
                "required": [
                  "prepItemIds"
                ]
              }
            },
            {
              "required": [
                "prepItemIds"
              ],
              "not": {
                "required": [
                  "prepItemId"
                ]
              }
            }
          ]
        },
        {
          "properties": {
            "disposition": {
              "const": "not-applicable"
            }
          },
          "required": [
            "rationale"
          ],
          "allOf": [
            {
              "not": {
                "required": [
                  "inlineContract"
                ]
              }
            },
            {
              "not": {
                "required": [
                  "prepItemId"
                ]
              }
            },
            {
              "not": {
                "required": [
                  "prepItemIds"
                ]
              }
            }
          ]
        }
      ]
    },
    "ImplementationPlanStage": {
      "type": "object",
      "required": [
        "stage",
        "title",
        "sliceValue",
        "acceptance",
        "carryIn",
        "stepwiseExecution",
        "exitContract",
        "stageValidation"
      ],
      "additionalProperties": false,
      "oneOf": [
        {
          "required": [
            "conformanceTests"
          ],
          "not": {
            "required": [
              "conformanceExemption"
            ]
          }
        },
        {
          "required": [
            "conformanceExemption"
          ],
          "not": {
            "required": [
              "conformanceTests"
            ]
          }
        }
      ],
      "if": {
        "not": {
          "required": [
            "tddExemption"
          ]
        }
      },
      "then": {
        "required": [
          "testCaseSuccess",
          "testCaseBoundary",
          "testCaseFailure"
        ]
      },
      "properties": {
        "stage": {
          "type": "integer",
          "minimum": 1
        },
        "title": {
          "type": "string",
          "minLength": 1
        },
        "sliceValue": {
          "type": "string",
          "minLength": 1
        },
        "acceptance": {
          "type": "string",
          "minLength": 1
        },
        "testCaseSuccess": {
          "type": "string",
          "minLength": 1,
          "description": "Happy-path test case proving the slice works for valid input. Text after the `Test case (success):` prefix."
        },
        "testCaseBoundary": {
          "type": "string",
          "minLength": 1,
          "description": "Boundary/edge test case (empty, min/max, missing). Text after the `Test case (boundary):` prefix. Use `N/A — <reason>` only when no boundary genuinely exists."
        },
        "testCaseFailure": {
          "type": "string",
          "minLength": 1,
          "description": "Failure/negative test case (invalid input, error path). Text after the `Test case (failure):` prefix."
        },
        "conformanceTests": {
          "type": "string",
          "minLength": 1,
          "description": "Text after the `Conformance tests: stage-N — ...` prefix."
        },
        "conformanceExemption": {
          "type": "string",
          "minLength": 1,
          "description": "Text after the `Conformance exemption:` prefix."
        },
        "tddExemption": {
          "type": "string",
          "description": "Optional text after the `TDD exemption:` prefix."
        },
        "carryIn": {
          "type": "string",
          "minLength": 1
        },
        "stepwiseExecution": {
          "type": "array",
          "minItems": 1,
          "maxItems": 6,
          "items": {
            "$ref": "#/$defs/StageStepRow"
          }
        },
        "designSurfaceCoverage": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DesignSurfaceCoverage"
          }
        },
        "exitContract": {
          "type": "string",
          "minLength": 1
        },
        "stageValidation": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "StageStepRow": {
      "type": "object",
      "description": "One stepwise-execution row. `outcome` is the step's success shape and `expectedDetail` is what that looks like in this plan's terms — kept apart so a sentence cannot be written where a verdict belongs.",
      "required": [
        "step",
        "action",
        "files",
        "plannedPaths",
        "command",
        "outcome",
        "expectedDetail"
      ],
      "additionalProperties": false,
      "properties": {
        "step": {
          "type": "integer",
          "minimum": 1
        },
        "action": {
          "type": "string",
          "minLength": 1
        },
        "files": {
          "type": "string",
          "minLength": 1
        },
        "plannedPaths": {
          "description": "Repository-relative paths this step may write, one per entry. `files` is prose for a human reader and cannot serve as a path ledger — it carries globs, exclusions and counts — so the implementer write policy reads this list instead.",
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "command": {
          "type": "string",
          "minLength": 1
        },
        "outcome": {
          "type": "string",
          "enum": [
            "PASS",
            "FAIL"
          ]
        },
        "expectedDetail": {
          "type": "string",
          "minLength": 1
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "action": {
                "pattern": "^RED:"
              }
            },
            "required": [
              "action"
            ]
          },
          "then": {
            "properties": {
              "outcome": {
                "const": "FAIL"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "action": {
                "pattern": "^GREEN:"
              }
            },
            "required": [
              "action"
            ]
          },
          "then": {
            "properties": {
              "outcome": {
                "const": "PASS"
              }
            }
          }
        }
      ]
    },
    "StepRow": {
      "type": "object",
      "required": [
        "step",
        "ticketId",
        "action",
        "files",
        "commandOrTest",
        "expectedOutcome"
      ],
      "additionalProperties": false,
      "properties": {
        "step": {
          "type": "integer",
          "minimum": 1
        },
        "ticketId": {
          "$ref": "#/$defs/TicketId"
        },
        "action": {
          "type": "string",
          "minLength": 1
        },
        "files": {
          "type": "string",
          "minLength": 1
        },
        "commandOrTest": {
          "type": "string",
          "minLength": 1
        },
        "expectedOutcome": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "StageSidecarEvidence": {
      "type": "object",
      "required": [
        "stageNumber",
        "stageTitle",
        "carryJson",
        "consumerRows"
      ],
      "additionalProperties": false,
      "properties": {
        "stageNumber": {
          "type": "integer",
          "minimum": 1
        },
        "stageTitle": {
          "type": "string",
          "minLength": 1
        },
        "carryJson": {
          "type": "string",
          "minLength": 1
        },
        "consumerRows": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "withheld": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "DependencyRow": {
      "type": "object",
      "required": [
        "id",
        "kind",
        "item",
        "impact",
        "mitigation"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^DM-\\d{3,}$"
        },
        "kind": {
          "enum": [
            "order",
            "backfill",
            "flag-precondition",
            "repo-sequencing",
            "cross-project",
            "other"
          ]
        },
        "item": {
          "type": "string",
          "minLength": 1
        },
        "impact": {
          "type": "string",
          "minLength": 1
        },
        "mitigation": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "CrossProjectDependency": {
      "type": "object",
      "required": [
        "id",
        "direction",
        "project",
        "requiredWork",
        "verificationSignal",
        "linkedWork",
        "howToStart"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^XP-\\d{3,}$"
        },
        "direction": {
          "enum": [
            "upstream-precondition",
            "downstream-carry"
          ]
        },
        "project": {
          "type": "string",
          "minLength": 1
        },
        "requiredWork": {
          "type": "string",
          "minLength": 1
        },
        "verificationSignal": {
          "type": "string",
          "minLength": 1
        },
        "linkedWork": {
          "type": "string",
          "minLength": 1
        },
        "howToStart": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "DecisionDraft": {
      "type": "object",
      "required": [
        "number",
        "slug",
        "status",
        "context",
        "decision",
        "consequences",
        "alternativesConsidered"
      ],
      "additionalProperties": false,
      "properties": {
        "number": {
          "type": "string",
          "pattern": "^\\d{4,}$"
        },
        "slug": {
          "type": "string",
          "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
        },
        "status": {
          "enum": [
            "Proposed"
          ]
        },
        "context": {
          "type": "string",
          "minLength": 1
        },
        "decision": {
          "type": "string",
          "minLength": 1
        },
        "consequences": {
          "type": "string",
          "minLength": 1
        },
        "alternativesConsidered": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "SkippedAdrCandidate": {
      "type": "object",
      "required": [
        "topic",
        "reason"
      ],
      "additionalProperties": false,
      "properties": {
        "topic": {
          "type": "string",
          "minLength": 1
        },
        "reason": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "ValidationCheckRow": {
      "type": "object",
      "required": [
        "id",
        "phase",
        "ticketId",
        "check",
        "commandOrObservation",
        "expectedOutcome"
      ],
      "additionalProperties": false,
      "properties": {
        "stageRefs": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"type": "integer", "minimum": 1}},
        "id": {
          "type": "string",
          "pattern": "^VC-\\d{3,}$"
        },
        "phase": {
          "enum": [
            "pre",
            "mid",
            "post"
          ]
        },
        "ticketId": {
          "$ref": "#/$defs/TicketId"
        },
        "check": {
          "type": "string",
          "minLength": 1
        },
        "commandOrObservation": {
          "type": "string",
          "minLength": 1
        },
        "expectedOutcome": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "RollbackRow": {
      "type": "object",
      "required": [
        "id",
        "step",
        "action",
        "triggerSignal",
        "verificationMethod"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^RB-\\d{3,}$"
        },
        "step": {
          "type": "integer",
          "minimum": 1
        },
        "action": {
          "type": "string",
          "minLength": 1
        },
        "triggerSignal": {
          "type": "string",
          "minLength": 1
        },
        "verificationMethod": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "SelfFixGroup": {
      "type": "object",
      "required": [
        "round",
        "causeSummary",
        "itemIds"
      ],
      "additionalProperties": false,
      "properties": {
        "round": {
          "type": "integer",
          "minimum": 1
        },
        "causeSummary": {
          "type": "string",
          "minLength": 1
        },
        "itemIds": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "rewrittenPaths": {
          "type": "array",
          "description": "data.json paths this round actually rewrote for this cause group. A self-fix round is contractually a targeted correction, not a full draft regeneration; recording the reach is what makes that claim checkable later.",
          "uniqueItems": true,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "outsideScopePaths": {
          "type": "array",
          "description": "The subset of rewrittenPaths that lies outside the sections this group's itemIds point at. Carrying a correction to its contradictions legitimately reaches further than the flagged item, so this is a measurement, not a violation.",
          "uniqueItems": true,
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      }
    },
    "SupersessionEntry": {
      "type": "object",
      "required": [
        "clarificationId",
        "disposition"
      ],
      "additionalProperties": false,
      "properties": {
        "clarificationId": {
          "type": "string",
          "pattern": "^C-\\d+$"
        },
        "disposition": {
          "enum": [
            "superseded",
            "no-dependent-statement"
          ]
        },
        "revisedSections": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "supersededStatement": {
          "type": "string",
          "minLength": 1
        },
        "replacedWith": {
          "type": "string",
          "minLength": 1
        },
        "rationale": {
          "type": "string",
          "minLength": 1
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "disposition": {
                "const": "superseded"
              }
            },
            "required": [
              "disposition"
            ]
          },
          "then": {
            "required": [
              "revisedSections",
              "supersededStatement",
              "replacedWith"
            ],
            "properties": {
              "revisedSections": {
                "minItems": 1
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "disposition": {
                "const": "no-dependent-statement"
              }
            },
            "required": [
              "disposition"
            ]
          },
          "then": {
            "required": [
              "rationale"
            ]
          }
        }
      ]
    },
    "PlanBodyVerification": {
      "type": "object",
      "required": [
        "roundCount",
        "gateResult",
        "planItems",
        "dissentLog"
      ],
      "additionalProperties": false,
      "properties": {
        "setAside": {"type": "array", "items": {"type": "object", "required": ["id", "reason"], "additionalProperties": false, "properties": {"id": {"type": "string", "minLength": 1}, "reason": {"type": "string", "enum": ["record", "observed", "deferred"]}}}},
        "stageLedger": {"type": "object", "additionalProperties": {"type": "string", "enum": ["done", "active", "ready", "blocked"]}},
        "dispatchQueue": {
          "type": "array",
          "description": "Plan-item ids sent to verifiers this round. In-scope plus plan-wide; deferred and observed stages are omitted.",
          "items": {"type": "string", "minLength": 1},
          "uniqueItems": true
        },
        "uniformVerifiers": {
          "type": "array",
          "description": "Verifiers whose every vote this round was one verdict. Advisory: a unanimous round is legitimate, but the gate reads as a three-way cross-check unless this sits beside it.",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "worker",
              "verdict",
              "itemCount"
            ],
            "properties": {
              "worker": {
                "type": "string",
                "minLength": 1
              },
              "verdict": {
                "type": "string",
                "minLength": 1
              },
              "itemCount": {
                "type": "integer",
                "minimum": 1
              }
            }
          }
        },
        "gating": {
          "type": "boolean",
          "description": "If false, plan-body verification is advisory: majority-disagree does not block approval, the self-fix loop does not run, and only one automatic round is allowed. Legal only when designPreparation.mode is no-design-inputs and the Stage Map has exactly one row. Prepare emits true; plan-items prepare/seed flip it after those facts exist."
        },
        "roundCount": {
          "type": "integer",
          "minimum": 0
        },
        "gateResult": {
          "enum": [
            "passed",
            "passed-with-dissent",
            "blocked-by-disagreement",
            "aborted-non-result"
          ]
        },
        "gateBlockedBy": {
          "type": "array",
          "uniqueItems": true,
          "items": {
            "enum": [
              "majority-disagree",
              "coverage-gap",
              "non-result"
            ]
          }
        },
        "participatingAnalysers": {
          "type": "object",
          "description": "How many rostered analysers actually cast a non-error vote in this round. The gate arithmetic is unchanged; this records the base it ran on, because a majority over two votes is a different claim than a majority over three.",
          "properties": {
            "rostered": {
              "type": "integer",
              "minimum": 0
            },
            "voting": {
              "type": "integer",
              "minimum": 0
            }
          },
          "required": [
            "rostered",
            "voting"
          ],
          "additionalProperties": false
        },
        "selfFixRoundsApplied": {
          "type": "integer",
          "minimum": 0
        },
        "selfFixGroups": {
          "type": "array",
          "description": "How each self-fix round's targets were grouped by common cause before being handed to report-writer. Several blocked items are usually one defect's derivatives; instructing them as a flat list makes each patch leave its siblings' contradictions standing, so the same family reappears next round.",
          "items": {
            "$ref": "#/$defs/SelfFixGroup"
          }
        },
        "selfFixStopReason": {
          "enum": [
            "not-attempted",
            "all-resolved",
            "no-progress",
            "max-rounds-reached",
            "cause-group-recurrence"
          ]
        },
        "planItems": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "id",
              "subject",
              "verdicts"
            ],
            "additionalProperties": false,
            "properties": {
              "block": {"type": "string", "enum": ["execution", "record"]},
              "stageScope": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"type": "integer", "minimum": 1}},
              "contentHash": {"type": "string", "pattern": "^[a-f0-9]{64}$", "description": "SHA-256 of subject+payload+block+stageScope for the current extract."},
              "verifiedContentHash": {"type": "string", "pattern": "^[a-f0-9]{64}$", "description": "contentHash at the last apply-verdicts. Matching hashes keep a pre-self-fix verdict."},
              "id": {
                "type": "string",
                "minLength": 1
              },
              "subject": {
                "type": "string",
                "minLength": 1
              },
              "sourceSection": {
                "type": "string"
              },
              "carriedForwardFromSeq": {
                "type": "string"
              },
              "clarificationRefs": {
                "type": "array",
                "uniqueItems": true,
                "items": {
                  "type": "string",
                  "pattern": "^C-\\d{3,}$"
                }
              },
              "selfFixNote": {
                "type": "string"
              },
              "verdicts": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "worker",
                    "verdict"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "claimKind": {"description": "Set only on DISAGREE. `fact` claims are settled by reproduction, `judgement` by quorum.", "enum": ["fact", "judgement", null]},
                    "reproduction": {"description": "Set only on a `fact` claim. The probe okstra runs; see okstra_ctl/claim_reproduction.py.", "type": ["object", "null"]},
                    "reproductionResult": {"description": "Written by okstra, not by the worker.", "enum": ["reproduced", "not-reproduced", "not-runnable", null]},
                    "worker": {
                      "type": "string",
                      "minLength": 1
                    },
                    "verdict": {
                      "enum": [
                        "AGREE",
                        "DISAGREE",
                        "SUPPLEMENT",
                        "verification-error"
                      ]
                    },
                    "breakageKind": {
                      "description": "Set only on DISAGREE. `null` and absent are equivalent, matching the sibling `votes.<worker>.disagreeBasis` contract in prompts/lead/convergence.md.",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "fixability": {
                      "description": "Set only on DISAGREE. `null` and absent are equivalent.",
                      "enum": [
                        "planner-fixable",
                        "needs-user-input",
                        null
                      ]
                    },
                    "note": {
                      "type": "string"
                    },
                    "explanation": {
                      "type": "string",
                      "description": "The worker's two-to-three-sentence verdict rationale. Distinct from `note`, which records the falsification candidate considered even on AGREE."
                    },
                    "round": {
                      "description": "The plan-body verification round this verdict was cast in. A self-fix round rewrites the plan after a verification round, so a verdict whose round is at or before `selfFixRoundsApplied` judged text that has since changed. Without it there is no way to tell how many rewrites a surviving verdict predates, and a gate can pass on judgements two generations stale.",
                      "type": "integer",
                      "minimum": 1
                    }
                  }
                }
              }
            }
          }
        },
        "dissentLog": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "planItem",
              "workerRole",
              "body"
            ],
            "additionalProperties": false,
            "properties": {
              "planItem": {
                "type": "string",
                "minLength": 1
              },
              "workerRole": {
                "type": "string",
                "minLength": 1
              },
              "body": {
                "type": "string",
                "minLength": 1
              }
            }
          }
        }
      }
    },
    "ExecutedCommandRow": {
      "type": "object",
      "required": [
        "number",
        "command",
        "exitCode",
        "outputSummary"
      ],
      "additionalProperties": false,
      "properties": {
        "number": {
          "type": "integer",
          "minimum": 1
        },
        "command": {
          "type": "string",
          "minLength": 1
        },
        "exitCode": {
          "type": "integer"
        },
        "outputSummary": {
          "type": "string"
        }
      }
    },
    "CommitRow": {
      "type": "object",
      "required": [
        "shortSha",
        "fullSha",
        "subject",
        "files"
      ],
      "additionalProperties": false,
      "properties": {
        "shortSha": {
          "type": "string",
          "minLength": 7
        },
        "fullSha": {
          "type": "string",
          "minLength": 40
        },
        "subject": {
          "type": "string",
          "minLength": 1
        },
        "files": {
          "type": "string"
        }
      }
    },
    "CommitWithStepRow": {
      "type": "object",
      "required": [
        "number",
        "shortSha",
        "fullSha",
        "planStep",
        "subject",
        "files"
      ],
      "additionalProperties": false,
      "properties": {
        "number": {
          "type": "integer",
          "minimum": 1
        },
        "shortSha": {
          "type": "string",
          "minLength": 7
        },
        "fullSha": {
          "type": "string",
          "minLength": 40
        },
        "planStep": {
          "type": "string",
          "minLength": 1
        },
        "subject": {
          "type": "string",
          "minLength": 1
        },
        "files": {
          "type": "string"
        }
      }
    },
    "DiffFileRow": {
      "type": "object",
      "required": [
        "file",
        "action",
        "lines",
        "planStep"
      ],
      "additionalProperties": false,
      "properties": {
        "file": {
          "type": "string",
          "minLength": 1
        },
        "action": {
          "enum": [
            "created",
            "modified",
            "deleted"
          ]
        },
        "lines": {
          "type": "string",
          "minLength": 1
        },
        "planStep": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "OutOfPlanEditRow": {
      "type": "object",
      "required": [
        "id",
        "file",
        "rationale",
        "trigger"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^OOP-\\d{3,}$"
        },
        "file": {
          "type": "string",
          "minLength": 1
        },
        "rationale": {
          "type": "string",
          "minLength": 1
        },
        "trigger": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "ValidationEvidenceRow": {
      "type": "object",
      "required": [
        "phase",
        "command",
        "exitCode",
        "outputTail"
      ],
      "additionalProperties": false,
      "properties": {
        "phase": {
          "enum": [
            "pre",
            "mid",
            "post"
          ]
        },
        "command": {
          "type": "string",
          "minLength": 1
        },
        "exitCode": {
          "type": "integer"
        },
        "outputTail": {
          "type": "string"
        },
        "tddEvidence": {
          "type": "string"
        }
      }
    },
    "VerifierResultBlock": {
      "type": "object",
      "required": [
        "verifier",
        "verdict",
        "readOnlyCommandLog",
        "independentValidationRerun"
      ],
      "additionalProperties": false,
      "properties": {
        "verifier": {
          "type": "string",
          "minLength": 1
        },
        "verdict": {
          "enum": [
            "PASS",
            "CONCERNS",
            "FAIL"
          ]
        },
        "readOnlyCommandLog": {
          "type": "string"
        },
        "independentValidationRerun": {
          "type": "string"
        },
        "styleLintTypecheck": {
          "type": "string"
        },
        "declinedFixRecommendations": {
          "type": "string"
        },
        "discrepancy": {
          "type": "string"
        }
      }
    },
    "RollbackVerificationRow": {
      "type": "object",
      "required": [
        "category",
        "rollbackCommand",
        "verification",
        "result"
      ],
      "additionalProperties": false,
      "properties": {
        "category": {
          "enum": [
            "Pure code",
            "Feature-flag-gated",
            "Schema/config/stateful"
          ]
        },
        "rollbackCommand": {
          "type": "string",
          "minLength": 1
        },
        "verification": {
          "type": "string",
          "minLength": 1
        },
        "result": {
          "enum": [
            "ok",
            "not-applicable",
            "advisory — human-run"
          ]
        }
      }
    },
    "AddedSurfaceRow": {
      "type": "object",
      "description": "One surface the merged diff added, and what requirement it serves.",
      "required": [
        "id",
        "surface",
        "callers",
        "requirement",
        "disposition",
        "note"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^AS-\\d{3,}$"
        },
        "surface": {
          "type": "string",
          "minLength": 1,
          "description": "path:line plus the added identifier / module / configuration key."
        },
        "callers": {
          "type": "string",
          "minLength": 1,
          "description": "The caller found by searching the whole repository, or `none`. A declaration, its own test, or a commented-out line is not a caller."
        },
        "requirement": {
          "type": "string",
          "description": "The brief requirement this surface serves. Empty unless disposition is `traced`."
        },
        "disposition": {
          "enum": [
            "traced",
            "exempt",
            "over-delivery"
          ]
        },
        "note": {
          "type": "string",
          "minLength": 1,
          "description": "`traced`: how the surface serves the requirement. `exempt`: which exit applies and its cited evidence. `over-delivery`: the `AB-NNN` or `CA-NNN` row this became."
        }
      }
    },
    "AcceptanceBlockerRow": {
      "type": "object",
      "required": [
        "id",
        "severity",
        "statement",
        "evidence",
        "followUpPhase"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^AB-\\d{3,}$"
        },
        "severity": {
          "enum": [
            "critical",
            "major"
          ]
        },
        "statement": {
          "type": "string",
          "minLength": 1
        },
        "evidence": {
          "type": "string",
          "minLength": 1
        },
        "followUpPhase": {
          "enum": [
            "error-analysis",
            "implementation-option-selection",
            "implementation-planning"
          ]
        }
      }
    },
    "ResidualRiskRow": {
      "type": "object",
      "required": [
        "id",
        "item",
        "owner",
        "escalationTrigger"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^RR-\\d{3,}$"
        },
        "item": {
          "type": "string",
          "minLength": 1
        },
        "owner": {
          "type": "string",
          "minLength": 1
        },
        "escalationTrigger": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "RequirementCoverageRow": {
      "type": "object",
      "required": [
        "id",
        "requirement",
        "artifact",
        "status"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^VE-\\d{3,}$"
        },
        "requirement": {
          "type": "string",
          "minLength": 1
        },
        "artifact": {
          "type": "string",
          "minLength": 1
        },
        "status": {
          "type": "string",
          "pattern": "^(covered|blocker AB-\\d{3,}|gap)$"
        }
      }
    },
    "ImplementationRequirementCoverageRow": {
      "type": "object",
      "required": [
        "id",
        "source",
        "requirement",
        "coveredBy",
        "status"
      ],
      "additionalProperties": false,
      "properties": {
        "stageRefs": {"type": "array", "minItems": 1, "uniqueItems": true, "items": {"type": "integer", "minimum": 1}},
        "id": {
          "type": "string",
          "pattern": "^R-\\d{3,}$"
        },
        "source": {
          "type": "string",
          "minLength": 1
        },
        "requirement": {
          "type": "string",
          "minLength": 1
        },
        "coveredBy": {
          "type": "string",
          "minLength": 1
        },
        "status": {
          "type": "string",
          "pattern": "^(covered|gap|blocked C-\\d{3,}|documented-deviation)$"
        },
        "decisionRefs": {
          "type": "array",
          "minItems": 1,
          "uniqueItems": true,
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "approvalDisposition": {
          "type": "string",
          "pattern": "^(accepted|blocked C-\\d{3,})$"
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "status": {
                "const": "documented-deviation"
              }
            },
            "required": [
              "status"
            ]
          },
          "then": {
            "required": [
              "decisionRefs",
              "approvalDisposition"
            ]
          }
        }
      ]
    },
    "ReadonlyCommandRow": {
      "type": "object",
      "required": [
        "number",
        "tier",
        "command",
        "status",
        "exitCode",
        "outputTail"
      ],
      "additionalProperties": false,
      "properties": {
        "number": {
          "type": "integer",
          "minimum": 1
        },
        "tier": {
          "enum": [
            1,
            2,
            3
          ]
        },
        "command": {
          "type": "string",
          "minLength": 1
        },
        "status": {
          "enum": [
            "executed",
            "rejected",
            "not-configured",
            "env-unavailable",
            "advisory"
          ]
        },
        "exitCode": {
          "type": [
            "integer",
            "null"
          ]
        },
        "statusReason": {
          "type": [
            "string",
            "null"
          ]
        },
        "outputTail": {
          "type": "string"
        }
      },
      "allOf": [
        {
          "if": {
            "properties": {
              "status": {
                "const": "executed"
              }
            }
          },
          "then": {
            "properties": {
              "exitCode": {
                "type": "integer"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "status": {
                "const": "rejected"
              }
            }
          },
          "then": {
            "required": [
              "statusReason"
            ]
          }
        },
        {
          "if": {
            "properties": {
              "status": {
                "const": "env-unavailable"
              }
            }
          },
          "then": {
            "required": [
              "statusReason"
            ]
          }
        },
        {
          "if": {
            "properties": {
              "status": {
                "const": "advisory"
              }
            },
            "required": [
              "status"
            ]
          },
          "then": {
            "required": [
              "statusReason"
            ],
            "properties": {
              "tier": {
                "const": 3
              },
              "statusReason": {
                "type": "string",
                "minLength": 1,
                "pattern": ".*\\S.*"
              }
            }
          }
        }
      ]
    },
    "ConditionalAcceptanceConditionRow": {
      "type": "object",
      "required": [
        "id",
        "condition",
        "evidenceRequired",
        "blocksReleaseHandoff"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^CA-\\d{3,}$"
        },
        "condition": {
          "type": "string",
          "minLength": 1
        },
        "evidenceRequired": {
          "type": "string",
          "minLength": 1
        },
        "blocksReleaseHandoff": {
          "type": "boolean"
        }
      }
    },
    "ClarificationRow": {
      "type": "object",
      "required": [
        "id",
        "ticketId",
        "kind",
        "statement",
        "expectedForm",
        "blocks",
        "status"
      ],
      "additionalProperties": false,
      "allOf": [
        {
          "if": {
            "properties": {
              "kind": {
                "const": "decision"
              }
            },
            "required": [
              "kind"
            ]
          },
          "then": {
            "required": [
              "options"
            ],
            "properties": {
              "options": {
                "contains": {
                  "type": "object",
                  "properties": {"role": {"const": "recommended"}},
                  "required": ["role"]
                },
                "minContains": 1,
                "maxContains": 1
              }
            }
          }
        },
        {
          "if": {
            "properties": {"blocks": {"const": "approval"}},
            "required": ["blocks"]
          },
          "then": {"required": ["approvalContext"]}
        },
        {
          "if": {
            "properties": {"status": {"const": "resolved"}},
            "required": ["status"]
          },
          "then": {"required": ["resolution"]},
          "else": {"not": {"required": ["resolution"]}}
        }
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^C-\\d{3,}$"
        },
        "ticketId": {
          "$ref": "#/$defs/TicketId"
        },
        "kind": {
          "$ref": "#/$defs/ClarificationKind"
        },
        "statement": {
          "type": "string",
          "minLength": 1
        },
        "expectedForm": {
          "type": "string",
          "minLength": 1
        },
        "blocks": {
          "$ref": "#/$defs/ClarificationBlocks"
        },
        "status": {
          "$ref": "#/$defs/ClarificationStatus"
        },
        "userInput": {
          "type": "string"
        },
        "origin": {
          "$ref": "#/$defs/ClarificationOrigin"
        },
        "userConfirmation": {
          "$ref": "#/$defs/ClarificationUserConfirmation"
        },
        "options": {
          "type": "array",
          "minItems": 2,
          "items": {
            "$ref": "#/$defs/ClarificationOption"
          }
        },
        "approvalContext": {
          "$ref": "#/$defs/ApprovalContext"
        },
        "resolution": {
          "$ref": "#/$defs/ApprovalResolution"
        }
      }
    },
    "RecommendedStep": {
      "type": "object",
      "required": [
        "text"
      ],
      "additionalProperties": false,
      "properties": {
        "text": {
          "type": "string",
          "minLength": 1
        },
        "commands": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "label",
              "claudeCode",
              "terminal"
            ],
            "additionalProperties": false,
            "properties": {
              "label": {
                "type": "string",
                "minLength": 1
              },
              "claudeCode": {
                "type": "string",
                "minLength": 1
              },
              "terminal": {
                "type": "string",
                "minLength": 1
              }
            }
          }
        }
      }
    },
    "FollowUpRow": {
      "type": "object",
      "required": [
        "id",
        "ticketId",
        "origin",
        "newTaskId",
        "title",
        "suggestedTaskType",
        "scope",
        "reason",
        "priority",
        "autoSpawn"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^FU-\\d{3,}$"
        },
        "ticketId": {
          "$ref": "#/$defs/TicketId"
        },
        "origin": {
          "$ref": "#/$defs/FollowUpOrigin"
        },
        "newTaskId": {
          "type": "string",
          "minLength": 1
        },
        "title": {
          "type": "string",
          "minLength": 1
        },
        "suggestedTaskType": {
          "$ref": "#/$defs/TaskType"
        },
        "scope": {
          "type": "string",
          "minLength": 1
        },
        "reason": {
          "type": "string",
          "minLength": 1
        },
        "priority": {
          "$ref": "#/$defs/Priority"
        },
        "autoSpawn": {
          "enum": [
            "yes",
            "no"
          ]
        }
      },
      "allOf": [
        {
          "description": "phase-continuation rows MUST have autoSpawn=no (advances via /okstra-run, no new dir).",
          "if": {
            "properties": {
              "origin": {
                "const": "phase-continuation"
              }
            }
          },
          "then": {
            "properties": {
              "autoSpawn": {
                "const": "no"
              }
            }
          }
        }
      ]
    },
    "TokenUsageTaskCumulative": {
      "type": "object",
      "description": "Every measured run of this task added up — this report's run plus every earlier one. Written by the Phase 7 token-usage step from the per-run team-states.",
      "required": [
        "totalTokens",
        "cacheReadTokens",
        "billableTokens",
        "costUsd",
        "runCount"
      ],
      "additionalProperties": false,
      "properties": {
        "totalTokens": {
          "type": "integer",
          "minimum": 0
        },
        "cacheReadTokens": {
          "type": "integer",
          "minimum": 0
        },
        "billableTokens": {
          "type": "integer",
          "minimum": 0
        },
        "costUsd": {
          "type": "number",
          "minimum": 0
        },
        "runCount": {
          "type": "integer",
          "minimum": 1
        }
      }
    }
  }
}
