{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "ai.stravica.knowledge.research/plan.schema.json",
  "title": "Research plan",
  "description": "plan.json at sessions/<sessionId>/plan.json. `run` writes a skeleton (empty subQuestions, mode-derived rounds/tier); the workflow (w-017) fills subQuestions. Validator: src/store/plan.mjs.",
  "type": "object",
  "additionalProperties": false,
  "required": ["subQuestions", "deepeningRounds", "verificationTier"],
  "properties": {
    "subQuestions": {
      "type": "array",
      "description": "Dependency-classified decomposition (build-spec §4). Empty until the planner fills it.",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id", "text", "kind", "dependsOn"],
        "properties": {
          "id": { "type": "string", "minLength": 1 },
          "text": { "type": "string", "minLength": 1 },
          "kind": { "type": "string", "enum": ["independent", "dependent"] },
          "dependsOn": {
            "type": "array",
            "items": { "type": "string" },
            "description": "Sub-question ids this one depends on. Empty for independent facets."
          },
          "claimClass": {
            "type": "string",
            "enum": ["sourced", "analysis"],
            "default": "sourced",
            "description": "Set by the planner from the sub-question shape. analysis = an allocation shape, trade-off or recommendation whose claims are inference; the unsourced guard ignores it. Optional; absent means sourced (w-2026-10-19-dave-009)."
          }
        }
      }
    },
    "deepeningRounds": {
      "type": "integer",
      "minimum": 0,
      "maximum": 3,
      "description": "0 for light, 1 for normal, up to 3 for deep."
    },
    "verificationTier": {
      "type": "string",
      "enum": ["none", "central-3vote", "diverse-lens-3vote"],
      "description": "none (light), central-3vote (normal), diverse-lens-3vote (deep)."
    }
  }
}
