{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/latitude-so/json-schema/latitude-so-agent-score-causes-schema.json",
  "title": "AgentScoreCauses",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/latitude-so-agent-score-api-openapi.yml#/components/schemas/AgentScoreCauses",
  "type": "object",
  "properties": {
    "status": {
      "type": "string",
      "enum": [
        "ready",
        "notComputed"
      ],
      "description": "`notComputed` when no matching explanation is available for today; any published score remains valid."
    },
    "explanation": {
      "$ref": "#/$defs/AgentScoreExplanation"
    }
  },
  "required": [
    "status",
    "explanation"
  ],
  "$defs": {
    "AgentScoreCauseRow": {
      "type": "object",
      "properties": {
        "causeId": {
          "type": "string",
          "description": "Stable identifier of the metric, claim or finding kind behind this row."
        },
        "label": {
          "type": "string",
          "description": "Human-readable name for the cause."
        },
        "attributedDeficit": {
          "type": "number",
          "description": "Points of the dimension's deficit attributed to this cause. Attributed deficits across a dimension add up; they are not a prediction of what fixing it returns."
        },
        "fixGain": {
          "type": "number",
          "description": "Points the dimension would recover if this cause alone disappeared. Fix gains overlap between causes and must never be summed."
        },
        "evidence": {
          "type": "string",
          "enum": [
            "measured",
            "associated"
          ],
          "description": "`measured` when the reader observed the effect directly; `associated` when it was estimated from matched comparison sessions and no causal claim is made."
        },
        "nativeEffect": {
          "type": "object",
          "properties": {
            "value": {
              "type": "number",
              "description": "Size of the effect in its own unit, before it became score points."
            },
            "unit": {
              "type": "string",
              "description": "Unit the value is in, such as nanoseconds, sessions, or a Cost family."
            }
          },
          "required": [
            "value",
            "unit"
          ],
          "description": "The effect in the dimension's own terms, which is what the row shows beside the points."
        },
        "observationCount": {
          "type": "integer",
          "description": "Independent observations behind the row. Coverage context, not a score."
        },
        "destination": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "sessions",
            "tools",
            "memory",
            "cost",
            "signals",
            null
          ],
          "description": "Product section that owns this evidence, or `null` when nothing specific can be opened."
        }
      },
      "required": [
        "causeId",
        "label",
        "attributedDeficit",
        "fixGain",
        "evidence",
        "nativeEffect",
        "observationCount",
        "destination"
      ]
    },
    "AgentScoreDimensionAttribution": {
      "type": "object",
      "properties": {
        "scoreDimension": {
          "type": "string",
          "enum": [
            "outcome",
            "reliability",
            "cost",
            "speed",
            "safety"
          ],
          "description": "Dimension explained."
        },
        "rows": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AgentScoreCauseRow"
          },
          "description": "Causes, most responsible first."
        },
        "residual": {
          "type": "number",
          "description": "Points of the deficit no named cause accounts for, including estimation error."
        },
        "totalDeficit": {
          "type": "number",
          "description": "The dimension's whole distance from healthy, in points."
        },
        "method": {
          "type": "string",
          "enum": [
            "exact",
            "sampled"
          ],
          "description": "`sampled` when there were too many causes to attribute exactly."
        },
        "approximationError": {
          "type": [
            "number",
            "null"
          ],
          "description": "Standard error of the sampled shares in points, or `null` when attribution was exact."
        }
      },
      "required": [
        "scoreDimension",
        "rows",
        "residual",
        "totalDeficit",
        "method",
        "approximationError"
      ]
    },
    "AgentScoreExplanation": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "computedAt": {
          "type": "string",
          "description": "When this evidence was computed, as an ISO-8601 timestamp. Retained explanations keep the original score computation time."
        },
        "scoringVersion": {
          "type": "string",
          "description": "Scoring version the evidence was read under."
        },
        "windowDays": {
          "type": "integer",
          "description": "Length in days of the window the evidence covers."
        },
        "eligibleSessionCount": {
          "type": "integer",
          "description": "Production sessions in that window."
        },
        "attribution": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AgentScoreDimensionAttribution"
          },
          "description": "Per-dimension cause rows for the dimensions that support a counterfactual."
        },
        "outcomeIssues": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AgentScoreIssueRow"
          },
          "description": "Where task failures concentrate. Reach only; these rows carry no share of the score."
        },
        "safetyConfirmedHarm": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AgentScoreIssueRow"
          },
          "description": "Issues where the agent caused confirmed harm."
        },
        "safetyExposure": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AgentScoreIssueRow"
          },
          "description": "Hostile or sensitive content the agent received. Exposure is context and never lowers Safety."
        }
      },
      "required": [
        "computedAt",
        "scoringVersion",
        "windowDays",
        "eligibleSessionCount",
        "attribution",
        "outcomeIssues",
        "safetyConfirmedHarm",
        "safetyExposure"
      ],
      "description": "Evidence for today's UTC date, retained with the published score when available, or `null` if unavailable."
    },
    "AgentScoreIssueRow": {
      "type": "object",
      "properties": {
        "issueKey": {
          "type": "string",
          "description": "Stable identifier for the issue."
        },
        "label": {
          "type": "string",
          "description": "Human-readable name for the issue."
        },
        "signalIds": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Signals this issue was observed through, if any."
        },
        "estimatedReach": {
          "type": [
            "number",
            "null"
          ],
          "description": "Sessions the issue touched, corrected for how often it could be observed. `null` when the correction is unknown."
        },
        "estimatedAdverseReach": {
          "type": [
            "number",
            "null"
          ],
          "description": "Sessions it touched that went badly, corrected the same way. `null` when unknown."
        },
        "examinedSessions": {
          "type": "integer",
          "description": "Raw sessions examined. Coverage context, never a ranking key."
        },
        "examinedAdverseSessions": {
          "type": "integer",
          "description": "Raw examined sessions that went badly."
        },
        "ranked": {
          "type": "boolean",
          "description": "`false` when a required joint observation probability was unknown, so the row explains without claiming a position."
        }
      },
      "required": [
        "issueKey",
        "label",
        "signalIds",
        "estimatedReach",
        "estimatedAdverseReach",
        "examinedSessions",
        "examinedAdverseSessions",
        "ranked"
      ]
    }
  }
}