{
  "$defs": {
    "MemoryTurn": {
      "description": "A single stored conversation turn.\n\nAttributes:\n    role: Who spoke (user/assistant/system/tool).\n    content: The turn text.",
      "properties": {
        "role": {
          "$ref": "#/$defs/Role"
        },
        "content": {
          "title": "Content",
          "type": "string"
        }
      },
      "required": [
        "role",
        "content"
      ],
      "title": "MemoryTurn",
      "type": "object"
    },
    "Role": {
      "description": "Chat message roles, normalised across providers.",
      "enum": [
        "system",
        "user",
        "assistant",
        "tool"
      ],
      "title": "Role",
      "type": "string"
    },
    "SearchHit": {
      "description": "A single retrieval result.\n\nAttributes:\n    chunk_id: The matching chunk ID.\n    document_id: The parent document ID.\n    score: Similarity/relevance score (higher is better).\n    text: The chunk text.\n    metadata: Chunk metadata/provenance.",
      "properties": {
        "chunk_id": {
          "title": "Chunk Id",
          "type": "string"
        },
        "document_id": {
          "title": "Document Id",
          "type": "string"
        },
        "score": {
          "title": "Score",
          "type": "number"
        },
        "text": {
          "title": "Text",
          "type": "string"
        },
        "metadata": {
          "additionalProperties": true,
          "title": "Metadata",
          "type": "object"
        }
      },
      "required": [
        "chunk_id",
        "document_id",
        "score",
        "text"
      ],
      "title": "SearchHit",
      "type": "object"
    }
  },
  "description": "Assembled context for the next model call.\n\nAttributes:\n    summary: Compressed summary of older turns (if any).\n    recent: The working window of recent turns.\n    recalled: Episodic memories semantically relevant to the query.",
  "properties": {
    "summary": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Summary"
    },
    "recent": {
      "items": {
        "$ref": "#/$defs/MemoryTurn"
      },
      "title": "Recent",
      "type": "array"
    },
    "recalled": {
      "items": {
        "$ref": "#/$defs/SearchHit"
      },
      "title": "Recalled",
      "type": "array"
    }
  },
  "title": "ConversationContext",
  "type": "object"
}
