---
name: tocsin
description: Rings the tab of a Claude Code session that just finished or waits for you, so you can run many sessions in many terminal tabs and come back the moment one needs you. Hooks (not the model) set the tab title to working, done or needs you, show a progress ring while it works, ring the bell (taskbar flash, bell icon on the background tab), pop a desktop toast that brings you back to the right tab, and push to your phone only when you are away from every terminal. Works through SSH and tmux, Windows Terminal, iTerm2, Ghostty, WezTerm, kitty. Use to install or tune these alerts, to see which sessions are done or waiting, to mute one project, or when the user says they never know when a session has finished. French triggers (previens-moi quand c est fini, notification de fin de tache, signal quand Claude a termine, son quand la routine est finie, plusieurs onglets ouverts, je ne sais pas quand l onglet a fini, quelle session m attend, coupe les notifications de ce projet, notification sur le telephone).
argument-hint: "[install | list | test | mute | config | doctor]"
---
# Tocsin
The tocsin is the bell rung from the belfry to call everyone back. Here it calls you back to the one tab, among ten, whose session just finished or is waiting for you.
**Request:** $ARGUMENTS
```bash
T="python3 $(ls -d ~/.claude/skills/tocsin .claude/skills/tocsin 2>/dev/null | head -1)/scripts/tocsin.py"
```
## How it works (read before changing anything)
Hooks in `settings.json` do the work on every turn, whatever the model does. A hook has no terminal of its own, so it answers with a `terminalSequence` that Claude Code (2.1.141 or later) writes to the user's terminal itself: through SSH and tmux, to the laptop where the user sits. Only OSC 0/1/2/9/99/777 and BEL pass Claude Code's allowlist.
| Moment | Hook | What the user sees |
|---|---|---|
| prompt sent | UserPromptSubmit | tab title `⏳ project topic`, progress ring in the tab |
| turn ends | Stop | title `✅ project done 4 min · topic`, ring cleared; if the turn lasted `min_seconds` (20) or more: toast + bell |
| permission, question, plan to approve | Notification, PreToolUse | title `🔔 project needs you`, toast + bell at once |
| API failure | StopFailure | title `❌`, red ring, toast + bell |
| user away from every terminal | any alert | phone push (ntfy) or any command, if configured |
Claude Code's own animated title is switched off (`CLAUDE_CODE_DISABLE_TERMINAL_TITLE=1` in the same settings), otherwise it repaints over the state. "Away" means no key typed in any of the user's terminals for `push.away_minutes` (the tty access time, as `w` reads it).
## The moves
1. **Install**: `$T install` (adds the hooks and the env line, keeps `settings.json.before-tocsin`). New sessions only: tell the user that tabs already open keep their old hooks until restarted.
2. **Check the terminal side**: ask the user to type `! $T test` in a tab and switch to another tab within 5 seconds. Then read [references/terminals.md](references/terminals.md) for their terminal and give them the exact setting to paste. For Windows Terminal: `"bellStyle": ["audible", "taskbar"]`, and for the toast Windows Terminal 1.26 or later with `"compatibility.allowOSC777": true` in the profile.
3. **See who waits**: `$T list` prints every live session, those that need the user first.
4. **Tune**: `$T config` shows everything; `$T config <key> <value>` sets one key (JSON values: `false`, `30`, `"osc9"`). Common ones: `lang fr`, `min_seconds 60`, `toast osc9` (iTerm2), `toast osc99` (kitty), `marks.done "OK"`, `remind true`.
5. **Phone**: `$T config push.ntfy https://ntfy.sh/<long random topic>` then `! $T test --push`. Before setting it, tell the user what leaves the machine: project name and first prompt words, plus the first sentence of the answer only if they set `push.include_message true`. A self-hosted ntfy or `command` (any script reading the event JSON on stdin: WhatsApp gateway, Telegram, a smart lamp) keeps it inside. `command` runs with the user's rights: never set one copied from an untrusted source.
6. **Quiet**: `$T mute [minutes]` for the current folder, `--all` for everything, `$T unmute`.
7. **Broken?** `$T doctor`: Claude Code version, hooks present, title switch, last alerts. `~/.claude/tocsin/events.log` keeps the last alerts and errors.
<!-- ‹guest · 2026-12-02› -->
## Rules
- Never edit `settings.json` by hand for this: `install` and `uninstall` keep the user's other hooks and refuse a file someone else is writing.
- A hook must never slow or block a session: the script always exits 0 with valid JSON, and the push runs in a detached child.
- Do not promise a toast on a terminal that does not support it: say which of title, ring, bell and toast their terminal shows.
این نسخه با نشانهگذاری اختصاصی حساب شما نمایش داده میشود. برای نصب سریع، به تب نصب و راهاندازی بروید.