S30 · Persistent Memory
Declared state: built — **SQLite is the store by decision** (D-02); the PostgreSQL migration is cancelled and its scaffolding deleted. Vault markdown is the human source of truth (D-22)..
This is the repository plan and evidence, not a live health reading. A task marked done may still depend on credentials, devices, deployment or a newer acceptance test.
Dependencies
S16, S32, S39
Tasks and gates
30.F1a · Centralize every persistent path under MUSHEGH_STATE_DIR.
Tier F · done · Verification: planned-test
Gate: new `test_memory_single_origin.py` — 46/46, ten plants (a store reverting to the repo
- unverified-import · undated ·
docs/SYSTEMS-DETAILS.md:3133 - migration-checkpoint · undated ·
docs/SYSTEMS-DETAILS.md:3133
30.F1b · Move derived stores and union learned facts without overwrite.
Tier F · done · Verification: planned-test
Gate: new `test_memory_single_origin.py` — 46/46, ten plants (a store reverting to the repo
- unverified-import · undated ·
docs/SYSTEMS-DETAILS.md:3133 - migration-checkpoint · undated ·
docs/SYSTEMS-DETAILS.md:3133
30.F1c · Prove the migration rejects split-origin and destructive regressions.
Tier F · done · Verification: planned-test
Gate: new `test_memory_single_origin.py` — 46/46, ten plants (a store reverting to the repo
- unverified-import · undated ·
docs/SYSTEMS-DETAILS.md:3133 - migration-checkpoint · undated ·
docs/SYSTEMS-DETAILS.md:3133
30.F2 · **One recall facade.** Seven stores, five holding their own SQLite handle, no unified
Tier F · done · Verification: hermetic-test
Gate: `test_layering.py` extended — no module outside the facade opens a memory
- unverified-import · undated ·
docs/SYSTEMS-DETAILS.md:3162
30.F3 · Every stored fact carries source, timestamp and confidence.
Tier F · done · Verification: hermetic-test
Gate: `test_memory_salience.py` extended. 31/31, seven plants.
- unverified-import · undated ·
docs/SYSTEMS-DETAILS.md:3176
30.R1 · Ranked merge with dedup across stores (L0–L5 + graph + patterns).
Tier R · in-progress · Verification: hermetic-test
Gate: new `test_unified_recall.py` - planned gate. new `test_unified_recall.py` — 30 queries, expected fact in top-3 ≥90%.
- hermetic-green · undated ·
bench/test_memory_dedup.py
30.R2 · Contradiction handling: two stores disagreeing produces "I have two versions", not a
Tier R · done · Verification: hermetic-test
Gate: new `test_unified_recall.py` - planned gate. `test_unified_recall.py` [contradiction]
- hermetic-green · 2026-10-17 ·
bench/test_unified_recall.py
30.R3 · Forgetting is a policy, not a leak: retention per layer, verified rotation.
Tier R · done · Verification: hermetic-test
Gate: `test_memory_hygiene.py` [3] + [per-store TTL] - journals rotate out of the hot path; every rolling store has a declared retention enforced by the daily job and verified by overdue().
- hermetic-green · 2026-10-17 ·
bench/test_memory_hygiene.py
30.R4 · The 607 unverified inferred graph edges are verified, weighted down, or dropped (TODO
Tier R · cancelled · Verification: hermetic-test
Gate: cancelled — the edges went with the relation layer on 2026-10-04 (D-26, M04), so there is nothing left to verify or weight down. The relations-parsing half of the old gate lives on in `test_memory_review_learn.py`
- owner-decision · undated ·
docs/DECISIONS.md D-26
30.R5 · **Schema and dual-write.** Postgres schema for every brain store; the 30.F2 facade
Tier R · cancelled · Verification: planned-test
Gate: new `test_store_parity.py` - planned gate. new `test_store_parity.py` — every facade query returns identical rows from both
- owner-decision · undated ·
docs/DECISIONS.md D-02
30.R6 · **Backfill and read-flip, one store at a time.** Backfill, compare, then move reads
Tier R · cancelled · Verification: planned-test
Gate: new `test_store_parity.py` - planned gate. `test_store_parity.py` [backfill] + recall p95 ≤300ms held on the real corpus.
- owner-decision · undated ·
docs/DECISIONS.md D-02
30.R7 · **pgvector replaces the embeddings API on the answer path.** A local model and a vector
Tier R · cancelled · Verification: planned-test
Gate: new `test_pgvector_recall.py` - planned gate. new `test_pgvector_recall.py` — precision@3 no worse than the Jina baseline on the
- owner-decision · undated ·
docs/DECISIONS.md D-02
30.R8 · **The laptop stays on sqlite, proven, not assumed.** edge and pc_agent never open a
Tier R · cancelled · Verification: planned-test
Gate: new `test_offline_edge.py` - planned gate. new `test_offline_edge.py` — laptop processes green with Postgres stopped; a Postgres
- owner-decision · undated ·
docs/DECISIONS.md D-02
30.R9 · **The cache is optional, proven, not assumed.** Valkey carries the turn digest, the
Tier R · cancelled · Verification: planned-test
Gate: new `test_cache_optional.py` - planned gate. new `test_cache_optional.py` — the full suite passes with the cache stopped, and no
- owner-decision · undated ·
docs/DECISIONS.md D-02
30.E1 · Memory behavioural category ≥95 with recall latency inside budget on the VPS.
Tier E · open · Verification: hermetic-test
Gate: `test_memory_behavioral.py` + `profile_memory_recall.py`
30.E2 · The brain host holds its memory ceiling with the stack that actually exists: the brain, its SQLite stores in WAL mode, and the warm caches, under a ceiling that was MEASURED rather than declared (D-02, D-43).
Tier E · open · Verification: hermetic-test
Gate: `test_speed.py` [rss-ceiling] — brain plus SQLite plus the warm caches under the declared ceiling, where the declared figure is the one 31.F6 measured on the same day with its headroom stated
- recorded-note · undated ·
docs/DECISIONS.md D-02 (2026-10-04, M02) - recorded-note · undated ·
docs/systems-plan.json (VPS diagnosis 2026-10-04)
30.F1 · **Consolidate the ten drifting sqlite stores into Postgres in one clean cutover** — no dual-write. Jev: consolidate p=0.93 conf 0.86; do the migration now, before unparking (p=0.67); dual-write is wrong (P=0.28) because it doubles the write path and produces divergence bugs costing more than a cutover.
Tier F · done · Verification: hermetic-test
Gate: test_s30_migration_removed.py — no staging module, no DSN, no psycopg, and the backup path that replaced the snapshot helper round-trips
- hermetic-green · undated ·
bench/test_s30_migration_removed.py
30.R10 · A conflicting correction supersedes the fact it corrects: the stale record is tombstoned with an audit line rather than deleted, and recall stops returning both. Deduplicating on identical text is not supersession (D-25, which has had no writer since it was written).
Tier R · in-progress · Verification: hermetic-test
Gate: new `test_supersession.py` — storing a fact, then a conflicting correction, leaves ONE fact in recall; the superseded one is present in the audit log with the reason and the supersession id; an inferred fact never supersedes an owner-stated one regardless of recency; and an unrelated fact added afterwards is untouched.
- hermetic-green · undated ·
bench/test_supersession.py
HUD screen contracts
- Persistent Memory · /systems/S30
All subsystems · Source: docs/systems-plan.json.