Docs
View as markdown

The docs graph

The relate docs as a graph of pages, sections, examples, terms, CLI facts and capabilities, the files it ships as, and what runs on it.

cyphermcpagents

The relate documentation is also published as a graph. Every page, heading, code example, glossary term, CLI command and flag, cookbook recipe, capability and problem is a node An entity in the graph: it carries zero or more labels and a map of properties, and relationships connect it to other nodes. Read more in the glossary, and the links between pages, the prerequisites, the terms a page uses and the flags it documents are relationship A directed, typed connection between two nodes, with properties of its own; every relationship has exactly one type and a start and an end node. Read more in the glossary. The build writes the graph from the same files as the pages, so it says what the pages say, at the version in the page header. It ships as a Cypher seed script, as JSON and, from launch, as a relate store A relate database: a directory, a single .rl file, or :memory:, opened with --database. Read more in the glossary; the cookbook recipe Query the relate docs searches it. The view on this page draws its pages, grouped by section, below the tables of its labels and relationship types.

Synopsis

ItemValue
Seed scripthttps://relatedb.ai/docs/graph.cypher: Cypher statements that build the graph in an empty store
JSONhttps://relatedb.ai/docs/graph.json: the same nodes and relationships as two arrays, without the section vectors
relate storehttps://relatedb.ai/docs/relate-docs.rl, with its SHA-256 in relate-docs.rl.sha256; both are launch-day targets
Per pagehttps://relatedb.ai/docs/<page>.graph.md: one page's prerequisites, links both ways, terms, sections, examples and CLI references, as markdown
IndexesFull-text index docs on (:Section) heading and text; vector index docs_vector on (:Section) embedding, 384 dimensions, cosine, declaring page so a vector search can filter on it (WHERE s.page IN …); full-text index problems on (:Problem) text
ConstraintsOne per label: id is unique within the label
SourceThe docs pages, the glossary, the cookbook's recipes, the CLI facts behind the CLI reference, and the capability catalog
DeterminismThe same source files give the same bytes: nothing reads the clock or git, and every list is sorted by id

Node labels

A property whose value would be null is left out, as Cypher stores it. Section text and Example code are quoted from the pages: reference text, not instructions.

LabelOne perProperties
PageDocs page, planned pages included (status is planned and there is no url)id, url, md_url, title, description, type, section, status, since, verified, tokens
SectionH2 and H3 of a published page, plus one at level 1 for the text before the first of themid, page, anchor, heading, level, position, url, text, length, embedding
ExampleCode block the page's markdown twin carries; a recorded result and a diagram are not examplesid, page, section, position, lang, first_line, title, runnable, cell
TermGlossary termid, term, short, context, see, url
SurfaceFront door, such as cli, python or mcpid
CookbookRecipeCookbook recipeid, title, summary, url, md_url
CommandCLI commandid, word, synopsis, disputed
FlagCLI flag, global or of one commandid, flag, names, command, value, disputed
Indexllms.txt, and the docs landing pageid, url, title
CapabilityEntry of the capability catalogid, title, problem, capability, url, schema_url, verify
ProblemA capability's problem, and each other way of asking itid, text, kind

embedding is a VECTOR<FLOAT32>(384) from the bge-small-en-v1.5 model. It is set in the seed script and the store, not in the JSON.

Relationship types

TypeFrom, toMeaning
LINKS_TO {anchor}Page to Page or CookbookRecipeA link in the page's body
PREREQUISITE_OFPage to PageThe frontmatter prerequisites, pointing from the page to read first at the page that needs it
RELATED_TO {anchor}Page to Page or CookbookRecipeThe frontmatter related
HAS_SECTIONPage to SectionEach section of the page
HAS_EXAMPLEPage to ExampleEach code example on the page
USES_TERMPage to TermEach glossary term the page marks
APPLIES_TOPage or Capability to SurfaceThe page's frontmatter surfaces, or the capability's surfaces
DOCUMENTSPage to Command or FlagA command or flag the page names in a shell or config block, or in inline code
HAS_FLAGCommand to FlagThe command's own flags
LISTSIndex to PageThe pages llms.txt and the landing page list
SOLVESCapability to ProblemThe capability's problem and its other phrasings
CITES {role, anchor}Capability to PageThe pages the catalog entry cites
DEMONSTRATESCookbookRecipe to CapabilityA recipe that shows the capability
VERIFIED_BY {cell}Capability to CookbookRecipe or PageThe recorded cell that proves the capability
HAS_CAPABILITYPage to CapabilityThe catalog page to each of its entries

