{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://chainchoice.io/methodology/spec/decision-dna.schema.json",
  "title": "ChainChoice Decision DNA",
  "description": "The cognitive-stack Level 4 surface. Decision DNA is the per-user behavioral fingerprint inferred from how they make decisions, not what they decide. The classifier produces a decision_style label; this schema is the full feature vector that the label is derived from.",
  "type": "object",
  "required": ["session_id", "computed_at", "features"],
  "properties": {
    "session_id": { "type": "string", "description": "Anonymized session identifier — never tied to a logged-in user without explicit consent." },
    "computed_at": { "type": "string", "format": "date-time" },
    "engine_version": { "type": "string" },
    "decision_style": {
      "type": "string",
      "enum": [
        "lowest_regret",
        "balanced_precision",
        "best_fit",
        "speed_first",
        "evidence_maximalist",
        "deliberative_comparator"
      ],
      "description": "Cluster label assigned by the weekly k-means run. Six clusters chosen as the dominant separating axes (regret-aversion × evidence-depth × completion-speed)."
    },
    "confidence": {
      "type": "number",
      "minimum": 0,
      "maximum": 1,
      "description": "Distance-to-centroid normalized to [0,1]. <0.5 means borderline; downstream surfaces should hedge."
    },
    "features": {
      "type": "object",
      "description": "Raw features. Each field is normalized to [0,1] where applicable so cluster centroids stay interpretable.",
      "properties": {
        "median_time_per_question_seconds": { "type": "number", "minimum": 0 },
        "answer_revision_count": { "type": "integer", "minimum": 0, "description": "How many times the user changed an answer before completing the wizard." },
        "alternatives_inspected": { "type": "integer", "minimum": 0, "description": "Distinct alternatives the user clicked-through-to in the results page." },
        "alternatives_inspected_norm": { "type": "number", "minimum": 0, "maximum": 1 },
        "receipt_dwell_seconds": { "type": "number", "minimum": 0, "description": "Time spent on the receipt page before navigating away." },
        "receipt_dwell_norm": { "type": "number", "minimum": 0, "maximum": 1 },
        "outbound_cta_clicked": { "type": "boolean" },
        "saved_to_watchlist": { "type": "boolean" },
        "explanation_endpoint_viewed": { "type": "boolean", "description": "Did the user open the GDPR explanation surface?" },
        "scroll_depth_pct": { "type": "number", "minimum": 0, "maximum": 100 },
        "completion_seconds": { "type": "number", "minimum": 0 }
      }
    }
  }
}
