Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/spec/action-graph-ir.md # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / spec / action-graph-ir.md` 199 lines · 9629 bytes Raw Blame History Rendered 1 # Omega action graph IR (OMEGA_ACTION_GRAPH_IR) 2 3 Code: `src/runtime/rx_graph.{c,h}`. Test: `tests/runtime/rx_action_graph.c`, 4 `make test-action-graph`. Receipt: `evidence/ACTION_GRAPH/`. 5 6 ## Purpose 7 8 Routine multi-step behaviour should not return to deliberation at every 9 step. AIEN states a goal. Omega compiles the goal, the World, the capabilities 10 the principal already holds, and the goal's constraints into a typed action 11 graph. Omega checks the graph, optimizes it, and lowers it onto resident 12 reactions. After that the graph runs by readiness alone, every time its run 13 token moves. 14 15 This is not a tool-call DAG. Nodes are typed semantic operations over World 16 objects, Cortex memory, Skill Net procedures and effects. Nothing in the 17 graph is prompt text, JSON, shell or source code. A backend may later lower a 18 node into one of those. The graph stays typed Omega state. 19 20 ## Boundaries 21 22 | Faculty | Role here | 23 |---|---| 24 | AIEN | states the goal (goal kind + World objects). Not changed by this work. | 25 | Omega | compiles, validates, optimizes, lowers. Has no admin handle. | 26 | AEGIS | decides policy when authority is missing (R8 slow path). | 27 | Aienux | the only minter (native C capability authority). | 28 | World | cells, run token, effect objects; readiness drives execution. | 29 30 Omega gains no authority. `rx_graph.o` is linked alone first and the build 31 fails if it references any `aienos_cap_*` admin operation. 32 33 ## Integration map (what is reused) 34 35 | Need | Existing mechanism | 36 |---|---| 37 | concurrency from dependencies | rx_world dependency index + worker pool (R3) | 38 | typed authority at start and publish | rx_world `validate_caps` twice per activation (R3/R7) | 39 | missing authority | AEGIS request/decision/slot, root.install mints (R8) | 40 | resource admission | rx_world `RxResourceNeed` / budget (R5) | 41 | stale references | object generations; `RX_ERR_STALE_GEN` invalidation (R3/R9) | 42 | causal record | content-addressed crumbs with parents and episodes (R4/R6) | 43 | pure operations | `omega_eval_pure_binary_uint` (Omega core) | 44 45 New: the IR, its validation and identity, compile, passes, lowering, and the 46 sequential reference. The engine is unchanged. 47 48 ## The graph 49 50 ``` 51 AgGraph { 52 nodes[] kind, out type, params, bound World object, cost 53 data[] typed edges (DATA or ON_FAIL) into numbered ports 54 deps[] GUARD (branch, polarity) and ORDER edges 55 auth[] authority requirements (resource, rights) 56 res[] resource requirements (RxResourceNeed) 57 success[], failure[] outcome conditions (node, status) 58 evidence[] nodes whose evidence must exist after a run 59 effects[] effect boundaries in their required total order 60 } 61 ``` 62 63 Node kinds: CONST, PURE (Omega op, possibly fused), WORLD_READ, 64 WORLD_PUBLISH, RECALL (Cortex memory), CAP_RESOLVE, PHYSICAL, SKILL, 65 EFFECT_PROPOSE, EFFECT_PERFORM, VERIFY, BRANCH, JOIN, RETRY. 66 67 Types: U64, BOOL, PROPOSAL, VERDICT, RECEIPT. EFFECT_PERFORM takes exactly a 68 PROPOSAL and a VERDICT; a raw number cannot be performed. 69 70 ### Status per run 71 72 Every node ends each run OK, FAILED or SKIPPED, or stays PENDING (blocked). 73 Rules, in order: a failed or skipped guard, or a guard of the other polarity, 74 gives FAILED / SKIPPED; a FAILED order source gives FAILED; JOIN takes the one 75 OK input; otherwise a SKIPPED input gives SKIPPED, then a FAILED input gives 76 FAILED; an ON_FAIL input runs the node only when its source FAILED. One 77 function (`semantics()`) implements this for both the lowered reaction and the 78 reference. 79 80 ### Validation 81 82 - types per kind; ports dense from 0; acyclic; 83 - effect boundaries (PUBLISH, PERFORM) form one total order; 84 - every node that reads an object some boundary writes is ordered against 85 that boundary (no timing-dependent reads); 86 - the arms of every JOIN are mutually exclusive (opposite guards, or OK vs 87 FAILED of the same node); 88 - at most one guard per node; the lowered dependency count fits 89 `RX_MAX_DEPS`. 90 91 ### Identity 92 93 Node identity is SHA-256 over kind, parameters, bound object and generation, 94 fused steps, input identities by port, and control dependencies sorted by 95 identity. A World read or recall also folds in every ancestor publication of 96 the same object, so reads separated by a publication are different. A 97 boundary folds in its position in the effect chain. The graph digest sorts 98 node identities and condition/evidence records, so builder order does not 99 change it; a semantic change does. 100 101 ## Compile 102 103 `rx_graph_compile(goal, world, caps, constraints, library, optimize)`: 104 105 1. choose the procedure for the goal kind (Skill Net template); 106 2. bind World parameters to the goal's objects; refuse stale references; 107 3. resolve CAP_RESOLVE nodes against the principal's table (a constant); 108 4. validate; derive authority from each target's resource and evidence for 109 VERIFY and boundaries; 110 5. constraints: max effects, forbidden resources, critical-path deadline; 111 6. optimize and check preservation; 112 7. report missing authority and resource-blocked nodes. 113 114 Missing authority and missing resources do not refuse the graph; they are 115 reported and the lowered node waits. Stale references, violated constraints, 116 and type or structure errors refuse it. 117 118 ## Passes 119 120 Passes 1–4 repeat until a round changes nothing; then 5. 121 122 1. **Constant propagation.** A PURE node whose inputs are unguarded CONSTs 123 becomes a CONST (a fold that would fail is left alone). 124 2. **Common subexpressions / redundant World reads.** Identity-equal nodes 125 merge. Never merged: boundaries, evidence nodes, condition nodes, BRANCH, 126 JOIN. 127 3. **Pure fusion.** A unary PURE step whose producer is a PURE node with no 128 other consumer folds into it. 129 4. **Dependency simplification.** An ORDER edge goes when a strict path 130 (DATA into non-JOIN, or ORDER, through nodes that can never be skipped) 131 already implies it, or when its source can neither fail nor skip and 132 neither end is a boundary. This is the parallelization pass: it removes 133 sequencing the plan stated but the semantics do not need. 134 5. **Dead nodes.** Everything not an ancestor of a boundary, evidence or 135 condition node goes. 136 137 `rx_graph_check_preserved` then requires the same boundaries in the same 138 order, every evidence node, and every condition. 139 140 ## Lowering 141 142 - one run token object (field 0 = run id; outside WRITE, principal READ); 143 - one cell per node: 0 run, 1 status, 2 value, 3 evidence, 4 attempts; 144 every field is proposed on every run (`stamp_proposed`); 145 - one reaction per node, faculty OMEGA, subject = the principal. Triggers: 146 the cells of its inputs, guard and order sources; source nodes trigger on 147 the run token. Reads: run token, own cell, the World target. Writes: own 148 cell, and the boundary target; 149 - a reaction whose inputs are not all in for the current run proposes 150 nothing (NOOP). The last arriving input makes it compute. A node computes 151 once per run. 152 153 No function sequences the nodes. Independent nodes are READY together and 154 run on whatever workers are free. 155 156 Authority per node: cell RW, run R, and the derived requirement. A held 157 capability is the resident fast path. A missing one lowers to an unusable 158 reference (the engine blocks and records BLOCKED_AUTHORITY), or, with an AEGIS 159 binding, to a slotted capability plus an `ag.ask` reaction that files the 160 request. AEGIS decides; the root mints into the slot; the slot wakes the 161 waiting node. 162 163 ## Effects 164 165 EFFECT_PROPOSE is thought: a value, no authority, no change. EFFECT_PERFORM 166 needs R|W|EFFECT on the effect object, a passing verdict, and its place in the 167 chain. The effect object holds count, last value, an order chain 168 `H(chain, run, value)`, and the last run; the chain proves order. 169 170 ## Gate evidence (what the test proves) 171 172 | Claim | How | 173 |---|---| 174 | same semantic result as sequential reference | every run: status, value and evidence of every node, outcome, effect chain | 175 | lower critical path for parallel graphs | 1 vs 4 workers, same lowered graph, median of 15 runs the machine did not disturb (run-queue delay from schedstat, `tests/runtime/rx_quiet_reps.h`), pinned to one core class | 176 | zero authority bypass | every commit to a boundary target comes from a lowered boundary reaction; stolen, revoked, forged and tampered cases blocked; compile mints nothing | 177 | zero missing evidence | every evidence node of every successful run has its word | 178 | same causal ancestry | per node, crumb parents inside the run's episode reach exactly the graph's ancestors and the run token | 179 | deterministic semantic result | 8 runs × worker counts 1, 2, 4, 8, digest of all node results + effect object | 180 181 Required scenarios: linear, parallel, diamond, branch/join (both arms), 182 failure branch (+ bounded retry, + exhausted retry), effect boundary (+ 183 proposal only, + constraints), authority-blocked (AEGIS + human approval), 184 resource-blocked (and resumed), stale-generation (compile-time and after 185 lowering with the slot reused). 186 187 ## Limits 188 189 - Procedures are fixed templates; no learned planner. 190 - One AEGIS request per lowered graph. 191 - RETRY loops inside its node; attempts do not re-enter the World. 192 - A node blocked for authority or resources blocks its dependants even when 193 it would have been SKIPPED (conservative). 194 - Up to 64 nodes, 4 data inputs per node. 195 - CAP_RESOLVE is decided at compile time; the engine still checks every use. 196 - The reference ignores resource budgets; resource scenarios compare after 197 admission. 198 - Host processor only. The authority is the native C library, not the 199 Aienux kernel.