Skip to content

A tiny friend in your Mac's notch and on your iPhone that keeps an eye on your AI coding agents: Claude Code, Codex, Cursor, Gemini CLI, Antigravity and more. Approve from the notch or your Lock Screen.

docs: coucou_agent field for third-party agents (#7, #9)

Louis Raillec586234f2112
diff --git a/CHANGELOG.md b/CHANGELOG.md
index cd5854e1..33d4f173 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,3 +8,4 @@
- The island always reopens after folding, and Settings opens below it, resizable — thanks @rouderz
- Choose the Claude model for the chat in Settings; the list comes from your Anthropic account, and Claude Sonnet 4.6 stays the default — thanks @rouderz
- Windows build artifacts are now downloadable from a manual CI run — thanks @MysJofR
+- Any agent can talk to Mochi: tag a hook payload with `coucou_agent` (e.g. `nb-hook --agent gemini`) and it gets its own pill in the island (#7, #9) — thanks @lacatu5
diff --git a/README.md b/README.md
index 8d727521..a337a8e1 100644
--- a/README.md
+++ b/README.md
@@ -31,7 +31,7 @@ Meet **Mochi**: a soft little squircle with big eyes that pops out of your notch
## Features
-- 🤖 **Claude Code, live** — see every session in your notch: what it reads, edits and runs, step by step. Finished? Mochi does a happy little jump.
+- 🤖 **Claude Code and other agents, live** — see every session in your notch: what it reads, edits and runs, step by step. Tag a hook payload with `coucou_agent` to give any agent its own pill (see [`docs/AGENTS.md`](docs/AGENTS.md)). Finished? Mochi does a happy little jump.
- ✅ **Approve from the notch** — Claude Code permission requests show up with **Allow / Deny**. One click, back to work.
- 🧑‍💻 **Jump to the right terminal** — open the exact terminal window of a session *(macOS)*.
- 💬 **Ask Claude anything** — built-in chat, straight from the notch. Pick the model in Settings; the list comes from your Anthropic account.
diff --git a/docs/AGENTS.md b/docs/AGENTS.md
new file mode 100644
index 00000000..7e91792d
--- /dev/null
+++ b/docs/AGENTS.md
@@ -0,0 +1,84 @@
+# Coucou — third-party agent integration
+
+Any tool that can write to a Unix domain socket (macOS) or a named pipe (Windows) can send events to Coucou and have its own pill next to Claude Code.
+
+## The `coucou_agent` field
+
+Add the optional field `coucou_agent` to any hook JSON payload. Coucou will create a pill labelled with the agent name and route all events to it.
+
+**Validation:** the name must match `^[a-z0-9-]{1,24}$` (lowercase letters, digits and hyphens, 1–24 characters). An absent or invalid name routes the event to the Claude Code pill instead.
+
+## Hook command (macOS)
+
+Configure your tool to call the Coucou relay with `--agent <your-name>` after the hook executable:
+
+```json
+{
+ "hooks": {
+ "UserPromptSubmit": [
+ { "type": "command", "command": "/path/to/nb-hook --agent my-tool" }
+ ]
+ }
+}
+```
+
+The shell wrapper passes `"$@"` to the Python relay, which extracts the agent name and injects it into the payload before forwarding to Coucou.
+
+## Hook command (Windows)
+
+Same pattern with the Windows relay:
+
+```json
+{
+ "hooks": {
+ "UserPromptSubmit": [
+ { "type": "command", "command": "C:\\path\\to\\coucou-hook.exe --agent my-tool" }
+ ]
+ }
+}
+```
+
+## Payload format
+
+The relay adds `coucou_agent` to the JSON it forwards. You can also add it yourself if you talk to the socket directly:
+
+```json
+{
+ "hook_event_name": "UserPromptSubmit",
+ "session_id": "my-session-1",
+ "coucou_agent": "my-tool",
+ "prompt": "Running task…"
+}
+```
+
+Send newline-terminated JSON to the socket:
+- **macOS (GitHub build):** `~/Library/Application Support/NotchBuddy/nb.sock`
+- **macOS (App Store build):** `~/Library/Containers/fr.louisraille.Coucou/Data/nb.sock`
+- **Windows:** `\\.\pipe\coucou-<user-SID>`
+
+## Supported events
+
+All standard Claude Code hook events are supported. The pill lifecycle:
+
+| Event | Effect |
+|---|---|
+| `SessionStart` | Creates the pill (if absent), sets state to idle |
+| `UserPromptSubmit` | State → thinking; prompt shown in ticker |
+| `PreToolUse` | State → working; tool label shown in ticker |
+| `PostToolUse` / `PostToolUseFailure` | State → working |
+| `Notification` | Rate-limit or question state if applicable |
+| `Stop` | State → finished for 5 s, then pill removed |
+| `StopFailure` | State → error |
+| `SessionEnd` | Pill removed |
+| `SubagentStart` / `SubagentStop` | Step added to ticker |
+
+## Quick test (macOS)
+
+With Coucou running:
+
+```sh
+echo '{"hook_event_name":"UserPromptSubmit","session_id":"t1","prompt":"hello","coucou_agent":"demo"}' \
+ | /bin/sh ~/Library/Application\ Support/NotchBuddy/nb-hook --agent demo
+```
+
+A "demo" pill should appear in the island.
diff --git a/docs/INTEGRATIONS.md b/docs/INTEGRATIONS.md
index 8e655386..715a825f 100644
--- a/docs/INTEGRATIONS.md
+++ b/docs/INTEGRATIONS.md
@@ -18,8 +18,9 @@ claude (terminal, VS Code, app Claude)
```
- `nb-hook` : cible séparée dans le projet, copiée dans `~/Library/Application Support/NotchBuddy/bin/nb-hook` au premier lancement.
- Socket : `~/Library/Application Support/NotchBuddy/nb.sock` (version GitHub) ou `~/Library/Containers/fr.louisraille.Coucou/Data/nb.sock` (version App Store). Dossier en 0700, socket en 0600. Connexions du même utilisateur seulement (vérification `getpeereid`). 1 Mio et 5 s maximum par message, 32 connexions simultanées.
-- `nb-hook <Event>` lit le JSON du hook sur stdin, ajoute le contexte du terminal (`TERM_PROGRAM`, `ITERM_SESSION_ID`, `TERM_SESSION_ID`, `__CFBundleIdentifier`, le tty trouvé en remontant les processus parents, `cwd`), l'envoie à l'app.
+- `nb-hook [--agent <nom>] <Event>` lit le JSON du hook sur stdin, ajoute le contexte du terminal (`TERM_PROGRAM`, `ITERM_SESSION_ID`, `TERM_SESSION_ID`, `__CFBundleIdentifier`, le tty trouvé en remontant les processus parents, `cwd`) et, si `--agent` est fourni, le champ `coucou_agent`, puis l'envoie à l'app.
- **Si l'app ne répond pas en 300 ms, `nb-hook` sort en code 0 sans rien écrire** : Claude Code continue normalement. Jamais de blocage.
+- Champ optionnel `coucou_agent` : nom en minuscules, chiffres et tirets, 24 caractères au plus. Si absent ou invalide, l'événement va dans la pastille Claude. Voir `docs/AGENTS.md` pour les autres agents.
### Événements à brancher et état du bonhomme
| Hook | Effet dans l'app |