Skip to content

Knowledge Graph Pipeline

Chris Sweet edited this page May 31, 2026 · 5 revisions

type: concept up: "Wiki-LLM-Pattern" status: aspirational tags: [kg, sparql, retrieval, not-yet-implemented]

Knowledge Graph Pipeline

NOT YET IMPLEMENTED. This page describes a design sketch. scripts/kg/build-graph.sh does not exist in the template repo on main as of 2026-05-31. The page is preserved as a design target so the schema work that anticipates it (typed edges, frontmatter conventions) stays motivated. See Implementation-Status for the current real vs aspirational classification, and Wiki-Corrections-Log for the correction that flagged this.

The frontmatter and body cross-references in the wiki are designed to feed an optional knowledge-graph pipeline that would expose the wiki as a SPARQL-queryable graph.

What it does

scripts/kg/build-graph.sh walks the wiki, extracts frontmatter and body links, converts them to RDF triples, and loads them into a local Fuseki endpoint at http://localhost:3030/wiki/sparql.

  • Frontmatter typed edges (extends:, supports:, criticizes:, source:, up:, related:) become typed predicates.
  • Body cross-references ([text](Page-Name)) become mentions edges.
  • Pages without frontmatter are included as untyped nodes; no data is lost.

The typing comes from Typed-Edges-and-Frontmatter; the operations come from Three-Operations.

When to use it

Use the KG for topology questions:

  • "Which pages cite finding X?"
  • "What concepts does this experiment depend on, transitively?"
  • "Find all pages tagged Y that criticizes: a parent of Z."

Use direct file reads for content questions: "What does page X actually say?"

The right pattern: use the KG to discover where to look, then use file tools to read what the chosen pages say. Reserve grep for non-wiki code or content searches that span many files.

Rebuilding

Run ./scripts/kg/build-graph.sh after each ingest, or periodically. The script is idempotent.

Optional in derived projects

The KG pipeline is shipped under scripts/kg/. Derived projects that do not want it can delete the directory. instantiate.sh strips the corresponding subsection from CLAUDE.md when scripts/kg/ is absent, so the generated documentation stays consistent.

Why typed edges matter here

Without the typed-edge contracts, the KG collapses to a directed graph of mentions between pages. That is useful but flat. With typed edges, the same query can ask not just "which pages connect to X" but "which pages support a claim that X". Edge typing is what turns the KG from a navigation aid into a reasoning substrate.

See also

Clone this wiki locally