Business operating system for Claude Code — 57 skills, 21 agents, smart daemon. Unified inbox (WhatsApp/Email/Slack/Telegram), autonomous PR merge, full-AWS monitoring, revenue (Stripe+RevenueCat), e-commerce (Shopify), marketing (Klaviyo/Meta/GA4), voice (Bland/ElevenLabs), APM (Datadog/NewRelic/OTEL), YOLO mode.
Shell agent-teamsai-agentai-automationanthropicautonomous-agentawsbusiness-operationsclaudeclaude-codeclaude-code-plugindevopsecommerceinbox-zeroklaviyomarketingmcpmorning-briefingpr-automationshopifyterminal
Fix ops-inbox-live-watch Gmail account, baseline, and false-alert bugs
Cursor Agent46f061196458
diff --git a/claude-ops/bin/ops-inbox-live-watch.sh b/claude-ops/bin/ops-inbox-live-watch.shindex 09e7179b..0ff5bdcd 100755--- a/claude-ops/bin/ops-inbox-live-watch.sh+++ b/claude-ops/bin/ops-inbox-live-watch.sh@@ -9,9 +9,7 @@# BSD (macOS) and GNU (Linux) userlands here), $TMPDIR-safe seen-file.## Env overrides:-# GOG_ACCOUNT mailbox to watch (default: gog's own configured-# default account — set this only to pin a-# non-default mailbox)+# GMAIL_ACCOUNT / GOG_ACCOUNT mailbox to watch (default: gog whoami)# OPS_INBOX_WATCH_INTERVAL_SEC poll interval in seconds (default 240 = 4min)# OPS_INBOX_WATCH_MAX_ITERS max polls before giving up (default 90 = ~6h)#@@ -27,20 +25,41 @@ MAX_ITERS="${OPS_INBOX_WATCH_MAX_ITERS:-90}"command -v gog >/dev/null 2>&1 || { echo "ops-inbox-live-watch: gog not found on PATH" >&2; exit 2; }command -v python3 >/dev/null 2>&1 || { echo "ops-inbox-live-watch: python3 not found on PATH" >&2; exit 2; }+GMAIL_ACCOUNT="${GMAIL_ACCOUNT:-${GOG_ACCOUNT:-}}"+if [ -z "$GMAIL_ACCOUNT" ]; then+ GMAIL_ACCOUNT="$(gog whoami 2>/dev/null | head -1 | grep -oE '[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+' || true)"+fi+ACCT_ARGS=()+[ -n "$GMAIL_ACCOUNT" ] && ACCT_ARGS=(-a "$GMAIL_ACCOUNT")+SEEN="$(mktemp "${TMPDIR:-/tmp}/.ops-inbox-seen-ids.XXXXXX")"-trap 'rm -f "$SEEN"' EXIT+trap 'rm -f "$SEEN" "${SEEN}.err"' EXIT-gog gmail search "in:inbox" --max 15 -j --results-only --no-input 2>/dev/null \- | python3 -c "import json,sys; [print(t['id']) for t in json.load(sys.stdin)]" > "$SEEN" 2>/dev/null+if ! gog gmail search "${ACCT_ARGS[@]}" "in:inbox" --max 100 -j --results-only --no-input 2>"${SEEN}.err" \+ | python3 -c "import json,sys; [print(t['id']) for t in json.load(sys.stdin)]" > "$SEEN"; then+ echo "ops-inbox-live-watch: baseline inbox snapshot failed: $(head -c 200 "${SEEN}.err" 2>/dev/null | tr '\n' ' ')" >&2+ exit 2+fi+rm -f "${SEEN}.err"for i in $(seq 1 "$MAX_ITERS"); dosleep "$INTERVAL"- NEW=$(gog gmail search "in:inbox" --max 15 -j --results-only --no-input 2>/dev/null | python3 -c "+ NEW=$(gog gmail search "${ACCT_ARGS[@]}" "in:inbox" --max 15 -j --results-only --no-input | python3 -c "import json, sysseen = set(open('$SEEN').read().split())-for t in json.load(sys.stdin):- if t['id'] not in seen:- print(f\"NEW INBOX MAIL: {t['from']} | {t['subject']} | {t['date']} | id={t['id']}\")" 2>/dev/null)+data = json.load(sys.stdin)+new_lines = []+for t in data:+ tid = t['id']+ if tid not in seen:+ new_lines.append(f\"NEW INBOX MAIL: {t['from']} | {t['subject']} | {t['date']} | id={tid}\")+ seen.add(tid)+if not new_lines:+ with open('$SEEN', 'w') as f:+ if seen:+ f.write('\n'.join(seen) + '\n')+for line in new_lines:+ print(line)")[ -n "$NEW" ] && { echo "$NEW"; exit 0; }done