interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / native / control / README.md

218 lines · 12644 bytes Raw Blame History Rendered
1# Om control contracts
2
3Live record: Linear DRA-312. Historical references (GitHub, no longer a forge
4for this project; No GitHub rule, 2026-11-11): omega-mv issues #659, #649 and #651.
5
6Three bounded Om modules implement action recovery decisions, delegation
7constraints and KV reuse admission. They use caller-owned fixed arrays. They
8perform no I/O and allocate no global application state. Tests are Om programs
9compiled by the existing seeded compiler. There is no foreign runtime fallback.
10
11These are component implementations awaiting integration into the existing
12trusted owners. They are not a new authority root, journal, scheduler, cache,
13daemon, transport or production entry point. The old active implementations
14remain migration work until their consumers have qualified Om replacements.
15No existing C/Rust consumer has been switched by this patch.
16
17## Trust and integration contract
18
19Inputs to these functions are **trusted host facts**, never unchecked model,
20RPC or client assertions. In particular, `authorized=1` and `verified=1` do not
21authenticate themselves. The existing capability/approval owner must derive
22them from its real authorization and receipt verification. Callers serialize
23each operation through their existing transaction/lock owner.
24
25The durable effect owner must:
26
271. Construct exact request, operation, provider, scope, policy and grant
28 identities. An operation ID names an intentional action, not just its
29 arguments. Retrying that action keeps the ID; a second intentional action
30 gets a new ID. The request digest covers the method, complete canonical
31 arguments and relevant contract version.
322. Check current authority and resource generation under the existing execution
33 fence. Call `actstart`, then durably persist the resulting in-flight record
34 **before** dispatch. A failed persistence step forbids dispatch. A snapshot
35 comparison alone cannot prevent revocation racing with dispatch.
363. Pass the same operation identity as the provider idempotency key when the
37 provider supports that contract. An ordinary request header alone is not
38 deduplication.
394. Treat a recovered in-flight record as unknown with `actlost`. An interrupted
40 call, timeout, missing response or missing receipt cannot establish that the
41 effect did not happen. Reconcile against the authoritative provider.
425. Persist reconciliation before exposing the next state. A terminal
43 not-performed result must also guarantee that the old attempt cannot later
44 complete. If the provider cannot prove that, use unknown. A read that returns
45 "not found" without such a guarantee is insufficient.
466. Recheck current authority, generation, expiry and exact bindings on every
47 retry. Do not change a frozen request to make a refused attempt pass.
48
49The modules do not provide atomic disk writes, crash-consistent replay,
50cross-process exclusion, cryptographic receipt verification or complete
51mediation of application entry points. Those integration gates remain open
52under #649/#651 and their existing owners. Hashes identify bytes; signatures,
53authorization and rollback freshness remain separate obligations.
54
55## Action record v1
56
57All arrays below contain exactly 32 `ulong` words. A different length is a
58compiler refusal, not a supported alternate wire format. These are in-memory
59contracts, not a newly standardized on-disk serialization.
60
61| Words | Stored record | Current admission facts | Reconciliation facts |
62|---|---|---|---|
63| 0 | Version, exactly 1 | Version, exactly 1 | Version, exactly 1 |
64| 1 | State | Authorized, exactly 1 | Outcome: 0 unknown, 1 not performed, 2 performed |
65| 2 | Attempt count | Current monotonic time | Exact attempt being reconciled |
66| 3 | Attempt limit, 1..1024 | Reserved, zero | Receipt verified by owner, exactly 1 |
67| 4 | Resource generation, nonzero | Current generation | Original generation |
68| 5 | Authority epoch, nonzero | Current epoch | Original epoch |
69| 6 | Exclusive expiry, nonzero | Reserved, zero | Reserved, zero |
70| 7 | Reserved, zero | Reserved, zero | Reserved, zero |
71| 8..11 | Operation ID | Same operation ID | Same operation ID |
72| 12..15 | Exact request digest | Same digest | Same digest |
73| 16..19 | Scope ID | Same scope | Same scope |
74| 20..23 | Provider identity | Same provider | Same provider |
75| 24..27 | Policy identity | Same policy | Same policy |
76| 28..31 | Grant/approval identity | Same grant | Same grant |
77
78Each four-word identity must be nonzero as a group; zero is the missing-identity
79sentinel. Generations and epochs are supplied by their authoritative owners.
80Expiry and current time must share the same clock domain. Attempt counts never
81wrap; a record exceeding its limit is malformed.
82
83| Function | Behavior |
84|---|---|
85| `actvalid(record)` | Validate the stored record without mutation. |
86| `actstart(record, current)` | Ready -> in-flight; increment attempt only after every check. |
87| `actlost(record)` | In-flight -> unknown; already unknown is idempotent. |
88| `actrecon(record, receipt)` | In-flight/unknown -> ready, unknown or performed, according to the verified outcome. |
89
90States are 1 ready, 2 in-flight, 3 unknown and 4 performed. A performed effect
91is terminal even if a higher-level task failed. Successful observation of an
92unknown outcome returns 21 and sets state 3. This is the one nonzero result
93that changes a record; malformed or rejected inputs leave it unchanged.
94Observation may record a past result after grant expiry; it grants no new work.
95
96| Result | Meaning |
97|---|---|
98| 0 | Transition accepted |
99| 11 / 12 | Unsupported version / malformed record or reserved field |
100| 20 / 21 / 22 / 23 | Wrong state / outcome unknown / already performed / attempt limit |
101| 30 / 31 / 32 / 33 | Not authorized / generation mismatch / epoch mismatch / expired |
102| 35 / 36 | Wrong attempt / unverified reconciliation |
103| 40..45 | Operation, request, scope, provider, policy or grant mismatch, respectively |
104
105## Delegation v1
106
107`capchild(parent, candidate, now)` is a predicate over two 24-word records. It
108does not issue credentials. The authority owner verifies the parent, checks
109revocation, reserves aggregate budgets and issues the child only after success.
110
111| Words | Meaning |
112|---|---|
113| 0 | Version 1 |
114| 1 | Opaque 64-bit rights set in the verified parent's authority namespace |
115| 2 / 3 | Memory and work/fuel ceiling; zero grants none |
116| 4 | Exclusive expiry in the same clock domain as `now` |
117| 5 | Remaining delegation depth, 0..64 |
118| 6 / 7 | Reserved, zero |
119| 8..11 / 12..15 | Exact resource scope / authority-root identity |
120| 16..19 / 20..23 | Subject / grant identity |
121
122Rights retain their existing authority-owner meanings; effect-class labels do
123not substitute for permission bits. All identities must be present. Scope and
124root stay equal. Subject and grant
125must change. Child rights are a subset, ceilings cannot increase, expiry cannot
126extend, and depth strictly decreases. Depth zero is terminal. Comparisons avoid
127increment/decrement overflow. No behavioral score participates in this contract.
128
129Individual child ceilings do not enforce the **sum across siblings**. The
130existing quota owner must reserve and account for shared budgets. The scope
131profile permits only exact resource equality; path prefixes, subnets and
132wildcard containment require separately qualified authority semantics.
133
134Results: 61 version, 62 malformed, 64 parent expired, 65 child expired, 66 rights
135increase, 67 memory increase, 68 fuel increase, 69 expiry increase, 70 changed
136scope, 71 changed root, 72 terminal parent, 73 depth not reduced, 74 unchanged
137subject, 75 unchanged grant. Zero means the predicate passed, not that a
138credential was minted or that the caller is authorized.
139
140## KV reuse v1
141
142`kvmatch(saved, expected, actual_payload_sha256)` accepts two 40-word records
143and a four-word payload digest. `expected` comes from the current trusted
144consumer, not from the saved header. `actual_payload_sha256` must be computed
145from the complete immutable payload by the existing digest/store owner. Merely
146copying the header digest into this argument would defeat integrity checking.
147
148| Words | Meaning |
149|---|---|
150| 0 | Format, exactly 1 |
151| 1 | Nonzero semantic profile identifier |
152| 2 / 3 | Prefix token count / context capacity; positive, prefix <= capacity |
153| 4 | Nonzero cache-layout profile identifier |
154| 5 | Dtype profile: 1 FP32, 2 FP16, 3 BF16, 4 quantized with complete numeric-config identity |
155| 6 / 7 | Nonzero RoPE profile identifier / reserved zero |
156| 8..11 | Model identity |
157| 12..15 | Exact weight-content identity |
158| 16..19 | Engine/compiler/build identity |
159| 20..23 | Tokenizer identity |
160| 24..27 | Tenant/authority scope identity |
161| 28..31 | Complete prefix token-sequence identity |
162| 32..35 | Numeric/target configuration identity |
163| 36..39 | Payload digest in `saved`; must be zero in `expected` |
164
165The numeric/target identity must cover every result-affecting setting, including
166actual RoPE parameters, rounding, quantization scales/layout, target arithmetic
167profile and relevant runtime configuration. A profile label alone is not that
168identity. Tokenize the complete prompt with the bound tokenizer before choosing
169a prefix; concatenating separately tokenized strings can change boundary tokens.
170No missing identity receives a default. This profile refuses empty-prefix caches.
171
172Results: 100 format, 102 reserved field, 103 invalid scalar profile/count, 104
173missing identity, 111..116 scalar mismatch in words 1..6, 120..126 identity
174mismatch in the table's seven groups, 127 payload digest mismatch, 128 invalid
175expected payload field. Zero permits this identity/integrity comparison only.
176The consumer still checks current authorization, payload bounds and supported
177deserialization before exposing data. Neither this module nor a cache hit is
178evidence of a speedup or a new hardware run.
179
180## Build and evidence
181
182Compiler: the in-tree `seed/out/omc` of the omega-mv revision being built. Its
183sha256 is in `seed/out/omc.sha256`; do not copy that value here. The original
1842026-10-23 run used compiler source `57f5f4258cebf3d5b2c22853cd062e351265c525`
185under QEMU ([evidence/659](evidence/659/README.md)). The 2026-11-16 replay onto
186main ran natively on AArch64 with the main compiler of that day
187([evidence/replay-20261116](evidence/replay-20261116/README.md)).
188On a supported AArch64 host, a module's test is built as one source unit:
189
190```sh
191cat native/control/src/action.om native/control/tests/action.om > /tmp/action.om
192seed/out/omc < /tmp/action.om > /tmp/action.elf
193chmod +x /tmp/action.elf
194/tmp/action.elf
195```
196
197Use `delegate` and `reuse` for the other suites. Source concatenation and command
198invocation here are temporary build transport, not new runtime semantics or a
199project-owned shell test runner. Native import/build ownership remains with the
200seeded tool owners. In the recorded x86_64 run, QEMU invoked the AArch64 compiler
201and output programs. That is **EMULATED**, not Spark hardware qualification.
202
203## Research provenance and selection
204
205The implementation is original Om code. No external implementation was copied.
206
207| Project reviewed | Pattern used or disposition |
208|---|---|
209| [Delentia](https://github.com/delentia-labs/Delentia-OS/tree/5602c9bb57106543ed799719be8d6dc79773c860) | Intent/result separation, uncertain effects, exact-payload approval, fresh authority on retry. |
210| [OctantOS public docs](https://github.com/MatrixForgeLabs/OctantOS-Public-Docs/tree/35f90f4dd4f03ce77f23733af2b8a39e9a459d9b) | Parent-child attenuation. Public documentation is not an inspected enforcement implementation. |
211| [Aither AWdk](https://github.com/Aitherium/awdk/tree/eca903dc7c84f98db7df72ae48d7e396e06bffc6) | Complete cache bindings and diagnostic refusals. Reuse the existing AIEN KV/store owner. |
212| [SomaOS](https://github.com/avsribhas/SomaOS/tree/ef3a42afe2cca50f0047294e4a42c6bb31fd7e9d) | Shared typed application state for human/agent interfaces belongs in #648. No behavior-based authority escalation is adopted. |
213| [khy](https://pypi.org/project/khy-os/1.1.7/) | Published source package reviewed separately; no code incorporated. Its source-available terms require separate permission for modification/redistribution. |
214| [KIRA author's thread](https://news.ycombinator.com/item?id=44584958) | No matching public implementation located. No kernel/AGI claims adopted as implementation evidence. |
215
216Production dispatch integration, authoritative durability, independent final
217source review and hardware execution remain open. This change does not close
218the parent issues or declare these projects' wider claims verified.