{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://workspai.dev/schemas/workspace-intelligence/workspace-intelligence-history.v1.json",
  "title": "Workspai Workspace Intelligence History",
  "type": "object",
  "required": ["schemaVersion", "retention", "entries"],
  "properties": {
    "schemaVersion": { "const": "workspace-intelligence-history.v1" },
    "retention": { "type": "integer", "minimum": 1 },
    "entries": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["generatedAt"],
        "properties": {
          "generatedAt": { "type": "string", "format": "date-time" },
          "kind": { "enum": ["verify", "agent-action", "doctor-fix"] },
          "verdict": { "enum": ["ready", "needs-attention", "blocked"] },
          "risk": { "type": "string" },
          "affectedProjects": { "type": "integer", "minimum": 0 },
          "freshness": { "enum": ["fresh", "stale", "unknown"] },
          "gatePassed": { "type": "boolean" },
          "blockingReasons": { "type": "integer", "minimum": 0 },
          "policyViolations": { "type": "integer", "minimum": 0 },
          "actionId": { "type": "string" },
          "scope": { "type": "string" },
          "summary": { "type": "string" },
          "outcome": { "enum": ["ok", "failed"] },
          "evidenceSha256": { "type": "string" },
          "applied": { "type": "integer", "minimum": 0 },
          "failed": { "type": "integer", "minimum": 0 },
          "skipped": { "type": "integer", "minimum": 0 },
          "remainingBlockers": { "type": "integer", "minimum": 0 }
        },
        "additionalProperties": true
      }
    }
  },
  "additionalProperties": false
}
