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: Claude is the brain, Voice settings down to the wake word and the voice
Claudeda2017cb3144
diff --git a/NotchBuddy/Sources/App/IslandWindowController.swift b/NotchBuddy/Sources/App/IslandWindowController.swiftindex 1be2a5be..4d0c2eeb 100644--- a/NotchBuddy/Sources/App/IslandWindowController.swift+++ b/NotchBuddy/Sources/App/IslandWindowController.swift@@ -1586,7 +1586,8 @@ extension IslandWindowController {}// If unknown, try VoiceBrain (macOS 26 + Apple Intelligence) with streaming TTS.- if case .unknown = intent, !askedBack {+ // (Not when Claude is the brain and just couldn't be reached: no local model then.)+ if case .unknown = intent, !askedBack, !ClaudeVoiceBrain.isActive {let tBrain0 = Date()let brainWarm = VoiceBrain.shared.isSessionReadyvar brainUsed = false@@ -1793,7 +1794,7 @@ extension IslandWindowController {private func finishVoiceTurn(expectAnswer: Bool) {// First time I speak one language and Coucou answers in another: offer once to// answer in mine ("You're speaking French. Want me to answer in French?").- if !expectAnswer, !VoiceSettings.languageOfferDone,+ if !expectAnswer, !ClaudeVoiceBrain.isActive, !VoiceSettings.languageOfferDone,let spoken = VoiceEngine.shared.speechLocale?.language.languageCode?.identifier,["fr", "en"].contains(spoken), spoken != VoiceSettings.language,VoiceEngine.shared.isEnabled {@@ -1815,7 +1816,7 @@ extension IslandWindowController {// (unless that reply leads to another question, e.g. "which one do I remove?").if expectAnswer && VoiceEngine.shared.isEnabled {isInConversation = true- VoiceBrain.shared.beginConversation()+ if !ClaudeVoiceBrain.isActive { VoiceBrain.shared.beginConversation() }if AppState.shared.soundEnabled { SoundEngine.shared.play("tick") }VoiceEngine.shared.startConversationTurn(firstWordTimeout: Self.answerWait(8.0))} else {diff --git a/NotchBuddy/Sources/App/SettingsView.swift b/NotchBuddy/Sources/App/SettingsView.swiftindex 445ba9cf..9141894f 100644--- a/NotchBuddy/Sources/App/SettingsView.swift+++ b/NotchBuddy/Sources/App/SettingsView.swift@@ -1258,17 +1258,11 @@ struct SettingsView: View {#if !APPSTORE@State private var voicePermissionsGranted: Bool = false@ObservedObject private var voiceEngine = VoiceEngine.shared- @AppStorage("voiceSpeakEnabled") private var speakEnabled: Bool = true- @AppStorage("voiceCaptionEnabled") private var captionEnabled: Bool = true- @AppStorage("voiceWeatherEnabled") private var weatherEnabled: Bool = false- @AppStorage("voiceWeatherCity") private var weatherCity: String = ""@AppStorage("voiceLanguage") private var voiceLanguage: String = "en"- @AppStorage("voiceListenLanguage") private var listenLanguage: String = "auto"@AppStorage("voiceTTSEngine") private var ttsEngine: String = "system"@AppStorage("voiceElevenGender") private var elevenGender: String = "female"@AppStorage("voicePitchFemale") private var pitchFemale: Double = VoiceSettings.defaultPitchFemale@AppStorage("voicePitchMale") private var pitchMale: Double = VoiceSettings.defaultPitchMale- @AppStorage("voiceClaudeBrain") private var webSearchEnabled: Bool = false@State private var webKeySaved: Bool = !(KeychainStore.shared.get("anthropic-api-key") ?? "").isEmpty@State private var elevenKeyDraft: String = ""@State private var elevenKeySaved: Bool = KeychainStore.shared.get(ElevenLabsTTS.keyName) != nil@@ -1281,128 +1275,23 @@ struct SettingsView: View {}@ViewBuilder private var voiceSection: some View {+ // Claude is Coucou's brain: no model, language or feature switches any more,+ // only the wake word, the Anthropic key it needs, and Coucou's voice.GroupBox(String(localized: "«\u{202F}OK Coucou\u{202F}» — voice wake word")) {VStack(alignment: .leading, spacing: 10) {Toggle(String(localized: "Enable voice command"), isOn: $voiceEngine.isEnabled).disabled(!voicePermissionsGranted && !voiceEngine.isEnabled)- Picker(String(localized: "voice.listen-language"), selection: $listenLanguage) {- Text(String(localized: "voice.listen-auto")).tag("auto")- Text(verbatim: "English").tag("en")- Text(verbatim: "Français").tag("fr")- }- .frame(maxWidth: 320)- .onChange(of: listenLanguage) { _, _ in VoiceEngine.shared.reloadLanguage() }-- Picker(String(localized: "voice.language"), selection: $voiceLanguage) {- Text(verbatim: "English").tag("en")- Text(verbatim: "Français").tag("fr")- }- .frame(maxWidth: 320)- .onChange(of: voiceLanguage) { _, _ in VoiceBrain.shared.endConversation() }-- Toggle(String(localized: "voice.setting-speak"), isOn: $speakEnabled)-- if speakEnabled {- Picker(String(localized: "voice.tts-engine"), selection: $ttsEngine) {- Text(String(localized: "voice.tts-system")).tag("system")- Text(verbatim: "ElevenLabs").tag("elevenlabs")- }- .frame(maxWidth: 260)-- if ttsEngine == "elevenlabs" {- HStack(spacing: 6) {- SecureField(elevenKeySaved ? String(localized: "voice.tts-key-saved")- : String(localized: "voice.tts-key"),- text: $elevenKeyDraft)- .textFieldStyle(.roundedBorder)- .frame(maxWidth: 220)- Button(String(localized: "Save")) {- let k = elevenKeyDraft.trimmingCharacters(in: .whitespacesAndNewlines)- if k.isEmpty { KeychainStore.shared.remove(ElevenLabsTTS.keyName) }- else { KeychainStore.shared.set(ElevenLabsTTS.keyName, value: k) }- elevenKeyDraft = ""- elevenKeySaved = !k.isEmpty- ElevenLabsTTS.shared.reset()- }- }- }-- Picker(String(localized: "voice.tts-gender"), selection: $elevenGender) {- Text(String(localized: "voice.tts-female")).tag("female")- Text(String(localized: "voice.tts-male")).tag("male")- }- .pickerStyle(.segmented)- .frame(maxWidth: 220)- .onChange(of: elevenGender) { _, _ in ElevenLabsTTS.shared.reset() }-- if ttsEngine == "system" {- HStack(spacing: 8) {- Text(String(localized: "voice.tts-pitch"))- Slider(value: elevenGender == "male" ? $pitchMale : $pitchFemale,- in: 0.8...1.6, step: 0.05,- onEditingChanged: { editing in- // Released: hear the new pitch right away.- if !editing { speakVoiceSample() }- })- .frame(maxWidth: 180)- }- let current = VoiceSpeaker.macVoiceName(for: Locale(identifier: voiceLanguage == "fr" ? "fr-FR" : "en-US"),- gender: elevenGender)- Text(String(format: String(localized: "voice.mac-voice-current %@"), current))- .font(.system(size: 11))- .foregroundColor(.secondary)- Text(String(localized: "voice.mac-voices-help"))- .font(.system(size: 11))- .foregroundColor(.secondary)- .fixedSize(horizontal: false, vertical: true)- Button(String(localized: "voice.mac-voices-open")) {- if let url = URL(string: "x-apple.systempreferences:com.apple.Accessibility-Settings.extension") {- NSWorkspace.shared.open(url)- }- }- }-- Button(String(localized: "voice.tts-test")) { speakVoiceSample() }- }-- Toggle(String(localized: "voice.setting-captions"), isOn: $captionEnabled)-- Toggle(String(localized: "voice.setting-web"), isOn: $webSearchEnabled)- .disabled(!webKeySaved && !webSearchEnabled)- Text(webKeySaved ? String(localized: "voice.setting-web-desc")- : String(localized: "voice.setting-web-nokey"))- .font(.system(size: 11))- .foregroundColor(.secondary)- .fixedSize(horizontal: false, vertical: true)- .onAppear { webKeySaved = !(KeychainStore.shared.get("anthropic-api-key") ?? "").isEmpty }-- Toggle(String(localized: "voice.setting-weather"), isOn: $weatherEnabled)- if weatherEnabled {- TextField(String(localized: "voice.setting-weather-city"), text: $weatherCity)- .textFieldStyle(.roundedBorder)- .frame(maxWidth: 220)- Text(String(localized: "voice.setting-weather-desc"))- .font(.system(size: 11))- .foregroundColor(.secondary)- .fixedSize(horizontal: false, vertical: true)- }-- Text("When enabled, Coucou listens for the wake word «\u{202F}OK Coucou\u{202F}». Speech recognition runs entirely on-device — no audio or transcript leaves your Mac.")- .font(.system(size: 11))- .foregroundColor(.secondary)- .fixedSize(horizontal: false, vertical: true)-HStack(alignment: .top, spacing: 6) {- Circle()- .fill(Color(hex: "#F97316"))- .frame(width: 8, height: 8)- .padding(.top, 2)- Text("While listening, macOS shows the orange microphone dot in the top-right of the menu bar. This is normal system behaviour.")+ Image(systemName: webKeySaved ? "checkmark.circle.fill" : "exclamationmark.circle")+ .foregroundColor(webKeySaved ? .green : .orange)+ Text(webKeySaved ? String(localized: "voice.setting-web-desc")+ : String(localized: "voice.setting-web-nokey")).font(.system(size: 11)).foregroundColor(.secondary).fixedSize(horizontal: false, vertical: true)}+ .onAppear { webKeySaved = !(KeychainStore.shared.get("anthropic-api-key") ?? "").isEmpty }if voiceEngine.recognizerUnavailable {HStack(spacing: 6) {@@ -1415,21 +1304,6 @@ struct SettingsView: View {}}- // Local model status- #if canImport(FoundationModels)- if #available(macOS 26, *) {- let status = VoiceBrain.shared.modelStatus- HStack(spacing: 6) {- Image(systemName: status == .available ? "cpu.fill" : "cpu")- .foregroundColor(status == .available ? .green : .secondary)- Text(localModelStatusLabel(status))- .font(.system(size: 11))- .foregroundColor(.secondary)- .fixedSize(horizontal: false, vertical: true)- }- }- #endif-if let err = voiceEngine.audioError {HStack(spacing: 6) {Image(systemName: "exclamationmark.triangle.fill")@@ -1440,24 +1314,7 @@ struct SettingsView: View {.fixedSize(horizontal: false, vertical: true)}}- }- .padding(6)- }- GroupBox(String(localized: "Permissions")) {- VStack(alignment: .leading, spacing: 10) {- HStack(spacing: 6) {- Image(systemName: micStatusIcon)- .foregroundColor(micStatusColor)- Text("\(String(localized: "Microphone:")) \(micStatusLabel)")- .font(.system(size: 12))- }- HStack(spacing: 6) {- Image(systemName: speechStatusIcon)- .foregroundColor(speechStatusColor)- Text("\(String(localized: "Speech recognition:")) \(speechStatusLabel)")- .font(.system(size: 12))- }if !voicePermissionsGranted {Button(String(localized: "Request permissions")) {Task {@@ -1475,7 +1332,72 @@ struct SettingsView: View {&& VoiceSettings.speechStatus == .granted}- VoiceTranscriptHistoryView()+ GroupBox(String(localized: "voice.tts-engine")) {+ VStack(alignment: .leading, spacing: 10) {+ Picker(String(localized: "voice.tts-engine"), selection: $ttsEngine) {+ Text(String(localized: "voice.tts-system")).tag("system")+ Text(verbatim: "ElevenLabs").tag("elevenlabs")+ }+ .labelsHidden() // the box is already titled "Voice"+ .frame(maxWidth: 260)++ if ttsEngine == "elevenlabs" {+ HStack(spacing: 6) {+ SecureField(elevenKeySaved ? String(localized: "voice.tts-key-saved")+ : String(localized: "voice.tts-key"),+ text: $elevenKeyDraft)+ .textFieldStyle(.roundedBorder)+ .frame(maxWidth: 220)+ Button(String(localized: "Save")) {+ let k = elevenKeyDraft.trimmingCharacters(in: .whitespacesAndNewlines)+ if k.isEmpty { KeychainStore.shared.remove(ElevenLabsTTS.keyName) }+ else { KeychainStore.shared.set(ElevenLabsTTS.keyName, value: k) }+ elevenKeyDraft = ""+ elevenKeySaved = !k.isEmpty+ ElevenLabsTTS.shared.reset()+ }+ }+ }++ Picker(String(localized: "voice.tts-gender"), selection: $elevenGender) {+ Text(String(localized: "voice.tts-female")).tag("female")+ Text(String(localized: "voice.tts-male")).tag("male")+ }+ .pickerStyle(.segmented)+ .frame(maxWidth: 220)+ .onChange(of: elevenGender) { _, _ in ElevenLabsTTS.shared.reset() }++ if ttsEngine == "system" {+ HStack(spacing: 8) {+ Text(String(localized: "voice.tts-pitch"))+ Slider(value: elevenGender == "male" ? $pitchMale : $pitchFemale,+ in: 0.8...1.6, step: 0.05,+ onEditingChanged: { editing in+ // Released: hear the new pitch right away.+ if !editing { speakVoiceSample() }+ })+ .frame(maxWidth: 180)+ }+ let current = VoiceSpeaker.macVoiceName(for: Locale(identifier: voiceLanguage == "fr" ? "fr-FR" : "en-US"),+ gender: elevenGender)+ Text(String(format: String(localized: "voice.mac-voice-current %@"), current))+ .font(.system(size: 11))+ .foregroundColor(.secondary)+ Text(String(localized: "voice.mac-voices-help"))+ .font(.system(size: 11))+ .foregroundColor(.secondary)+ .fixedSize(horizontal: false, vertical: true)+ Button(String(localized: "voice.mac-voices-open")) {+ if let url = URL(string: "x-apple.systempreferences:com.apple.Accessibility-Settings.extension") {+ NSWorkspace.shared.open(url)+ }+ }+ }++ Button(String(localized: "voice.tts-test")) { speakVoiceSample() }+ }+ .padding(6)+ }}#if !APPSTOREdiff --git a/NotchBuddy/Sources/App/Voice/ClaudeVoiceBrain.swift b/NotchBuddy/Sources/App/Voice/ClaudeVoiceBrain.swiftindex 7431a6cf..1cca2404 100644--- a/NotchBuddy/Sources/App/Voice/ClaudeVoiceBrain.swift+++ b/NotchBuddy/Sources/App/Voice/ClaudeVoiceBrain.swift@@ -22,9 +22,9 @@ final class ClaudeVoiceBrain {let failed: Bool // nothing usable came back}- /// On when the setting is on and an Anthropic key is saved.+ /// Claude is Coucou's brain whenever an Anthropic key is saved (Settings → Chat).static var isActive: Bool {- VoiceSettings.claudeBrainEnabled && !(ClaudeService.shared.apiKey ?? "").isEmpty+ !(ClaudeService.shared.apiKey ?? "").isEmpty}private var messages: [[String: Any]] = []@@ -125,8 +125,8 @@ final class ClaudeVoiceBrain {in one or two short sentences, no markdown, no lists, no emojis, no links.Act with the tools instead of describing: pills, music, service_info for the user's own data \(Stripe sales, GitHub, Vercel, Resend, n8n, Notion, Cal.com, agent sessions like Claude Code, \- plan usage, music, weather), open_app, prepare_email, and web_search for anything current \- (news, scores, prices, facts you are not sure of). Never invent the user's data.+ plan usage, music), open_app, prepare_email, and web_search for anything current \+ (weather, news, scores, prices, facts you are not sure of). Never invent the user's data.Email: gather the recipient, the subject and what to say (write the text yourself from what \the user wants to say, in the language they used), asking for what is missing one short \question at a time, then call prepare_email. The email is never sent by you: the user checks \@@ -171,11 +171,12 @@ final class ClaudeVoiceBrain {],["name": "service_info",- "description": "Read the user's real data that Coucou already has: Stripe sales and balance, GitHub stars/PRs/CI, Vercel deployments, Resend emails, n8n runs, Notion pages, Cal.com bookings, agent sessions (Claude Code, Codex…), Claude or Codex plan usage, music now playing, active pills, weather today or tomorrow.",+ "description": "Read the user's real data that Coucou already has: Stripe sales and balance, GitHub stars/PRs/CI, Vercel deployments, Resend emails, n8n runs, Notion pages, Cal.com bookings, agent sessions (Claude Code, Codex…), Claude or Codex plan usage, music now playing, active pills.","input_schema": ["type": "object","properties": [- "topic": ["type": "string", "enum": VoiceTopic.allCases.map(\.rawValue)],+ "topic": ["type": "string", "enum": VoiceTopic.allCases.map(\.rawValue)+ .filter { !$0.hasPrefix("weather") }], // weather: web_search],"required": ["topic"],],diff --git a/NotchBuddy/Sources/App/Voice/VoiceEngine.swift b/NotchBuddy/Sources/App/Voice/VoiceEngine.swiftindex c7f4cbf8..4f04d560 100644--- a/NotchBuddy/Sources/App/Voice/VoiceEngine.swift+++ b/NotchBuddy/Sources/App/Voice/VoiceEngine.swift@@ -625,7 +625,8 @@ final class VoiceEngine: ObservableObject {if wc > lastWordCount {// Load the on-device model once the sentence has started, not at the wake// word: loading it at the same moment slowed speech recognition down.- if lastWordCount == 0 { VoiceBrain.shared.prewarmSession() }+ // Not when Claude is the brain: the on-device model would load for nothing.+ if lastWordCount == 0 && !ClaudeVoiceBrain.isActive { VoiceBrain.shared.prewarmSession() }lastWordCount = wcresetSilenceTimer()let trimmed = command.trimmingCharacters(in: .whitespaces)