Home / Projects / Orchestrata Ultimate / Decisions / ADR index / ADR-0005
ADR-0005: Prolog is a stateless reasoning view; the graph is the sole fact store
| field | value |
|---|---|
| Status | Accepted |
| Date | 2026-07-23 |
| Register | factory (docs/adr, 4-digit ids) |
| Source | docs/adr/0005-prolog-is-a-stateless-reasoning-view.md — permalink at bdafa201a (unchanged on master since that commit) |
| Wiki register entry | ADR-0005 (wiki status: Accepted) |
The record
- Status: Accepted
- Date: 2026-07-23
- Spec: SPEC-033 §4
Context
The system needs two different capabilities over the same information:
- Storage and traversal at scale — AST, traceability, design, provenance; fast impact and test-selection queries. This is a graph database's job.
- Logical inference — recursive rules, negation-as-failure, escalation/quorum logic, unsatisfiability ("impossibility") proofs. This is a logic engine's job.
The naive options are to duplicate the facts into both, or to force one tool to do the other's job.
Decision
The knowledge graph is the single system of record for facts. Prolog owns no durable facts.
Per check, the relevant subgraph is projected into Prolog terms; the layered rulebase runs; the
result is returned. Prolog is ephemeral and stateless. Rules — not facts — are Prolog's durable
content, and they live in version control (.pl + ADRs), with the graph recording only their
provenance.
Alternatives rejected
- A separate Prolog fact-KB — two copies of every fact ⇒ drift and dual maintenance, the exact failure this design exists to eliminate.
- Inference inside Cypher — cannot express recursive rules, negation-as-failure, or the escalation/unsatisfiability logic; adopting it would cripple governance to avoid a projection step.
Consequences
- Exactly one copy of each fact exists, so fact drift is structurally impossible.
- Introduces the projection as a new correctness surface: negation-as-failure over a partial projection is unsound — addressed by ADR-0006.
- Introduces a per-check projection cost; if that boundary ever becomes the bottleneck, revisit with a reasoning-native store (Stardog/Datalog) — a decision that would supersede this ADR.
- Prolog process lifetime becomes an engineering question (cold-start per check vs a long-lived service), with concurrency implications under parallel worktrees.
Provenance
Original design decision (v0.1), articulated when choosing between unifying facts+rules in one engine versus separating storage from inference. Round-2 confirmed the factoring as correct in principle; Round-3 Fable confirmed it remains consistent with the red-first ledger living in the KG.
This ADR back-fills an earlier human ruling. plans/prolog-utilization-plan.md records it as a
standing constraint from session 165: "Variable-bearing rules live in .pl files (consult); only GROUND
facts are assertz'd — user ruling" (with the accompanying instruction never to reintroduce pyswip). The
2026-07-24 rulebase survey found the ruling already honoured across all 16 rulebases, documented in-code —
e.g. routing.pl:7, kg_relevance.pl:14. So the decision recorded here was made by the human and
implemented before this register existed; ADR-0027 and ADR-0025 both depend on it.
Related ADRs
Rulings cited
None.