Skip to content
Knowledge Modelling / Knowledge Graphs

Build knowledge graphs agents can trust

  • BP-0031
  • v1.0.0
  • draft
  • guideline
  • role: implementer
  • role: researcher
  • role: any
  • stage: plan
  • stage: build
  • stage: operate
  • updated 2026-11-24
  • reviewed 2026-11-24
  • next review 2027-05-24
  1. MUST choose a graph only when the questions depend on relationships: “what depends on X”, “who owns what”, “what changed and why”, multi-hop paths, or summaries across a whole corpus. For “find passages about X”, text retrieval (BP-0028) is simpler and enough.
  2. MUST write the competency questions the graph must answer before building it, and test the graph against them.
  1. MUST define node and relationship types from an ontology or a small explicit schema (BP-0014, BP-0024), with each relationship type named, directed and defined. Do not let extraction invent new types freely.
  2. MUST validate the graph against its schema (SHACL, LinkML, or the graph database’s constraints) on every load: required properties, allowed relationship types, cardinality.
  1. MUST resolve every mention to a stable entity ID before it enters the graph: merge spellings, acronyms and aliases of the same thing; keep different things with the same name apart. Record aliases on the entity.
  2. MUST NOT merge two entities on name alone. Use identifiers, attributes or context, and keep low-confidence merges reversible (a “possibly same as” link for review rather than a merge).
  1. MUST attach provenance to every node and relationship: source document and location, the agent or process that extracted it, when, and a confidence (BP-0025).
  2. MUST attach a trust level and keep agent-extracted facts below verified facts until checked; let queries exclude untrusted facts.
  3. MUST record when a fact is true (valid-from and valid-until), separately from when it was written, and supersede rather than overwrite facts that change, so the graph can answer “as of” questions.
  4. SHOULD store contradictions as contradictions (both facts, linked) for review, not silently keep the last one written.
  1. SHOULD retrieve by combining entity lookup and graph traversal with text search over the linked source passages, and cite both the facts and their sources in answers.
  2. SHOULD use pre-computed summaries of densely connected groups of entities (as in GraphRAG) for whole-corpus questions, and regenerate them when the graph changes significantly.
  3. MUST apply the same access control to the graph as to its sources, including relationships that reveal sensitive connections, and the same untrusted-data handling to text stored in nodes (BP-0029).
  4. SHOULD monitor graph quality: orphan nodes, duplicate entities, unused relationship types, facts with no source, and growth in untrusted facts.

Building agent memory as a graph, extracting knowledge graphs from documents or code, CMDB or asset relationship models, security knowledge (ATT&CK-style), and GraphRAG.

A fact with provenance, trust and time (property-graph style):

{
"from": "asset:MP01", "rel": "RUNS_ROLE", "to": "role:management-point",
"valid_from": "2026-11-10", "valid_until": null,
"source": { "doc": "sop:sccm-upgrade", "section": "2.4" },
"extracted_by": "agent:[email protected]", "extracted_at": "2026-11-24T21:00:00+08:00",
"confidence": 0.92, "trust": "inferred"
}
Question Graph or text?
“Which site systems depend on PS01?” Graph traversal
“What does the SOP say about rollback?” Text retrieval
“What are the main risk themes across all incident reports?” Graph community summaries
“Who owned this server last March?” Graph with valid-time
  • Letting an LLM extract entities and relationship types with no schema, then querying a graph of near-duplicates.
  • Merging “Mercury (planet)” and “Mercury (element)” because the names match.
  • Facts with no source, date or confidence.
  • Overwriting a changed fact so history is lost.
  • A graph that bypasses the access controls of the documents it was built from.
  • Competency questions need relationships; graph tested against them
  • Schema from an ontology; validated on load
  • Entities resolved to stable IDs; uncertain merges reversible
  • Every fact has provenance, trust, confidence and valid time
  • Contradictions kept and flagged
  • Retrieval combines traversal and text; access control enforced