{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://github.com/danilo-aguiar-br/sqlite-graphrag/schemas/graph.schema.json",
"title": "GraphSnapshot",
"description": "Response emitted by `sqlite-graphrag graph --format json` on stdout as a single JSON line. Exit codes: 0 success, 1 runtime error, 2 CLI usage error.",
"$defs": {
"NodeOut": {
"type": "object",
"required": ["id", "name", "namespace", "kind", "type"],
"additionalProperties": false,
"properties": {
"id": { "type": "integer" },
"name": { "type": "string" },
"namespace": { "type": "string" },
"kind": { "type": "string", "description": "GAP-SG-231: DEPRECATED alias of `type`, kept for backward compatibility with pre-v1.0.35 clients. Mirrors `type` while the deprecation window is active, and will be removed in a future major release. New consumers MUST NOT read it. Until v1.2.8 this document said the opposite of `NodeOut` in src/commands/graph_export/formats.rs — `type` was described as the duplicate — so a caller who read the published schema was pointed at the field being retired." },
"type": { "type": "string", "description": "GAP-SG-231: canonical entity classification (organization, concept, person, etc.). This is the field new consumers MUST read; `kind` merely mirrors it for the length of the deprecation window." },
"description": { "type": "string", "description": "The entity's stored description. Omitted when NULL or empty. Added so entity descriptions have a bulk read path: previously they could only be read one memory at a time via `memory-entities`." }
}
},
"EdgeOut": {
"type": "object",
"required": ["from", "to", "relation", "weight"],
"additionalProperties": false,
"properties": {
"from": { "type": "string", "description": "Source entity name." },
"to": { "type": "string", "description": "Target entity name." },
"relation": { "type": "string" },
"weight": { "type": "number", "minimum": 0.0, "maximum": 1.0 }
}
}
},
"type": "object",
"required": ["nodes", "edges", "elapsed_ms"],
"additionalProperties": false,
"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." },
"nodes": { "type": "array", "items": { "$ref": "#/$defs/NodeOut" } },
"entities": { "type": "array", "items": { "$ref": "#/$defs/NodeOut" }, "description": "Alias for nodes (v1.0.66). LLM-friendly field name." },
"edges": { "type": "array", "items": { "$ref": "#/$defs/EdgeOut" } },
"elapsed_ms": { "type": "integer", "minimum": 0, "description": "Wall-clock time in milliseconds." }
}
}