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): stop skill load from starting scans (#1049)

Aurora Capitalbd77f83dacdb
diff --git a/claude-ops/skills/ops-speedup/SKILL.md b/claude-ops/skills/ops-speedup/SKILL.md
index 1dc272ea..94823d98 100644
--- a/claude-ops/skills/ops-speedup/SKILL.md
+++ b/claude-ops/skills/ops-speedup/SKILL.md
@@ -80,18 +80,36 @@ All modes:
| Memory purge | ✓ (`purge`) | ✓ (drop_caches, aggressive) | ✓ (aggressive) | — |
| Stale build dir prune (>14d) | ✓ | ✓ | ✓ | — |
-## Phase 1 — Visual header
+## Phase 1 — Select the diagnostic run
-```!
-${CLAUDE_PLUGIN_ROOT}/bin/ops-speedup 2>/dev/null || echo "SCAN_FAILED"
-```
+Loading this skill must not execute diagnostic commands. Do not use executable
+Markdown preambles for the header or scan: they run before the agent can check
+ownership, previous runs, or the user's current scope.
+
+Before starting, check the existing task list and scheduler. Reuse an in-flight
+scan or its completed output; never launch another scan while that result is
+pending. Do not create a second recurring job for an existing speedup or fleet
+control. Recurring fleet checks use their authorized lightweight probes, not a
+new full scan on each tick.
+
+## Phase 2 — Run one explicit diagnostic command
-## Phase 2 — Full diagnostic scan (parallel, all probes)
+For an explicit full-scan request, invoke the binary once through Bash after the
+preflight checks:
-```!
-${CLAUDE_PLUGIN_ROOT}/bin/ops-speedup --scan 2>/dev/null || echo '{}'
+```bash
+${CLAUDE_PLUGIN_ROOT}/bin/ops-speedup --scan
```
+Do not run the bare binary first to draw a header. Build the header from the
+returned JSON instead. Preserve stderr and the real exit status; never replace
+failed output with an empty success-shaped JSON object.
+
+If the tool moves the command to the background, retain its task ID and wait for
+the completion notification. A foreground timeout does not prove the command
+hung or finished. Do not start a replacement scan or duplicate scheduler while
+it is pending. Read the completed output before reporting a score or failure.
+
The binary already runs all probes in parallel. Do NOT add additional serial probe calls from this skill — they will duplicate work that's already in the JSON output.
## Phase 3 — Health score + cleanup report
diff --git a/claude-ops/tests/run-all.sh b/claude-ops/tests/run-all.sh
index bdb9d29e..71c04ddc 100755
--- a/claude-ops/tests/run-all.sh
+++ b/claude-ops/tests/run-all.sh
@@ -42,6 +42,7 @@ run_suite "$TESTS_DIR/test-gog-account.sh"
run_suite "$TESTS_DIR/test-ops-ci.sh"
run_suite "$TESTS_DIR/test-ops-speedup.sh"
run_suite "$TESTS_DIR/test-ops-mac-maintenance.sh"
+run_suite "$TESTS_DIR/test-speedup-skill-invocation.sh"
run_suite "$TESTS_DIR/test-ops-update-stale-clone.sh"
run_suite "$TESTS_DIR/test-ops-update-downgrade-guard.sh"
run_suite "$TESTS_DIR/test-skill-update-gate.sh"
diff --git a/claude-ops/tests/test-speedup-skill-invocation.py b/claude-ops/tests/test-speedup-skill-invocation.py
new file mode 100644
index 00000000..06c3ddf3
--- /dev/null
+++ b/claude-ops/tests/test-speedup-skill-invocation.py
@@ -0,0 +1,62 @@
+#!/usr/bin/env python3
+"""Check skill loading without executing a machine-wide diagnostic scan."""
+
+from pathlib import Path
+import re
+import unittest
+
+
+SKILL = Path(__file__).resolve().parents[1] / "skills/ops-speedup/SKILL.md"
+
+
+def invocation_defects(text):
+ defects = []
+ if re.search(r"^```!", text, re.MULTILINE):
+ defects.append("automatic preamble")
+ phases = text.split("## Phase 1", 1)[1].split("## Phase 3", 1)[0]
+ commands = re.findall(r"^\$\{CLAUDE_PLUGIN_ROOT\}/bin/ops-speedup[^\n]*", phases, re.MULTILINE)
+ if commands != ["${CLAUDE_PLUGIN_ROOT}/bin/ops-speedup --scan"]:
+ defects.append("multiple or masked diagnostic commands")
+ for rule in (
+ "Reuse an in-flight",
+ "never launch another scan",
+ "Do not create a second recurring job",
+ "Preserve stderr and the real exit status",
+ "wait for\nthe completion notification",
+ ):
+ if rule not in phases:
+ defects.append("missing lifecycle rule: " + rule)
+ return defects
+
+
+class SpeedupSkillInvocationTests(unittest.TestCase):
+ def test_loading_does_not_execute_scan(self):
+ self.assertEqual(invocation_defects(SKILL.read_text()), [])
+
+ def test_automatic_preamble_mutation_is_rejected(self):
+ text = SKILL.read_text().replace("```bash", "```!", 1)
+ self.assertIn("automatic preamble", invocation_defects(text))
+
+ def test_header_command_mutation_is_rejected(self):
+ text = SKILL.read_text().replace(
+ "${CLAUDE_PLUGIN_ROOT}/bin/ops-speedup --scan",
+ "${CLAUDE_PLUGIN_ROOT}/bin/ops-speedup\n${CLAUDE_PLUGIN_ROOT}/bin/ops-speedup --scan",
+ 1,
+ )
+ self.assertIn("multiple or masked diagnostic commands", invocation_defects(text))
+
+ def test_failure_mask_mutation_is_rejected(self):
+ text = SKILL.read_text().replace(
+ "${CLAUDE_PLUGIN_ROOT}/bin/ops-speedup --scan",
+ "${CLAUDE_PLUGIN_ROOT}/bin/ops-speedup --scan 2>/dev/null || echo '{}'",
+ 1,
+ )
+ self.assertIn("multiple or masked diagnostic commands", invocation_defects(text))
+
+ def test_pending_run_rule_mutation_is_rejected(self):
+ text = SKILL.read_text().replace("never launch another scan", "launch another scan", 1)
+ self.assertTrue(invocation_defects(text))
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/claude-ops/tests/test-speedup-skill-invocation.sh b/claude-ops/tests/test-speedup-skill-invocation.sh
new file mode 100644
index 00000000..3149c790
--- /dev/null
+++ b/claude-ops/tests/test-speedup-skill-invocation.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+TESTS_DIR="$(cd "$(dirname "$0")" && pwd)"
+python3 -I -B "$TESTS_DIR/test-speedup-skill-invocation.py"