# Notifiche — Liu Terminal

> Notifiche di Liu Terminal. Ricevi notifiche quando gli agenti IA terminano le attività, con hook configurabili e avvisi sonori.

URL: https://liu.software/it/docs/notify/  
Language: it  
Updated: 2026-10-17

liu-notify è un processo autonomo opzionale, mentre la GUI Liu può ospitare lo stesso server nel processo. Accetta un header v1 da 24 byte o l'attuale header v2 da 28 byte con metadati opzionali su socket locale, limita con token bucket, deduplica gli eventi e instrada suono o voce per ogni coppia (agente, evento).

## Eseguilo

```
# Compila insieme all'app principale
cmake --build build --target liu-notify

# Avvia il demone
./build/liu-notify daemon

# Invia un evento una tantum
./build/liu-notify send --tool=claude --event=stop
```

La configurazione si trova in ~/.config/liu/notify.conf — separata dal config.json dell'app principale in modo che il demone rimanga utilizzabile anche senza Liu in esecuzione.

When Liu is running, its GUI hosts the notification server in-process; the CLI does not need to start a second daemon. If no server is listening, send exits without delivering an event. Use the standalone daemon only when notifications must work without Liu.

## Hook degli agenti supportati

Liu può installare e rimuovere gli hook del ciclo di vita per gli agenti seguenti mentre l’app è in esecuzione. L’hook viene scritto nella configurazione dell’agente e Liu rimuove la voce gestita quando l’istanza che lo ospita termina.

| Agente | Superficie hook | Segnali | Note |
| --- | --- | --- | --- |
| Claude Code | `~/.claude/settings.json` | `start · notify · complete` | UserPromptSubmit drives the working state; Notification and Stop can alert you. |
| Codex | `~/.codex/config.toml` | `complete` | The Stop hook reports a completed turn. Run /hooks in Codex once to trust it. |
| Grok | `~/.grok/hooks/liu-notify.json` | `notify · complete` | Notification and top-level Stop events are handled; sub-agent completions stay silent. |
| OpenCode | `~/.config/opencode/plugins/liu-notify.js` | `complete` | The managed plugin listens for top-level session.idle events. |
| Antigravity | `~/.gemini/config/hooks.json` | `complete` | A named Stop hook reports when the top-level execution loop ends. |
| Command Code | `~/.commandcode/settings.json` | `complete` | Its Claude-compatible settings schema is wired to the top-level Stop event. |

Copilot e custom sono accettati dal protocollo di notifica a basso livello e dalla matrice dei suoni, ma Liu non installa ancora un hook automatico del ciclo di vita per loro. Gli altri agenti funzionano normalmente nelle schede Liu, ma non ricevono notifiche automatiche dagli hook.

## Matrice Strumento × Evento

Configura una regola audio per qualsiasi combinazione. Le celle non impostate ricadono sulla regola generale.

|  | start | stop | notify | error | complete |
| --- | --- | --- | --- | --- | --- |
| claude | · | · | · | · | · |
| copilot | · | · | · | · | · |
| codex | · | · | · | · | · |
| custom | · | · | · | · | · |

## Formato del frame

L'header v1 è di 24 byte; l'attuale header v2 è di 28 byte perché aggiunge meta\_len. Il frame completo è limitato a 4096 byte. tests/fuzz\_notify\_validate.c verifica tramite fuzzing che i frame malformati vengano rifiutati in sicurezza.

```
offset  size  field
0       4     magic      ('N','T','F','Y')
4       2     version    (1 or current 2)
6       2     flags      (speak=1, bell=2)
8       1     tool_id    (claude=1, copilot=2, codex=3, custom=255)
9       1     event_id   (start=1, stop=2, notify=3, error=4, complete=5)
10      1     priority   (reserved)
11      1     source     (cli=0, stdin=1, test=2)
12      4     seq        (client nonce — for dedup)
16      4     title_len  (<= 256)
20      4     body_len   (<= 3072)
24      4     meta_len   (v2 only, <= 512)
payload         title, body, then metadata key=value lines
                total frame <= 4096 bytes
```

La sezione metadati v2 contiene attualmente righe cwd=, session= e agent=. I mittenti degli hook le usano per attribuire l'evento al pannello corretto; le chiavi sconosciute vengono ignorate per compatibilità futura.

## Backend di piattaforma

Stesso frame, speaker diverso. macOS utilizza AVSpeechSynthesizer e Linux si affida a notify-send. Ogni backend risiede in un proprio file (platform\_notify\_macos.m, platform\_notify\_linux.c), quindi sostituirne o simularne uno richiede la modifica di un solo file.

[Prossimo Configurazione →](https://liu.software/it/docs/config.md)
