Back to catalogue
NotificationStopStopWhen the agent finishes its task· non-blocking
Voice task-completion announcement
Announces out loud via TTS that the agent has finished its task, with a random completion message.
Use cases
- Get notified without watching the screen when the task is done
- Audio feedback at the end of a long session
Providers & tags
Claude Code
#tts#stop#voice#completion#audio
settings.json fragment
{
"hooks": {
"Stop": [
{
"hooks": [
{
"command": "node $CLAUDE_PROJECT_DIR/.claude/hooks/stop-tts.mjs",
"type": "command"
}
],
"matcher": ""
}
]
}
}Script · .claude/hooks/stop-tts.mjs
#!/usr/bin/env node
// Annonce la fin de session Claude par TTS (Stop)
import { execSync } from 'child_process';
import { fileURLToPath } from 'url';
function defaultExec(cmd) {
execSync(cmd, { timeout: 10_000, stdio: 'ignore', shell: true });
}
export function run({
exec = defaultExec,
platform = process.platform,
projectDir = process.env.CLAUDE_PROJECT_DIR,
} = {}) {
const project = projectDir?.split('/').pop() ?? 'Claude';
const text = `Tâche terminée sur ${project}`;
try {
if (platform === 'darwin') exec(`say "${text}"`);
else exec(`espeak "${text}" 2>/dev/null || spd-say "${text}"`);
} catch {
// TTS absent — non bloquant
}
return text;
}
/* v8 ignore next 3 */
if (process.argv[1] === fileURLToPath(import.meta.url)) {
run();
}