Skip to content

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.

Mac: chat on your Claude plan through Claude Code when no API key is saved (GitHub build)

Claudeb4b319749880
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a06db411..562dafec 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
# Changelog
+## Unreleased
+
+- **Chat on your Claude plan, no API key** — with no Anthropic key saved, the chat is answered by your own Claude Code (`claude -p`), signed in with your account: on Windows and Linux the chat, Flow's clean-up and the notes of a call (#903 by @RomainBrocheton), on the Mac the chat (GitHub build). Each run loads none of your settings or hooks, no MCP server, saves no session, and may only search the web or, with no web at all, read the file you dropped. Saving a key switches back to the API
+
## 0.5.4 — October 29, 2026
Reliability: bugs reported by @romainb82 and others, fixed by the community.
diff --git a/NotchBuddy/Resources/Localizable.xcstrings b/NotchBuddy/Resources/Localizable.xcstrings
index c3388a00..e0ffb572 100644
--- a/NotchBuddy/Resources/Localizable.xcstrings
+++ b/NotchBuddy/Resources/Localizable.xcstrings
@@ -75094,7 +75094,96 @@
}
}
}
+ },
+ "chat.relay.no-key" : {
+ "extractionState" : "manual",
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "No key: your Claude Code answers instead, with your account."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Pas de clé : ton Claude Code répond à la place, avec ton compte."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Sin clave: responde tu Claude Code, con tu cuenta."
+ }
+ },
+ "pt-BR" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Sem chave: o seu Claude Code responde no lugar, com a sua conta."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Нет ключа: вместо него отвечает ваш Claude Code с вашей учётной записью."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "没有密钥:改由你的 Claude Code 用你的账户回答。"
+ }
+ },
+ "hi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "कोई कुंजी नहीं: इसके बजाय आपका Claude Code आपके खाते से जवाब देता है।"
+ }
+ },
+ "ar" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "لا يوجد مفتاح: يجيب Claude Code الخاص بك بدلاً من ذلك، بحسابك."
+ }
+ },
+ "bn" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "কোনো কী নেই: এর বদলে আপনার Claude Code আপনার অ্যাকাউন্ট দিয়ে উত্তর দেয়।"
+ }
+ },
+ "id" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Tanpa kunci: Claude Code-mu yang menjawab, dengan akunmu."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Kein Schlüssel: Dein Claude Code antwortet stattdessen, mit deinem Konto."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Anahtar yok: Bunun yerine Claude Code’un kendi hesabınla yanıtlar."
+ }
+ },
+ "th" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "ไม่มีคีย์: Claude Code ของคุณจะตอบแทน ด้วยบัญชีของคุณ"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "沒有金鑰:改由你的 Claude Code 用你的帳戶回答。"
+ }
+ }
+ }
}
},
"version" : "1.0"
-}
\ No newline at end of file
+}
diff --git a/NotchBuddy/Sources/App/ClaudeCodeRelay.swift b/NotchBuddy/Sources/App/ClaudeCodeRelay.swift
new file mode 100644
index 00000000..68aa6948
--- /dev/null
+++ b/NotchBuddy/Sources/App/ClaudeCodeRelay.swift
@@ -0,0 +1,181 @@
+import Foundation
+
+// MARK: - The Claude Code relay (GitHub build)
+//
+// With no Anthropic API key saved, the chat is answered by the user's own Claude
+// Code (`claude -p`), signed in with their own account: their Claude plan, no key.
+// Coucou reads no credential and makes no network call of its own; Claude Code
+// answers exactly as it does in a terminal. Same design as the Windows and Linux
+// relay (windows/src-tauri/src/claude_code.rs, #903).
+//
+// Each run is kept apart from the user's sessions: no settings file is loaded (so
+// no hooks: Coucou's own would show the relay's runs as sessions), no MCP server,
+// no skill or slash command, nothing saved to resume, and it runs in an empty
+// folder of Coucou's, so no CLAUDE.md is picked up. It may only use the tools it
+// is given: web search for the chat or, with no web at all, reading the one
+// dropped file, copied alone into a folder of its own.
+//
+// The App Store build is sandboxed and can't start `claude`: there the chat still
+// needs a key.
+
+enum ClaudeCodeRelay {
+
+ #if APPSTORE
+ static var isAvailable: Bool { false }
+ #else
+ static var isAvailable: Bool { executable() != nil }
+ #endif
+
+ /// Where `claude` usually lives; the app doesn't get the shell's PATH.
+ static func executable() -> String? {
+ let home = FileManager.default.homeDirectoryForCurrentUser.path
+ let candidates = [
+ "\(home)/.local/bin/claude",
+ "\(home)/.claude/local/claude",
+ "/opt/homebrew/bin/claude",
+ "/usr/local/bin/claude",
+ "\(home)/.npm-global/bin/claude",
+ "\(home)/.volta/bin/claude",
+ "\(home)/.bun/bin/claude",
+ ]
+ return candidates.first { FileManager.default.isExecutableFile(atPath: $0) }
+ }
+
+ struct Request: Sendable {
+ var model: String
+ var system: String
+ var prompt: String
+ /// Built-in tools the run may use; none at all when empty.
+ var tools: [String]
+ /// A folder the run may read from, besides its own.
+ var readDir: URL?
+ var timeout: TimeInterval
+ }
+
+ enum Failure: LocalizedError {
+ case notInstalled, timedOut, noAnswer, failed(String)
+ var errorDescription: String? {
+ switch self {
+ case .notInstalled: return "Claude Code is not installed."
+ case .timedOut: return "Claude Code took too long to answer."
+ case .noAnswer: return "Claude Code gave no answer."
+ case .failed(let why): return why
+ }
+ }
+ }
+
+ /// The command line of one run. Pure, so it can be tested.
+ static func arguments(_ r: Request) -> [String] {
+ var out = ["-p", "--output-format", "json", "--model", r.model, "--system-prompt", r.system,
+ "--tools", r.tools.joined(separator: ",")]
+ if !r.tools.isEmpty { out += ["--allowedTools", r.tools.joined(separator: ",")] }
+ if let dir = r.readDir { out += ["--add-dir", dir.path] }
+ out += ["--setting-sources", "", "--strict-mcp-config", "--no-session-persistence", "--disable-slash-commands"]
+ return out
+ }
+
+ /// The answer's text from `claude -p --output-format json`, or why there is none.
+ static func parse(_ stdout: Data) -> Result<String, Failure> {
+ guard let json = (try? JSONSerialization.jsonObject(with: stdout)) as? [String: Any] else {
+ return .failure(.noAnswer)
+ }
+ let result = (json["result"] as? String ?? "").trimmingCharacters(in: .whitespacesAndNewlines)
+ if json["is_error"] as? Bool == true {
+ return .failure(.failed(result.isEmpty ? "Claude Code could not answer." : result))
+ }
+ return result.isEmpty ? .failure(.noAnswer) : .success(result)
+ }
+
+ /// One chat turn as a single prompt: the earlier turns, the context the first
+ /// question carries, then the question.
+ static func chatPrompt(history: [(user: String, assistant: String)], context: String?, query: String) -> String {
+ var out = ""
+ if !history.isEmpty {
+ out += "The conversation so far:\n<conversation>\n"
+ for turn in history {
+ out += "<user>\n\(turn.user)\n</user>\n<assistant>\n\(turn.assistant)\n</assistant>\n"
+ }
+ out += "</conversation>\n\nThe user's new message:\n"
+ }
+ if let context { out += context + "\n\n" }
+ return out + query
+ }
+
+ #if !APPSTORE
+ /// Runs `claude -p` once and returns the text of its answer.
+ static func ask(_ request: Request) async throws -> String {
+ guard let exe = executable() else { throw Failure.notInstalled }
+ let support = FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask)[0]
+ let workdir = support.appendingPathComponent("NotchBuddy/relay", isDirectory: true)
+ try FileManager.default.createDirectory(at: workdir, withIntermediateDirectories: true)
+
+ let run = Run()
+ run.process.executableURL = URL(fileURLWithPath: exe)
+ run.process.arguments = arguments(request)
+ run.process.currentDirectoryURL = workdir
+ var env = ProcessInfo.processInfo.environment
+ env.removeValue(forKey: "CLAUDECODE")
+ // An npm install is a `#!/usr/bin/env node` script: its own folder and the
+ // usual ones first on PATH so it finds its Node.
+ let dir = (exe as NSString).deletingLastPathComponent
+ env["PATH"] = ([dir, "/opt/homebrew/bin", "/usr/local/bin"] + [env["PATH"] ?? "/usr/bin:/bin"])
+ .joined(separator: ":")
+ run.process.environment = env
+ run.process.standardInput = run.input
+ run.process.standardOutput = run.output
+ run.process.standardError = run.errors
+ let prompt = Data(request.prompt.utf8)
+ let timeout = request.timeout
+
+ return try await withCheckedThrowingContinuation { continuation in
+ DispatchQueue.global(qos: .userInitiated).async {
+ do { try run.process.run() } catch {
+ continuation.resume(throwing: Failure.failed("Could not start Claude Code: \(error.localizedDescription)"))
+ return
+ }
+ let timer = DispatchWorkItem { if run.process.isRunning { run.process.terminate() } }
+ DispatchQueue.global().asyncAfter(deadline: .now() + timeout, execute: timer)
+ run.input.fileHandleForWriting.write(prompt)
+ try? run.input.fileHandleForWriting.close()
+ // Read both pipes to the end before waiting, so a long answer can't fill one and stall.
+ let group = DispatchGroup()
+ group.enter()
+ DispatchQueue.global().async { run.stderrData = run.errors.fileHandleForReading.readDataToEndOfFile(); group.leave() }
+ let stdoutData = run.output.fileHandleForReading.readDataToEndOfFile()
+ group.wait()
+ run.process.waitUntilExit()
+ timer.cancel()
+ if run.process.terminationReason == .uncaughtSignal {
+ continuation.resume(throwing: Failure.timedOut)
+ return
+ }
+ switch parse(stdoutData) {
+ case .success(let text): continuation.resume(returning: text)
+ case .failure(let failure):
+ let detail = String(decoding: run.stderrData, as: UTF8.self)
+ .split(separator: "\n").last.map(String.init)?.trimmingCharacters(in: .whitespaces) ?? ""
+ if detail.isEmpty { continuation.resume(throwing: failure) }
+ else { continuation.resume(throwing: Failure.failed("\(failure.localizedDescription) (\(detail))")) }
+ }
+ }
+ }
+ }
+
+ /// One run's process and pipes, handed between the queues that drive it.
+ private final class Run: @unchecked Sendable {
+ let process = Process()
+ let input = Pipe(), output = Pipe(), errors = Pipe()
+ var stderrData = Data()
+ }
+
+ /// A dropped file copied alone into a fresh folder, so the run can read that file and
+ /// nothing else that was ever dropped. Removed by the caller once the run is over.
+ static func isolate(_ file: URL) throws -> URL {
+ let dir = FileManager.default.temporaryDirectory
+ .appendingPathComponent("coucou-relay-\(UUID().uuidString)", isDirectory: true)
+ try FileManager.default.createDirectory(at: dir, withIntermediateDirectories: true)
+ try FileManager.default.copyItem(at: file, to: dir.appendingPathComponent(file.lastPathComponent))
+ return dir
+ }
+ #endif
+}
diff --git a/NotchBuddy/Sources/App/ClaudeService.swift b/NotchBuddy/Sources/App/ClaudeService.swift
index a9cbb06a..b95ec5d9 100644
--- a/NotchBuddy/Sources/App/ClaudeService.swift
+++ b/NotchBuddy/Sources/App/ClaudeService.swift
@@ -215,8 +215,64 @@ final class ClaudeService {
func clearConversation() {
conversationMessages = []
+ #if !APPSTORE
+ relayHistory = []
+ #endif
}
+ /// Whether the chat can answer with Claude: an API key, or else Claude Code (GitHub build).
+ var canAnswer: Bool {
+ !(apiKey ?? "").isEmpty || ClaudeCodeRelay.isAvailable
+ }
+
+ #if !APPSTORE
+ // MARK: - Chat through Claude Code (no API key)
+
+ /// The relay's turns, as plain text: they never mix with the API's content blocks.
+ private var relayHistory: [(user: String, assistant: String)] = []
+
+ private func chatThroughClaudeCode(query: String, context: PromptContext?, state: AppState) async {
+ var contextLine: String?
+ var readDir: URL?
+ if relayHistory.isEmpty, let context {
+ switch context {
+ case .window(let app, let title, let url):
+ var text = "Context — App: \(app), Window: \(title)"
+ if let url { text += ", URL: \(url)" }
+ contextLine = text
+ case .file(let name, let fileURL):
+ if let fileURL, let dir = try? ClaudeCodeRelay.isolate(fileURL) {
+ readDir = dir
+ contextLine = "File: \(name) (read it at \(dir.appendingPathComponent(fileURL.lastPathComponent).path))"
+ } else {
+ contextLine = "File: \(name)"
+ }
+ }
+ }
+ defer { if let readDir { try? FileManager.default.removeItem(at: readDir) } }
+ let request = ClaudeCodeRelay.Request(
+ model: model,
+ system: systemPrompt,
+ prompt: ClaudeCodeRelay.chatPrompt(history: relayHistory, context: contextLine, query: query),
+ // Reading a dropped file, no web at all: a file written to steer the model
+ // could otherwise send what it reads to a website.
+ tools: readDir == nil ? ["WebSearch", "WebFetch"] : ["Read"],
+ readDir: readDir,
+ timeout: 180
+ )
+ do {
+ let text = try await ClaudeCodeRelay.ask(request)
+ relayHistory.append((user: contextLine.map { "\($0)\n\n\(query)" } ?? query, assistant: text))
+ state.chatHistory.append(ChatMessage(role: .assistant, content: text))
+ state.stateOverride = nil
+ state.view = .prompt
+ NotificationCenter.default.post(name: .triggerEmote, object: BotEmote.happy)
+ } catch {
+ await showError(error.localizedDescription, state: state)
+ }
+ }
+ #endif
+
/// Resolved once: NSFullUserName() is a system call, and the name cannot change under us
/// while the app runs.
private let systemPrompt = ClaudeService.makeSystemPrompt()
@@ -255,6 +311,13 @@ final class ClaudeService {
return
}
guard let key = apiKey, !key.isEmpty else {
+ #if !APPSTORE
+ // No key: the user's own Claude Code answers, on their Claude plan.
+ if ClaudeCodeRelay.isAvailable {
+ await chatThroughClaudeCode(query: query, context: context, state: state)
+ return
+ }
+ #endif
await showError("API key missing. Open settings.", state: state)
return
}
diff --git a/NotchBuddy/Sources/App/IslandViewContent.swift b/NotchBuddy/Sources/App/IslandViewContent.swift
index 7aa0fb1b..31682600 100644
--- a/NotchBuddy/Sources/App/IslandViewContent.swift
+++ b/NotchBuddy/Sources/App/IslandViewContent.swift
@@ -1980,7 +1980,7 @@ struct IntegrationCardView: View {
return true // public market data: no key, nothing to set up
case "integration_portfolio":
return PortfolioSettings.hasAnyAccount
- case "ai_anthropic": return KeychainStore.shared.get("anthropic-api-key") != nil
+ case "ai_anthropic": return KeychainStore.shared.get("anthropic-api-key") != nil || ClaudeCodeRelay.isAvailable
case "ai_google": return KeychainStore.shared.get("google-api-key") != nil
case "ai_openai": return KeychainStore.shared.get("openai-api-key") != nil
case "ai_ollama": return !AppState.shared.ollamaServerURL.isEmpty
diff --git a/NotchBuddy/Sources/App/SettingsView.swift b/NotchBuddy/Sources/App/SettingsView.swift
index 6547d767..3fb81f78 100644
--- a/NotchBuddy/Sources/App/SettingsView.swift
+++ b/NotchBuddy/Sources/App/SettingsView.swift
@@ -1050,6 +1050,13 @@ struct SettingsView: View {
}
.buttonStyle(.borderedProminent)
+ if apiKey.isEmpty && ClaudeCodeRelay.isAvailable {
+ Text(String(localized: "chat.relay.no-key"))
+ .font(.system(size: 11))
+ .foregroundColor(.secondary)
+ .fixedSize(horizontal: false, vertical: true)
+ }
+
Divider().padding(.vertical, 2)
Picker(String(localized: "chat.model"), selection: $modelChoice) {
diff --git a/README.md b/README.md
index c3dfeb16..09bf9773 100644
--- a/README.md
+++ b/README.md
@@ -66,7 +66,7 @@ Flow dictation and the Notetaker are on the Mac for now; Windows and Linux are n
- See what Claude is editing, live in the notch: each file modification shows the file name and +N −M counts in the ticker, tap to read the full diff
- ✅ **Approve and answer from the notch** — Claude Code permission requests show up with **Allow / Deny / Always**; `AskUserQuestion` prompts show the choices right in the notch (single or multi-select, up to 4 questions). One click, or "Reply in terminal" to fall back to the CLI. Codex also gets Allow / Deny.
- 🧑‍💻 **Jump to the right terminal** — open the exact terminal window of a session *(macOS)*.
-- 💬 **Chat with Claude, Gemini, OpenAI, DeepSeek, Qwen, Moonshot, or a local model (Ollama / LM Studio)** — click the model name above the chat box to switch provider and pick a model. Cloud providers use your own API key; local providers connect to a server running on your Mac. *(Gemini, OpenAI, DeepSeek, Qwen, Moonshot and local models: macOS)*
+- 💬 **Chat with Claude, Gemini, OpenAI, DeepSeek, Qwen, Moonshot, or a local model (Ollama / LM Studio)** — click the model name above the chat box to switch provider and pick a model. Cloud providers use your own API key; local providers connect to a server running on your Mac. **No API key?** With Claude Code installed, Claude answers through it, on your Claude plan *(GitHub build, Windows, Linux)*. *(Gemini, OpenAI, DeepSeek, Qwen, Moonshot and local models: macOS)*
- 📈 **Portfolio pill** *(macOS)* — track your crypto across 16 networks (Bitcoin, Ethereum, Solana, Polygon, BNB, Avalanche, Arbitrum, Optimism, Base, Dogecoin, Litecoin, TRON, XRP, Cardano, Cosmos, NEAR) and 5 exchanges (Binance, OKX, Bybit, Kraken, Coinbase) in the notch. Live balances, 7-day sparklines and 24-hour price change per holding. Read-only API keys for exchanges, public addresses for wallets — nothing leaves your Mac.
- 📊 **Claude plan usage** *(macOS, GitHub build)* — a small pill in the notch header shows your 5-hour and weekly Claude plan limits. Enable it from Settings → Agents → Plan usage. Pro and Max plans only.
- 📊 **Codex plan usage** *(macOS, GitHub build)* — a Codex pill next to it shows your Codex limits and how many free resets you have left, read from the Codex CLI. Turn it on in Settings → Agents → Plan usage.
diff --git a/windows/src/i18n/extra.json b/windows/src/i18n/extra.json
index e43bb4fa..592fb332 100644
--- a/windows/src/i18n/extra.json
+++ b/windows/src/i18n/extra.json
@@ -6092,19 +6092,6 @@
"de": "Schalte eine andere Pill aus, um Platz für WhatsApp zu schaffen (höchstens {max}).",
"tr": "WhatsApp’a yer açmak için başka bir hapı kapat (en fazla {max})."
},
- "No key: your Claude Code answers instead, with your account.": {
- "zh-Hans": "没有密钥:改由你的 Claude Code 用你的账户回答。",
- "hi": "कोई कुंजी नहीं: इसके बजाय आपका Claude Code आपके खाते से जवाब देता है।",
- "es": "Sin clave: responde tu Claude Code, con tu cuenta.",
- "ar": "لا يوجد مفتاح: يجيب Claude Code الخاص بك بدلاً من ذلك، بحسابك.",
- "fr": "Pas de clé : ton Claude Code répond à la place, avec ton compte.",
- "bn": "কোনো কী নেই: এর বদলে আপনার Claude Code আপনার অ্যাকাউন্ট দিয়ে উত্তর দেয়।",
- "pt-BR": "Sem chave: seu Claude Code responde no lugar, com sua conta.",
- "ru": "Ключа нет: вместо него отвечает ваш Claude Code с вашей учётной записью.",
- "id": "Tidak ada kunci: Claude Code Anda yang menjawab, dengan akun Anda.",
- "de": "Kein Schlüssel: Stattdessen antwortet dein Claude Code mit deinem Konto.",
- "tr": "Anahtar yok: bunun yerine Claude Code'unuz hesabınızla yanıtlıyor."
- },
"Claude Code is not installed.": {
"zh-Hans": "未安装 Claude Code。",
"hi": "Claude Code इंस्टॉल नहीं है।",
diff --git a/windows/src/i18n/strings.json b/windows/src/i18n/strings.json
index b2a0137d..f8ac50a0 100644
--- a/windows/src/i18n/strings.json
+++ b/windows/src/i18n/strings.json
@@ -4487,6 +4487,19 @@
"de": "Keine Fehlerdetails verfügbar.",
"tr": "Hata ayrıntısı yok."
},
+ "No key: your Claude Code answers instead, with your account.": {
+ "zh-Hans": "没有密钥:改由你的 Claude Code 用你的账户回答。",
+ "hi": "कोई कुंजी नहीं: इसके बजाय आपका Claude Code आपके खाते से जवाब देता है।",
+ "es": "Sin clave: responde tu Claude Code, con tu cuenta.",
+ "ar": "لا يوجد مفتاح: يجيب Claude Code الخاص بك بدلاً من ذلك، بحسابك.",
+ "fr": "Pas de clé : ton Claude Code répond à la place, avec ton compte.",
+ "bn": "কোনো কী নেই: এর বদলে আপনার Claude Code আপনার অ্যাকাউন্ট দিয়ে উত্তর দেয়।",
+ "pt-BR": "Sem chave: o seu Claude Code responde no lugar, com a sua conta.",
+ "ru": "Нет ключа: вместо него отвечает ваш Claude Code с вашей учётной записью.",
+ "id": "Tanpa kunci: Claude Code-mu yang menjawab, dengan akunmu.",
+ "de": "Kein Schlüssel: Dein Claude Code antwortet stattdessen, mit deinem Konto.",
+ "tr": "Anahtar yok: Bunun yerine Claude Code’un kendi hesabınla yanıtlar."
+ },
"No messages": {
"zh-Hans": "没有邮件",
"hi": "कोई संदेश नहीं",