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/workflow-fusion.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 / workflow-fusion.md` 225 lines · 12387 bytes Raw Blame History Rendered 1 # Omega verified workflow fusion (OMEGA_WORKFLOW_FUSION) 2 3 Code: `src/runtime/rx_fusion.{c,h}`, plus the `AG_META` node kind in 4 `src/runtime/rx_graph.{c,h}`. Test: `tests/runtime/rx_workflow_fusion.c`, 5 `make test-workflow-fusion`. Receipt: `evidence/WORKFLOW_FUSION/`. 6 7 ## Purpose 8 9 Omega runs the same verified action-graph fragments again and again. When a 10 fragment `A -> B -> C -> D` keeps coming back with the same semantic 11 dependencies, the same authority pattern and the same result contract, a low 12 failure rate and stable evidence, Omega may propose it as a **MetaSkill**: 13 one node that does what the steps did, with fewer reactions, crumbs and 14 scheduling rounds per run. 15 16 A MetaSkill never replaces behaviour silently. It starts as a candidate and 17 only becomes usable after verification, measurement, a canary, promotion 18 through the generation barrier and publication into the Skill Net table. 19 `rx_fusion_compile` applies only published MetaSkills and reports each fusion 20 it made; everything else in its library is refused and counted. 21 22 ## Pipeline 23 24 | Stage | What happens | State after | 25 |---|---|---| 26 | observe | `rx_fusion_observe` takes a run only when the lowered result equals the sequential reference on every node (status, value, evidence, step evidence), the outcome is decided, and every evidence node of a successful run has its word. Fragments are enumerated and grouped by signature. | pattern | 27 | judge | too small; evidence unstable (a repeated input gave a different result or step evidence); failure rate over the policy; too few occurrences; seen in too few graphs | candidate or not | 28 | build | `rx_fusion_build`: ancestry, contracts derived from the fragment, realization, reference graph, observed samples | CANDIDATE | 29 | verify | `rx_fusion_verify` against the reference fragment | VERIFIED / REJECTED | 30 | measure | original and fused side by side; `rx_fusion_accept_measure` | MEASURED / SLOWER | 31 | canary | fused graph in shadow beside production; `rx_fusion_canary` | CANARY_PASSED / QUARANTINED | 32 | promote | `rx_fusion_promote`: an R9 generation carrying the realization bytes, identities, contracts and figures; the promotion right is checked on the native authority; the proposer cannot promote its own candidate | PROMOTED | 33 | publish | `rx_fusion_publish`: the promoted generation must be active and its bytes must equal the MetaSkill as it is now | PUBLISHED | 34 35 REJECTED, SLOWER and QUARANTINED are final. 36 37 ## What a fragment may hold 38 39 So that one node means exactly what the steps meant: 40 41 - steps: CONST, PURE, WORLD_READ, RECALL, PHYSICAL, SKILL, RETRY, 42 EFFECT_PROPOSE, and VERIFY as the exit; 43 - never an effect boundary (WORLD_PUBLISH, EFFECT_PERFORM). The effect chain 44 stays as it was, by construction; 45 - no BRANCH or JOIN, no control dependency touching a step, no ON_FAIL edge 46 between steps; an outside source may feed the fragment by ON_FAIL, and one 47 source never feeds it in both modes; 48 - one exit: the only step whose result leaves the fragment; every step is an 49 ancestor of the exit; no step but the exit is an evidence or condition node; 50 - the authority of the steps is READ on the objects they read, nothing else; 51 - it fits one reaction: ports + objects + run token + own cell + one 52 authority-slot wake ≤ `RX_MAX_DEPS` (8), at most 4 ports and 2 objects. 53 Larger fragments are counted (`fragments_over_budget`) and never proposed. 54 55 Enumeration grows each fragment backwards from its exit, adding a producer 56 only when every consumer of that producer is already inside, so every set is 57 convex and single-exit. 58 59 ## The MetaSkill 60 61 ``` 62 AgMetaSkill { 63 id, state, identity 64 ancestry[] graph digest, run, exit origin of the runs it came from 65 input_contract type and edge mode per port 66 output_contract type, may fail 67 authority_contract READ per object slot, nothing else 68 resource_contract merged need of the steps 69 effect_contract performs 0, publishes 0, proposals n 70 realization COMPILED | LEARNED | HYBRID | HARDWARE 71 reference the fragment as observed (a step program) 72 samples[] observed inputs and what the reference produced 73 verdict, measure, canary counts, generation 74 } 75 ``` 76 77 Contracts are derived from the fragment, never chosen. The identity is 78 SHA-256 over the id, contracts, realization identity, reference signature and 79 ancestry. 80 81 ### Realizations 82 83 A realization is not assumed to be text or code. 84 85 - **Compiled**: the step program — steps in canonical order (post-order from 86 the exit over data inputs by port), inputs resolved to a port or an earlier 87 step — run in one reaction. Each step runs through the same node semantics 88 the graph uses (`semantics()` in rx_graph.c). 89 - **Learned**: a table learned from verified observations (inputs, the World 90 fields read, result, step evidence). Nothing else: outside what it saw it 91 cannot run, so verification rejects it (`not_runnable`). It is kept as a 92 contract kind, not promoted. 93 - **Hybrid**: the learned table, and the step program on a miss. 94 - **Hardware**: a contract slot. No hardware realization exists on this host; 95 verification rejects it (`not_runnable`). 96 97 ### The AG_META node 98 99 `AG_META` is an action-graph node kind. `op` is the skill id; `imm`/`imm2` 100 hold the first 128 bits of the realization identity the node was built for, 101 and the node runs only a published realization with that identity. It carries 102 its input contract (`in_type`) and its object slots (`mobj`). Lowering gives 103 it one reaction reading its ports, its objects, the run token and its cell; 104 authority is derived from its objects (READ each). Its cell field 5 holds the 105 **step evidence**: the chain `H(acc, local step identity, status, value, 106 inputs)` over the steps that ran, which is exactly what the original steps 107 would have recorded. Identity, validation, dependency budgets, CSE, the 108 effect-ordering rule and the sequential reference all know the kind. 109 110 ## Verification 111 112 `rx_fusion_verify` first checks, in order, and rejects on the first failure: 113 114 1. identity: resealed reference and realization, realization identity and 115 MetaSkill identity equal what it carries; 116 2. contracts: input/output contracts equal those derived from the reference; 117 the realization's program signature equals the reference's; 118 3. authority equivalence: READ per slot, equal to the reference's; 119 4. effect equivalence: no boundary in reference or realization; effect 120 contract equal; 121 5. resource contract equal. 122 123 Then it runs vectors. Both sides run in the sequential reference: the 124 original fragment step by step as ordinary graph nodes, the candidate as one 125 `AG_META` node, behind the same port drivers (each port ends OK with a value, 126 FAILED, or SKIPPED): 127 128 - every observed sample: the fragment must reproduce what was recorded, and 129 the candidate must agree with the fragment; 130 - every combination of OK / FAILED / SKIPPED over the ports, each with value 131 and World sets (zeros, ones, all-ones, three random ranges, and the bounds 132 of the steps' checks). 133 134 Per vector: exit status, value and attempts (semantic equivalence; failure 135 behaviour when a port was not OK or the exit was not OK), and step evidence 136 (evidence equivalence). Any mismatch rejects. 137 138 What each check catches (all exercised by the test): narrowed or widened 139 authority → authority; a claimed effect → effect; a change without a new 140 identity → identity; a changed program step → contract; a learned wrong value 141 → semantic; a learned right value with wrong evidence → evidence; a learned 142 failure turned into success → failure behaviour; the reference and the 143 realization rewritten together → semantic (it no longer reproduces the 144 observations), and it matches no real workflow anyway. 145 146 Tampering with contracts cannot widen authority at run time either: a fused 147 node's authority is derived from its objects, and `rx_fusion_apply` checks 148 that it equals exactly the union of the replaced steps' authority. 149 150 ## Measurement 151 152 Original and fused graphs run side by side in two worlds with the same inputs, 153 41 interleaved runs each at 4 workers, pinned to one core class: 154 155 - cognitive operations avoided: reactions that computed per run, crumbs per 156 run; 157 - latency: median run time; 158 - resource use: process CPU time per run, reactions registered, World objects; 159 - success and failure counts; 160 - energy: the `aien_spbm` package and performance-core accumulators, two 161 rounds of idle / original / idle / fused / idle (1 s each), idle power 162 subtracted, the spread between rounds reported. A difference inside twice 163 the spread is reported as not resolved. On a machine without the meter the 164 receipt says `unavailable`. 165 166 Accepted when fewer reactions compute per run, the median is within the 167 original leg's own spread ((p75 − p25) / median, never less than 5 %) of the 168 original, and success and failure counts are equal. The receipt records the 169 spread and the tolerance used. A fragment of two 170 independent heavy steps is refused (SLOWER): fused, they no longer run side 171 by side. 172 173 ## Canary 174 175 The fused graph runs in shadow beside the original on production traffic, 176 including inputs never observed. Per run: exit status, value and attempts, 177 outcome, the out and effect objects, and the fused node's step evidence 178 against the evidence recomputed from the original run. One divergence 179 quarantines the MetaSkill for good. The test's poisoned hybrid (one learned 180 entry for an input verification never generates) verifies and is then 181 quarantined by the canary. 182 183 ## Promotion and publication 184 185 `rx_fusion_promote` proposes an R9 generation carrying the realization's 186 canonical bytes (`rx_graph_realization_encode`), the realization and 187 MetaSkill identities, the authority contract, the verification, measurement 188 and canary figures, and the ancestry, then promotes it with the caller's 189 request. The barrier checks the promotion right on the native authority and 190 refuses a proposer promoting its own candidate. `rx_fusion_publish` then 191 requires the generation to be active and re-reads the bytes: a MetaSkill 192 changed after promotion is not published. 193 194 `rx_fusion.o` references no Aienux admin operation (checked by the build). 195 196 ## Gate evidence (what the test proves) 197 198 | Claim | How | 199 |---|---| 200 | observation of verified runs only | a run that differs from its reference is refused | 201 | repeated fragments found across graphs | the workflow found in three procedures, with its failure count | 202 | unstable / flaky / too-big / single-graph fragments not proposed | judge reasons, budget counter | 203 | semantic, authority, effect, evidence, failure-behaviour equivalence | verification of compiled and hybrid; nine tampering cases caught | 204 | learned alone and hardware not promoted | both rejected `not_runnable` | 205 | never silent | an unpublished MetaSkill (verified, measured, canary-passed, promoted) is not applied and the graph is unchanged; after publication, three unpublished library entries are still refused | 206 | benchmark is a real gate | the parallel fragment is SLOWER | 207 | canary is a real gate | the poisoned hybrid is QUARANTINED | 208 | promotion needs authority | refused without the right and for the proposer | 209 | fused graphs equal the originals | every run: lowered == reference (incl. step evidence), original vs fused (exit, outcome, out and effect objects, step evidence), causal ancestry, evidence present, no bypass; determinism at 1, 2, 4, 8 workers | 210 | authority removed (golden path N3) | both sides block with BLOCKED_AUTHORITY and perform nothing; the fused node needs READ on A and nothing else; missing authority is reported on it | 211 212 ## Limits 213 214 - Observation and proposal are host calls, not resident reactions. 215 - Fragments never contain effect boundaries, branches, joins or control 216 dependencies; one exit; at most 8 steps, 4 ports, 2 objects. 217 - A node blocked for authority blocks the whole fused node (the steps before 218 the blocked one do not run either) — conservative, as in the action graph. 219 - The compiled realization is a typed step program run in one reaction, not 220 machine code. The learned realization is a table, not a neural module. No 221 hardware realization is built. 222 - Energy saved per run is only claimed where it exceeds the meter's 223 round-to-round spread. 224 - Host processor only. The authority is the native C library, not the Aienux 225 kernel.