feat: Calendar Agent + IoT Agent design + DB migration

- Deployed Calendar Agent (n8n ID: 4ZIEGck9n4l5qaDt)
  - 12 Google Calendars via HA proxy, cron 06:30
  - GPT-4.1 batch classification -> memory_facts
  - Telegram daily briefing
- DB: added source_ref column + dedup index on memory_facts
- DB: created ha_sensor_config table (IoT Agent sensor allowlist)
  - 9 seed entries (Pixel 10, Pixel Watch, EY HP, Spotify, GPS)
- README: full IoT Agent design documentation
  - Sensor allowlist (regex), LLM-based activity inference
  - Three-layer data flow, confidence-gated clarification
- README: Calendar Agent design + workflow diagram
- README: updated infra table, ADR broker, credentials
- CHANGELOG: Calendar Agent milestone

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-03-21 13:45:12 +00:00
parent 841d3a93f6
commit 90d9faacca
3 changed files with 258 additions and 34 deletions

View File

@@ -4,6 +4,44 @@ Tutte le modifiche significative al progetto ALPHA_PROJECT sono documentate qui.
---
## [2026-03-20] Calendar Agent — primo workflow Pompeo in produzione
### Cosa è stato fatto
Primo agente Pompeo deployato e attivo su n8n: `📅 Pompeo — Calendar Agent [Schedule]` (ID `4ZIEGck9n4l5qaDt`).
### Design
- **Sorgente dati**: Home Assistant REST API usata come proxy Google Calendar — evita OAuth Google diretto in n8n e funziona per tutti i 25 calendari registrati in HA.
- **Calendari tracciati** (12): Lavoro, Famiglia, Spazzatura, Pulizie, Formula 1, WEC, Inter, Compleanni, Varie, Festività Italia, Films (Radarr), Serie TV (Sonarr).
- **LLM enrichment**: GPT-4.1 (via Copilot) classifica ogni evento: category, action_required, do_not_disturb, priority, behavioral_context, pompeo_note.
- **Dedup**: `memory_facts.source_ref` = HA event UID; `ON CONFLICT DO NOTHING` su indice unico parziale.
- **Telegram briefing**: ogni mattina alle 06:30, riepilogo eventi prossimi 7 giorni raggruppati per calendario.
### Migrazioni DB applicate
- `ALTER TABLE memory_facts ADD COLUMN source_ref TEXT` — colonna per ID esterno di dedup
- `CREATE UNIQUE INDEX memory_facts_dedup_idx ON memory_facts (user_id, source, source_ref) WHERE source_ref IS NOT NULL`
- `CREATE INDEX idx_memory_facts_source_ref ON memory_facts (source_ref) WHERE source_ref IS NOT NULL`
### Credential n8n create
| ID | Nome | Tipo |
|---|---|---|
| `u0JCseXGnDG5hS9F` | Home Assistant API | HTTP Header Auth |
| `mRqzxhSboGscolqI` | Pompeo — PostgreSQL | Postgres (pompeo/martin) |
### Flusso workflow
```
⏰ Schedule (06:30) → 📅 Range → 🔑 Token Copilot
→ 📋 Calendari (12 items) → 📡 HA Fetch (×12) → 🏷️ Estrai + Tag
→ 📝 Prompt (dedup) → 🤖 GPT-4.1 → 📋 Parse
→ 💾 Postgres Upsert (memory_facts) → 📦 Aggrega → 📱 Telegram
```
---
## [2026-03-21] ADR — Message Broker: nessun broker dedicato
### Decisione