aien-architecture-mv
Canonical architecture for the AIEN ecosystem: flows, boundaries, ADRs, and the map from design to implementation repositories.
Brought by drakestapleton
aien-architecture-mv / docs / 10-relational-path-engine.md
| 1 | # Relational Path Engine |
| 2 | |
| 3 | ## Research basis |
| 4 | |
| 5 | PEARL (September 2026) makes relational paths first-class graph objects, contextualizes them against entity and global subgraph state, then scores paths relative to the query relation. |
| 6 | |
| 7 | AIEN should adopt the **idea**, not the Python/PyTorch/DGL implementation. |
| 8 | |
| 9 | The PEARL reference repository did not expose a root license file at the time of review, so do not copy source code unless licensing is clarified. |
| 10 | |
| 11 | ## AIEN opportunity |
| 12 | |
| 13 | Build: |
| 14 | |
| 15 | ```text |
| 16 | aien-relation-graph |
| 17 | aien-path-ranker |
| 18 | ``` |
| 19 | |
| 20 | Use one path substrate across: |
| 21 | |
| 22 | - Cortex evidence reasoning, |
| 23 | - Capability Graph routing, |
| 24 | - J-Space plan comparison. |
| 25 | |
| 26 | ## Path object |
| 27 | |
| 28 | ```rust |
| 29 | pub struct RelationalPath { |
| 30 | pub id: PathId, |
| 31 | pub start: NodeId, |
| 32 | pub end: NodeId, |
| 33 | pub nodes: SmallVec<[NodeId; 7]>, |
| 34 | pub edges: SmallVec<[EdgeId; 6]>, |
| 35 | pub digest: Digest32, |
| 36 | } |
| 37 | ``` |
| 38 | |
| 39 | ## Cortex use |
| 40 | |
| 41 | Infer candidate relationships from: |
| 42 | |
| 43 | ```text |
| 44 | entity |
| 45 | -> claim |
| 46 | -> entity |
| 47 | -> evidence |
| 48 | -> entity |
| 49 | ``` |
| 50 | |
| 51 | Predictions become `MemoryCandidate`s, never immediate facts. |
| 52 | |
| 53 | ## Capability use |
| 54 | |
| 55 | Score complete execution paths: |
| 56 | |
| 57 | ```text |
| 58 | intent |
| 59 | -> skill |
| 60 | -> tools |
| 61 | -> credential |
| 62 | -> Machine |
| 63 | -> policy |
| 64 | -> effect class |
| 65 | ``` |
| 66 | |
| 67 | This is more useful than scoring each skill independently. |
| 68 | |
| 69 | ## J-Space use |
| 70 | |
| 71 | Make the trajectory that produced a candidate first-class: |
| 72 | |
| 73 | ```text |
| 74 | World A: |
| 75 | inspect -> patch -> test -> verify |
| 76 | |
| 77 | World B: |
| 78 | search -> alternate patch -> test -> verify |
| 79 | ``` |
| 80 | |
| 81 | Store observed operations and evidence, not hidden chain-of-thought. |
| 82 | |
| 83 | ## Adaptive exploration |
| 84 | |
| 85 | Combine PEARL-style contextual path scoring with a MOSAIC-like query-dependent exploration budget. |
| 86 | |
| 87 | Do not hard-code the same hop count and path count for every query. |
| 88 | |
| 89 | ## Performance plan |
| 90 | |
| 91 | Start in Rust: |
| 92 | |
| 93 | - CSR graph, |
| 94 | - compact integer IDs, |
| 95 | - bounded bidirectional BFS, |
| 96 | - `SmallVec`, |
| 97 | - arenas/slabs, |
| 98 | - Rayon for independent queries. |
| 99 | |
| 100 | Only move scoring kernels to Omega GPU kernels if profiling shows a real bottleneck. |
| 101 | |
| 102 | ## First experiment |
| 103 | |
| 104 | Compare baseline routing/retrieval with path-context routing on: |
| 105 | |
| 106 | - top-1 skill accuracy, |
| 107 | - top-5 skill accuracy, |
| 108 | - invalid capability rate, |
| 109 | - unavailable Machine selections, |
| 110 | - Cortex evidence recovery, |
| 111 | - J-Space time-to-valid-answer, |
| 112 | - routing latency, |
| 113 | - token cost. |
| 114 | |
| 115 | Stop if it does not produce clear value. |