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
omega-mv / spec / state-projection.md
| 1 | # Cognitive state projection |
| 2 | |
| 3 | Gate `OMEGA_STATE_PROJECTION_PASS`. |
| 4 | |
| 5 | ## Rule |
| 6 | |
| 7 | Cognition does not get "everything the system knows". A cognitive operation states |
| 8 | what it needs (`CognitiveNeed`). Omega turns that need into the smallest state |
| 9 | that is enough for the operation (`StateProjection`), using typed queries to |
| 10 | Cortex. Cortex never hands over its history. |
| 11 | |
| 12 | ``` |
| 13 | CognitiveNeed { goal, operation_class, required_fact_types[], |
| 14 | required_temporal_scope, required_world_scope, |
| 15 | uncertainty_requirement, evidence_requirement, |
| 16 | memory_scope, resource_budget } |
| 17 | ↓ pj_compile (typed Cortex queries) |
| 18 | StateProjection { canonical_world_refs[], cortex_refs[], derived_features[], |
| 19 | temporal_windows[], hypotheses[], uncertainty[], |
| 20 | evidence_refs[], excluded_state[], recoverability_manifest } |
| 21 | ``` |
| 22 | |
| 23 | Nothing here is text or tokens. A projection holds object references, |
| 24 | typed summaries and derived numbers. "Compile" means selecting and shaping |
| 25 | state from a declared need. It generates no code. It is not an Omega |
| 26 | compiler (see the M6 note in the project memory). |
| 27 | |
| 28 | ## What runs |
| 29 | |
| 30 | Code: |
| 31 | |
| 32 | - `src/runtime/rx_cortex.{c,h}`: Cortex, the typed append-only store. |
| 33 | - `src/runtime/rx_projection.{c,h}`: the need, the projection, the |
| 34 | compiler, compression, recall, recovery and the audit. |
| 35 | |
| 36 | Test: `tests/runtime/rx_state_projection.c` with |
| 37 | `tests/runtime/rx_sp_workloads.{c,h}`. Run it with `make test-state-projection`. |
| 38 | The build compiles `rx_cortex.o` and `rx_projection.o` on their own. It fails |
| 39 | if either one references the world, a faculty or Omega realization code. |
| 40 | |
| 41 | ### Cortex |
| 42 | |
| 43 | Every object is a fixed header plus a payload of 64-bit words: |
| 44 | |
| 45 | - class |
| 46 | - kind |
| 47 | - subject |
| 48 | - time |
| 49 | - generation |
| 50 | - branch |
| 51 | - protection bits |
| 52 | - tag |
| 53 | - up to four links |
| 54 | |
| 55 | It carries a SHA-256 digest of its canonical encoding. The store keeps a |
| 56 | running hash chain over every digest. Two axes are kept apart: |
| 57 | |
| 58 | - **Content class.** What the object is. These are the nine memory classes of |
| 59 | doctrine AIEN.md §8.2: entity, claim, observation, execution, failure, |
| 60 | evidence, plan, realization, relationship. |
| 61 | - **Treatment.** How one operation may use the object. It is decided per |
| 62 | operation, never stored. |
| 63 | |
| 64 | The indexes are kept per subject and in time order. A query costs the objects |
| 65 | in its range, not the size of the store. |
| 66 | |
| 67 | Scope: one in-memory tier. The doctrine's L1/L2/L3 tiers (accelerator memory, |
| 68 | host memory, NVMe) are not implemented. |
| 69 | |
| 70 | ### Treatments |
| 71 | |
| 72 | | Treatment | Meaning | Form | |
| 73 | |---|---|---| |
| 74 | | PINNED | always present; never dropped for budget | full | |
| 75 | | LIVE | the current value (with LATEST it is canonical world state) | full | |
| 76 | | DERIVED | replaced by one computed feature (count, sum, sum of squares, min, max); the sources can be recovered | feature | |
| 77 | | RECALLABLE | reference; the body can be recalled on demand, digest-checked | ref | |
| 78 | | COMPRESSIBLE | lossy summary of a sample series; the source can be recovered | summary | |
| 79 | | REFERENCE_ONLY | identity, header and digest only | ref | |
| 80 | | EPHEMERAL | valid for this operation only; outside the recoverability contract | full | |
| 81 | | BRANCH_LOCAL | only from the need's hypothetical branch; the main line never sees it | full | |
| 82 | | PROTECTED_EVIDENCE | evidence and protected state; never summarized | full, or ref with exact digest | |
| 83 | |
| 84 | ### Protected state |
| 85 | |
| 86 | Five kinds of state are protected: |
| 87 | |
| 88 | - authority |
| 89 | - commit receipts |
| 90 | - verification evidence |
| 91 | - generation identity |
| 92 | - effect receipts |
| 93 | |
| 94 | These carry protection bits in Cortex. A need that asks to summarize, derive |
| 95 | or make ephemeral any protected object does not compile. The whole projection |
| 96 | is refused (`PJ_ERR_PROTECTED`). Nothing is silently weakened. Protected state |
| 97 | appears in full, or as a reference that keeps its exact digest. |
| 98 | |
| 99 | A budget smaller than the pinned and protected state is also refused |
| 100 | (`PJ_ERR_BUDGET`). The compiler never trims silently. |
| 101 | |
| 102 | ### Excluded state and recovery |
| 103 | |
| 104 | Excluded objects are not copied. The projection records three things: |
| 105 | |
| 106 | - the Cortex object count and chain head it was compiled against |
| 107 | - how many objects it left out, per in-scope subject |
| 108 | - how many it left out from all other subjects |
| 109 | |
| 110 | `pj_audit` goes through Cortex object by object. It gives each excluded object |
| 111 | exactly one reason (subject, type, time, branch, superseded, derived source). |
| 112 | It checks that each one is still intact, and that the projection's counts agree. |
| 113 | |
| 114 | `pj_recover_all` checks every entry against Cortex: |
| 115 | |
| 116 | - the digest of every entry |
| 117 | - that every summary is what its verified source summarizes to |
| 118 | - that every derived feature recomputes to the same numbers from verified |
| 119 | sources |
| 120 | |
| 121 | ## Gate |
| 122 | |
| 123 | Consumer: an explicit, rule-based reasoner in the style of R11's |
| 124 | statistical AIEN (part A), and the R11 AIEN faculty itself (part B). **Neither |
| 125 | is a neural model.** The consumer reads a projection and the whole store with |
| 126 | the same code, and filters for relevance itself. It therefore pays for every |
| 127 | object it is handed. |
| 128 | |
| 129 | Histories are generated with **planted answers**. The generator decides the |
| 130 | cause, verdict or choice first, then writes a history in which it is true. |
| 131 | Both runs are scored against the planted answer, not against each other. |
| 132 | |
| 133 | **Part A** has five operations, each run on 24 histories of 64 subsystems |
| 134 | (about 43,000 Cortex objects and 6.8 MB each): |
| 135 | |
| 136 | | Operation | Need (abridged) | |
| 137 | |---|---| |
| 138 | | explain a regression | window since the last verified realization; own telemetry COMPRESSIBLE; resource changes PINNED; realizations of self and dependencies; prior regressions REFERENCE_ONLY (all time); hypotheses RECALLABLE; evidence as references | |
| 139 | | verify a cost claim | the claim (focus, PINNED) with its receipt in full; telemetry since the claim COMPRESSIBLE | |
| 140 | | plan the next experiment | latest authority grant PINNED; every past plan REFERENCE_ONLY (episodic memory) | |
| 141 | | what-if on a branch | branch-local changes; recent telemetry COMPRESSIBLE; the goal LIVE | |
| 142 | | assess a goal with uncertainty | window = current generation; telemetry DERIVED into one feature with second moments; goal LIVE | |
| 143 | |
| 144 | Measured in a development run, as medians over 24 tasks. The committed receipt |
| 145 | is from candidate run `20260928T211355Z`, which has the same deterministic |
| 146 | columns. |
| 147 | Correctness, bytes and items touched are deterministic for the fixed seeds. |
| 148 | Latencies vary from run to run. The committed evidence receipt is the |
| 149 | authority. |
| 150 | |
| 151 | | Operation | Correct (whole / projection) | Bytes | Items the consumer touched | End-to-end | |
| 152 | |---|---|---|---|---| |
| 153 | | explain regression | 24/24, 24/24 | 6,816,128 → 18,696 | 86,008 → 276 | 1.90 ms → 35 µs | |
| 154 | | verify cost claim | 24/24, 24/24 | 6,818,688 → 20,824 | 43,024 → 154 | 1.95 ms → 18 µs | |
| 155 | | plan next experiment | 24/24, 24/24 | 6,820,928 → 1,024 | 43,038 → 8 | 1.74 ms → 7 µs | |
| 156 | | branch what-if | 24/24, 24/24 | 6,818,992 → 1,872 | 43,025 → 14 | 1.79 ms → 4 µs | |
| 157 | | assess goal | 24/24, 24/24 | 6,819,376 → 336 | 86,052 → 3 | 1.84 ms → 19 µs | |
| 158 | |
| 159 | End-to-end for the projection includes the compile. For the whole store it |
| 160 | includes building the whole-store view. The gate also requires the projection |
| 161 | end-to-end to beat the whole-store *reasoning alone*, so the result does not |
| 162 | rest on the cost of handing the store over. |
| 163 | |
| 164 | **Part B** uses the real R11 faculty (`rx_aien.o`, native Aienux authority). |
| 165 | Each of 8 histories covers one regime's lifetime (24 records under changing |
| 166 | placements), interleaved with three other regimes. It ends in a failed |
| 167 | prediction whose planted cause is a core-class change or drift. The history is |
| 168 | fed to the faculty twice: |
| 169 | |
| 170 | - once whole: 1,217 objects, 703 AIEN activations |
| 171 | - once as the projection for "why did this prediction fail": 18 objects, 36 |
| 172 | activations |
| 173 | |
| 174 | The projection is the last verified record, its receipt as a reference, the |
| 175 | demand since the record, and the placement carried in from before the window. |
| 176 | Both runs produce the planted hypothesis and the same plan in 8 of 8 cases. |
| 177 | |
| 178 | **Part C** is scale. For "explain a regression" at 16, 64 and 256 subsystems, |
| 179 | the whole store grows from 1.7 MB to 27 MB. The projection stays at about |
| 180 | 18 KB. Cortex objects examined stay at about 2,780. |
| 181 | |
| 182 | ### Definitions |
| 183 | |
| 184 | - **Recall precision.** The fraction of provided items that passed the |
| 185 | consumer's relevance filters and entered a decision (from its access trace). |
| 186 | - **Recall.** The fraction of the objects the planted answer rests on that the |
| 187 | projection carries. An object counts as carried if it is an entry, or if it |
| 188 | is a source of a derived feature. |
| 189 | - **Unnecessary-state ratio.** One minus recall precision (trace-based). |
| 190 | Leave-one-out is also reported: remove each projected item alone and count |
| 191 | the ones whose removal changes the answer. |
| 192 | - Leave-one-out undercounts necessity for redundant statistical evidence. For |
| 193 | example, no single telemetry interval out of 120 changes a mean-based |
| 194 | verdict. So it reads high for explain (895 per 1,000) and verify (981 per |
| 195 | 1,000), while the trace-based ratio is 27 and 0. |
| 196 | - Both are in the receipt. |
| 197 | |
| 198 | ### Controls that must fail |
| 199 | |
| 200 | - **Leave-one-out.** Every task has at least one item whose removal changes the |
| 201 | answer. |
| 202 | - **The newest objects in Cortex, at the same byte size as the projection.** |
| 203 | 0 of 120 tasks correct. |
| 204 | - **Everything about the subject, all time, in full.** It fails every |
| 205 | dependency-caused regression (18 of 24 correct) and every goal assessment |
| 206 | (0 of 24: the generation identity is machine state). |
| 207 | - **Under-specified needs.** Each one fails: |
| 208 | - no dependency scope: 18 of 24 |
| 209 | - receipt as a reference instead of in full: 8 of 24 |
| 210 | - working memory instead of episodic: 9 of 24 |
| 211 | - main line instead of the branch: 0 of 24 |
| 212 | - whole lifetime instead of the current generation: 0 of 24 |
| 213 | - **Protected state.** All 75 requests to summarize, derive or make ephemeral |
| 214 | protected state were refused: 5 protections × 3 treatments × 5 operations. |
| 215 | - **Other refusals.** |
| 216 | - A budget below the pinned state is refused. |
| 217 | - BRANCH_LOCAL without a branch is refused. |
| 218 | - **Tampering.** Changing one word of a source the projection summarizes, |
| 219 | references or derives from is caught by recovery and by recall, in 120 of |
| 220 | 120 tasks. |
| 221 | |
| 222 | ### Not claimed |
| 223 | |
| 224 | - Neural cognition. |
| 225 | - Cortex storage tiers. |
| 226 | - Energy measurement. |
| 227 | - Live production histories. The part A histories are generated, and part B |
| 228 | replays generated R11 objects. |
| 229 | - Code generation. |
| 230 | - Latency on any accelerator. Everything runs on the host processor. |