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.

Stop asking for a key on pills that run on hooks

TheodoreRiant4eb661d729e5
diff --git a/NotchBuddy/NotchBuddy.xcodeproj/project.pbxproj b/NotchBuddy/NotchBuddy.xcodeproj/project.pbxproj
index 9e8944b4..21ae1700 100644
--- a/NotchBuddy/NotchBuddy.xcodeproj/project.pbxproj
+++ b/NotchBuddy/NotchBuddy.xcodeproj/project.pbxproj
@@ -21,6 +21,7 @@
186AB8904029767DAA5277CF /* IslandScreenGeometry.swift in Sources */ = {isa = PBXBuildFile; fileRef = 78BC1357785CA1B099A33969 /* IslandScreenGeometry.swift */; };
18D47AE663EB96BE5638D5F7 /* ClaudePlanCardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4263B550838CC5614569D13 /* ClaudePlanCardView.swift */; };
1969590AFEE6CB21404346F1 /* CalcomPoller.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3104222B3F17BA5E8DEA5277 /* CalcomPoller.swift */; };
+ 1DCF28998358810CDBC93F91 /* ClaudeHookDetection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EA7D927F6BB2667D37AA963 /* ClaudeHookDetection.swift */; };
1F11EC4E6F604C612A1ADAD1 /* AppState.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2E4F18AA940EFF7E047B9F7 /* AppState.swift */; };
2132477000FD77F7EB234DAA /* FileDropView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3232F258523DD8D09B670363 /* FileDropView.swift */; };
2875610F701376BD65573386 /* WindowContextCapture.swift in Sources */ = {isa = PBXBuildFile; fileRef = E91B733ADC638E14E9BB6EFA /* WindowContextCapture.swift */; };
@@ -58,6 +59,7 @@
8C32A0C3EAF536D3836F61D5 /* GreetingCanvasView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C581F7B1A9F14B281B60063E /* GreetingCanvasView.swift */; };
8D1C01F283FA7806119A1C85 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C1A7D5CBE2AC084A10C5FF3 /* SettingsView.swift */; };
8FC5907E9506DC79EB1DDC3C /* ChatMarkdown.swift in Sources */ = {isa = PBXBuildFile; fileRef = D797CC384B5BC70D34F121BC /* ChatMarkdown.swift */; };
+ 91B8AAADB623A12FF6769755 /* ClaudeHookDetection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EA7D927F6BB2667D37AA963 /* ClaudeHookDetection.swift */; };
94E0849D13762C6EC8548FEF /* ClaudePlanCardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4263B550838CC5614569D13 /* ClaudePlanCardView.swift */; };
967B525F7D3837F31D740D18 /* ResendPoller.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61B5FDDE03F5F711146937E2 /* ResendPoller.swift */; };
9C653B8291EFFA414565E8A8 /* MusicController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F142FB3952B5F0639383047 /* MusicController.swift */; };
@@ -97,6 +99,7 @@
15A1A8206F73376F4CAF2057 /* IslandRootView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IslandRootView.swift; sourceTree = "<group>"; };
192844E7299DEED5C2372067 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
1BE21C2B315D37AA70ED45E9 /* SoundEngine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SoundEngine.swift; sourceTree = "<group>"; };
+ 1EA7D927F6BB2667D37AA963 /* ClaudeHookDetection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClaudeHookDetection.swift; sourceTree = "<group>"; };
2EF78999D68D56ADE4CEFBE2 /* StripePoller.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StripePoller.swift; sourceTree = "<group>"; };
3104222B3F17BA5E8DEA5277 /* CalcomPoller.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalcomPoller.swift; sourceTree = "<group>"; };
3232F258523DD8D09B670363 /* FileDropView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FileDropView.swift; sourceTree = "<group>"; };
@@ -153,6 +156,7 @@
3104222B3F17BA5E8DEA5277 /* CalcomPoller.swift */,
D797CC384B5BC70D34F121BC /* ChatMarkdown.swift */,
BFE88A53AEAA637F866D479D /* ChatMarkdownView.swift */,
+ 1EA7D927F6BB2667D37AA963 /* ClaudeHookDetection.swift */,
F4263B550838CC5614569D13 /* ClaudePlanCardView.swift */,
8BF22817EC70748F2D1FB2E7 /* ClaudePlanGauge.swift */,
A83D5410BD030B243ADDCFF4 /* ClaudeService.swift */,
@@ -294,8 +298,8 @@
projectDirPath = "";
projectRoot = "";
targets = (
- 12E59C1D41BFA3D2F7CDD7F5 /* NotchBuddy */,
495922874E20462B9FC47E53 /* CoucouAppStore */,
+ 12E59C1D41BFA3D2F7CDD7F5 /* NotchBuddy */,
);
};
/* End PBXProject section */
@@ -335,6 +339,7 @@
4F1E0B3C838DA3CD6F864BC0 /* CalcomPoller.swift in Sources */,
8FC5907E9506DC79EB1DDC3C /* ChatMarkdown.swift in Sources */,
4976F8BF814D6F817370F1D8 /* ChatMarkdownView.swift in Sources */,
+ 1DCF28998358810CDBC93F91 /* ClaudeHookDetection.swift in Sources */,
94E0849D13762C6EC8548FEF /* ClaudePlanCardView.swift in Sources */,
D861479F6E7EAD07A6AC2105 /* ClaudePlanGauge.swift in Sources */,
2DEB459FBD0BA3CEAAA5FDE9 /* ClaudeService.swift in Sources */,
@@ -382,6 +387,7 @@
1969590AFEE6CB21404346F1 /* CalcomPoller.swift in Sources */,
B2D86BE268D6F4C86BD0C446 /* ChatMarkdown.swift in Sources */,
733FCC6A45DE963EF2024B4E /* ChatMarkdownView.swift in Sources */,
+ 91B8AAADB623A12FF6769755 /* ClaudeHookDetection.swift in Sources */,
18D47AE663EB96BE5638D5F7 /* ClaudePlanCardView.swift in Sources */,
E9C21D11BCB72C392436D19E /* ClaudePlanGauge.swift in Sources */,
0329E76BA4A8FEEA8A6D76E7 /* ClaudeService.swift in Sources */,
diff --git a/NotchBuddy/Sources/App/ClaudeHookDetection.swift b/NotchBuddy/Sources/App/ClaudeHookDetection.swift
new file mode 100644
index 00000000..87c5f416
--- /dev/null
+++ b/NotchBuddy/Sources/App/ClaudeHookDetection.swift
@@ -0,0 +1,17 @@
+import Foundation
+
+/// True when a parsed ~/.claude/settings.json routes Claude Code SessionStart events to Coucou.
+///
+/// Kept free of file access so it can be tested on fixtures instead of the real settings file.
+/// Both the installed app and earlier builds matched on the command text: a hook written by
+/// Coucou runs ~/.claude/coucou/nb-hook, and the App Store build names NotchBuddy instead.
+func coucouHooksPresent(inSettings settings: [String: Any]) -> Bool {
+ guard let hooks = settings["hooks"] as? [String: Any],
+ let sessionStart = hooks["SessionStart"] as? [[String: Any]] else { return false }
+ return sessionStart.contains { group in
+ (group["hooks"] as? [[String: Any]])?.contains { hook in
+ guard let command = hook["command"] as? String else { return false }
+ return command.contains("NotchBuddy") || command.contains("coucou")
+ } ?? false
+ }
+}
diff --git a/NotchBuddy/Sources/App/HookServer.swift b/NotchBuddy/Sources/App/HookServer.swift
index ca734bfd..89d32858 100644
--- a/NotchBuddy/Sources/App/HookServer.swift
+++ b/NotchBuddy/Sources/App/HookServer.swift
@@ -1466,6 +1466,22 @@ final class HookServer: @unchecked Sendable {
// MARK: Installed-state detection
+ /// True when ~/.claude/settings.json already routes Claude Code events to Coucou.
+ /// Cursor sessions ride on these same hooks, so they share this state.
+ static func claudeHooksInstalled() -> Bool {
+ #if APPSTORE
+ // Sandboxed: can't read ~/.claude directly — check the install flag set on write.
+ return UserDefaults.standard.bool(forKey: "coucouHooksInstalled")
+ #else
+ let url = FileManager.default.homeDirectoryForCurrentUser
+ .appendingPathComponent(".claude/settings.json")
+ guard let data = try? Data(contentsOf: url),
+ let json = (try? JSONSerialization.jsonObject(with: data)) as? [String: Any]
+ else { return false }
+ return coucouHooksPresent(inSettings: json)
+ #endif
+ }
+
static func geminiHooksInstalled() -> Bool {
guard let data = try? Data(contentsOf: geminiSettingsURL),
let settings = (try? JSONSerialization.jsonObject(with: data)) as? [String: Any],
diff --git a/NotchBuddy/Sources/App/IslandViewContent.swift b/NotchBuddy/Sources/App/IslandViewContent.swift
index 16163f1f..9d445ed5 100644
--- a/NotchBuddy/Sources/App/IslandViewContent.swift
+++ b/NotchBuddy/Sources/App/IslandViewContent.swift
@@ -1553,20 +1553,15 @@ struct IntegrationCardView: View {
private var isConfigured: Bool {
switch task.id {
- case "integration_claude":
- #if APPSTORE
- // Sandboxed: can't read ~/.claude directly — check install flag set by HookServer
- return UserDefaults.standard.bool(forKey: "coucouHooksInstalled")
+ // Cursor sessions are Claude Code running in Cursor's integrated terminal,
+ // so the Cursor pill is set up exactly when the Claude Code hooks are.
+ case "integration_claude", "agent_cursor":
+ return HookServer.claudeHooksInstalled()
+ case "agent_codex":
+ #if !APPSTORE
+ return HookServer.codexHooksInstalled()
#else
- let url = FileManager.default.homeDirectoryForCurrentUser.appendingPathComponent(".claude/settings.json")
- guard let data = try? Data(contentsOf: url),
- let json = try? JSONSerialization.jsonObject(with: data) as? [String: Any],
- let hooks = json["hooks"] as? [String: Any],
- let ss = hooks["SessionStart"] as? [[String: Any]] else { return false }
- return ss.contains { ($0["hooks"] as? [[String: Any]])?.contains {
- let cmd = $0["command"] as? String
- return cmd?.contains("NotchBuddy") == true || cmd?.contains("coucou") == true
- } ?? false }
+ return false
#endif
case "agent_gemini":
#if !APPSTORE
@@ -1580,8 +1575,6 @@ struct IntegrationCardView: View {
#else
return false
#endif
- case "agent_cursor", "agent_codex":
- return false // coming soon
case "integration_music":
#if !APPSTORE
return true // Apple Music is always installed on macOS
@@ -1707,7 +1700,12 @@ struct IntegrationCardView: View {
: task.id == "integration_calcom" ? appState.calcomError
: nil
if let err = svcErr { return err }
- let isHooks = task.id == "agent_gemini" || task.id == "agent_antigravity"
+ // Pills driven by hooks, never by a key: the idle card reports whether the
+ // hooks are in place. integration_claude read "Connected · loading…" with
+ // nothing left to load — a session replaces this card, it never resolves here.
+ let isHooks = task.id == "integration_claude" || task.id == "agent_gemini"
+ || task.id == "agent_antigravity" || task.id == "agent_cursor"
+ || task.id == "agent_codex"
let isAI = ChatProvider(pillID: task.id) != nil
if isConfigured {
if isHooks { return "Hooks installed" }
diff --git a/scripts/test-claude-hooks.sh b/scripts/test-claude-hooks.sh
new file mode 100755
index 00000000..621ab95c
--- /dev/null
+++ b/scripts/test-claude-hooks.sh
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+set -euo pipefail
+cd "$(dirname "$0")/.."
+TEST_DIR="$(mktemp -d "${TMPDIR:-/tmp}/coucou-claude-hooks.XXXXXX")"
+trap 'rm -rf "$TEST_DIR"' EXIT
+swiftc NotchBuddy/Sources/App/ClaudeHookDetection.swift \
+ tests/ClaudeHookDetectionTests.swift -o "$TEST_DIR/claude-hooks-tests"
+"$TEST_DIR/claude-hooks-tests"
diff --git a/tests/ClaudeHookDetectionTests.swift b/tests/ClaudeHookDetectionTests.swift
new file mode 100644
index 00000000..1e83aba9
--- /dev/null
+++ b/tests/ClaudeHookDetectionTests.swift
@@ -0,0 +1,60 @@
+import Foundation
+
+@main
+enum ClaudeHookDetectionTests {
+ static func settings(_ json: String) -> [String: Any] {
+ let object = try? JSONSerialization.jsonObject(with: Data(json.utf8))
+ return (object as? [String: Any]) ?? [:]
+ }
+
+ static func main() {
+ // Installed: the hook Coucou writes, GitHub build
+ precondition(coucouHooksPresent(inSettings: settings("""
+ {"hooks":{"SessionStart":[{"hooks":[
+ {"type":"command","command":"$HOME/.claude/coucou/nb-hook"}]}]}}
+ """)))
+
+ // Installed: App Store build names NotchBuddy
+ precondition(coucouHooksPresent(inSettings: settings("""
+ {"hooks":{"SessionStart":[{"hooks":[
+ {"type":"command","command":"/Applications/NotchBuddy.app/.../nb-hook"}]}]}}
+ """)))
+
+ // Installed: our hook sits alongside somebody else's
+ precondition(coucouHooksPresent(inSettings: settings("""
+ {"hooks":{"SessionStart":[
+ {"hooks":[{"type":"command","command":"/usr/local/bin/other-tool"}]},
+ {"hooks":[{"type":"command","command":"$HOME/.claude/coucou/nb-hook"}]}]}}
+ """)))
+
+ // Not installed: other tools only — the case that showed "Key not configured"
+ precondition(!coucouHooksPresent(inSettings: settings("""
+ {"hooks":{"SessionStart":[{"hooks":[
+ {"type":"command","command":"$HOME/.vibe-island/bin/vibe-island-bridge"},
+ {"type":"command","command":"python3 /Users/me/.claude/skills/harness/hook.py"}]}]}}
+ """)))
+
+ // Not installed: hooks for other events do not count
+ precondition(!coucouHooksPresent(inSettings: settings("""
+ {"hooks":{"PreToolUse":[{"hooks":[
+ {"type":"command","command":"$HOME/.claude/coucou/nb-hook"}]}]}}
+ """)))
+
+ // Malformed or empty settings never crash, and never read as installed
+ precondition(!coucouHooksPresent(inSettings: settings("{}")))
+ precondition(!coucouHooksPresent(inSettings: settings("""
+ {"hooks":{"SessionStart":[]}}
+ """)))
+ precondition(!coucouHooksPresent(inSettings: settings("""
+ {"hooks":{"SessionStart":[{"hooks":[{"type":"command"}]}]}}
+ """)))
+ precondition(!coucouHooksPresent(inSettings: settings("""
+ {"hooks":{"SessionStart":"not-an-array"}}
+ """)))
+ precondition(!coucouHooksPresent(inSettings: settings("""
+ {"hooks":"not-an-object"}
+ """)))
+
+ print("Claude hook detection: 10 cases passed")
+ }
+}