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.
Swift ai-agentsanthropicantigravityclaudeclaude-codecodexcursordynamic-islandgemini-cliiosiphonlinuxmacosmacos-appmenubar-appnotchopen-sourceswiftswiftuiwindows
voice brain review fixes: no orphan tool calls in history, no double action on failure, attachment kept on revision, drops only into the visible card, mic closed on attach, one turn at a time, accurate privacy text
Claude6d1ff6c60444
diff --git a/NotchBuddy/Resources/Localizable.xcstrings b/NotchBuddy/Resources/Localizable.xcstringsindex 9b27c6d9..8ac23065 100644--- a/NotchBuddy/Resources/Localizable.xcstrings+++ b/NotchBuddy/Resources/Localizable.xcstrings@@ -26018,61 +26018,61 @@"ar": {"stringUnit": {"state": "translated",- "value": "بعد «OK Coucou»، يُرسل ما تقوله إلى Claude بمفتاح Anthropic API الخاص بك: ينفّذ (الحبوب، الموسيقى، البريد، خدماتك) ويبحث على الويب. تُرسل كلماتك فقط، وليس الصوت أبدًا."+ "value": "بعد «OK Coucou»، يُرسل ما تقوله إلى Claude بمفتاح Anthropic API الخاص بك، مع ما يقرؤه Coucou للإجابة (حبوبك، بيانات خدماتك، عنوان جهة اتصال). ينفّذ ويبحث على الويب. لا يُرسل الصوت أبدًا."}},"bn": {"stringUnit": {"state": "translated",- "value": "«OK Coucou»-এর পরে তুমি যা বলো তা তোমার Anthropic API কী দিয়ে Claude-এর কাছে যায়: সে কাজ করে (পিল, গান, মেইল, তোমার সার্ভিস) আর ওয়েবে খোঁজে। শুধু তোমার কথা পাঠানো হয়, কখনো অডিও নয়।"+ "value": "«OK Coucou»-এর পরে তুমি যা বলো তা তোমার Anthropic API কী দিয়ে Claude-এর কাছে যায়, সঙ্গে Coucou উত্তর দিতে যা পড়ে (তোমার পিল, তোমার সার্ভিসের ডেটা, কোনো কন্টাক্টের ঠিকানা)। সে কাজ করে আর ওয়েবে খোঁজে। অডিও কখনো নয়।"}},"en": {"stringUnit": {"state": "translated",- "value": "After «OK Coucou», what you say goes to Claude with your Anthropic API key: it acts (pills, music, email, your services) and searches the web. Only your words are sent, never audio."+ "value": "After «OK Coucou», what you say goes to Claude with your Anthropic API key, with what Coucou reads to answer (your pills, your services' data, a contact's address). It acts and searches the web. Never audio."}},"es": {"stringUnit": {"state": "translated",- "value": "Tras «OK Coucou», lo que dices va a Claude con tu clave de API de Anthropic: actúa (píldoras, música, correo, tus servicios) y busca en la web. Solo se envían tus palabras, nunca el audio."+ "value": "Tras «OK Coucou», lo que dices va a Claude con tu clave de API de Anthropic, junto con lo que Coucou lee para responder (tus píldoras, los datos de tus servicios, la dirección de un contacto). Actúa y busca en la web. Nunca el audio."}},"fr": {"stringUnit": {"state": "translated",- "value": "Après « OK Coucou », ce que tu dis part chez Claude avec ta clé API Anthropic : il agit (pilules, musique, mail, tes services) et cherche sur le web. Seuls tes mots sont envoyés, jamais l'audio."+ "value": "Après « OK Coucou », ce que tu dis part chez Claude avec ta clé API Anthropic, avec ce que Coucou lit pour répondre (tes pilules, les données de tes services, l'adresse d'un contact). Il agit et cherche sur le web. Jamais l'audio."}},"hi": {"stringUnit": {"state": "translated",- "value": "«OK Coucou» के बाद तुम जो कहते हो वह तुम्हारी Anthropic API कुंजी से Claude को जाता है: वह काम करता है (पिल्स, संगीत, ईमेल, तुम्हारी सेवाएँ) और वेब पर खोजता है। सिर्फ़ तुम्हारे शब्द भेजे जाते हैं, ऑडियो कभी नहीं।"+ "value": "«OK Coucou» के बाद तुम जो कहते हो वह तुम्हारी Anthropic API कुंजी से Claude को जाता है, साथ में वह जो Coucou जवाब देने के लिए पढ़ता है (तुम्हारी पिल्स, तुम्हारी सेवाओं का डेटा, किसी संपर्क का पता)। वह काम करता है और वेब पर खोजता है। ऑडियो कभी नहीं।"}},"id": {"stringUnit": {"state": "translated",- "value": "Setelah «OK Coucou», ucapanmu dikirim ke Claude dengan kunci API Anthropic-mu: ia bertindak (pil, musik, email, layananmu) dan mencari di web. Hanya kata-katamu yang dikirim, tidak pernah audio."+ "value": "Setelah «OK Coucou», ucapanmu dikirim ke Claude dengan kunci API Anthropic-mu, beserta apa yang dibaca Coucou untuk menjawab (pil-mu, data layananmu, alamat kontak). Ia bertindak dan mencari di web. Tidak pernah audio."}},"pt-BR": {"stringUnit": {"state": "translated",- "value": "Depois de «OK Coucou», o que você diz vai para o Claude com sua chave de API da Anthropic: ele age (pílulas, música, e-mail, seus serviços) e pesquisa na web. Só suas palavras são enviadas, nunca o áudio."+ "value": "Depois de «OK Coucou», o que você diz vai para o Claude com sua chave de API da Anthropic, junto com o que o Coucou lê para responder (suas pílulas, os dados dos seus serviços, o endereço de um contato). Ele age e pesquisa na web. Nunca o áudio."}},"ru": {"stringUnit": {"state": "translated",- "value": "После «OK Coucou» сказанное уходит в Claude по твоему ключу Anthropic API: он действует (пилюли, музыка, почта, твои сервисы) и ищет в интернете. Отправляются только слова, никогда не звук."+ "value": "После «OK Coucou» сказанное уходит в Claude по твоему ключу Anthropic API вместе с тем, что Coucou читает для ответа (твои пилюли, данные твоих сервисов, адрес контакта). Он действует и ищет в интернете. Звук — никогда."}},"zh-Hans": {"stringUnit": {"state": "translated",- "value": "说「OK Coucou」后,你说的话会用你的 Anthropic API 密钥发送给 Claude:它会执行操作(药丸、音乐、邮件、你的服务)并进行网页搜索。只发送文字,从不发送音频。"+ "value": "说「OK Coucou」后,你说的话会用你的 Anthropic API 密钥发送给 Claude,同时发送 Coucou 为回答而读取的内容(你的药丸、你的服务数据、联系人地址)。它会执行操作并进行网页搜索。从不发送音频。"}}}diff --git a/NotchBuddy/Sources/App/ClaudeService.swift b/NotchBuddy/Sources/App/ClaudeService.swiftindex cbbb7c19..875afe3a 100644--- a/NotchBuddy/Sources/App/ClaudeService.swift+++ b/NotchBuddy/Sources/App/ClaudeService.swift@@ -510,7 +510,7 @@ final class ClaudeService {async -> (content: [[String: Any]], stopReason: String)? {guard let key = apiKey, !key.isEmpty else { return nil }func body(_ model: String) -> [String: Any] {- ["model": model, "max_tokens": 600, "system": system, "tools": tools, "messages": messages]+ ["model": model, "max_tokens": 2048, "system": system, "tools": tools, "messages": messages]}let data: Datado {diff --git a/NotchBuddy/Sources/App/IslandWindowController.swift b/NotchBuddy/Sources/App/IslandWindowController.swiftindex fbe8f420..1be2a5be 100644--- a/NotchBuddy/Sources/App/IslandWindowController.swift+++ b/NotchBuddy/Sources/App/IslandWindowController.swift@@ -164,7 +164,7 @@ final class IslandWindowController: NSWindowController {return}// The mail card prepared by voice (Claude) is open: the file is its attachment.- if AppState.shared.voiceMailDraft != nil, let url = urls.first {+ if AppState.shared.voiceMailDraft != nil, AppState.shared.view == .mail, let url = urls.first {self?.attachToVoiceMailCard(url)return}@@ -1851,6 +1851,9 @@ extension IslandWindowController {/// attachment, and Coucou says so.@MainActorfunc attachToVoiceMailCard(_ url: URL) {+ // Not listening any more: Coucou's own "attached" must not come back as a turn.+ VoiceEngine.shared.cancelListening()+ if isInConversation || AppState.shared.voiceActive { closeVoiceTurn() }let state = AppState.sharedstate.fileDragOver = falsestate.droppedFile = DroppedFile(url: url, name: url.lastPathComponent)diff --git a/NotchBuddy/Sources/App/Voice/ClaudeVoiceBrain.swift b/NotchBuddy/Sources/App/Voice/ClaudeVoiceBrain.swiftindex dd0c25f9..7431a6cf 100644--- a/NotchBuddy/Sources/App/Voice/ClaudeVoiceBrain.swift+++ b/NotchBuddy/Sources/App/Voice/ClaudeVoiceBrain.swift@@ -28,12 +28,17 @@ final class ClaudeVoiceBrain {}private var messages: [[String: Any]] = []+ /// One turn at a time: a second "OK Coucou" during the wait must not interleave.+ private var busy = falsefunc reset() { messages = [] }// MARK: Turnfunc respond(to transcript: String) async -> Reply? {+ guard !busy else { return nil }+ busy = true+ defer { busy = false; repairHistory() }messages.append(["role": "user", "content": transcript])trimHistory()var acted = false@@ -47,7 +52,9 @@ final class ClaudeVoiceBrain {// Leave the history coherent: drop the question that got no answer.if let last = messages.last, last["role"] as? String == "user",last["content"] is String { messages.removeLast() }- return nil+ // Something already happened (a pill, the music, the mail card): the+ // parser must not do it again. Say it's done.+ return acted ? Reply(text: "", acted: true, failed: false) : nil}messages.append(["role": "assistant", "content": turn.content])if let text = claudeResponseText(fromContent: turn.content) { spoken = text }@@ -73,6 +80,21 @@ final class ClaudeVoiceBrain {return Reply(text: text, acted: acted, failed: text.isEmpty && !acted)}+ /// The API refuses a history whose last assistant turn calls a tool with no result+ /// after it (cut by max_tokens, a failure, or a pause on the last round): drop it.+ private func repairHistory() {+ guard let last = messages.last, last["role"] as? String == "assistant",+ let content = last["content"] as? [[String: Any]] else { return }+ let calls = content.contains {+ let t = $0["type"] as? String+ return t == "tool_use" || t == "server_tool_use"+ }+ let answered = content.contains { $0["type"] as? String == "web_search_tool_result" }+ if calls && !answered || content.contains(where: { $0["type"] as? String == "tool_use" }) {+ messages.removeLast()+ }+ }+/// Keeps the last exchanges, never cutting between a tool call and its result.private func trimHistory() {guard messages.count > 24 else { return }@@ -182,9 +204,15 @@ final class ClaudeVoiceBrain {"required": ["recipient", "subject", "body"],],],- ["type": "web_search_20250305", "name": "web_search", "max_uses": 3],+ webSearchTool,]+ private static var webSearchTool: [String: Any] {+ var location: [String: Any] = ["type": "approximate", "timezone": TimeZone.current.identifier]+ if let country = Locale.current.region?.identifier, country.count == 2 { location["country"] = country }+ return ["type": "web_search_20250305", "name": "web_search", "max_uses": 3, "user_location": location]+ }+// MARK: Running a tool/// Returns the text sent back to Claude, and whether something changed.@@ -284,6 +312,8 @@ final class ClaudeVoiceBrain {file = info.findFile(name, folder: nil)if file == nil { note = " The file \(name) was not found: the user can drop it on the notch." }}+ // A file already dropped on the open card stays attached when Claude revises the mail.+ if file == nil, AppState.shared.voiceMailDraft != nil { file = AppState.shared.droppedFile?.url }info.showMailCard(to: address, subject: subject, body: body, file: file)let attach = (input["wants_attachment"] as? Bool ?? false) && file == nil? " The user wants an attachment: tell them to drop the file on the notch." : ""diff --git a/docs/privacy.html b/docs/privacy.htmlindex 076b780c..63c3b384 100644--- a/docs/privacy.html+++ b/docs/privacy.html@@ -33,7 +33,7 @@<li><b>OpenAI</b> <i>(macOS)</i> — when you chat using OpenAI, the text you type and the current conversation are sent to the OpenAI API. If you attached a window, the app name, title and URL are also sent. If you attached a file, only its name is sent (file content is only sent to Anthropic or to a local model server you connected). The list of available models is fetched when you open the chat. <a href="https://openai.com/policies/privacy-policy">OpenAI privacy policy</a>.</li><li><b>Ollama / LM Studio</b> <i>(macOS)</i> — when you chat using a local model, the text you type, the current conversation, and the content of any attached text file (up to 24 000 characters) are sent to the server address you configured in Settings → Chat → Local models. By default that address is <code>127.0.0.1</code> on your Mac — nothing leaves your computer. If you point it at a remote server, that server receives the data. The server address is stored in your Mac's user preferences (not the Keychain). The list of available models is fetched each time you open the model picker.</li><li><b>Stripe, GitHub, Vercel, Resend, Notion, Cal.com, n8n</b> — Coucou reads data from your own accounts (payments, repositories, deployments, emails, pages, bookings, workflow runs) to display them. For GitHub specifically, Coucou also reads your open pull requests, reviews requested on you, CI status of your repositories' default branches, and your contribution calendar (the green squares on your profile); this data is kept in memory only and deleted when the app quits. Coucou only reads from them.</li>-<li><b>Voice: « OK Coucou »</b> <i>(macOS, GitHub build, off by default)</i> — what you say is recognized on your Mac and never recorded or saved. Only if you turn them on in Settings → Voice: with <b>ElevenLabs</b> as the voice, the text of Coucou’s answers is sent to ElevenLabs with your key to be spoken (<a href="https://elevenlabs.io/privacy-policy">ElevenLabs privacy policy</a>); with <b>Weather by voice</b>, the city you entered is sent to Open-Meteo when you ask; with <b>Answer questions with a web search</b>, a question your pills can’t answer, and the previous questions and answers of the same conversation, are sent to Anthropic with your key, and Anthropic searches the web for it. An email prepared by voice is sent from Apple Mail only when you click Send.</li>+<li><b>Voice: « OK Coucou »</b> <i>(macOS, GitHub build, off by default)</i> — what you say is recognized on your Mac and never recorded or saved. Only if you turn them on in Settings → Voice: with <b>ElevenLabs</b> as the voice, the text of Coucou’s answers is sent to ElevenLabs with your key to be spoken (<a href="https://elevenlabs.io/privacy-policy">ElevenLabs privacy policy</a>); with <b>Weather by voice</b>, the city you entered is sent to Open-Meteo when you ask; with <b>Claude as Coucou’s brain</b>, what you say after « OK Coucou » and the previous turns of the same conversation are sent to Anthropic with your key, together with what Coucou reads to answer (your active pills, your connected services’ data, a contact’s email address); Anthropic may search the web for it. Audio never leaves your Mac. An email prepared by voice is sent from Apple Mail only when you click Send.</li></ul><p>We have no access to these requests or their responses.</p>