{
"$defs": {
"RelatedMemory": {
"additionalProperties": false,
"properties": {
"description": {
"type": "string"
},
"hop_distance": {
"minimum": 1,
"type": "integer"
},
"memory_id": {
"type": "integer"
},
"name": {
"type": "string"
},
"namespace": {
"type": "string"
},
"relation": {
"type": [
"string",
"null"
]
},
"source_entity": {
"description": "Present when traversal found a relationship.",
"type": [
"string",
"null"
]
},
"target_entity": {
"type": [
"string",
"null"
]
},
"type": {
"type": "string"
},
"weight": {
"maximum": 1.0,
"minimum": 0.0,
"type": [
"number",
"null"
]
},
"from": {
"type": [
"string",
"null"
],
"description": "Alias of `source_entity`, kept for cross-command consistency with `graph`, `link` and `deep-research`. Skipped on the wire when the arriving edge has no source name, which is why the closed definition validated every EMPTY `results` while rejecting a populated one (GAP-SG-291)."
},
"to": {
"type": [
"string",
"null"
],
"description": "Alias of `target_entity`; same aliasing and same skip rule as `from` (GAP-SG-291)."
}
},
"required": [
"memory_id",
"name",
"namespace",
"type",
"description",
"hop_distance"
],
"type": "object"
}
},
"$id": "https://github.com/danilo-aguiar-br/sqlite-graphrag/schemas/related.schema.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false,
"description": "Response emitted by `sqlite-graphrag related` on stdout as a single JSON line. Exit codes: 0 success, 1 runtime error, 2 CLI usage error, 4 not found.",
"properties": {
"agent_surface": {
"$ref": "https://github.com/danilo-aguiar-br/sqlite-graphrag/schemas/agent-surface.schema.json#/$defs/AgentSurfaceMeta"
},
"truncated": {
"type": "boolean",
"description": "GAP-SG-142: raised by the agent-native surface whenever it removed data from this envelope."
},
"count": {
"type": "integer",
"minimum": 0,
"description": "GAP-SG-142: emitted under --count-only, which replaces the payload. See agent-surface.schema.json#/$defs/CountOnlyEnvelope."
},
"elapsed_ms": {
"description": "Wall-clock time in milliseconds.",
"minimum": 0,
"type": "integer"
},
"max_hops": {
"description": "Maximum traversal depth requested.",
"minimum": 1,
"type": "integer"
},
"name": {
"description": "Name of the seed memory.",
"type": "string"
},
"related_memories": {
"description": "Alias for results (v1.0.66). LLM-friendly field name. Identical content. GAP-SG-142: dropped, and listed under `agent_surface.aliases_removed`, whenever the agent-native surface reshapes `results`.",
"type": "array",
"items": {
"type": "object"
}
},
"results": {
"items": {
"$ref": "#/$defs/RelatedMemory"
},
"type": "array"
}
},
"required": [
"results",
"elapsed_ms"
],
"title": "RelatedResponse",
"type": "object"
}