# SuperLuca — Setup del Profilo per Raffaele

Creazione del 17/06/2026. Profilo separato per Raffaele, Business Analyst AI Process Automation Cippà Trasporti.

## Comandi Usati

```bash
hermes profile create superluca
```

Path profilo: `~/.hermes/profiles/superluca/`

## Configurazione Applicata

- **SOUL.md** scritta con identità completa (Luca, agente di Raffaele)
- **Design system Cippà Trasporti**: rosso #C40030, accent #FF0000, CTA nero/bianco
- **Progetti pregressi**: FAK tariff comparison, tool PDF-to-Word via API LLM, CRM automation, HRO digitalizzazione
- **Stile comunicazione**: Niente convenevoli, codice robusto, ROI-focused per comunicazioni aziendali
- **Modello**: DeepSeek V4 Flash (come Emma) — gratuito
- **API Key**: DEEPSEEK_API_KEY copiata dal profilo principale

## Dati di Contatto Raffaele

- Nome: Raffaele
- Ruolo: Business Analyst & AI Process Automation Specialist
- Azienda: Cippà Trasporti SA (Chiasso, Svizzera)
- Telefono: +41 76 201 34 43
- Telegram: @SuperLucaCippaBot (nuovo bot creato apposta)

## Stato Collegamento Telegram

**Completato il 17/06/2026** — Bot Telegram separato creato e collegato.

### Dati Bot SuperLuca

- **Nome bot:** SuperLucaCippàBot
- **Username Telegram:** @SuperLucaCippaBot
- **ID bot:** 8973040069
- **Token:** configurato in `~/.hermes/profiles/superluca/.env` (TELEGRAM_TOKEN)

### Gateway

- **Servizio systemd:** `hermes-gateway-superluca.service`
- **Stato:** Active running
- **Log:** `~/.hermes/profiles/superluca/logs/gateway.log`
- **Collegamento Telegram:** ✅ Connected (polling mode)
- **Menu comandi:** 30 registrati, 100 nascosti

### Configurazione `.env` (CORRETTA)

```env
# ~/.hermes/profiles/superluca/.env
DEEPSEEK_API_KEY=sk-......
TELEGRAM_BOT_TOKEN=897304......   # ← NOME CORRETTO: TELEGRAM_BOT_TOKEN, NON TELEGRAM_TOKEN!
GATEWAY_ALLOW_ALL_USERS=true     # Necessario per evitare crash loop del gateway
```

### ⚠️ Lezione Importante: Il nome esatto della variabile

Il gateway Hermes (file `gateway/config.py`, riga 1165) cerca **`TELEGRAM_BOT_TOKEN`** — non `TELEGRAM_TOKEN`, non `BOT_TOKEN`.

Usare `TELEGRAM_TOKEN` fa sì che il gateway parta ma mostri _"No messaging platforms enabled"_ nei log e vada in crash loop con exit code 1. Il token viene ignorato silenziosamente.

### ⚠️ systemd EnvironmentFile

Il servizio systemd di default **non carica** il `.env` del profilo. Dopo aver creato il file `.env`, modificare il service:

```bash
systemctl --user edit --full hermes-gateway-superluca
```

Aggiungere sotto `[Service]`:
```
EnvironmentFile=/home/oem/.hermes/profiles/superluca/.env
```

Poi:
```bash
systemctl --user daemon-reload
systemctl --user restart hermes-gateway-superluca
```

### Risoluzione Problemi Incontrati

1. **Primo avvio con systemd fallito** — Manca `GATEWAY_ALLOW_ALL_USERS=true`. Aggiunto, fermato systemd e riavviato in foreground con `superluca gateway run --replace`.
2. **Gateway in crash loop** — systemd riavviava continuamente. Fermato con `systemctl --user stop` e avviato con `nohup ... &` in background.
3. **Verifica token Telegram** — Il comando `curl -s "https://api.telegram.org/bot$(grep TELEGRAM_TOKEN ... | cut -d= -f2)/getMe"` ha confermato token valido.

### Come Raffaele usa il bot

1. Apre Telegram
2. Cerca @SuperLucaCippaBot
3. Avvia la chat
4. Scrive il primo messaggio → Risponde come **Luca** 🧠⚡
5. Non serve approvazione (GATEWAY_ALLOW_ALL_USERS=true)

### Comandi Utili

```bash
# Stato gateway
systemctl --user status hermes-gateway-superluca

# Log live
journalctl --user -u hermes-gateway-superluca -f

# Test bot
curl -s "https://api.telegram.org/bot$(grep TELEGRAM_TOKEN ~/.hermes/profiles/superluca/.env | cut -d= -f2)/getMe"

# Fermare il gateway
systemctl --user stop hermes-gateway-superluca

# Riavviare
systemctl --user restart hermes-gateway-superluca

# Avvio manuale (senza systemd)
nohup superluca gateway run --replace > ~/.hermes/profiles/superluca/logs/gateway.log 2>&1 &
```

## Accessi Decisi (da Kuki)

- FAK confronto: ✅ Condiviso (stessa cartella ~/.hermes/fak-comparison/)
- Ticket Emma: ❌ Non visibili
- Costi/token Emma: ❌ Non visibili
- Dashboard Emma: In sola lettura (da confermare)

## Path Condivisi

- Dati FAK: `/home/oem/.hermes/fak-comparison/`
- Server: Acer Veriton, IP 10.205.63.252, Tailscale 100.78.71.82
- HTTP server Emma: porta 8080
- FAK webapp: porta 5000
