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-speedup): keep --clean under 60s (#1035)
Aurora Capitalb5bad0054cb1
diff --git a/claude-ops/bin/ops-speedup b/claude-ops/bin/ops-speedupindex 6a1b8b4a..d7921071 100755--- a/claude-ops/bin/ops-speedup+++ b/claude-ops/bin/ops-speedup@@ -567,7 +567,15 @@ probe_startup() {run_parallel_scan() {local tmp; tmp=$(mktemp -d "/tmp/ops-speedup.XXXXXX")- probe_disk_reclaimable "$tmp/disk" &+ # The reclaimable-size probe walks multi-GB caches (du over npm/pnpm/yarn,+ # /var/log, Downloads) and costs ~40s on a busy Linux host. Only the --json+ # report and the bare banner path read DISK_*; a plain cleanup run never does,+ # so skip the scan there. This keeps --clean inside a 60s cron budget.+ if $MODE_JSON || ! $MODE_CLEAN; then+ probe_disk_reclaimable "$tmp/disk" &+ else+ : > "$tmp/disk"+ fiprobe_memory "$tmp/mem" &probe_cpu_hogs "$tmp/cpu" &probe_runtime "$tmp/runtime" &@@ -1022,9 +1030,15 @@ action_memory_purge() {echo " ${GRN}✓${RST} Memory purged (pressure=${pressure}% free, swap=${swap}MB)"fielif $IS_LINUX || $IS_WSL; then- if sudo -n true 2>/dev/null; then+ # drop_caches throws away the whole page cache (tens of GB on a busy host),+ # which forces every service to re-read from disk and itself causes the IO+ # spike the next health sweep measures. It is not a safe --clean action, so+ # it runs only under the explicit --aggressive tier.+ if $MODE_AGGRESSIVE && sudo -n true 2>/dev/null; thensync; echo 3 | sudo tee /proc/sys/vm/drop_caches >/dev/null 2>&1 || true- echo " ${GRN}✓${RST} Memory caches dropped"+ echo " ${GRN}✓${RST} Memory caches dropped (aggressive)"+ else+ echo " ${DIM}-${RST} Page cache kept (drop_caches only under --aggressive)"fifiif $IS_WINDOWS; thendiff --git a/claude-ops/skills/ops-speedup/SKILL.md b/claude-ops/skills/ops-speedup/SKILL.mdindex 0819815a..1dc272ea 100644--- a/claude-ops/skills/ops-speedup/SKILL.md+++ b/claude-ops/skills/ops-speedup/SKILL.md@@ -77,7 +77,7 @@ All modes:| Kernel tune (vnodes/somaxconn) | ✓ | ✓ | ✓ | — || TCP BBR | — | ✓ (aggressive) | ✓ (aggressive) | — || DNS flush | ✓ (dscacheutil) | ✓ (resolved) | ✓ (via Windows) | — |-| Memory purge | ✓ (`purge`) | ✓ (drop_caches) | ✓ | — |+| Memory purge | ✓ (`purge`) | ✓ (drop_caches, aggressive) | ✓ (aggressive) | — || Stale build dir prune (>14d) | ✓ | ✓ | ✓ | — |## Phase 1 — Visual headerdiff --git a/claude-ops/tests/test-ops-speedup.sh b/claude-ops/tests/test-ops-speedup.shindex df42a218..f0f8ae74 100644--- a/claude-ops/tests/test-ops-speedup.sh+++ b/claude-ops/tests/test-ops-speedup.sh@@ -342,6 +342,60 @@ assert_eq "linux cpu parse sys" "2.0" "$parsed_sys"assert_eq "linux cpu parse idle" "91.5" "$parsed_idle"assert_true "bin uses robust linux cpu parse" grep -q 'grep -oE .*(us|user)' "$BIN"+# --clean must finish inside a 60s cron budget (fleet-speedup sweep). On a busy+# Linux host it took 86s: ~43s in the reclaimable-size du scan that --clean never+# reads, ~30s in drop_caches, which also discards the page cache and causes the+# IO spike the next health sweep measures. Run the real binary with every+# side-effecting or slow tool replaced by a logging shim so the test is+# hermetic: nothing is deleted, reniced, pruned or dropped on the host.+shimdir="$tmpdir/shims"+shimlog="$tmpdir/shim-calls.log"+mkdir -p "$shimdir"+for tool in sudo du find rm docker pnpm brew renice ionice kill killall sync systemctl journalctl apt-get yum launchctl purge sysctl; do+ cat > "$shimdir/$tool" <<SHIM+#!/usr/bin/env bash+echo "$tool \$*" >> "$shimlog"+exit 0+SHIM+ chmod +x "$shimdir/$tool"+done++# `kill` is a bash builtin, so a PATH shim never runs. An exported function+# takes precedence over the builtin in the child bash, keeping --aggressive+# from signalling real host processes.+kill() { echo "kill $*" >> "$shimlog"; return 0; }+export -f kill+export shimlog++# Canary: a child bash must hit the shim, not the real builtin.+: > "$shimlog"+bash -c 'kill -TERM 999999' >/dev/null 2>&1 || true+assert_true "kill is shimmed in child bash (hermetic --aggressive)" grep -q '^kill -TERM 999999' "$shimlog"++run_with_shims() {+ : > "$shimlog"+ PATH="$shimdir:$PATH" "$BIN" "$@" > "$tmpdir/shim-run.out" 2> "$tmpdir/shim-run.err"+}++SECONDS=0+if run_with_shims --clean; then pass "--clean exits 0 with shimmed tools"; else fail "--clean exits 0 with shimmed tools"; fi+assert_true "--clean finishes under the 60s cron budget" test "$SECONDS" -lt 60+assert_true "--clean does not run the du reclaimable-size scan" bash -c "! grep -q '^du ' '$shimlog'"+assert_true "--clean never writes drop_caches" bash -c "! grep -q 'drop_caches' '$shimlog'"+# macOS purge is not asserted here: that branch is unchanged and still runs+# under --clean when memory pressure is high, so the result depends on the host.++# The size scan must stay available where it is read: --json reports sizes.+if run_with_shims --json; then pass "--json exits 0 with shimmed tools"; else fail "--json exits 0 with shimmed tools"; fi+assert_true "--json still runs the du reclaimable-size scan" grep -q '^du ' "$shimlog"+assert_true "--json output is valid JSON" "$PY" -c "import json,sys; json.load(open(sys.argv[1]))" "$tmpdir/shim-run.out"++# Only the explicit --aggressive tier may drop the page cache on Linux.+if [ "$(uname -s)" = "Linux" ] && ! grep -qi microsoft /proc/version 2>/dev/null; then+ if run_with_shims --aggressive; then pass "--aggressive exits 0 with shimmed tools"; else fail "--aggressive exits 0 with shimmed tools"; fi+ assert_true "--aggressive still drops caches" grep -q 'drop_caches' "$shimlog"+fi+echoecho "Results: $PASS passed, $FAIL failed"[ "$FAIL" -eq 0 ]