The graph, drawn

The view draws each published page as a node, one cluster and one color per section, with the links and prerequisites between pages. Glossary terms, capabilities and cookbook recipes sit on the ring nearest the pages; CLI commands, flags and surfaces on the middle ring; the problems capabilities solve on the outermost ring. Each ring is off until its toggle is on. Sections and examples are not drawn: there are more than 3,000 of them, past the roughly 1,000 nodes a canvas draws comfortably, and each belongs to a page that is drawn. The build places every page from the list of pages alone, not from the links between them, so the live view draws each page where the picture puts it, and nothing moves when it loads. The links, and the counts of every kind, change with nearly every edit to any page; the view reads them from the data the site is built with.

The live view draws the 142 published pages, one cluster per section: Get started 12, Guides 66, Reference 55, Concepts 9. The picture places them where the live view first draws them. The links and prerequisites between them, and the number of nodes and relationships of each kind, change with nearly every edit, so the live view draws and counts them from the data the site is built with; the seed script's header lists the same counts.

LabelIn the live view
Pagedrawn at first: each published page, colored by section (planned pages are not drawn)
Sectionleft out: one per heading, part of its page
Exampleleft out: one per code block, part of its page
Terma toggle, on the nearest ring around the pages
Surfacea toggle, on the middle ring around the pages
CookbookRecipea toggle, on the nearest ring around the pages
Commanda toggle, on the middle ring around the pages
Flaga toggle, on the middle ring around the pages
Indexleft out: llms.txt and the landing list nearly every page
Capabilitya toggle, on the nearest ring around the pages
Problema toggle, on the outermost ring around the pages
RelationshipIn the live view
LINKS_TOa toggle, on at first
PREREQUISITE_OFa toggle, on at first
RELATED_TOa toggle, off at first
HAS_SECTIONnot drawn: its far end is a kind the view leaves out
HAS_EXAMPLEnot drawn: its far end is a kind the view leaves out
USES_TERMdrawn when both ends are
APPLIES_TOdrawn when both ends are
DOCUMENTSdrawn when both ends are
HAS_FLAGdrawn when both ends are
LISTSnot drawn: its far end is a kind the view leaves out
SOLVESdrawn when both ends are
CITESdrawn when both ends are
DEMONSTRATESdrawn when both ends are
VERIFIED_BYdrawn when both ends are
HAS_CAPABILITYdrawn when both ends are
The published docs pages, one cluster per section, where the live view first draws them142 published pages as dots, one cluster per section, each labelled with its name and page count: Get started 12, Guides 66, Reference 55, Concepts 9. The live view draws the links between them over the same positions.Get started (12)Guides (66)Reference (55)Concepts (9)
The published docs pages, one cluster per section, where the live view first draws them142 published pages as dots, one cluster per section, each labelled with its name and page count: Get started 12, Guides 66, Reference 55, Concepts 9. The live view draws the links between them over the same positions.Get started (12)Guides (66)Reference (55)Concepts (9)
The published docs pages, one cluster per section, where the live view first draws them

Live: the view draws the pages with the links and prerequisites between them from /docs/graph-view.json and counts every kind; a search box enlarges the nodes whose title matches and dims the rest, toggles add glossary terms, capabilities and the other kinds, hovering a node shows its description and the nodes it is joined to, and a click opens its page.

Files

Seed script. /docs/graph.cypher is Cypher for an empty store: a comment header with the verified version, the node and relationship counts and the schema; a uniqueness constraint per label; UNWIND statements of up to 500 rows that create the nodes, then the relationships; the statements that set the section vectors; then the three indexes. Its header names the command that builds a new store from it, relate query --database ./relate-docs.rl < graph.cypher.

