Phase 3 core memory substrate
Phase 3 — Goals
Core Memory Substrate: schema, vector store, write pipeline, read/ranking, and exit gate.
Phase 3 — Goals
Track A — Memory Schema & Data Foundation
Goal 3.A: Establish the memory schema with HNSW, temporal validity, and multi-label taxonomy
Milestones:
- 3.1.1 — Postgres schema v2 (completed): expand foundation
ibex_core.memories(from G5.M1 / ADR-0047) with HNSW vector index (m=16, ef_construction=64), quality columns, generatedsearch_vector, boundedembedding_model/metadataCHECKs. Labels + primary sync already shipped in ADR-0048; expand ADR is ADR-0052 (not ADR-0040).
Acceptance criteria:
- Migration applies cleanly from zero via
make db-migrate - HNSW index type confirmed in CI assertion (not just present — type-checked)
- RLS integration test proves cross-org denial on
memories(labels covered in 2.5.G5.M2) - Primary-category sync verified via existing trigger (insert 2 labels, differing confidence, correct one wins)
Track B — Vector Store & Embedding Integration
Goal 3.B: Pluggable vector store with category-conditional composite scoring
Milestones:
- 3.2.1 — VectorStore interface + pgvector-HNSW implementation:
VectorStoreABC,PgVectorStorewithSET LOCAL hnsw.ef_searchper-transaction. Composite scoring v2 with category-conditional half-life (factual: 180d, procedural: 120d, preference: 45d, behavioral: 30d, episodic: 14d). Embedding client calling Phase 2.5's embedder service. Recall/latency benchmark at 10K/100K/1M synthetic rows.
Acceptance criteria:
VectorStoreABC withPgVectorStoreimplementation,ef_searchset per-transaction- Composite scoring v2 unit-tested against documented formula
- Benchmark run at 10K/100K/1M rows, results committed
embedding_client.pyhas zero direct ML library imports
Track C — Memory Write Pipeline
Goal 3.C: 9-step write pipeline with PII detection, dedup, and temporal conflict resolution
Milestones:
- 3.C.1 — PII detection and redaction: Two-tier detection via Microsoft Presidio (regex patterns + NER). Redaction before embedding. Quarantine for low-confidence PII findings.
- 3.C.2 — Content and near-duplicate detection: SHA-256 content hash for exact dedup. Cosine > 0.92 for near-duplicate candidate detection.
- 3.C.3 — Temporal-interval-aware conflict detection: Interval overlap check before LLM escalation. Sequential facts (
valid_fromordering) auto-classified assupersedeswith zero LLM calls. ADR-0042 rewritten for temporal-first design. - 3.C.4 — Multi-label memory classification:
memory_labelsjoin table. Extraction prompt outputs label array with per-label confidence.
Acceptance criteria:
- Sequential-fact fixture classified as
supersedeswith zero LLM calls - Genuinely overlapping-interval contradiction still escalates to LLM correctly
- PII detection: >95% recall on structured PII, NER-based detection for names/addresses
- Redaction happens strictly before embedding (pipeline ordering test)
Track D — Read/Ranking Pipeline & Hot Cache
Goal 3.D: Semantic search, composite scoring, and hot cache
Milestones:
- 3.D.1 — Semantic search read path:
find_similarviaVectorStore.search(), GIN full-text fallback when vector results < K. - 3.D.2 — Composite scoring v2: Category-conditional recency decay. Formula weights unchanged (0.40/0.25/0.20/0.10/0.05), only recency component is category-conditional. Regression test proves old factual outranks fresh episodic at equal relevance.
- 3.D.3 — Hot cache (Redis sorted set):
ZADD/ZREVRANGEper agent, top-50 capacity, TTL-based eviction. Cache score uses category-conditional recency for consistency.
Acceptance criteria:
find_similaruses HNSW index (confirmed viaEXPLAIN ANALYZE)- Cross-org result leakage impossible (integration test)
- Hot cache score formula reuses
CATEGORY_HALF_LIFE_DAYS
Track E — Exit Gate
Goal 3.E: Prove the composed system enforces isolation and meets quality bars
Milestones:
- 3.E.1 — Memory security integration suite (
TestMemory_ISO_*): 10+ cross-tenant isolation cases against real Postgres+pgvector+Redis. - 3.E.2 — End-to-end memory lifecycle test: Full write/dedup/conflict/retrieve round trip via HTTP API.
make e2e-smoke-p3-memory. - 3.E.3 — Retrieval-quality benchmark sign-off: Recall@10, p50/p95/p99 latency, precision@k. CI regression gate.
- 3.E.4 — ADR consolidation: Phase 3 memory ADRs published and indexed (next free numbers after ADR-0047; 0040–0046 are Phase 2.5).
- 3.E.5 — Phase 3 exit audit: Severity-tiered gap register (P0–P3), same format as Phase 1 exit audit.
Acceptance criteria:
- All ISO-* cases pass with real containers
memory-security-integrationCI job required onmain- Benchmark baseline committed; CI fails on regression
- Zero open P0 gaps in exit audit
Edit on GitHub
Last updated on