aien-architecture-mv
Canonical architecture for the AIEN ecosystem: flows, boundaries, ADRs, and the map from design to implementation repositories.
Brought by drakestapleton
aien-architecture-mv / docs / milestone-10-spec.md
| 1 | # Specification: Milestone 10 — Omega Library V1 (`OMEGA_LIBRARY_V1`) |
| 2 | |
| 3 | ```text |
| 4 | Document ID: SPEC-OMEGA-M10 |
| 5 | Milestone: Milestone 10 (OMEGA_LIBRARY_V1) |
| 6 | Classification: Sovereign Machine Canonical Specification |
| 7 | Target Substrate: Versioned Procedural Program Library, Provenance Tracking, and Component Catalog |
| 8 | Status: COMPLETE / RATIFIED (aien-spark/aien-architecture#22, aien-spark/omega#16) |
| 9 | Lineage: SILICON -> ATLAS (M1) -> PHYSICS (M2/M3) -> OMEGA (M4-M10) -> AIEN |
| 10 | ``` |
| 11 | |
| 12 | --- |
| 13 | |
| 14 | ## 1. Executive Summary & Core Invariants |
| 15 | |
| 16 | Milestone 9 established sovereign program synthesis (`OMEGA_SYNTHESIS_V0`), discovering verified programs from input/output specifications. |
| 17 | Milestone 10 establishes the **sovereign program library substrate** (`OMEGA_LIBRARY_V1`): |
| 18 | |
| 19 | > **DISCOVERED MEANINGS ARE ACCUMULATED, NOT FORGOTTEN. EVERY COMPONENT IS IMMUTABLY INDEXED, PROVENANCE-LINKED, AND VERIFIED.** |
| 20 | |
| 21 | The `OMEGA_LIBRARY` substrate provides: |
| 22 | 1. **Content-Addressed Catalog**: Programs indexed by canonical `SemanticId` (Program ID) and `RealizationId` with constant-time retrieval. |
| 23 | 2. **Contract-Based Semantic Query**: Search and filter components by typed signatures (input/output types, bit widths, precondition/postcondition constraints). |
| 24 | 3. **Dependency DAG Tracking**: Composite programs declare explicit dependencies on constituent components, forming an acyclic dependency graph with cycle detection. |
| 25 | 4. **Immutable Versioned State**: Library evolution is tracked via monotonic versions ($v_1, v_2, \dots$); a SHA-256 state digest seals the library catalog at every version. |
| 26 | 5. **Fail-Closed Verification Gate**: Only programs that have passed the full M7 verification ladder ($V_0, V_1, V_2$) with valid receipts are admitted into the library. |
| 27 | 6. **Synthesis Reuse**: The synthesis engine can consume an `OmegaLibrary` as its primitive bank, reusing existing verified abstractions to solve higher-level tasks at lower search depths. |
| 28 | |
| 29 | --- |
| 30 | |
| 31 | ## 2. Library Data Model & Interfaces |
| 32 | |
| 33 | ```c |
| 34 | #define OMEGA_LIB_MAX_PROGRAMS 128 |
| 35 | #define OMEGA_LIB_MAX_DEPS 8 |
| 36 | |
| 37 | typedef struct { |
| 38 | OmegaProgram program; |
| 39 | uint32_t version_introduced; |
| 40 | uint64_t timestamp_added; |
| 41 | size_t dep_count; |
| 42 | SemanticId dependency_ids[OMEGA_LIB_MAX_DEPS]; |
| 43 | uint8_t evidence_receipt_hash[32]; |
| 44 | } OmegaLibraryEntry; |
| 45 | |
| 46 | typedef struct { |
| 47 | uint32_t version; |
| 48 | size_t count; |
| 49 | OmegaLibraryEntry entries[OMEGA_LIB_MAX_PROGRAMS]; |
| 50 | uint8_t state_digest[32]; |
| 51 | } OmegaLibrary; |
| 52 | |
| 53 | int omega_library_init(OmegaLibrary *lib); |
| 54 | void omega_library_destroy(OmegaLibrary *lib); |
| 55 | |
| 56 | /* Insert a verified program into the library. Fails if unverified or duplicate. */ |
| 57 | int omega_library_insert(OmegaLibrary *lib, const OmegaProgram *prog, |
| 58 | const SemanticId *deps, size_t dep_count, |
| 59 | const uint8_t receipt_hash[32]); |
| 60 | |
| 61 | /* Content-addressed lookup */ |
| 62 | const OmegaLibraryEntry* omega_library_find_by_id(const OmegaLibrary *lib, const SemanticId *prog_id); |
| 63 | |
| 64 | /* Semantic query: find all programs matching input/output types and width */ |
| 65 | size_t omega_library_query_by_type(const OmegaLibrary *lib, |
| 66 | TypeTag in_type, uint16_t in_width, |
| 67 | TypeTag out_type, uint16_t out_width, |
| 68 | const OmegaLibraryEntry **out_results, size_t max_results); |
| 69 | |
| 70 | /* Compute cryptographic checksum over entire library catalog */ |
| 71 | int omega_library_compute_digest(OmegaLibrary *lib); |
| 72 | |
| 73 | /* Advance version and seal state */ |
| 74 | int omega_library_advance_version(OmegaLibrary *lib); |
| 75 | ``` |
| 76 | |
| 77 | --- |
| 78 | |
| 79 | ## 3. Qualification Gates for M10 |
| 80 | |
| 81 | 1. `OMEGA_LIBRARY_INIT_PASS`: Library initialized with version 1, empty catalog, and zeroed digest. |
| 82 | 2. `OMEGA_LIBRARY_INSERT_PASS`: Verified programs inserted into the catalog with complete metadata. |
| 83 | 3. `OMEGA_LIBRARY_LOOKUP_ID_PASS`: O(1) content-addressed retrieval by `SemanticId`. |
| 84 | 4. `OMEGA_LIBRARY_LOOKUP_TYPE_PASS`: Semantic query by type contracts returns matching component entries. |
| 85 | 5. `OMEGA_LIBRARY_DEPENDENCY_DAG_PASS`: Composite program dependencies recorded and topologically validated without cycles. |
| 86 | 6. `OMEGA_LIBRARY_IMMUTABILITY_PASS`: Cryptographic state digest seals library contents; tampering is detected. |
| 87 | 7. `OMEGA_LIBRARY_UNVERIFIED_REFUSAL_PASS`: Unverified programs or programs lacking verification pass are rejected fail-closed. |
| 88 | 8. `OMEGA_LIBRARY_DUPLICATE_REFUSAL_PASS`: Duplicate insertions of identical `SemanticId` rejected fail-closed. |
| 89 | 9. `OMEGA_LIBRARY_SYNTHESIS_REUSE_PASS`: Synthesis engine queries library components as primitives to discover solutions at reduced depth. |
| 90 | 10. `OMEGA_LIBRARY_RECEIPT_PASS`: Qualified library demonstration produces cryptographic evidence receipt with full provenance. |