בס״ד

FME — Storage Validation Report (hookstreet-memory / D1)

docs/FME_STORAGE_VALIDATION.md · last changed (pre-VM history) · rendered from GitHub master

FME — Storage Validation Report (hookstreet-memory / D1)

Demanded by ZW-ENGINE-V9 before any search layer. No retrieval is built until this passes. Verified by live queries against the production D1, not from memory. Generated 2026-06-07. KV is now correctly demoted to cache (see hierarchy).

Architecture hierarchy (LOCKED)

Original Artifact  (Telegram file / text)   ← source of truth, recoverable via original_ref
        ↓
D1  hookstreet-memory  (PERMANENT memory)    ← never rolls off
        ↓
Family Memory Index  (memory table)          ← searchable catalog (Phase 2 — not yet populated)
        ↓
KV  PLAID_ITEMS:*:thread  (CACHE / buffer)   ← fast, last 50 msgs / 14 days. NOT the store.

1. Schema (verified live via sqlite_master)

2. Write path (single, audited)

Every family/Mildred message → saveToMemory() in ops-api/src/index.tsone function, called from /chanie/send, /family/send, /mildred/send after the KV write and after the dedup gate.
- Stores id, person, sender, original text, kind, UTC ts+created, search_text (normalized lowercase), original_ref (the Telegram file_id for voice/photo → original audio re-downloadable via the bot).
- Also writes a capture row to event_log per message. ✅ verified: event_log incremented +2 across the two-message test.

3. Failure behavior (verified by design + code)

4. Duplicate prevention (verified)

5. IDs / timestamps / original preservation

6. Backup

Verdict

The storage foundation is REAL and durable for the raw message log: verified schema, fail-open writes, dedup, UTC timestamps, search_text, original_ref, and an append-only audit. Open (by design, not bugs): the memory Index (chapters/entities) is unpopulated until Phase 2; kind=voice detection is correct but only production-verified (CLI can't transmit the emoji); original-audio recoverability leans on Telegram retention. Search is NOT built and will not be until classification populates the Index.

Source trail · docs/FME_STORAGE_VALIDATION.md @ master · rendered 2026-07-02 7:23 PM EDT by scripts/build-docs.py · the .md in the repo is the truth; this page is the phone-readable view