Knowledge Modelling / Knowledge Graphs
Build knowledge graphs agents can trust
- 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.
- MUST write the competency questions the graph must answer before building it, and test the graph against them.
Schema
Section titled “Schema”- 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.
- MUST validate the graph against its schema (SHACL, LinkML, or the graph database’s constraints) on every load: required properties, allowed relationship types, cardinality.
Entities
Section titled “Entities”- 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.
- 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).
- 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).
- MUST attach a trust level and keep agent-extracted facts below verified facts until checked; let queries exclude untrusted facts.
- 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.
- SHOULD store contradictions as contradictions (both facts, linked) for review, not silently keep the last one written.
Retrieval and operation
Section titled “Retrieval and operation”- 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.
- 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.
- 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).
- SHOULD monitor graph quality: orphan nodes, duplicate entities, unused relationship types, facts with no source, and growth in untrusted facts.
When to apply
Section titled “When to apply”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.
Examples
Section titled “Examples”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" }, "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 |
Anti-patterns
Section titled “Anti-patterns”- 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.
Checklist
Section titled “Checklist”- 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