From 4b4b4f51d13444d0fb316289013effcd32ff1720 Mon Sep 17 00:00:00 2001 From: Brian Phillips Date: Thu, 23 Jul 2026 12:43:11 -0500 Subject: [PATCH] feat: notify Busy Bar when Codex awaits input --- README.md | 18 ++++++++++++++---- hooks/codex-notify.sh | 32 ++++++++++++++++++++++++++++++++ packaging/Info.plist | 2 +- 3 files changed, 47 insertions(+), 5 deletions(-) create mode 100755 hooks/codex-notify.sh diff --git a/README.md b/README.md index 11818af..b0f2e38 100644 --- a/README.md +++ b/README.md @@ -109,10 +109,20 @@ codex mcp add barkeep \ Restart ChatGPT desktop, Codex, or the IDE extension after adding the server. Use `/mcp` to confirm that `barkeep` is connected. -For the same automatic task-finished and needs-input signals as Claude Code, -merge [`hooks/codex-hooks.json`](hooks/codex-hooks.json) into -`~/.codex/hooks.json`, restart Codex/ChatGPT desktop, then open `/hooks` and -trust the three BarKeep commands. Codex and ChatGPT desktop share these hooks. +To notify the Busy Bar whenever Codex or ChatGPT desktop finishes a turn and +waits for you, add this top-level setting to `~/.codex/config.toml`: + +```toml +notify = ["/opt/homebrew/opt/barkeep-cli/share/barkeep-cli/hooks/codex-notify.sh"] +``` + +The notifier also forwards the event to Codex Computer Use when that helper is +installed. Restart Codex/ChatGPT desktop after changing the setting. + +For permission-request signals and long-task timing, merge +[`hooks/codex-hooks.json`](hooks/codex-hooks.json) into +`~/.codex/hooks.json`, restart the app, then open `/hooks` and trust the three +BarKeep commands. ## Permissions diff --git a/hooks/codex-notify.sh b/hooks/codex-notify.sh new file mode 100755 index 0000000..96ea14f --- /dev/null +++ b/hooks/codex-notify.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# External Codex notifier. Codex passes one JSON payload as the final argument +# when a turn completes or needs approval. +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +payload="${1:-{}}" + +# Preserve the desktop Computer Use notifier when it is installed. BarKeep's +# setup can therefore replace Codex's single `notify` command without disabling +# the helper that keeps remote-control sessions in sync. +computer_use_notifier="$HOME/.codex/computer-use/Codex Computer Use.app/Contents/SharedSupport/SkyComputerUseClient.app/Contents/MacOS/SkyComputerUseClient" +if [ -x "$computer_use_notifier" ]; then + "$computer_use_notifier" turn-ended "$payload" >/dev/null 2>&1 & +fi + +message=$(printf '%s' "$payload" | /usr/bin/python3 -c ' +import json, sys + +try: + data = json.load(sys.stdin) +except Exception: + data = {} + +event = data.get("type", "") +if event == "approval-requested": + print("needs your approval") +else: + print("is waiting for your response") +' 2>/dev/null) +[ -n "$message" ] || message="is waiting for your response" + +printf '{"message":"%s"}' "$message" | + BARKEEP_AGENT=Codex "$SCRIPT_DIR/agent-notification.sh" diff --git a/packaging/Info.plist b/packaging/Info.plist index c827d25..cffefb4 100644 --- a/packaging/Info.plist +++ b/packaging/Info.plist @@ -13,7 +13,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.0.11 + 1.0.12 LSMinimumSystemVersion 14.0 LSUIElement