{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://skill-map.ai/spec/v1/findings/report.schema.json",
  "title": "FindingsReport",
  "description": "Canonical findings envelope: the report shape every probabilistic Analyzer records. A probabilistic Analyzer's `report.schema.json` MUST extend this schema via `$ref` (typically inside `allOf`); the kernel enforces the reference at load time (`invalid-manifest` otherwise) and `sm record` writes the validated `findings` array through to `state_findings` (see `job-lifecycle.md` §Record). Extends `report-base.schema.json`, so every findings report also carries the model's `confidence` and the `safety` block. The envelope and the per-finding item are deliberately open (no `additionalProperties: false`): a finder's own schema MAY narrow `type` to an enum of its categories and MAY add evidence fields per finding. Stability: experimental.",
  "allOf": [
    { "$ref": "../report-base.schema.json" }
  ],
  "type": "object",
  "required": ["findings"],
  "properties": {
    "confidence": true,
    "safety": true,
    "findings": {
      "type": "array",
      "description": "Zero or more findings against the job's target node. An empty array is a legitimate clean verdict: it still replaces the finder's previous rows for the node (see `db-schema.md` §state_findings, replace semantics).",
      "items": {
        "type": "object",
        "required": ["type", "severity", "message"],
        "properties": {
          "type": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9-]*$",
            "description": "Finder-defined category slug (kebab-case), e.g. `contradiction`, `incoherence`, `redundancy`, `low-quality`. The slugs `injection-detected`, `content-suspicious`, and `content-malformed` are RESERVED for kernel-derived safety findings (`origin = 'kernel'`) and MUST NOT be emitted by extensions."
          },
          "severity": {
            "type": "string",
            "enum": ["info", "warn", "error"],
            "description": "Finder-assigned weight. Findings never drive exit codes (they are probabilistic, advisory by construction); severity feeds display ordering and filtering only."
          },
          "message": {
            "type": "string",
            "minLength": 1,
            "description": "One-sentence human-readable statement of the finding."
          },
          "confidence": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "description": "Optional per-finding confidence. When absent, the report-level `confidence` applies to the row."
          },
          "detail": {
            "type": "string",
            "description": "Optional longer evidence: quoted spans, reasoning, a suggested rewrite. Rendered by `sm findings` detail output and the UI card body."
          }
        }
      }
    }
  }
}
