Calls you by name out loud when Claude needs you or finishes a task

A Claude Code mod that calls you by name, out loud, when Claude needs you:
minSeconds to change it, 0 for every task), with a one-line spoken summary of what was doneIt stays quiet while you're in a meeting, i.e. while any app is using a microphone or camera (set muteInMeetings to off to disable). The first check compiles a tiny Swift helper into ~/.cache/call-my-name/, so it needs the Xcode command line tools; without them the mod just keeps talking.
It starts muted. To turn the voice on, press the 🔇 voice off toggle at the right end of the band above the prompt, or ask Claude to start talking: it can flip the same switch itself (the set_voice tool), and back off when you tell it to be quiet. The last choice is remembered, so new sessions and restarts keep it. startMuted (on by default) only decides the state before you ever flip the switch.
Available in English, 中文, Deutsch and 日本語, with a female, male or alternating voice. macOS only.
From any shell (works for the desktop app too):
claude plugin marketplace add juhaodong/call-my-name
claude plugin install call-my-name@haodong-mods
uv tool install edge-tts # optional, much nicer voices
Or, inside a Claude Code terminal session:
/plugin install call-my-name --marketplace juhaodong/call-my-name
Restart Claude Code afterwards.
With /plugin install, answer y to add the marketplace, pick the user scope, then set your options. With the shell install, set them in /config:
| Option | Values | Default |
|---|---|---|
nickname | anything; empty skips the name | empty |
language | en, zh, de, ja | en |
minSeconds | seconds; 0 announces every finished task | 10 |
voice | random, alternate, female, male | random |
muteInMeetings | on, off | on |
startMuted | on, off | on |
Change them later in /config.
The mod uses edge-tts neural voices when available and falls back to macOS say otherwise:
uv tool install edge-tts
(or pipx install edge-tts). For the say fallback, a Premium/Enhanced system voice for your language sounds much better: System Settings → Accessibility → Spoken Content → System Voice → Manage Voices.
安装(在终端里运行):
claude plugin marketplace add juhaodong/call-my-name
claude plugin install call-my-name@haodong-mods
uv tool install edge-tts # 可选,声音更自然
装好后重启 Claude Code,在 /config 里设置 nickname(昵称)、language 选 zh、voice(女声 / 男声 / 轮流)。
装好后默认静音。想让它开口:点输入框下方右侧的 🔇 voice off 开关,或者直接让 Claude 开声音,它会自己打开;想再安静,再点一下或让它闭嘴。最后一次的选择会记住,新 session 和重启后都保持不变。startMuted(默认 on)只决定你还没碰过开关时的状态。
hooks/register.tsx 342 lines1import { atom, read, update } from 'claude-code'
2import type { EngineInterface, PluginOptions, Register } from 'claude-code'
3
4import type { IsMuted } from '../types'
5
6const isMuted = atom({ plugin: 'call-my-name', key: 'isMuted' } as const, null as IsMuted)
7
8const TOOL = 'mcp__call-my-name__set_voice'
9const personTools = new Set(['AskUserQuestion', 'ExitPlanMode'])
10
11type Language = 'zh' | 'en' | 'de' | 'ja'
12type VoiceChoice = 'random' | 'alternate' | 'female' | 'male'
13
14type Phrases = {
15 edgeVoices: { female: string; male: string }
16 macVoices: string[]
17 separator: string
18 tools: Record<string, string>
19 otherTool: (name: string) => string
20 permission: (label: string) => string
21 question: (text: string) => string
22 error: string
23 doneFallback: string
24 summarySystem: string
25 summaryPrompt: (prompt: string, answer: string) => string
26}
27
28const PHRASES: Record<Language, Phrases> = {
29 zh: {
30 edgeVoices: { female: 'zh-CN-XiaoxiaoNeural', male: 'zh-CN-YunxiNeural' },
31 macVoices: ['Lilian (Premium)', 'Lili (Premium)', 'Tingting (Premium)', 'Tingting (Enhanced)', 'Tingting'],
32 separator: ',',
33 tools: { Bash: '跑个命令', Edit: '改个文件', Write: '写个文件', WebFetch: '上网看个网页', WebSearch: '上网搜一下' },
34 otherTool: name => `用一下 ${name}`,
35 permission: label => `我想${label},你点个同意呗。`,
36 question: text => `问你个事儿:${text}`,
37 error: '哎,出了点岔子,你来瞅一眼吧。',
38 doneFallback: '活儿干完啦,你来看看吧。',
39 summarySystem:
40 '你是用户的搭档,刚帮他干完一件活儿。用一句很口语、很随意的中文告诉他干完了什么,不超过二十五个字,不要称呼他,不要引号。例如:登录页那个报错我搞定啦,你来瞅一眼吧。',
41 summaryPrompt: (prompt, answer) => `用户的请求:${prompt}\n\n助手的最终回复:${answer}`,
42 },
43 en: {
44 edgeVoices: { female: 'en-US-AvaNeural', male: 'en-US-AndrewNeural' },
45 macVoices: ['Ava (Premium)', 'Zoe (Premium)', 'Ava (Enhanced)', 'Samantha (Enhanced)', 'Samantha'],
46 separator: ', ',
47 tools: {
48 Bash: 'run a command',
49 Edit: 'edit a file',
50 Write: 'write a file',
51 WebFetch: 'open a web page',
52 WebSearch: 'search the web',
53 },
54 otherTool: name => `use ${name}`,
55 permission: label => `I want to ${label}, mind giving me the okay?`,
56 question: text => `quick question: ${text}`,
57 error: 'oops, something went wrong, come take a look.',
58 doneFallback: 'all done, come take a look.',
59 summarySystem:
60 "You are the user's teammate and just finished a task for them. In one short, casual spoken English sentence (max 15 words), tell them what you got done. Do not address them by name, no quotes. Example: Fixed that login page error, come check it out.",
61 summaryPrompt: (prompt, answer) => `User's request: ${prompt}\n\nAssistant's final reply: ${answer}`,
62 },
63 de: {
64 edgeVoices: { female: 'de-DE-KatjaNeural', male: 'de-DE-ConradNeural' },
65 macVoices: ['Anna (Premium)', 'Petra (Premium)', 'Anna (Enhanced)', 'Anna'],
66 separator: ', ',
67 tools: {
68 Bash: 'einen Befehl ausführen',
69 Edit: 'eine Datei ändern',
70 Write: 'eine Datei schreiben',
71 WebFetch: 'eine Webseite öffnen',
72 WebSearch: 'im Web suchen',
73 },
74 otherTool: name => `${name} benutzen`,
75 permission: label => `ich möchte ${label}, gibst du mir kurz das Okay?`,
76 question: text => `kurze Frage: ${text}`,
77 error: 'hoppla, da ist was schiefgelaufen, schau mal kurz rein.',
78 doneFallback: 'fertig, schau mal rein.',
79 summarySystem:
80 'Du bist der Teamkollege des Nutzers und hast gerade eine Aufgabe für ihn erledigt. Sag ihm in einem kurzen, lockeren gesprochenen deutschen Satz (höchstens 15 Wörter), was du erledigt hast. Keine Anrede mit Namen, keine Anführungszeichen. Beispiel: Den Fehler auf der Login-Seite hab ich behoben, schau mal rein.',
81 summaryPrompt: (prompt, answer) => `Anfrage des Nutzers: ${prompt}\n\nLetzte Antwort des Assistenten: ${answer}`,
82 },
83 ja: {
84 edgeVoices: { female: 'ja-JP-NanamiNeural', male: 'ja-JP-KeitaNeural' },
85 macVoices: ['Kyoko (Premium)', 'Kyoko (Enhanced)', 'Kyoko'],
86 separator: '、',
87 tools: {
88 Bash: 'コマンドを実行し',
89 Edit: 'ファイルを編集し',
90 Write: 'ファイルを作成し',
91 WebFetch: 'ウェブページを開き',
92 WebSearch: 'ウェブで検索し',
93 },
94 otherTool: name => `${name} を使い`,
95 permission: label => `${label}たいんだけど、許可してもらえる?`,
96 question: text => `ちょっと聞いていい?${text}`,
97 error: 'あれ、何か問題が起きたみたい。ちょっと見てくれる?',
98 doneFallback: '終わったよ、見てみて。',
99 summarySystem:
100 'あなたはユーザーの相棒で、たった今作業を一つ終えたところです。何を終えたかを、くだけた話し言葉の日本語一文(三十文字以内)で伝えてください。名前で呼びかけず、引用符も使わないこと。例:ログイン画面のエラー直しといたよ、見てみて。',
101 summaryPrompt: (prompt, answer) => `ユーザーの依頼:${prompt}\n\nアシスタントの最終回答:${answer}`,
102 },
103}
104
105type Settings = {
106 voice: VoiceChoice
107 nickname: string
108 minTurnMs: number
109 muteInMeetings: boolean
110 startMuted: boolean
111 phrases: Phrases
112}
113
114function readOptions(options: PluginOptions): Settings {
115 const language: Language = Object.hasOwn(PHRASES, String(options.language)) ? (options.language as Language) : 'en'
116 const voice: VoiceChoice = ['female', 'male', 'alternate'].includes(String(options.voice)) ? (options.voice as VoiceChoice) : 'random'
117 const nickname = typeof options.nickname === 'string' ? options.nickname.trim() : ''
118 const minSeconds = Number(options.minSeconds)
119 const minTurnMs = Number.isFinite(minSeconds) && minSeconds > 0 ? minSeconds * 1000 : 0
120 const muteInMeetings = options.muteInMeetings !== 'off'
121 const startMuted = options.startMuted !== 'off'
122 return { voice, nickname, minTurnMs, muteInMeetings, startMuted, phrases: PHRASES[language] }
123}
124
125const SAVED_MUTE_KEY = 'isMuted'
126
127async function voiceIsMuted($: EngineInterface, { startMuted }: Settings): Promise<boolean> {
128 return (await read($, isMuted)) ?? startMuted
129}
130
131async function setMuted($: EngineInterface, muted: boolean): Promise<void> {
132 await update($, isMuted, () => muted)
133 await $.store.set(SAVED_MUTE_KEY, muted)
134}
135
136async function restoreMuted($: EngineInterface): Promise<void> {
137 const saved = await $.store.get(SAVED_MUTE_KEY)
138 if (typeof saved === 'boolean') await update($, isMuted, () => saved)
139}
140
141function toolLabel({ phrases }: Settings, tool: string): string {
142 if (phrases.tools[tool]) return phrases.tools[tool]
143 const name = tool.startsWith('mcp__') ? (tool.split('__').at(-1) ?? tool).replaceAll('_', ' ') : tool
144 return phrases.otherTool(name)
145}
146
147function withName({ nickname, phrases }: Settings, text: string): string {
148 return nickname ? `${nickname}${phrases.separator}${text}` : text
149}
150
151// Prints `busy` while any app records from a microphone or a camera, `free` otherwise.
152const IN_USE_SWIFT = `import AVFoundation
153import CoreAudio
154
155func micInUse() -> Bool {
156 var addr = AudioObjectPropertyAddress(mSelector: kAudioHardwarePropertyDevices, mScope: kAudioObjectPropertyScopeGlobal, mElement: kAudioObjectPropertyElementMain)
157 var size: UInt32 = 0
158 AudioObjectGetPropertyDataSize(AudioObjectID(kAudioObjectSystemObject), &addr, 0, nil, &size)
159 var ids = [AudioDeviceID](repeating: 0, count: Int(size) / MemoryLayout<AudioDeviceID>.size)
160 AudioObjectGetPropertyData(AudioObjectID(kAudioObjectSystemObject), &addr, 0, nil, &size, &ids)
161 return ids.contains { id in
162 var input = AudioObjectPropertyAddress(mSelector: kAudioDevicePropertyStreamConfiguration, mScope: kAudioObjectPropertyScopeInput, mElement: kAudioObjectPropertyElementMain)
163 var s: UInt32 = 0
164 guard AudioObjectGetPropertyDataSize(id, &input, 0, nil, &s) == noErr, s > 0 else { return false }
165 let buf = UnsafeMutableRawPointer.allocate(byteCount: Int(s), alignment: 16)
166 defer { buf.deallocate() }
167 guard AudioObjectGetPropertyData(id, &input, 0, nil, &s, buf) == noErr,
168 UnsafeMutableAudioBufferListPointer(buf.assumingMemoryBound(to: AudioBufferList.self)).count > 0 else { return false }
169 var running = AudioObjectPropertyAddress(mSelector: kAudioDevicePropertyDeviceIsRunningSomewhere, mScope: kAudioObjectPropertyScopeGlobal, mElement: kAudioObjectPropertyElementMain)
170 var value: UInt32 = 0
171 var valueSize = UInt32(MemoryLayout<UInt32>.size)
172 return AudioObjectGetPropertyData(id, &running, 0, nil, &valueSize, &value) == noErr && value != 0
173 }
174}
175
176func cameraInUse() -> Bool {
177 AVCaptureDevice.DiscoverySession(deviceTypes: [.builtInWideAngleCamera, .external, .continuityCamera], mediaType: .video, position: .unspecified)
178 .devices.contains { $0.isInUseByAnotherApplication }
179}
180
181print(micInUse() || cameraInUse() ? "busy" : "free")
182`
183
184const IN_USE_BINARY = 'in-use-v1'
185
186let inUseBinary: Promise<string | undefined> | undefined
187
188async function buildInUseBinary($: EngineInterface, home: string): Promise<string | undefined> {
189 const dir = `${home}/.cache/call-my-name`
190 const binary = `${dir}/${IN_USE_BINARY}`
191 if (await $.fs.exists(binary)) return binary
192 await $.fs.write(`${dir}/${IN_USE_BINARY}.swift`, IN_USE_SWIFT)
193 const built = await $.process.run(['swiftc', '-O', `${dir}/${IN_USE_BINARY}.swift`, '-o', binary], { timeoutMs: 180_000 })
194 return built.exitCode === 0 ? binary : undefined
195}
196
197async function isInMeeting($: EngineInterface, { muteInMeetings }: Settings): Promise<boolean> {
198 if (!muteInMeetings) return false
199 const home = await $.env.get('HOME')
200 if (!home) return false
201 inUseBinary ??= buildInUseBinary($, home).catch(() => undefined)
202 const binary = await inUseBinary
203 if (!binary) {
204 inUseBinary = undefined
205 return false
206 }
207 const { stdout } = await $.process.run([binary], { timeoutMs: 5_000 })
208 return stdout.trim() === 'busy'
209}
210
211let spokenCount = 0
212
213function nextEdgeVoice({ voice, phrases }: Settings): string {
214 if (voice === 'female' || voice === 'male') return phrases.edgeVoices[voice]
215 const useFemale = voice === 'alternate' ? spokenCount++ % 2 === 0 : Math.random() < 0.5
216 return useFemale ? phrases.edgeVoices.female : phrases.edgeVoices.male
217}
218
219async function sayWithEdge($: EngineInterface, settings: Settings, text: string): Promise<boolean> {
220 const edgeVoice = nextEdgeVoice(settings)
221 const file = `/tmp/call-my-name-${await $.clock.now()}.mp3`
222 const home = await $.env.get('HOME')
223 for (const bin of home ? ['edge-tts', `${home}/.local/bin/edge-tts`] : ['edge-tts']) {
224 const made = await $.process
225 .run([bin, '--voice', edgeVoice, '--text', text, '--write-media', file], { timeoutMs: 10_000 })
226 .catch(() => undefined)
227 if (made?.exitCode !== 0) continue
228 const played = await $.process.run(['afplay', file], { timeoutMs: 60_000 })
229 await $.process.run(['rm', '-f', file])
230 return played.exitCode === 0
231 }
232 return false
233}
234
235async function sayWithMacVoice($: EngineInterface, { phrases }: Settings, text: string): Promise<void> {
236 const { stdout } = await $.process.run(['say', '-v', '?'])
237 const installed = stdout.split('\n').map(line => line.split(/\s{2,}/)[0].trim())
238 const macVoice = phrases.macVoices.find(v => installed.includes(v))
239 await $.process.run(macVoice ? ['say', '-v', macVoice, text] : ['say', text], { timeoutMs: 60_000 })
240}
241
242async function say($: EngineInterface, settings: Settings, text: string): Promise<void> {
243 const spoken = await sayWithEdge($, settings, text).catch(() => false)
244 if (!spoken) await sayWithMacVoice($, settings, text)
245}
246
247async function sayUnlessInMeeting($: EngineInterface, settings: Settings, text: () => Promise<string>): Promise<void> {
248 if (await voiceIsMuted($, settings)) return
249 if (await isInMeeting($, settings).catch(() => false)) return
250 await say($, settings, withName(settings, await text()))
251}
252
253function speak($: EngineInterface, settings: Settings, text: string): void {
254 void sayUnlessInMeeting($, settings, async () => text).catch(() => undefined)
255}
256
257async function describeDone($: EngineInterface, { phrases }: Settings, prompt: string, answer: string): Promise<string> {
258 const reply = await $.model.complete({
259 model: 'haiku',
260 maxTokens: 80,
261 system: phrases.summarySystem,
262 prompt: phrases.summaryPrompt(prompt.slice(0, 1500), answer.slice(0, 3000)),
263 })
264 const sentence = reply.isAnswered ? reply.text.trim().replace(/^["“”'「」]+|["“”'「」]+$/g, '') : ''
265 return sentence || phrases.doneFallback
266}
267
268async function announceDone($: EngineInterface, settings: Settings, prompt: string, answer: string): Promise<void> {
269 await sayUnlessInMeeting($, settings, () => describeDone($, settings, prompt, answer))
270}
271
272export const register: Register = (on, options) => {
273 const settings = readOptions(options)
274 const { phrases } = settings
275 const prompts = new Map<string, string>()
276
277 on('session.start', async ($, e, next) => {
278 const started = await next(e)
279 await restoreMuted($)
280 await $.tool.register({
281 name: 'set_voice',
282 description:
283 'Turns the spoken call-outs (permission asks, questions, "task done") on or off; the choice is remembered for new sessions. Call it when the user asks you to speak, call them, turn the voice on, or to be quiet, stop talking, mute.',
284 inputSchema: {
285 type: 'object',
286 properties: { isMuted: { type: 'boolean', description: 'true silences the voice, false turns it back on' } },
287 required: ['isMuted'],
288 },
289 })
290 return started
291 })
292
293 on('tool.call', { tool: TOOL }, async ($, e) => {
294 const muted = e.isMuted === true
295 await setMuted($, muted)
296 return { result: muted ? 'Voice muted for this session.' : 'Voice on for this session.' }
297 })
298
299 on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
300 const band = await next(e)
301 if (e.props.hasSurvey) return band
302 const muted = await voiceIsMuted($, settings)
303 const { Box, Button } = $.ui.resolve(e)
304 return (
305 <Box flexDirection="row" alignItems="center" columnGap={1}>
306 <Box flexGrow={1} flexShrink={1}>
307 {band}
308 </Box>
309 <Button key="voice" plain label={muted ? '🔇 voice off' : '🔊 voice'} onPress={async () => setMuted($, !(await voiceIsMuted($, settings)))} />
310 </Box>
311 )
312 })
313
314 on('turn.start', ($, e, next) => {
315 prompts.set(e.turnId, e.text)
316 return next(e)
317 })
318
319 on('tool.check', async ($, e, next) => {
320 const verdict = await next(e)
321 if (verdict.decision === 'ask' && e.tool_use_id !== undefined && !personTools.has(e.tool)) {
322 speak($, settings, phrases.permission(toolLabel(settings, e.tool)))
323 }
324 return verdict
325 }).catch(($, e, next) => next(e))
326
327 on('tool.call', { tool: 'AskUserQuestion' }, ($, e, next) => {
328 speak($, settings, phrases.question(e.questions[0]?.question ?? ''))
329 return next(e)
330 }).catch(($, e, next) => next(e))
331
332 on('turn.complete', async ($, e, next) => {
333 const done = await next(e)
334 const prompt = prompts.get(e.turnId) ?? ''
335 prompts.delete(e.turnId)
336 if (e.agentId !== undefined || e.isAborted || e.durationMs < settings.minTurnMs) return done
337 if (e.reason === 'error') speak($, settings, phrases.error)
338 else void announceDone($, settings, prompt, e.answer).catch(() => speak($, settings, phrases.doneFallback))
339 return done
340 })
341}
342types/index.d.ts 8 lines1export type IsMuted = boolean | null
2
3declare module 'claude-code' {
4 interface PluginState {
5 'call-my-name': { isMuted: IsMuted }
6 }
7}
8