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/capability-query-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 / capability-query-ir.md` 163 lines · 7865 bytes Raw Blame History Rendered 1 # Omega capability query IR (OMEGA_CAPABILITY_QUERY) 2 3 Code: `src/runtime/rx_capq.{c,h}`. Test: `tests/runtime/rx_capability_query.c`, 4 `make test-capability-query`. Receipt: `evidence/CAPABILITY_QUERY/`. 5 6 ## Purpose 7 8 AIEN says what capability it needs. It does not need to know in advance every 9 Skill, tool, device or machine that could provide it, and it never reads the 10 catalog. Omega compiles the need into probes of the capability sources and 11 returns a short list of candidates. Each candidate carries its values on 12 explicit dimensions. The caller's own priorities decide the order. 13 14 ## Records 15 16 ``` 17 CapabilityNeed (CqNeed) { 18 semantic_operation operation id or alias 19 accepted_input_types types the caller can supply (bit set) 20 required_output_types types the result must include (bit set) 21 effect_class accepted effect classes (docs/04: PURE .. SECRET_BEARING) 22 authority_ceiling resource range + most rights it may use 23 locality_constraints local / Fabric, optionally one machine 24 latency_budget microseconds (0 = none) 25 energy_budget microjoules (0 = none) 26 reliability_requirement minimum, ppm 27 evidence_requirement NONE < DECLARED < MEASURED < RECEIPT 28 sources optional restriction 29 } 30 31 CapabilityCandidate (CqCandidate, 88 bytes) { 32 capability_id, skill_id, machine_id, realization_id 33 required_authority resource, rights, held (validated now) 34 expected_cost, expected_latency, expected_energy 35 confidence, reliability ppm 36 evidence ref + level 37 source, local, effects 38 } 39 ``` 40 41 No field of a candidate points into the catalog. A description never leaves 42 the catalog. 43 44 ## Sources 45 46 | Source | What it holds | 47 |---|---| 48 | Capability Graph | native AIEN capabilities | 49 | Skill Network | Skill Net procedures (a candidate's `skill_id`) | 50 | MCP registry | MCP tools; a dead session makes its tools unavailable | 51 | local physical | this machine's devices | 52 | Fabric | capabilities another machine advertises; live only while its lease holds | 53 54 Each operation declares which sources can realize it (a physical operation 55 has no MCP realization; a tool operation has no physical one). The catalog 56 refuses a registration outside its operation's sources, and only the Fabric 57 may speak for another machine. 58 59 ## Compile 60 61 `cq_compile(catalog, need) -> CqPlan`: 62 63 1. resolve the name (alias or id) to the canonical operation; 64 2. add every specialization of it (an operation's children, recursively; at 65 most 32); 66 3. keep the sources that can realize any of them, that the caller allows, 67 and that the locality allows (local only drops the Fabric; Fabric only 68 keeps nothing else; a pinned machine keeps one side); 69 4. the plan's identity is SHA-256 over the resolved operation set, the 70 sources and every constraint. Asking by alias or by id gives the same plan. 71 72 An unknown operation gives `CQ_E_NO_OP`; no applicable source gives 73 `CQ_E_NO_SOURCE`. 74 75 ## Run 76 77 `cq_query` visits only the plan's (operation, source) buckets of an index 78 built once over the catalog. An entry is feasible when all of these hold: 79 80 - live: not withdrawn, its MCP session alive, its machine's lease valid; 81 - locality allowed, and the pinned machine if any; 82 - inputs it requires are a subset of what the caller can supply; 83 - outputs it produces include everything required; 84 - its effect classes are a subset of those accepted; 85 - its rights are within the ceiling, and a resource it needs is in range; 86 - latency and energy within budget; reliability and evidence at least the 87 minimum; the caller's cost maximum and confidence minimum. 88 89 `held` is decided for each feasible candidate by validating the principal's 90 capabilities through the world's authority view (`rx_world_validate_cap`). 91 The query mints nothing. `rx_capq.o` is linked alone first and the build fails 92 if it references any Aienux admin operation. 93 94 ## Ranking 95 96 There is no relevance score. Each candidate has seven values to minimize: 97 cost, latency, energy, 1 - confidence, 1 - reliability, authority not held, 98 not local. The caller (`CqTradeoffs`) names the dimensions that matter in 99 priority order, a tolerance band on each, a cost maximum, a confidence 100 minimum and K. 101 102 1. **Pareto front** over the named dimensions: drop every candidate some other 103 candidate beats or equals on all of them and beats on one. (Sorted by the 104 named dimensions, a candidate can only be dominated by one before it, and 105 only front members need checking.) `include_dominated` skips this step. 106 2. **Caller's order**: on the first dimension keep every candidate within 107 `best * (1 + tolerance)`, let the next dimension decide among those, and 108 so on; the strict order (dimensions, then ids) breaks what remains. Pick, 109 remove, repeat until K. 110 111 Two callers with different priorities get different winners from the same 112 candidates; the test checks this. 113 114 ## What crosses into cognition 115 116 `CqResult`: verdict, how many were returned, how many were feasible, how 117 large the front was, and at most K = 16 candidates. `cq_result_bytes` is the 118 header (16 bytes) plus 88 bytes per returned candidate, at most 1,424 bytes 119 whatever the catalog size. 120 121 ## Consumption 122 123 `cq_bind_skill_node(graph, node, candidate)` points an action graph SKILL node 124 at the candidate's procedure and declares the candidate's authority on it. 125 `rx_graph_compile` then finds the authority held, or reports exactly that 126 requirement missing, and routes it to AEGIS as usual. 127 128 ## Gate evidence (what the test proves) 129 130 | Measure | How | 131 |---|---| 132 | candidate recall | every query against an oracle in the test: a full scan of every entry with a separately written match rule, Pareto front and selection. The returned list must equal the oracle's ranked list. | 133 | selection precision | every returned candidate is feasible by the oracle's rule; the top candidate equals the oracle's top | 134 | query latency | median, p99 and max of compile + lookup + rank at each size, plus a hot operation with 1,000 providers; the oracle's full-scan time alongside | 135 | bytes into cognition | `cq_result_bytes` per query, against the catalog's description bytes and against handing over just the named operation's descriptions | 136 | catalog size scaling | 100, 1,000, 10,000, 100,000 capabilities; operations grow with the catalog (about 6 providers each), so the index is what is tested | 137 138 Pass requires, at every size: zero ranked-list, feasible-count and front 139 mismatches with the oracle; recall, precision and top-1 all 1.0; no 140 description byte read; bytes into cognition within the bound; at least 500 141 queries with candidates. Across sizes (catalog x1000): query median at most 142 x10 while the full scan grows more than x100. 143 144 Scenarios: alias and specialization, each hard constraint, Fabric leases and 145 locality, MCP sessions and applicability, tolerance bands, two orders -> two 146 winners, determinism over repeated queries and registration orders, held / 147 not held / forged / revoked authority through the native Aienux authority, 148 and a chosen candidate driving an action graph (runs when held; reported 149 missing when not). 150 151 ## Limits 152 153 - The MCP registry and the Fabric are in-process catalogs: no live MCP 154 sessions and no network. Leases and session liveness are catalog state. 155 - Operations are matched by id, alias and specialization. The lexical, 156 semantic and model-based stages of the router pipeline (docs/04) are not 157 part of this gate. 158 - The query is a host function call, not yet a resident reaction. 159 - Confidence and reliability are catalog values, not learned. 160 - At most 32 operations in a plan (an operation and its specializations). 161 - Compile computes the plan digest every time; that is most of a query's 162 cost (about 1 µs). A caller that keeps a plan pays only the lookup. 163 - Host processor only.