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-ci): emit only currently-failing workflows; add pre-dispatch staleness check (#196)
Aurora Capital2cabd935ce5c
diff --git a/claude-ops/.claude-plugin/plugin.json b/claude-ops/.claude-plugin/plugin.jsonindex ef084120..4797c26d 100644--- a/claude-ops/.claude-plugin/plugin.json+++ b/claude-ops/.claude-plugin/plugin.json@@ -1,6 +1,6 @@{"name": "ops",- "version": "2.0.8",+ "version": "2.0.9","description": "Business operations command center for Claude Code — 30 skills, 14 agents, and a smart background daemon that manage communications (WhatsApp/Email/Slack/Telegram), projects, infrastructure (all AWS services), revenue (Stripe + RevenueCat), e-commerce (Shopify), marketing (Klaviyo/Meta/GA4/GSC), monitoring (Datadog/New Relic/OTEL), and voice (Bland AI/ElevenLabs/Whisper). Includes /gtm go-to-market planner, /ops:projects portfolio dashboard, and YOLO mode for autonomous operation with 4 parallel C-suite agents.","author": {"name": "Lifecycle Innovations Limited",diff --git a/claude-ops/bin/ops-ci b/claude-ops/bin/ops-ciindex 6b1e1b2c..61db7e07 100755--- a/claude-ops/bin/ops-ci+++ b/claude-ops/bin/ops-ci@@ -1,6 +1,20 @@#!/usr/bin/env bash-# ops-ci — Recent CI failures across all repos → JSON-# Checks last 24h of GitHub Actions failures+# ops-ci — Currently-failing CI workflows across all repos → JSON+#+# Returns workflows where the LATEST run on a tracked branch (main/dev/master)+# is currently failing. Stale failures that have since been fixed by a newer+# successful run are excluded — this prevents downstream consumers+# (ops-fires, ops-go) from dispatching fix agents to already-resolved fires+# and burning tokens.+#+# Algorithm per repo:+# 1. Pull last 30 runs (any branch, any conclusion) — survey workflows in play+# 2. Extract distinct workflow names from those runs+# 3. For each workflow × tracked branch (main, dev, master), fetch latest run+# 4. Emit only entries where conclusion == "failure"+#+# Override: OPS_CI_MODE=legacy reverts to "any failure in last 24h" (slower+# but matches pre-1.7.x behaviour). Default is "current-state".set -euo pipefail@@ -16,19 +30,70 @@ if ! command -v gh &>/dev/null; thenfiREPOS=$(jq -r '[.projects[].repos[]] | unique | .[]' "$REGISTRY")-SINCE=$(date -v-1d +%Y-%m-%d 2>/dev/null || date -d '1 day ago' +%Y-%m-%d 2>/dev/null || date +%Y-%m-%d)+MODE="${OPS_CI_MODE:-current}"+TRACKED_BRANCHES=("main" "dev" "master")TMPDIR_OPS=$(mktemp -d)trap 'rm -rf "$TMPDIR_OPS"' EXIT+# ─── Per-repo scan ──────────────────────────────────────────────────────────+scan_repo_current() {+ local repo="$1"+ local safe_name+ safe_name=$(echo "$repo" | tr '/' '_')++ # Survey workflows in recent activity (last 30 runs across all branches)+ local recent_workflows+ recent_workflows=$(gh run list --repo "$repo" --limit 30 \+ --json name,workflowName 2>/dev/null \+ | jq -r '[.[] | (.workflowName // .name)] | unique | .[]' 2>/dev/null || true)++ [ -z "$recent_workflows" ] && return 0++ local failures="[]"+ while IFS= read -r workflow; do+ [ -z "$workflow" ] && continue+ for branch in "${TRACKED_BRANCHES[@]}"; do+ # Latest run for this workflow + branch+ local latest+ latest=$(gh run list --repo "$repo" --workflow "$workflow" --branch "$branch" --limit 1 \+ --json name,headBranch,createdAt,conclusion,event,workflowName 2>/dev/null || echo '[]')++ # Skip if no run, or latest is success/skipped/cancelled/in_progress+ local conclusion+ conclusion=$(echo "$latest" | jq -r '.[0].conclusion // empty' 2>/dev/null)+ [ "$conclusion" != "failure" ] && continue++ # Append to failures array+ failures=$(echo "$failures" | jq --argjson new "$latest" '. + $new')+ done+ done <<< "$recent_workflows"++ if [ "$(echo "$failures" | jq 'length')" -gt 0 ]; then+ echo "{\"repo\":\"$repo\",\"failures\":$failures}" > "$TMPDIR_OPS/$safe_name.json"+ fi+}++scan_repo_legacy() {+ local repo="$1"+ local safe_name+ safe_name=$(echo "$repo" | tr '/' '_')++ local failures+ failures=$(gh run list --repo "$repo" --status failure --limit 3 \+ --json name,headBranch,createdAt,conclusion,event 2>/dev/null || echo '[]')++ if [ "$failures" != "[]" ] && [ -n "$failures" ]; then+ echo "{\"repo\":\"$repo\",\"failures\":$failures}" > "$TMPDIR_OPS/$safe_name.json"+ fi+}+for repo in $REPOS; do(- SAFE_NAME=$(echo "$repo" | tr '/' '_')- FAILURES=$(gh run list --repo "$repo" --status failure --limit 3 \- --json name,headBranch,createdAt,conclusion,event 2>/dev/null || echo '[]')-- if [ "$FAILURES" != "[]" ] && [ -n "$FAILURES" ]; then- echo "{\"repo\":\"$repo\",\"failures\":$FAILURES}" > "$TMPDIR_OPS/$SAFE_NAME.json"+ if [ "$MODE" = "legacy" ]; then+ scan_repo_legacy "$repo"+ else+ scan_repo_current "$repo"fi) &donediff --git a/claude-ops/skills/ops-fires/SKILL.md b/claude-ops/skills/ops-fires/SKILL.mdindex efc07f21..044bbaa6 100644--- a/claude-ops/skills/ops-fires/SKILL.md+++ b/claude-ops/skills/ops-fires/SKILL.md@@ -185,6 +185,29 @@ If no fires: show "ALL SYSTEMS OPERATIONAL" with last-checked timestamps.---+## Pre-dispatch staleness check (MANDATORY)++The pre-gathered CI data is cached and may be minutes-to-hours old. Before+dispatching ANY fix agent, verify the failure is still red on its branch HEAD.+This is defense-in-depth: even after the `bin/ops-ci` "current-state" filter+(which only emits workflows whose latest run on a tracked branch is failing),+a fix may have landed in the seconds since the cache was written. Dispatching+to a self-resolved fire wastes Sonnet quota — typically 50–150k tokens per+agent before it figures out there's nothing to fix.++For each fire the user selects:++```bash+gh run list --repo "$REPO" --workflow "$WORKFLOW" --branch "$BRANCH" --limit 1 \+ --json conclusion,databaseId,createdAt --jq '.[0]'+```++- If `conclusion == "success"` → SKIP. Mark task completed with metadata `{resolution: "self-resolved-pre-dispatch"}`. Do NOT spawn agent.+- If `conclusion == "failure"` → proceed to dispatch.+- If `conclusion == null` (in_progress) → wait 30s, recheck once, then proceed if still null.++For workflows scoped only to PRs (no main/dev runs), check the PR's combined CI status instead: `gh pr checks <num> --repo "$REPO" --json bucket,name`.+## Dispatch fix agentWhen user selects to fix an issue, use `AskUserQuestion` to confirm the scope before dispatching: