Home / Projects / Orchestrata Ultimate / Decisions / ADR index / ADR-0094

ADR-0094: Graph queries run with the ontology structure memory injected first

field value
Status Accepted
Date 2026-10-12
Register factory (docs/adr, 4-digit ids)
Source docs/adr/0094-graph-queries-run-with-the-ontology-structure-memory-injected-first.md — recorded on branch docs/adr-register-0080-0085 at 3f68a11a5, not yet on master
Wiki register entry ADR-0094 (wiki status: Accepted)

← ADR-0093 · ADR-0095 →

The record

Status: Accepted · Date: 2026-10-12 · Ruled: 2026-10-12 (Mohamed's directive; the mechanism below is designed under it)

Context

Decision

Mohamed's directive above is the decision. Under it:

  1. The memory.
    • A project memory kg-ontology-structure lives in the same memory directory as the ADR-0093 memories.
    • Its first section, ## Query card, is at most 60 lines. For each database it gives:
      • endpoint, database name and the env key that selects it;
      • every label with its key properties;
      • every relationship pattern as (:From)-[:TYPE]->(:To);
      • the constraints and indexes.
    • The rest of the file carries the detail:
      • node and relationship counts with the date they were measured;
      • each divergence between the live graph and canonical_schema.py;
      • the co-mingled and split labels;
      • the :Project connectivity invariant;
      • the exact read-only commands that re-derive every number in the file.
    • It is built from canonical_schema.py, read through the AST toolkit, and from read-only introspection of the TEST fleet graph (10.53.2.10). It is never built from the prod subnet 10.53.1.x.
  2. The injection. workflow_context_inject.py gains an ontology domain. It injects the memory's ## Query card verbatim, plus the file's path and its **How to apply:** line. A missing file or a missing ## Query card section is named as missing, never skipped.
    • Prompt trigger. Word-boundary matches on: cypher, graph query, knowledge graph, KG, ontology, orchkg, memgraph, semantic graph, RAG graph, MATCH (, MERGE (.
    • Command trigger, on EVERY match with no dedup. It fires on a Bash command that runs any of:
      • graph_query.py, graph_browser.py, semantic_search.py, kg_schema.py;
      • check_kg_connectivity.py, bootstrap_graphs.py, sync_*_to_graph.py, ingest_orchestrata_ultimate.py;
      • cypher-shell, mgconsole, wiki-rag-query;
      • any command whose text contains a Cypher clause (MATCH (, MERGE (, CREATE () or imports the neo4j driver.
  3. Shared mechanism. Compaction reset, memory-dir resolution and the structured additionalContext delivery are ADR-0093's. The live headless delivery test gains one ontology case per event.

Alternatives rejected

Consequences

Provenance

Rulings cited

None.

Specs cited