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/aien-architecture-mv/patches/83b3f5a7edf8c5d9 # aien-architecture-mv Canonical architecture for the AIEN ecosystem: flows, boundaries, ADRs, and the map from design to implementation repositories. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers ## GitHub aien-dev/aien-architecture-mv#75 (code only) closed derived `83b3f5a7edf8c5d9` #75 Imported from GitHub aien-dev/aien-architecture-mv#75 (code only) GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed). Base `b9aa9a2336d01ec3fd15f6c418f53f01d7c44e43` · Head `831f6fceafe2f649046765193217e97a65b107ed` ### Apply it ``` git checkout -b patch-83b3f5a7edf8c5d9 b9aa9a2336d01ec3fd15f6c418f53f01d7c44e43 curl -fsSL https://interplane.io/drakestapleton/aien-architecture-mv/patches/83b3f5a7edf8c5d9.patch | git am ``` Raw patch (mbox) · Diff ### Provenance This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record: ``` github-import 1 aien-dev/aien-architecture-mv 75 831f6fceafe2f649046765193217e97a65b107ed ``` ``` {"kind":"github-import","owner":"aien-dev","repo":"aien-architecture-mv","number":75,"url":"https://github.com/aien-dev/aien-architecture-mv/pull/75","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:38:09Z","metadata":"unavailable","state_derived":true} ``` ### Changes ``` diff --git a/docs/adr/0022-canonical-cortex-owner.md b/docs/adr/0022-canonical-cortex-owner.md new file mode 100644 index 0000000..6d6fed9 --- /dev/null +++ b/docs/adr/0022-canonical-cortex-owner.md @@ -0,0 +1,58 @@ +# ADR 0022: The canonical Cortex owner is omega `rx_cortex` + +**Status:** Accepted 2026-09-30. This is an engineering call made by the orchestrator under the operator's standing rule that the orchestrator decides engineering calls; it was not separately reviewed by the operator. +**Supersedes:** nothing. **Amends:** nothing. +**Related:** ARCH-0007 (J-Space effect boundary), ARCH-0015 (Resident Semantic Store), ARCH-0016 (resident reaction architecture), `doctrine/ARCHITECTURE.md` §2.8 (Concept Ownership), `doctrine/DISCOVERY.md` §16.1 (Responsibilities), `docs/plans/RUST_TO_C_MIGRATION.md` §6. + +Citation note: in this repository "ADR 0022" and ARCH-0022 name the same decision. In other repositories cite it as ARCH-0022. + +--- + +## Context + +`doctrine/ARCHITECTURE.md` §2.8 listed three Cortex implementations and recorded no owner: + +- aien-sovereign-core `crates/cortex-rs`: the Linux LLM-stack memory service. +- omega `src/runtime/rx_cortex.{c,h}`: the host reference in the runtime tree. +- aienos `crates/aienos-cortex`: a Rust epistemic store. + +§2.8 moves a concept to an owner only through an accepted ADR or an R16 gate result. `aien-dev/omega#114` (merge `43dcb04`) gave omega `rx_cortex` an append-only journal with verified replay, a single writer, typed recall and World execution recording, and declared it canonical in code. This ADR records that ownership in the architecture. + +## Decision + +1. **Owner.** omega `src/runtime/rx_cortex.{c,h}` is the one canonical Cortex. It owns the Cortex contract, the single writer and the journal. Every authoritative Cortex write goes through `cx_append` or `cx_append_as` on a `CxStore`. A store has at most one writer: `cx_claim_writer` inside a process, an exclusive lock on the journal file across processes. +2. **World execution.** World execution enters Cortex only through `src/runtime/rx_cortex_record.c`. Attaching the recorder to a World claims the store as its single writer; while attached, no other code may append to that store. +3. **Non-authoritative stores are retired, not ported.** aien-sovereign-core `crates/cortex-rs` and aienos `crates/aienos-cortex` are non-authoritative. `RUST_TO_C_MIGRATION.md` §6 left both open: item 6 ("aienos host crates ... port or retire") covers `aienos-cortex`, and item 7 ("the rest of sovereign-core ... per-crate review") covers `cortex-rs`. This ADR makes that per-crate call for these two crates: retire. The path is: + 1. No new caller is added to either crate. + 2. Records worth keeping are imported into the canonical store through `cx_append_as` as `CX_K_IMPORTED` claims, with the tag naming the source (`CX_SRC_CORTEX_RS`, `CX_SRC_AIENOS_CORTEX`). They never enter as facts and never by writing a journal directly. + 3. The crates are deleted. + Until step 3, nothing treats either crate as a source of truth. +4. **Model output is a candidate, never a fact.** Records that originate from model output enter Cortex as candidate claims (`CX_CLAIM` / `CX_K_CANDIDATE`). A candidate becomes fact only through `cx_promote`, which appends a protected `CX_K_PROMOTION` record linking the candidate to an evidence object of class `CX_EVIDENCE`. +5. **J-Space holds no memory or evidence.** Memory, evidence and provenance belong to Cortex. J-Space (`rx_jspace.h`) holds runtime state-space material only and never records them (ARCH-0007). +6. **Roles.** In the responsibilities table of `doctrine/DISCOVERY.md` §16.1, this store is the "Record" holder ("Cortex / Evidence ledger"). Proposing, defining, verifying, minting capabilities, authorizing and realizing stay with the holders named in that table. Cortex records their outputs and decides none of them. + +## Limits at the time of this decision + +- **Host only.** `rx_cortex` runs hosted on Linux. Native AIENOS does not run it. +- **One tier.** One in-memory tier, optionally backed by an append-only journal that is replayed and verified on reopen. The doctrine tiers L1 (accelerator memory), L2 (host memory) and L3 (NVMe) are not implemented. +- **Not in the living build.** `rx_cortex` is built into the state-projection test target and `test-cortex`. It is not in the R13 living-system build (`RX_R13_SRCS` in the omega `Makefile` does not list it). Integration into the living system is the COMPOSITION-2 work. +- **No Fabric, no remote Cortex.** There is one local store per journal. Nothing replicates it or serves it to another machine. +- **Candidate discipline is not type-enforced.** Nothing in `rx_cortex.h` identifies a writer as model output or stops a writer from appending `CX_K_CLAIM` directly. Decision 4 holds today by writer discipline and review, not by a check in the store. + +## Evidence + +Checked on omega `origin/main` on 2026-09-30. + +- `aien-dev/omega#114` "M20 A7: canonical Cortex, World execution recording", merge `43dcb04`, an ancestor of omega `main`. ("M20" in that title means COMPOSITION-1; see `CURRENT_EXECUTION_PLAN.md`.) +- `src/runtime/rx_cortex.h`: the AUTHORITY block names this file the canonical contract, describes the single writer and the journal lock, names `cortex-rs` and `aienos-cortex` as non-authoritative, and states the three-step retire path. It defines `CX_K_CANDIDATE`, `CX_K_PROMOTION`, `CX_K_IMPORTED`, `CX_SRC_CORTEX_RS`, `CX_SRC_AIENOS_CORTEX` and `cx_promote`, and states that the L1/L2/L3 tiers are not implemented. +- `src/runtime/rx_cortex_record.h`: the World recorder; attaching it claims the store as the single writer. `rx_world.c` calls it through one optional recorder hook (`rx_world_set_recorder`). +- `src/runtime/rx_jspace.h`: "J-Space holds runtime state-space material only. Memory, evidence and provenance belong to Cortex; J-Space never records them." +- `src/runtime/rx_projection.c` already reads Cortex through `cx_get` and `cx_payload`. +- Test target: `make test-cortex` (journal, single writer, typed recall, World execution recorded through `rx_cortex_record`). + +## Consequences + +- `doctrine/ARCHITECTURE.md` §2.8 records omega `rx_cortex` as the Cortex owner by this ADR, in the same change. +- `cortex-rs` and `aienos-cortex` are legacy. Adding a caller to either is a violation of this ADR. +- `CURRENT_EXECUTION_PLAN.md` still describes the Cortex owner as formally unrecorded. That file is reconciled separately and is not edited here. +- Moving Cortex off the host, adding the L1/L2/L3 tiers, putting it into the living build, or exposing it over Fabric are later work. Each must keep the single-writer and candidate-to-fact rules above. diff --git a/docs/adr/README.md b/docs/adr/README.md index d5f6061..ee1d56f 100644 --- a/docs/adr/README.md +++ b/docs/adr/README.md @@ -34,3 +34,4 @@ Current ADRs: - [0019 - Mixed-algebra realization](0019-mixed-algebra-realization.md) - Accepted 2026-09-29 - [0020 - Belief / estimation layer](0020-belief-estimation-layer.md) - Accepted by operator Drake Stapleton, 2026-09-30 - [0021 - Four operating decisions of 2026-09-30: Physics pin, SSD block layout, admission receipts, R16 status](0021-four-operating-decisions-2026-09-30.md) - Recorded 2026-09-30 from the orchestrator brief +- [0022 - The canonical Cortex owner is omega `rx_cortex`](0022-canonical-cortex-owner.md) - Accepted 2026-09-30 (orchestrator engineering call under the operator's standing rule) diff --git a/doctrine/ARCHITECTURE.md b/doctrine/ARCHITECTURE.md index 9f9f8e6..481add2 100644 --- a/doctrine/ARCHITECTURE.md +++ b/doctrine/ARCHITECTURE.md @@ -231,7 +231,7 @@ This table names, for each runtime concept, the one implementation that is autho | Generations | omega `src/runtime/rx_generation.c` (protected; u64 capability generations via omega#71) | aienos `world.rs` `Promoted` state: legacy. sovereign-core `cortex-rs/src/promotion.rs` (memory candidates) and `crumbs/src/promotion.rs` (curriculum operations) promote other things and are a separate concept, not alternates | Hosted only | | Queues | Two separate roles. Reaction task queues: omega `src/runtime/rx_world.h` priority `ready_q` arrays and deferred queue, scheduled by `rx_world.c` `enqueue`. Cross-engine transport: shared-world SPSC rings (`src/runtime/omega_shared_world_abi.h`) consumed by `src/runtime/rx_coherent.c` `rx_resident_seat_step`: E | M19 GPFIFO path in the accelerator world: C recovery. aegis-runtime SQLite pending-task queue: A. sovereign-core Cortex writer queue: E disk-write batcher, not a task queue | Hosted only | | Evidence | omega `src/omega_evidence.{h,c}` (digest-named `evidence//.json`) guarded by `.github/workflows/evidence-immutable.yml`; `rx_world.c` causal crumbs; aienos `native/argus/` event ingest | Pre-R fixed-name receipts for M4-M19: historical records, kept unchanged. Not classified by the R16 map | No shared cross-repo evidence schema exists. The R16 map lists "duplicate causal state" as open: the R4 causal-trace target is not yet named | -| Cortex | No authoritative owner recorded | sovereign-core `crates/cortex-rs` (live Linux LLM-stack Cortex), omega `src/runtime/rx_cortex.{c,h}` (host reference, one in-memory tier, built at the re-check only in the state-projection test, since omega#114 also in `test-cortex`), aienos `crates/aienos-cortex` (Rust epistemic store) | Conflicting: three implementations, owner decision open. Not in the R16 map. 2026-09-30: `aien-dev/omega#114` (`43dcb04`) gives omega `rx_cortex` a journal, single writer and World recording, and declares it canonical in code; this table records the owner only after an accepted ADR or R16 gate result | +| Cortex | omega `src/runtime/rx_cortex.{c,h}` by [ADR 0022](../docs/adr/0022-canonical-cortex-owner.md): contract, single writer (`cx_claim_writer`, exclusive journal lock) and journal; World execution enters only through `rx_cortex_record.c` | sovereign-core `crates/cortex-rs` (live Linux LLM-stack Cortex): legacy, retire not port. aienos `crates/aienos-cortex` (Rust epistemic store): legacy, retire not port. Records enter the canonical store only as `CX_K_IMPORTED` claims | Host only, one in-memory tier plus journal, L1/L2/L3 tiers not implemented, not in the R13 living-system build (built in the state-projection test and `test-cortex`), no Fabric or remote Cortex. Not in the R16 map. Owner recorded 2026-09-30 from `aien-dev/omega#114` (`43dcb04`) | | J-Space | No authoritative owner recorded | omega `src/runtime/rx_jspace.{c,h}` host reference, built at the re-check only into the `rx_branch_reuse` test target, since omega#116 also in `test-jspace-prod` (evidence `evidence/BRANCH_REUSE`), not in the R13 living-system build. aienos `JSpaceWorld`: legacy | Missing on the production reaction path (EST-7 planned). 2026-09-30: production local-only `rx_jspace` merged (`aien-dev/omega#116`, `529ebfa`, own CI test target); remote operations return `JS_ERR_REMOTE`; still not in the R13 living-system build | A concept moves to a new owner only through an accepted ADR or an R16 gate result recorded in `ROADMAP.md`. ```