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(review): align EMAIL_SCORE thresholds + null-safe Google Ads jq

auroracapital6371e2d6d535
diff --git a/claude-ops/agents/marketing-optimizer.md b/claude-ops/agents/marketing-optimizer.md
index be1c55b0..2e566baa 100644
--- a/claude-ops/agents/marketing-optimizer.md
+++ b/claude-ops/agents/marketing-optimizer.md
@@ -19,7 +19,9 @@ Read pre-gathered marketing data from the ops-marketing-dash script:
Parse the JSON output. The schema emitted by `ops-marketing-dash` (v1.5+) is:
- `meta` — account-level Meta Ads totals (last 7 days): `meta.spend`, `meta.impressions`, `meta.clicks`, `meta.ctr`, `meta.purchases`, `meta.purchase_value`, `meta.roas`. All values are strings. No per-campaign breakdown is pre-gathered — fetch campaigns directly via the fallback query below if you need per-campaign analysis.
-- `google_ads` — raw Google Ads `searchStream` response (array of pages). Each page has `.results[]` with `.campaign.{id,name,status}` and `.metrics.{costMicros,impressions,clicks,conversions,conversionsValue}`. Compute `google_ads.spend` as `[.[].results[]?.metrics.costMicros | tonumber] | add / 1000000` and `google_ads.conversions_value` as `[.[].results[]?.metrics.conversionsValue | tonumber] | add`.
+- `google_ads` — raw Google Ads `searchStream` response (array of pages) when configured, or `null` otherwise. Each page has `.results[]` with `.campaign.{id,name,status}` and `.metrics.{costMicros,impressions,clicks,conversions,conversionsValue}`. Derive spend and conversions_value via null-safe reductions so unconfigured / empty responses yield `0` instead of throwing:
+ - spend: `(if type=="array" then [.[].results[]?.metrics.costMicros // "0" | tonumber] | add // 0 else 0 end) / 1000000`
+ - conversions_value: `if type=="array" then [.[].results[]?.metrics.conversionsValue // "0" | tonumber] | add // 0 else 0 end`
- `klaviyo` — `klaviyo.subscribers`, `klaviyo.last_campaign`, `klaviyo.last_campaign_status`, `klaviyo.open_rate`.
- `ga4` — `ga4.sessions`, `ga4.users`, `ga4.conversions`, `ga4.revenue`, `ga4.cvr`.
- `gsc` — `gsc.clicks`, `gsc.impressions`, `gsc.ctr`, `gsc.avg_position`.
diff --git a/claude-ops/bin/ops-marketing-dash b/claude-ops/bin/ops-marketing-dash
index 36b5952f..c7c51e17 100755
--- a/claude-ops/bin/ops-marketing-dash
+++ b/claude-ops/bin/ops-marketing-dash
@@ -299,9 +299,10 @@ BLENDED_ROAS=$(awk "BEGIN { if (${TOTAL_SPEND:-0} > 0) printf \"%.2f\", ${TOTAL_
# ROAS score (0-30)
ROAS_SCORE=$(awk "BEGIN { r = ${BLENDED_ROAS:-0}; if (r >= 3) print 30; else if (r >= 1) print 15; else print 0 }")
# Email open rate score (0-20) — derived from Klaviyo last-campaign open rate
-# when available; falls back to 0 when we have no campaign data.
+# when available; falls back to 0 when we have no campaign data. Thresholds
+# come from SKILL.md §Marketing Health Score: >=20% → 20pt, 10-20% → 10pt.
KLAVIYO_OPEN_RATE=$(echo "$KLAVIYO_DATA" | jq -r '.open_rate // "0"' 2>/dev/null || echo "0")
-EMAIL_SCORE=$(awk "BEGIN { r = ${KLAVIYO_OPEN_RATE:-0}; if (r >= 0.25) print 20; else if (r >= 0.15) print 10; else print 0 }")
+EMAIL_SCORE=$(awk "BEGIN { r = ${KLAVIYO_OPEN_RATE:-0}; if (r >= 0.20) print 20; else if (r >= 0.10) print 10; else print 0 }")
# Channel diversification (0-20): count active platforms.
# Compare numerically — after the tempfile fix these fields can be JSON null or
# numeric strings like "0.00", neither of which a literal != "0" string test