RUL-016 — Design the ontology before importing into any graph
Ruling
Before importing/ingesting nodes into a graph (Neo4j→Memgraph, source ingest, etc.), design/extend the canonical KG ontology FIRST — never dump raw nodes. "The user pushed back hard on a raw Neo4j→Memgraph mirror" (GIGO).
Evidence
- Global memory
feedback-ontology-before-graph-import: raw import copies the mess — duplicate label trees (Class/CodeClass),Sessionkeyed 3 ways (257k dupes), audit/packet churn — into a second graph.knowledge_graph/canonical_schema.py(SPEC-106 FR-001) is the anchor: canonicalLABEL_*,REL_*,CANONICAL_MERGE_KEYS(one merge key per label).
Enforcement
- gate scripts/kg_schema.py canon
- gate scripts/sweep_test_pollution.py canonical
Verification
scripts/kg_schema.py check reports drift between the live graph and the canonical schema (CI-required per ADR-023); scripts/sweep_test_pollution.py purges nodes that violate the canonical id-marker/merge-key contract before test runs seed new ones, keeping the operational KG's ontology from silently drifting.