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 / spec / plan-reuse.md

201 lines · 11305 bytes Raw Blame History Rendered
1# Omega plan IR and verified plan cache (OMEGA_PLAN_REUSE)
2
3Code: `src/runtime/rx_plan.{c,h}` (plan IR, identity, cache, applicability,
4lifecycle), `src/runtime/rx_plan_arrange.{c,h}` (one planning domain and the
5AIEN planner for it). Test: `tests/runtime/rx_plan_reuse.c`,
6`make test-plan-reuse`. Receipt: `evidence/PLAN_REUSE/`.
7
8This file was committed before the implementation. The gate criteria in §7
9are binding; the receipt reports measured values against them and never
10relabels a miss.
11
12## 1. Purpose
13
14Successful reasoning structure should be reusable. A plan is semantic
15computation: a typed Omega action graph over World objects (`rx_graph.h`),
16with the conditions under which it is valid and the evidence it must leave.
17It is not prose and not a hidden chain of thought.
18
19The action graph IR (merged before this work) states its own limit:
20"procedures are fixed templates; no learned planner". This work supplies the
21other half: AIEN produces a plan by search when none applies; the plan is
22executed as an action graph, verified, generalised into a slot-parameterised
23template and stored. A later goal of the same shape retrieves the template,
24checks that it applies, binds its slots and runs it without searching.
25
26## 2. PlanTemplate
27
28```
29PlanTemplate {
30 semantic_id SHA-256 of the canonical semantic bytes (§3)
31 goal_shape SHA-256 of the canonical goal shape (§4)
32 preconditions[] predicates over the goal object (kind, constraints)
33 required_state[] predicates over bound World objects (slots)
34 required_capabilities[] (slot, rights) the principal must already hold
35 required_resources RxResourceNeed per step and total energy
36 action_graph kind + digest; kind 1 = rx_graph AgGraph template
37 whose World objects are parameters 1..n (the slots)
38 variable_slots[] typed slots; the role each plays (goal / involved)
39 invariants[] predicates that must hold before and after the run
40 evidence_requirements evidence nodes of the graph; crumbs must verify
41 success_predicate predicates over slots after the run
42 failure_predicate graph FAILED, invariant broken, or evidence missing
43 applicability_predicate shape + preconditions + required state +
44 capabilities + resources + environment assumptions
45 + world generation + cognitive generation
46 ancestry origin (search, adapted, re-derived), parent ids,
47 producing goal, producing cognitive generation
48 verification_status CANDIDATE, VERIFIED, STALE
49}
50```
51
52Environment assumptions (for example "the station's arm is ready") are
53predicates over named environment objects and are part of the plan's meaning.
54
55## 3. Identity
56
57`semantic_id` = SHA-256 over `OMEGA_PLAN_TEMPLATE_V1` followed by canonical
58bytes of: goal kind, goal shape, slots, every predicate list (each list sorted
59by its canonical record bytes, so builder order does not matter), required
60capabilities, required resources, action graph kind and digest
61(`rx_graph_identify` over the unbound template; builder-order independent),
62evidence requirements, failure predicate flags.
63
64Excluded: ancestry, verification status, counters, and everything about one
65physical realization. A **realization** is one binding of the template in one
66World: slot objects (id, generation), the capability references used, the
67digest of the compiled and optimised graph, the world generation and the core
68class the run was placed on. `realization_id` = SHA-256 over
69`OMEGA_PLAN_REALIZATION_V1`, the semantic id and those fields. Many
70realizations share one semantic id.
71
72The verification record (world generation and cognitive generation the
73template was last verified under) belongs to the cache record, not to the
74semantic id. A template re-derived under a new World generation has the same
75semantic id; its record is re-verified, not duplicated.
76
77Canonical bytes round-trip: decode(encode(t)) re-encodes to identical bytes
78and the same id.
79
80## 4. Flow
81
82```
83goal object (World)
84 -> derive goal shape (canonical, object identities abstracted)
85 -> retrieve candidate templates (cache index by goal shape)
86 -> check applicability (every axis of §5; first failing axis recorded)
87 -> bind variables (goal slots from the goal, involved slots by
88 following World references)
89 -> verify capability/resource conditions
90 -> execute (rx_graph compile, optimise, lower, run)
91 -> verify (success predicate, invariants, evidence, crumbs)
92```
93
94When no template applies: AIEN plans by search over World predicates,
95executes, verifies, and stores the generalised plan as a CANDIDATE.
96
97Every retrieval decision (accept, or refuse with its axis) is published to a
98World decision object by the principal, so it leaves a causal crumb.
99
100## 5. Applicability axes (no blind replay)
101
102| axis | refused when |
103|---|---|
104| shape | goal shape digest differs |
105| binding | a slot cannot be bound, or a bound object is not live at that generation |
106| goal constraints | goal kind differs, max steps below the plan's steps, energy budget below the plan's energy |
107| required state | any required World predicate fails under the binding |
108| authority | the principal's table has no capability that the World's authority view validates for a slot's required rights (never minted) |
109| resources | a step's need does not fit the World's current budget |
110| environment | an environment assumption predicate fails |
111| world generation | the World generation differs from the one the template was verified under |
112| cognitive generation | AIEN's cognitive generation differs from the one it was verified under |
113
114### Lifecycle
115
116- A plan found by search that executes and verifies is stored **CANDIDATE**.
117- A CANDIDATE reuse first runs the action graph's sequential reference
118 against a copy of the World (no effects). Only if the reference reaches
119 the success predicate is it executed.
120- A reuse that executes and verifies promotes to **VERIFIED**. A VERIFIED
121 reuse skips the reference.
122- A reuse that fails its success or failure predicate marks the template
123 **STALE** and is counted as a false applicability. STALE is never reused.
124
125## 6. Planning domain and planner (what is and is not claimed)
126
127The domain is the classic arrangement ("blocks world") benchmark lifted onto
128World objects. Unit objects (type 0x5B01) carry field 0 = what they rest on
129(packed reference of another unit, 0 = floor) and field 2 = their own packed
130reference. Moving a unit is a publication of field 0, authority-checked by
131the engine under a capability the principal holds for that unit's resource.
132
133The AIEN planner is A* over the World projection of every live unit, with an
134admissible heuristic (unsatisfied goal facts). It is a small explicit search
135model over World predicates, not a neural model. The claim is the reuse
136structure, not the planner's intelligence.
137
138A plan is generalised into a template: slots are goal objects plus every unit
139the plan moves, moves onto, or that rests on a slot at the start (closure).
140Required state: each slot's support relation (slot, floor, or a non-slot) and
141"no non-slot unit rests on a slot". These are sufficient conditions for every
142step of the plan to be legal and for the success predicate to follow.
143
144Adaptation: when a template of the goal's shape fails only on required state,
145the planner searches for a short prefix that reaches the template's required
146state, then runs prefix and template. Adaptation overhead is reported.
147
148## 7. Gate OMEGA_PLAN_REUSE_PASS (binding)
149
150Workloads: two repeated goal shapes (reverse a tower; merge two towers), each
151with at least 40 instances in fresh Worlds with different object identities
152and distractor units. For every instance the first-use path (cache off, AIEN
153search) runs in a mirror World built identically, and the reuse path runs in
154its own World.
155
156"Cognitive operations" = planner states expanded + successors generated +
157heuristic evaluations (first use); goal-shape operations + candidates
158retrieved + predicates evaluated + binding attempts (reuse). Cognition CPU
159time = thread CPU time from goal read to a graph ready to compile.
160
161| # | criterion |
162|---|---|
163| G1 | per shape, median cognitive operations: reuse <= first use / 20 |
164| G2 | per shape, median cognition CPU time: reuse <= first use / 10 |
165| G3 | every accepted reuse succeeds: success predicate, invariants, all evidence nodes carry evidence, crumbs verify; the outcome equals the first-use outcome (same goal facts hold, same number of steps, same number of evidence words) |
166| G4 | false applicability = 0 over all accepted reuses, and at least 80 adversarial goals of a stored shape across the 9 axes of §5 (at least 8 per non-shape axis) are all refused, each refusal published as a World decision (crumb present) |
167| G5 | identity: canonical round-trip; semantic id invariant under builder order and binding; a change to any semantic field changes it; two bindings give two realization ids and one semantic id; re-derivation under a new World generation yields the same semantic id |
168| G6 | per shape, median end-to-end latency (goal to verified outcome): reuse < first use |
169
170Reported, not gated: instructions retired (perf counter, when available),
171package energy per cognition (SPBM hwmon, whole package, machine not quiet),
172adaptation overhead versus full search, what blind replay (no applicability
173check) does on each adversarial axis, lifecycle transitions.
174
175## 8. Limits
176
177- One planning domain. The plan IR and cache are domain-independent; the
178 goal-shape derivation, planner and generaliser are per domain.
179- Templates live in a host-side store; only the decision and index records
180 are World objects. Durability through R9 is not claimed.
181- A template's graph must fit the action graph's 64 nodes.
182- Host processor only; no graphics processor run is claimed.
183- Cognition (goal shape, retrieval, applicability, AIEN's search) reads a
184 consistent host projection of the World taken under the world lock, not
185 through capabilities. Execution is capability-checked by the engine.
186- First-use cognition includes hashing the new template's identity, which a
187 system without a cache would not do. The receipt also reports the CPU
188 ratio with that hash excluded.
189- Two workloads can share one goal shape (both build one six-unit tower);
190 their templates differ in required state. Every candidate of the shape
191 is checked and each refusal is recorded.
192
193## 9. Owner decision (2026-09-28, after the qualification run)
194
195The pre-registered verdict is FAIL: G1 required 20x fewer cognitive
196operations for every workload, and the reverse-tower workload measured 1.2x
197(its goal is too easy for the planner to leave reasoning to save). The
198task's own gate asks for at least one repeated workload; merge-two-towers
199meets it (26.6x fewer operations, outcome and evidence equal to first use,
2000 false applicability). The owner chose to judge the gate by the task's
201wording and merge. The receipt keeps both verdicts; neither is relabelled.