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/cortex/blob/main/spec/CUTOVER.md # cortex aien-dev/cortex Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `cortex / spec / CUTOVER.md` 64 lines · 4426 bytes Raw Blame History Source # Cutover plan: cortex-rs to the Omega Cortex (PROPOSED, NOT EXECUTED) Status: PROPOSED. Nothing here has been run against a production instance. Each step that stops, switches or restarts a production Cortex needs the operator's approval. Host-specific details (ports, service names, paths, credentials) live in the operator's private runbook, not in this public repository. ## Blockers before any switch - Short-string pool runway (fixed on this branch). Every logged revision's short fields live in the string space `hs` (om/store.om). An omc pool holds at most 16,777,216 elements, so `hs` is now four 16 MiB pools behind one byte accessor (`hsg`/`hsp`), 64 MiB in total. On 2026-10-26 the primary instance's 6641 entities used 2,022,373 bytes (about 305 bytes each); at 60-70 new entities an hour the 64 MiB space lasts about 127-148 days (modeled; the single 16 MiB pool lasted about 29-34 days). When the space is full the server still traps while loading its log, so the remaining margin must be watched. `tests/big` pads a snapshot past 16 MiB of short strings and reads the last entity back; the old single-pool build exits 109 on the same log. - Ranked search speed. Until 2026-11-11 ranked search and recall took about 1.35x the oracle's wall time; since the incremental FTS index they are faster than the oracle on the same store at 1,000 to 100,000 entities per space (README "Speed", evidence/brain/bench), and get and traverse stay faster. - Shadow. At least 24 h of read-only shadow comparison against the live instance, with zero unexplained differences. ## Order One instance at a time. The primary instance goes first; any further instance only after the first has run on Omega for a quiet week, and only with the operator's explicit approval (an instance that runs under a separate system user needs a new privileged launch rule, which is a new trust path). ## Steps per instance - Checkpointed import. Snapshot without touching the live writer: `sqlite3 'file:DB?mode=ro' '.backup SNAP.db'`, then `cortex-import SNAP.db NEW.log` (refuses an existing OUT; prints `IMPORT OK spaces=… entities=… claims=… fts=…`). Compare the counts with `SELECT count(*)` on SNAP.db. - Side-port run. Start the Omega server on a free side port with the same token source and encoder URL as the production instance, under the operator's process supervisor or by hand. - Shadow comparison. Replay real read traffic to both ports and compare with `tests/parity/pcmp` (same equivalence rule as spec/PARITY.md). `tests/shadow/run.sh` takes a fresh read-only snapshot for every round and discards a round when the live data changed between the snapshot and the end of the live replay, so writes are covered by re-snapshotting, not mirrored. Gate: zero byte differences (identical except the masked timing fields: `elapsedMs`, timestamps and the `/health` runtime string) over at least one day of rounds. PROPOSED, not built: a tee in the MCP bridge that sends each real write to both instances in commit order, which would let reads that follow a write be compared without waiting for the next snapshot. Writes themselves are checked by the write-path gates in step 4. - Write-path checks on the build being switched in. The wire parity gate and its mutant from a clean clone (`check.sh`), the concurrent writers-plus-readers load test with kill -9 mid-run (`tests/load/`), and claims create/upsert/retract on real-shaped data. - Switch. Pause writers, take the final snapshot and import (step 1), stop cortex-rs (do not delete it or its database), start the Omega server on the production port. Clients keep their URL. - Rollback. cortex-rs, its launch configuration and its SQLite file stay untouched during and after the switch. Rollback = stop the Omega server, start cortex-rs again. Writes accepted by Omega after the switch are not in SQLite: re-send them as `/api/cortex/write` requests (they are the log records after the switch time) or accept their loss explicitly. ## Known differences a client can see - `/health` reports `"runtime":"native-arm64-omega"`. - POST `/api/cortex/delete` and `--tokens` exist only in the Omega server (spec/CORTEX-API.md). - A client that "forgets" by retracting keeps the retracted row on disk, as with cortex-rs; delete removes it from the log.