{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/coldstate-ai/json-schema/coldstate-ai-related-response-schema.json",
  "title": "RelatedResponse",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/coldstate-ai-openapi.yml#/components/schemas/RelatedResponse",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "kb_snapshot": {
      "type": [
        "string",
        "null"
      ]
    },
    "related": {
      "type": "array",
      "items": {
        "allOf": [
          {
            "$ref": "#/$defs/KnowledgeResult"
          },
          {
            "type": "object",
            "properties": {
              "relation": {
                "type": "string",
                "enum": [
                  "same-cluster",
                  "neighbor-cluster"
                ]
              },
              "cross_domain": {
                "type": "boolean"
              }
            }
          }
        ]
      }
    }
  },
  "$defs": {
    "KnowledgeResult": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Stable entry id"
        },
        "title": {
          "type": "string"
        },
        "snippet": {
          "type": "string"
        },
        "metadata": {
          "type": "object",
          "properties": {
            "domain": {
              "type": "string"
            },
            "source": {
              "type": "string"
            }
          }
        },
        "score": {
          "$ref": "#/$defs/Score"
        },
        "state": {
          "$ref": "#/$defs/State"
        }
      }
    },
    "Score": {
      "type": "object",
      "properties": {
        "Ψ": {
          "type": "number",
          "minimum": 0,
          "maximum": 1
        }
      },
      "required": [
        "Ψ"
      ]
    },
    "State": {
      "type": "string",
      "enum": [
        "CRYSTALLINE",
        "FLUID",
        "REACTIVE",
        "DECOHERENT"
      ],
      "description": "Result confidence state derived from the Ψ score"
    }
  }
}