Skip to content

index.json Schema

index.json is the serialized knowledge graph for a knowledge space. Every build writes one. It sits next to the .indx archive and is also copied inside it. Its chunk shape matches the canonical shape used throughout the pipeline.

The file contains the document graph, the chunks, the resolved relations, build metadata, and aggregate stats. It holds everything except the vectors. Embeddings live separately under embeddings/, which keeps the graph small, diffable, and easy to read.

Running indx ./docs --out ./ai-ready writes index.json both as a top-level file in the output directory and as an entry inside the sealed archive:

ai-ready/
├── handbook.indx # portable archive (contains a copy of index.json)
├── index.json # the knowledge graph (this page)
├── chunks/ # per-chunk files (same chunk shape + resolved context)
└── embeddings/ # vectors + manifest (NOT in index.json)

The on-disk index.json and the copy inside the archive are identical. For the full container layout and manifest.json, see the .indx archive reference.

A chunk is the retrievable unit of content. Every chunk records where it came from in source, what sits next to it in neighbors, and any typed edges it owns in relations. This exact shape appears in the chunks[] array and in the per-chunk files under chunks/.

{
"id": "7bd8f3a4c91e0b52",
"doc_id": "0e1f2a3b4c5d6e7f",
"position": 1,
"text": "Enterprise data is retained for 90 days…",
"prev_id": "2f8c9b4a1d0e6c31",
"next_id": "a1c9e33b72d45f00",
"source": { "path": "policies/data/retention.pdf", "folder": "policies/data", "type": "policy" },
"metadata": { "topics": ["retention", "compliance"], "summary": "90-day retention rule…" },
"relations": [ { "src": "7bd8f3a4c91e0b52", "dst": "legal/gdpr.md", "type": "references", "score": 1.0 } ]
}
FieldTypeNotes
idstringStable deterministic id generated from document id and position.
doc_idstringParent document id.
positioninteger0-based position within the parent document.
textstringThe retrievable text payload.
sourceobjectProvenance: path, folder, type (see source).
prev_id / next_idstring or nullAdjacent chunk ids.
metadataobjectEnriched fields: topics (string[]), summary (string), tags (string[]).
relationsarrayOutgoing typed edges from this chunk (see relation).

The root of index.json is the serialized KnowledgeSpace. The required keys are version, root, documents, and chunks. Normal builds also include metadata, stats, and relations.

{
"version": "1.0",
"root": "/abs/path/docs",
"metadata": {
"tool_version": "indx 0.4.2",
"created_at": "2026-06-06T12:00:00Z",
"embedder": { "name": "text-embedding-3-small", "dim": 1536 },
"config": { "...": "snapshot of resolved indx.toml" }
},
"stats": {
"documents": 128, "chunks": 1042, "relations": 380,
"embeddings": 1042, "embed_dim": 1536,
"types": { "policy": 40, "guide": 30, "table": 12 }
},
"documents": [
{
"id": "0e1f2a3b4c5d6e7f",
"path": "policies/data/retention.pdf",
"lineage": ["policies", "policies/data"],
"size_bytes": 42811,
"doc_type": "policy",
"topics": ["retention", "compliance"],
"tags": ["gdpr", "data"],
"summary": "Defines the 90-day retention rule…",
"chunk_ids": ["2f8c9b4a1d0e6c31", "7bd8f3a4c91e0b52", "a1c9e33b72d45f00"],
"references": [ { "src": "0e1f2a3b4c5d6e7f", "dst": "legal/gdpr.md", "type": "references", "score": 1.0 } ],
"referenced_by": [ { "src": "guides/onboarding.md", "dst": "0e1f2a3b4c5d6e7f", "type": "references", "score": 1.0 } ]
}
],
"chunks": [ /* objects in the canonical chunk shape above */ ],
"relations": [ /* graph-level edges; an optional mirror of per-object edges */ ]
}
KeyTypeRequiredDescription
versionstringyesKnowledge-space schema version, e.g. "1.0".
rootstringyesAbsolute path of the walked directory or ZIP.
metadataobjectBuild provenance: tool_version, created_at, embedder ({name, dim}), and a config snapshot of the resolved indx.toml. May also carry an errors array of non-fatal per-item failures.
statsobjectAggregate counts (see stats).
documentsarrayyesThe document graph (see document).
chunksarrayyesAll chunks in the canonical shape.
relationsarrayGraph-level edges. An optional mirror of edges stored on individual chunks and documents.

