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.

Plan approval card in the notch: approve with auto mode or manual edits, or change it in the terminal

Orlando Castañeda8d2632caafc3
diff --git a/NotchBuddy/Sources/App/HookServer.swift b/NotchBuddy/Sources/App/HookServer.swift
index 3d6c37b0..4f7bde02 100644
--- a/NotchBuddy/Sources/App/HookServer.swift
+++ b/NotchBuddy/Sources/App/HookServer.swift
@@ -833,7 +833,10 @@ final class HookServer: @unchecked Sendable {
return
}
- let command = toolInput["command"] as? String ?? tool
+ // A plan is too long for the card: show its title.
+ let command = tool == "ExitPlanMode"
+ ? Self.planTitle(toolInput["plan"] as? String)
+ : toolInput["command"] as? String ?? tool
// Several requests can wait at once (several sessions or agents): they queue, the
// card shows the oldest. Past the cap, the newest goes back to its own terminal.
@@ -918,10 +921,26 @@ final class HookServer: @unchecked Sendable {
case "allow": json = #"{"permissionDecision":"allow"}"#
case "always": json = #"{"permissionDecision":"always"}"#
case "ask": json = #"{"permissionDecision":"ask"}"#
+ // Plan approval (ExitPlanMode): the hook turns "mode" into a setMode permission update.
+ case "plan_auto": json = #"{"permissionDecision":"allow","mode":"auto"}"#
+ case "plan_default": json = #"{"permissionDecision":"allow","mode":"default"}"#
+ // Reject the plan and stop Claude, so the change can be typed in the terminal.
+ case "plan_change": json = #"{"permissionDecision":"change_plan"}"#
default: json = #"{"permissionDecision":"deny"}"#
}
- RecapStore.shared.recordDecision(pillId: head.pillId, decision: decision)
+ // The recap only counts allow / always / deny.
+ let recapDecision = ["plan_auto": "allow", "plan_default": "allow", "plan_change": "deny"][decision] ?? decision
+ RecapStore.shared.recordDecision(pillId: head.pillId, decision: recapDecision)
removeApproval(id: head.id, answer: json)
+ if decision == "plan_change" { ClaudeHost.activate(head.hostApp) }
+ }
+
+ /// The plan's first non-empty line without its Markdown heading marks, for the card.
+ static func planTitle(_ plan: String?) -> String {
+ let firstLine = plan?.split(separator: "\n")
+ .first { !$0.trimmingCharacters(in: .whitespaces).isEmpty }
+ let title = firstLine.map { String($0.drop { $0 == "#" || $0 == " " }) } ?? ""
+ return title.isEmpty ? "Plan" : title
}
// MARK: - Question request
@@ -3428,6 +3447,13 @@ def main():
else:
# Claude Code / Codex plain allow
out = {'hookSpecificOutput': {'hookEventName': 'PermissionRequest', 'decision': {'behavior': 'allow'}}}
+ # Claude Code ignores an allow for ExitPlanMode without updatedInput (Allow and Always).
+ if payload.get('tool_name') == 'ExitPlanMode' and 'hookSpecificOutput' in out:
+ out['hookSpecificOutput']['decision']['updatedInput'] = payload.get('tool_input', {})
+ # Mode picked on the plan card: same choice as the terminal's plan dialog.
+ mode = resp_obj.get('mode')
+ if mode in ('auto', 'default'):
+ out['hookSpecificOutput']['decision']['updatedPermissions'] = [{'type': 'setMode', 'mode': mode, 'destination': 'session'}]
sys.stdout.write(json.dumps(out) + '\\n')
sys.stdout.flush()
sys.exit(0)
@@ -3447,6 +3473,13 @@ def main():
sys.stdout.write(json.dumps(out) + '\\n')
sys.stdout.flush()
sys.exit(0)
+ elif decision == 'change_plan':
+ # Plan card "Change plan": like the terminal's "Tell Claude what to change",
+ # reject the plan and stop Claude so the prompt is free for the change.
+ out = {'hookSpecificOutput': {'hookEventName': 'PermissionRequest', 'decision': {'behavior': 'deny', 'interrupt': True, 'message': 'The user wants to change the plan and will type the changes in the terminal.'}}}
+ sys.stdout.write(json.dumps(out) + '\\n')
+ sys.stdout.flush()
+ sys.exit(0)
# 'ask' or unknown: fall through → no output → agent re-asks
except Exception:
pass
@@ -3734,6 +3767,13 @@ def main():
else:
# Claude Code / Codex plain allow
out = {'hookSpecificOutput': {'hookEventName': 'PermissionRequest', 'decision': {'behavior': 'allow'}}}
+ # Claude Code ignores an allow for ExitPlanMode without updatedInput (Allow and Always).
+ if payload.get('tool_name') == 'ExitPlanMode' and 'hookSpecificOutput' in out:
+ out['hookSpecificOutput']['decision']['updatedInput'] = payload.get('tool_input', {})
+ # Mode picked on the plan card: same choice as the terminal's plan dialog.
+ mode = resp_obj.get('mode')
+ if mode in ('auto', 'default'):
+ out['hookSpecificOutput']['decision']['updatedPermissions'] = [{'type': 'setMode', 'mode': mode, 'destination': 'session'}]
sys.stdout.write(json.dumps(out) + '\\n')
sys.stdout.flush()
sys.exit(0)
@@ -3753,6 +3793,13 @@ def main():
sys.stdout.write(json.dumps(out) + '\\n')
sys.stdout.flush()
sys.exit(0)
+ elif decision == 'change_plan':
+ # Plan card "Change plan": like the terminal's "Tell Claude what to change",
+ # reject the plan and stop Claude so the prompt is free for the change.
+ out = {'hookSpecificOutput': {'hookEventName': 'PermissionRequest', 'decision': {'behavior': 'deny', 'interrupt': True, 'message': 'The user wants to change the plan and will type the changes in the terminal.'}}}
+ sys.stdout.write(json.dumps(out) + '\\n')
+ sys.stdout.flush()
+ sys.exit(0)
# 'ask' or unknown: fall through → no output → agent re-asks
except Exception:
pass
diff --git a/NotchBuddy/Sources/App/IslandViewContent.swift b/NotchBuddy/Sources/App/IslandViewContent.swift
index 2a7652e6..c33a7185 100644
--- a/NotchBuddy/Sources/App/IslandViewContent.swift
+++ b/NotchBuddy/Sources/App/IslandViewContent.swift
@@ -352,11 +352,12 @@ struct ApprovalView: View {
// Captured when the card is drawn: a click answers the request that was on screen,
// and is ignored if the card has moved on to the next one since.
let shownId = approval?.id
+ let isPlan = approval?.tool == "ExitPlanMode"
ZStack {
CardBackground(wash: .amber)
VStack(alignment: .leading, spacing: 5) {
HStack(spacing: 7) {
- AgentWho(task: asker, label: "needs permission")
+ AgentWho(task: asker, label: isPlan ? "has a plan ready" : "needs permission")
// Other requests waiting behind this one: "1/3".
if let count = approval?.queueCount, count > 1 {
Text(verbatim: "1/\(count)")
@@ -366,20 +367,35 @@ struct ApprovalView: View {
}
}
CodeBlock(text: approval?.command ?? approval?.tool ?? "…")
- HStack(spacing: 8) {
- SecondaryButton("Deny") {
- HookServer.shared.sendApprovalDecision("deny", for: shownId)
- }
- PrimaryButton("Allow") {
- HookServer.shared.sendApprovalDecision("allow", for: shownId)
+ if isPlan {
+ // The terminal's plan dialog choices, not a tool permission.
+ HStack(spacing: 8) {
+ SecondaryButton("Change plan") {
+ HookServer.shared.sendApprovalDecision("plan_change", for: shownId)
+ }
+ PrimaryButton("Auto mode") {
+ HookServer.shared.sendApprovalDecision("plan_auto", for: shownId)
+ }
+ SecondaryButton("Manual") {
+ HookServer.shared.sendApprovalDecision("plan_default", for: shownId)
+ }
}
- // Codex, Copilot CLI and Muse Code do not support updatedPermissions
- let hideAlways = approval?.pillId == "agent_codex"
- || approval?.pillId == "agent_copilot"
- || approval?.pillId == "agent_muse"
- if !hideAlways {
- SecondaryButton("Always") {
- HookServer.shared.sendApprovalDecision("always", for: shownId)
+ } else {
+ HStack(spacing: 8) {
+ SecondaryButton("Deny") {
+ HookServer.shared.sendApprovalDecision("deny", for: shownId)
+ }
+ PrimaryButton("Allow") {
+ HookServer.shared.sendApprovalDecision("allow", for: shownId)
+ }
+ // Codex, Copilot CLI and Muse Code do not support updatedPermissions
+ let hideAlways = approval?.pillId == "agent_codex"
+ || approval?.pillId == "agent_copilot"
+ || approval?.pillId == "agent_muse"
+ if !hideAlways {
+ SecondaryButton("Always") {
+ HookServer.shared.sendApprovalDecision("always", for: shownId)
+ }
}
}
}