Skip to content

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.

fix(ops-speedup): skip macOS login-items osascript query under --clean (66s on a busy Mac) (#1036)

Aurora Capital1aa0928d6d94
diff --git a/claude-ops/bin/ops-speedup b/claude-ops/bin/ops-speedup
index d7921071..9a1f67e4 100755
--- a/claude-ops/bin/ops-speedup
+++ b/claude-ops/bin/ops-speedup
@@ -539,7 +539,14 @@ probe_startup() {
{
if $IS_MACOS; then
local login agents
- login=$($_OSASCRIPT -e 'tell application "System Events" to count of login items' 2>/dev/null || echo "?")
+ # The System Events login-items query took 66s on a busy Mac. Only the
+ # --json report reads login_items (the health score does not), so a plain
+ # cleanup run skips it and stays inside a 60s cron budget.
+ if $MODE_JSON || ! $MODE_CLEAN; then
+ login=$($_OSASCRIPT -e 'tell application "System Events" to count of login items' 2>/dev/null || echo "?")
+ else
+ login="?"
+ fi
agents=$(ls "$HOME/Library/LaunchAgents/" 2>/dev/null | wc -l | tr -d ' ')
echo "login_items=$login"
echo "launch_agents=$agents"
diff --git a/claude-ops/tests/test-ops-speedup.sh b/claude-ops/tests/test-ops-speedup.sh
index f0f8ae74..9f549df5 100644
--- a/claude-ops/tests/test-ops-speedup.sh
+++ b/claude-ops/tests/test-ops-speedup.sh
@@ -396,6 +396,35 @@ if [ "$(uname -s)" = "Linux" ] && ! grep -qi microsoft /proc/version 2>/dev/null
assert_true "--aggressive still drops caches" grep -q 'drop_caches' "$shimlog"
fi
+# macOS: the System Events login-items query took 66s on a busy Mac and only
+# --json reads its result, so --clean must not run it. Force the Darwin branch
+# with a uname shim; osascript is shimmed so nothing real is queried.
+for tool in osascript; do
+ cat > "$shimdir/$tool" <<SHIM
+#!/usr/bin/env bash
+echo "$tool \$*" >> "$shimlog"
+echo 0
+exit 0
+SHIM
+ chmod +x "$shimdir/$tool"
+done
+cat > "$shimdir/uname" <<'SHIM'
+#!/usr/bin/env bash
+case "${1:-}" in
+ -s) echo Darwin ;;
+ -m|-p) echo arm64 ;;
+ -r) echo 25.0.0 ;;
+ *) echo Darwin ;;
+esac
+SHIM
+chmod +x "$shimdir/uname"
+HOME_BAK="$HOME"; export HOME="$tmpdir/darwin-home"; mkdir -p "$HOME/Library/LaunchAgents"
+if run_with_shims --clean; then pass "--clean exits 0 on forced Darwin"; else fail "--clean exits 0 on forced Darwin"; fi
+assert_true "--clean on macOS skips the login-items osascript query" bash -c "! grep -q 'login items' '$shimlog'"
+if run_with_shims --json; then pass "--json exits 0 on forced Darwin"; else fail "--json exits 0 on forced Darwin"; fi
+assert_true "--json on macOS still queries login items" grep -q 'login items' "$shimlog"
+export HOME="$HOME_BAK"
+
echo
echo "Results: $PASS passed, $FAIL failed"
[ "$FAIL" -eq 0 ]