feat(digest): add memory persistence step to Daily Digest
- Parallel branch: Estrai Fatti (GPT) → Upsert Memoria (Postgres) - Extracts structured facts from non-trash emails with pompeo_note + entity_refs - Upserts into memory_facts with thread dedup via memory_facts_dedup_idx - Fix: added newer_than:1d filter to Gmail fetch nodes Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
29
CHANGELOG.md
29
CHANGELOG.md
@@ -24,6 +24,35 @@ Tutte le modifiche significative al progetto ALPHA_PROJECT sono documentate qui.
|
||||
|
||||
---
|
||||
|
||||
## [2026-03-21] Daily Digest — integrazione memoria Postgres
|
||||
|
||||
### Modifiche al workflow `📬 Gmail — Daily Digest [Schedule]` (`1lIKvVJQIcva30YM`)
|
||||
|
||||
Aggiunto branch parallelo di salvataggio fatti in memoria dopo la classificazione GPT:
|
||||
|
||||
```
|
||||
Parse risposta GPT-4.1 ──┬──> Telegram - Invia Report (invariato)
|
||||
├──> Dividi Email (invariato)
|
||||
└──> 🧠 Estrai Fatti ──> 🔀 Ha Fatti? ──> 💾 Upsert Memoria
|
||||
```
|
||||
|
||||
**`🧠 Estrai Fatti` (Code):**
|
||||
- Filtra le email con `action != 'trash'` e summary non vuoto
|
||||
- Chiama GPT-4.1 in batch per estrarre per ogni email: `fact`, `category`, `ttl_days`, `pompeo_note`, `entity_refs`
|
||||
- Calcola `expires_at` da `ttl_days` (14gg prenotazioni, 45gg bollette, 90gg lavoro/condominio, 30gg default)
|
||||
- Restituisce un item per ogni fatto da persistere
|
||||
|
||||
**`💾 Upsert Memoria` (Postgres node → `mRqzxhSboGscolqI`):**
|
||||
- `INSERT INTO memory_facts` con `source='email'`, `source_ref=threadId`
|
||||
- `ON CONFLICT ON CONSTRAINT memory_facts_dedup_idx DO UPDATE` → aggiorna se lo stesso thread viene riprocessato
|
||||
- Campi salvati: `category`, `subject`, `detail` (JSONB), `action_required`, `action_text`, `pompeo_note`, `entity_refs`, `expires_at`
|
||||
|
||||
### Fix contestuale
|
||||
|
||||
- Aggiunto `newer_than:1d` alla query Gmail su entrambi i nodi fetch — evitava di rifetchare email vecchie di mesi non marcate `Processed`
|
||||
|
||||
---
|
||||
|
||||
## [2026-03-21] Schema DB v2 — contacts, memory_facts_archive, entity_refs
|
||||
|
||||
### Nuove tabelle
|
||||
|
||||
Reference in New Issue
Block a user