interplane.Get Omega
Read in your language

cortex

aien-dev/cortex

Brought by drakestapleton

branch main Branches Tags History

cortex / spec / BUILD-CONTRACT.md

72 lines · 5331 bytes Raw Blame History Source

Omega Cortex — shared build contract (owner: CortexOmega)

Goal: re-implement the Cortex memory server (Rust cortex-rs 0.1.0, live binary $HOME/.local/bin/cortex-rs sha256 91ccba94…afe, SQLite 3.45.0 bundled, serde_json 1.0.x, ryu 1.0.x, axum 0.7, rustc 1.98.1) in seeded Omega, byte-for-byte compatible on the wire. Reference source: the archived cortex-rs src/ (db.rs, handlers.rs, models.rs, embeddings.rs, auth.rs); where the live binary and the source disagree, the binary wins (spec/ORACLE-OBSERVED.md). Repo: github.com/aien-dev/cortex, Apache-2.0 WITH LLVM-exception.

Toolchain (pinned)

Program structure

All server sources are concatenated in a fixed order into ONE unit (build.sh), so every global and function is visible everywhere. Cross-module data passes through the callee's documented input/output globals (caller puts into them, then calls). To avoid collisions:

ownerfiles (om/)global names start withfunction names start with
FtsEngineuni_fts.om, flog.om, fts.om, like.omqfts_, like_, uf_, flog
JsonNumjson.om, f64.om, uni_rust.omjjs_, num_, ru_
SqliteImportcrc32c.om, sqlite.om, import_main.omkcrc_, sq_, imp_
CortexOmegaeverything elseany other lettercx_, st_, http_, api_, ...

Each module ships tests/<module>/ with its own main harness(es), a runner script, and a differential check against the stated oracle, plus at least one negative control (a mutant or corrupted expected value that the check must FAIL). Evidence logs go to evidence/<module>/. No main inside om/*.om library files except import_main.om.

Log file format (storage; SqliteImport writes it, CortexOmega reads+writes it)

File = 8-byte header CXLOG001 then records. Integers little-endian. Record = u32 payload_len, u32 crc32c(payload) (Castagnoli, reflected poly 0x82F63B78, init/xorout 0xFFFFFFFF; check value of "123456789" = 0xE3069283), then payload. Payload = u8 op, then fields. Field kinds: str = u32 len + bytes, len 0xFFFFFFFF = SQL NULL; u64/i64 = 8 bytes; f64 = 8 bytes IEEE bits; u8 = 1 byte; blob = like str (NULL allowed). Ops (field order is normative):