{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://hypotize.ai/specs/hypotize-experiment-record-v1.json",
  "title": "Hypotize experiment record",
  "description": "Open, versioned description of the experiment fields accepted and returned by Hypotize. Derived from server/src/modules/experiments/schemas.ts on 2026-08-29.",
  "version": "1.0.0",
  "type": "object",
  "required": ["title", "shortIdea", "funnel", "framework"],
  "properties": {
    "id": { "type": "string", "format": "uuid", "readOnly": true },
    "projectId": { "type": "string", "format": "uuid", "readOnly": true },
    "title": { "type": "string", "minLength": 1, "maxLength": 240 },
    "shortIdea": { "type": "string", "minLength": 1, "maxLength": 2000 },
    "description": { "type": ["string", "null"], "maxLength": 20000 },
    "funnel": {
      "type": "string",
      "enum": ["Awareness", "Acquisition", "Activation", "Revenue", "Retention", "Referral"]
    },
    "framework": { "type": "string", "enum": ["ICE", "PIE", "RICE", "CUSTOM"] },
    "tags": {
      "type": "array",
      "maxItems": 100,
      "items": { "type": "string", "minLength": 1, "maxLength": 100 }
    },
    "ownerId": { "type": ["string", "null"], "format": "uuid" },
    "status": {
      "type": ["string", "null"],
      "enum": ["Idea", "Approved", "Ready", "Running", "Analyzing", "Winning", "Failed", "Learned", "Archived", "Inconclusive", "Testing", "Analysis", null]
    },
    "validated": { "type": ["boolean", "null"] },
    "priorityScore": { "type": "number" },
    "targetMetric": { "type": ["string", "null"], "maxLength": 1000 },
    "primaryKpi": {
      "oneOf": [
        { "$ref": "#/$defs/kpi" },
        { "type": "null" }
      ]
    },
    "secondaryKpis": {
      "type": "array",
      "maxItems": 20,
      "items": { "$ref": "#/$defs/kpi" }
    },
    "actionPlan": {
      "type": "array",
      "maxItems": 500,
      "items": { "$ref": "#/$defs/actionItem" }
    },
    "result": { "type": ["string", "null"], "enum": ["Win", "Lose", "Neutral", null] },
    "learningSummary": { "type": ["string", "null"], "maxLength": 20000 },
    "evidenceLinks": {
      "type": "array",
      "maxItems": 100,
      "items": { "type": "string", "minLength": 1, "maxLength": 2048 }
    },
    "dueDate": { "type": ["string", "null"], "format": "date-time" },
    "createdAt": { "type": ["string", "null"], "format": "date-time", "readOnly": true },
    "updatedAt": { "type": ["string", "null"], "format": "date-time", "readOnly": true },
    "initialInsight": { "type": ["string", "null"], "maxLength": 20000 },
    "researchBackground": { "type": ["string", "null"], "maxLength": 20000 },
    "hypothesis": { "type": ["string", "null"], "maxLength": 20000 },
    "successMetric": { "type": ["string", "null"], "maxLength": 2000 },
    "failCriterion": { "type": ["string", "null"], "maxLength": 2000 },
    "baselineValue": { "type": ["string", "null"], "maxLength": 2000 },
    "targetSegment": { "type": ["string", "null"], "maxLength": 2000 },
    "startDate": { "type": ["string", "null"], "format": "date-time" },
    "actualResult": { "type": ["string", "null"], "maxLength": 20000 },
    "nextSteps": { "type": ["string", "null"], "maxLength": 20000 },
    "customFrameworkId": { "type": ["string", "null"], "format": "uuid" }
  },
  "$defs": {
    "kpi": {
      "type": "object",
      "required": ["name", "why", "actionsItUnlocks"],
      "properties": {
        "name": { "type": "string", "minLength": 1, "maxLength": 240 },
        "why": { "type": "string", "maxLength": 2000 },
        "actionsItUnlocks": { "type": "string", "maxLength": 2000 }
      },
      "additionalProperties": false
    },
    "actionItem": {
      "type": "object",
      "required": ["id", "title", "estimatedHours", "completed"],
      "properties": {
        "id": { "type": "string", "minLength": 1, "maxLength": 240 },
        "title": { "type": "string", "minLength": 1, "maxLength": 1000 },
        "estimatedHours": { "type": "number", "minimum": 0, "maximum": 10000 },
        "assigneeId": { "type": "string", "format": "uuid" },
        "completed": { "type": "boolean" }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
