Graph Builder
Cognipeer Graph Builder
Build queryable text graphs. Turn documents, code, and provider-backed records into a typed graph with deterministic extraction first and optional semantic enrichment after.
- Package
@cognipeer/graph-builder - Language TypeScript
- Inputs Arrays · async iterables · custom providers · local filesystem paths
The API-first path comes first: no CLI, no hosted wrapper required. The default pipeline extracts structure from markdown and code deterministically; LLM enrichment is additive, explicit, and tracked in diagnostics — so you can query nodes, shortest paths, neighbors, and communities against a graph you can fully account for.
import { graphBuilder } from "@cognipeer/graph-builder";
const result = await graphBuilder.fromTexts([
{
id: "docs/overview.md",
title: "Overview",
path: "docs/overview.md",
text: "# Overview\n\nSee [Guide](guide.md)."
},
{
id: "docs/guide.md",
title: "Guide",
path: "docs/guide.md",
text: "# Guide\n\nThe guide explains how providers and path-based inputs work."
}
]);
console.log(result.graph.stats);
console.log(result.query.path("Overview", "Guide"));
console.log(result.artifacts.report);Getting started
The fastest path to a working graph from arrays or local files.
Core concepts
What the graph, result, and artifacts actually contain.
Architecture
Where deterministic extraction stops and semantic enrichment begins.
Querying
Nodes, shortest paths, neighbors, communities, and seeded graph slices.
API reference
Core API, types, adapters, query helpers, artifacts, and the semantic surface.
Examples
From texts, custom providers, local paths, and LLM-backed semantic enrichment.
What it gives you
Deterministic extraction, optional semantic pass
The default pipeline extracts structure from markdown and code without a model call. LLM enrichment is additive, explicit, and tracked in diagnostics.
Output artifacts for analysis and visualization
Emit JSON, report, wiki, and HTML outputs from the same graph, so apps and humans inspect the same model.
Provider and adapter friendly
Bring your own provider, memory facts, or markdown converter without changing the core graph pipeline.
Incremental update path
Update existing graphs by source item instead of rebuilding the full corpus every time your content changes.
Where to go next
- Getting started — the fastest path to a working graph.
- Core concepts — what the graph, result, and artifacts contain.
- Semantic enrichment — where the optional LLM pass fits in.
- Examples — concrete integration patterns.