A document is one source file, enriched. It carries its folder lineage, detected type, LLM-derived topics/tags/summary, the ids of the chunks it produced, and its references in both directions.

FieldTypeNotes
idstringStable deterministic id generated from the relative path.
pathstringOriginal path relative to root.
lineagestring[]Folder ancestry, root→leaf.
size_bytesintegerSource file size in bytes.
doc_typestring or nullDetected/enriched document type, e.g. policy.
topicsstring[]Enriched topics.
tagsstring[]Enriched tags.
summarystringLLM-generated summary (may be absent).
chunk_idsstring[]Chunks produced from this document, in order.
referencesarrayOutgoing references resolved in the Relate stage.
referenced_byarrayIncoming references (reverse edges).

The following is the abridged schema (JSON Schema draft 2020-12). It defines $defs for source, relation, chunk, document, and stats, and is authoritative for the shapes above.

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "indx index.json",
"type": "object",
"required": ["version", "root", "documents", "chunks"],
"properties": {
"version": { "type": "string" },
"root": { "type": "string" },
"metadata": { "type": "object" },
"stats": { "$ref": "#/$defs/stats" },
"documents": { "type": "array", "items": { "$ref": "#/$defs/document" } },
"chunks": { "type": "array", "items": { "$ref": "#/$defs/chunk" } },
"relations": { "type": "array", "items": { "$ref": "#/$defs/relation" } }
},
"$defs": {
"source": {
"type": "object",
"required": ["path"],
"properties": {
"path": { "type": "string" },
"folder": { "type": "string" },
"type": { "type": ["string", "null"] }
}
},
"relation": {
"type": "object",
"required": ["src", "dst", "type"],
"properties": {
"src": { "type": "string" },
"dst": { "type": "string" },
"type": { "enum": ["sibling", "parent", "references", "continues", "duplicate-of"] },
"score": { "type": "number", "minimum": 0, "maximum": 1 }
}
},
"chunk": {
"type": "object",
"required": ["id", "doc_id", "position", "text"],
"properties": {
"id": { "type": "string" },
"doc_id": { "type": "string" },
"position": { "type": "integer" },
"text": { "type": "string" },
"prev_id": { "type": ["string", "null"] },
"next_id": { "type": ["string", "null"] },
"source": { "$ref": "#/$defs/source" },
"metadata": {
"type": "object",
"properties": {
"topics": { "type": "array", "items": { "type": "string" } },
"summary": { "type": "string" },
"tags": { "type": "array", "items": { "type": "string" } }
}
},
"relations": { "type": "array", "items": { "$ref": "#/$defs/relation" } }
}
},
"document": {
"type": "object",
"required": ["id", "path"],
"properties": {
"id": { "type": "string" },
"path": { "type": "string" },
"lineage": { "type": "array", "items": { "type": "string" } },
"size_bytes": { "type": "integer" },
"doc_type": { "type": ["string", "null"] },
"topics": { "type": "array", "items": { "type": "string" } },
"tags": { "type": "array", "items": { "type": "string" } },
"summary": { "type": "string" },
"chunk_ids": { "type": "array", "items": { "type": "string" } },
"references": { "type": "array", "items": { "$ref": "#/$defs/relation" } },
"referenced_by":{ "type": "array", "items": { "$ref": "#/$defs/relation" } }
}
},
"stats": {
"type": "object",
"properties": {
"documents": { "type": "integer" },
"chunks": { "type": "integer" },
"relations": { "type": "integer" },
"embeddings": { "type": "integer" },
"embed_dim": { "type": "integer" },
"types": { "type": "object", "additionalProperties": { "type": "integer" } }
}
}
}
}

Provenance for a chunk or parsed unit. path is required and is relative to the walked root. folder defaults to "", and type may be null until detection or enrichment fills it.

A typed, directed edge. src, dst, and type are required. score is an optional confidence/similarity score in [0, 1] and defaults to 1.0.

type valueMeaning
siblingSame folder / same logical group.
parentFolder lineage / containment.
referencesOutgoing citation, link, or mention.
continuesNext unit in a split sequence.
duplicate-ofNear or exact duplicate content.

The serialized SpaceStats — the same object returned by space.stats and emitted by indx inspect --json. embed_dim is the vector dimensionality (e.g. 1024 for bge-m3) and types is a document-count histogram keyed by detected type.

The per-chunk files under chunks/ (chunk_0000.json, chunk_0001.json, …) use the same canonical chunk shape shown above. The file names are sequential for convenient browsing; the chunk’s stable identity remains the id field inside each JSON object.