{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://daarion.city/schemas/cm_payload_v1.json", "title": "Co-Memory Payload Schema v1", "description": "Canonical payload schema for Qdrant vectors in DAARION platform", "type": "object", "required": [ "schema_version", "tenant_id", "owner_kind", "owner_id", "scope", "visibility", "indexed", "source_kind", "source_id", "chunk", "fingerprint", "created_at" ], "properties": { "schema_version": { "type": "string", "const": "cm_payload_v1", "description": "Schema version identifier" }, "tenant_id": { "type": "string", "pattern": "^t_[a-z0-9_]+$", "description": "Tenant identifier (t_)" }, "team_id": { "type": ["string", "null"], "pattern": "^team_[a-z0-9_]+$", "description": "Team identifier (team_)" }, "project_id": { "type": ["string", "null"], "pattern": "^proj_[a-z0-9_]+$", "description": "Project identifier (proj_)" }, "agent_id": { "type": ["string", "null"], "pattern": "^agt_[a-z0-9_]+$", "description": "Agent identifier (agt_)" }, "owner_kind": { "type": "string", "enum": ["user", "team", "agent"], "description": "Type of owner" }, "owner_id": { "type": "string", "minLength": 1, "description": "Owner identifier" }, "scope": { "type": "string", "enum": ["docs", "messages", "memory", "artifacts", "signals"], "description": "Content type/scope" }, "visibility": { "type": "string", "enum": ["public", "confidential", "private"], "description": "Access visibility level" }, "indexed": { "type": "boolean", "description": "Whether content is searchable by AI" }, "source_kind": { "type": "string", "enum": ["document", "wiki", "message", "artifact", "web", "code"], "description": "Type of source content" }, "source_id": { "type": "string", "pattern": "^(doc|msg|art|web|code)_[A-Za-z0-9]+$", "description": "Source identifier with type prefix" }, "chunk": { "type": "object", "required": ["chunk_id", "chunk_idx"], "properties": { "chunk_id": { "type": "string", "pattern": "^chk_[A-Za-z0-9]+$", "description": "Chunk identifier" }, "chunk_idx": { "type": "integer", "minimum": 0, "description": "Chunk index within source" } } }, "fingerprint": { "type": "string", "minLength": 1, "description": "Content hash for deduplication" }, "created_at": { "type": "string", "format": "date-time", "description": "Creation timestamp (ISO 8601)" }, "updated_at": { "type": ["string", "null"], "format": "date-time", "description": "Last update timestamp (ISO 8601)" }, "acl": { "type": "object", "properties": { "read_team_ids": { "type": "array", "items": {"type": "string"}, "description": "Teams with read access" }, "read_agent_ids": { "type": "array", "items": {"type": "string"}, "description": "Agents with read access" }, "read_role_ids": { "type": "array", "items": {"type": "string"}, "description": "Roles with read access" } } }, "tags": { "type": "array", "items": {"type": "string"}, "description": "Content tags for filtering" }, "lang": { "type": ["string", "null"], "pattern": "^[a-z]{2}(-[A-Z]{2})?$", "description": "Language code (ISO 639-1)" }, "importance": { "type": ["number", "null"], "minimum": 0, "maximum": 1, "description": "Importance score (0-1)" }, "ttl_days": { "type": ["integer", "null"], "minimum": 1, "description": "Auto-delete after N days" }, "channel_id": { "type": ["string", "null"], "description": "Channel/chat identifier for messages" }, "embedding": { "type": "object", "properties": { "model": { "type": "string", "description": "Embedding model identifier" }, "dim": { "type": "integer", "minimum": 1, "description": "Vector dimension" }, "metric": { "type": "string", "enum": ["cosine", "dot", "euclidean"], "description": "Distance metric" } } } }, "additionalProperties": true }