JSON. /docs/graph.json holds format (1), kind (documentation), verified, seed (the seed script's URL), embeddings (the label, property, index, dimension, similarity and model of the vectors, which it does not carry), then nodes, each with id (Label:id), labels and properties, and relationships, each with type, start, end and properties. It carries every section's text and every example's code, so it runs to several megabytes.

relate store. /docs/relate-docs.rl is the seed script built into a single-file store A store kept in one .rl file that holds the snapshot and the WAL together; the layout for a --database path ending in .rl. Read more in the glossary by the relate CLI, with its SHA-256 beside it. Both URLs are launch-day targets: the store is built and served once the deploy workflows install relate. --load reads it into an in-memory store A store that lives only in the process that opened it, named :memory:; the default --database, gone when the process exits. Read more in the glossary, which is read-only.

Per page. Every published page has /docs/<page>.graph.md, a markdown list of its neighborhood under the headings Prerequisites, Prerequisite of, Related, Links to, Linked from, Terms, Sections, Examples, and CLI commands and flags.

The view's data. /docs/graph-view.json is what the view on this page draws: the pages, terms, capabilities, problems, recipes, commands, flags and surfaces, each with its title, description, link and position, and the relationships between them. It leaves out sections and examples, and it is shaped for this page; the seed script and graph.json are the complete forms.

What runs on it

ReaderHow it loads the graphWhat it offers
relate's own MCP server, on the reader's machine--load of relate-docs.rl into an in-memory storeread_cypher and get_schema over the whole graph; write_cypher is not listed on a read-only store
The recipe Query the relate docsThe graph's pages, terms, capabilities and recipes with the sections of five pages and their vectors, in the recipe's data block, run in the browserVector search over the sections, then traversals that expand the hits into context, scope the search and reach the capability behind the answer, step by step

The local form serves the docs graph to an MCP host over stdio. The URL is a launch-day target:

relate serve --mcp stdio --database :memory: --load https://relatedb.ai/docs/relate-docs.rl --read-only

A store opened read-only lists read_cypher and get_schema, not write_cypher (read-only policy), and --load into :memory: opens it read-only. --safe refuses a remote --load source, so the checked path is to download the store, compare its SHA-256 with the published value, and load the local copy. In this block, <sha256> is the value in relate-docs.rl.sha256, and the search runs only when it matches; on macOS, shasum -a 256 --strict -c - stands in for sha256sum --strict -c -:

curl -sSfLO https://relatedb.ai/docs/relate-docs.rl
echo "<sha256>  relate-docs.rl" | sha256sum --strict -c - && relate --load ./relate-docs.rl --mode envelope "MATCH (s:Section) SEARCH s IN (FULLTEXT INDEX docs FOR 'exit code' LIMIT 5) SCORE AS score RETURN s.page AS page, s.heading AS heading, s.url AS url, score"

The downloaded store served to an MCP host. A relative path resolves against the directory the host starts the server in:

claude mcp add relate-docs-local -- relate serve --mcp stdio --database :memory: --load <absolute-path>/relate-docs.rl --read-only

Examples

Over the store, or the seed script replayed into an empty one, these statements read the graph. Their results change as the pages do.

The pages that link to the MCP server reference:

MATCH (p:Page)-[:LINKS_TO]->(:Page {id: 'reference/server/mcp'})
RETURN DISTINCT p.id AS page, p.section AS section ORDER BY page

The glossary terms the most pages use:

MATCH (:Page)-[:USES_TERM]->(t:Term)
RETURN t.term AS term, count(*) AS pages ORDER BY pages DESC, term LIMIT 5

The chains of prerequisites that lead to a page:

MATCH path = (:Page)-[:PREREQUISITE_OF*1..]->(:Page {id: 'guides/agents/connect-over-mcp'})
RETURN [n IN nodes(path) | n.id] AS chain ORDER BY length(path) DESC

See also