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
chore(rotate): reconcile drift between local and public account-rotation scripts (#704)
Aurora Capital696403d870fa
diff --git a/claude-ops/scripts/account-rotation/claude-stack.mjs b/claude-ops/scripts/account-rotation/claude-stack.mjsindex 4d008a45..b97eb3c3 100644--- a/claude-ops/scripts/account-rotation/claude-stack.mjs+++ b/claude-ops/scripts/account-rotation/claude-stack.mjs@@ -99,7 +99,8 @@ function accountRotationStatus() {function status() {const route = routeStatus();- const crsHealthUrl = route.state.crs?.healthUrl || 'http://127.0.0.1:3000/health';+ const crsHealthUrl =+ route.state.crs?.healthUrl || process.env.CRS_HEALTH_URL || 'http://127.0.0.1:3005/health';return {ok: !route.settings.mixedProvider,route,@@ -139,6 +140,12 @@ function doctor() {});if (s.route.state.mode === 'crs-oauth' && !s.crs.healthy)findings.push({ severity: 'error', code: 'crs_unhealthy', detail: `${s.crs.healthUrl} is not healthy` });+ if (s.route.state.mode === 'crs-oauth' && s.route.settings.tokenKind !== 'crs-relay')+ findings.push({+ severity: 'error',+ code: 'crs_auth_token_missing',+ detail: 'CRS token variable is not a relay token (set ANTHROPIC_AUTH_TOKEN or CLAUDE_CODE_OAUTH_TOKEN)',+ });if (s.route.state.mode === 'bedrock-confirmed' && !s.route.bedrockConfirmationActive)findings.push({severity: 'error',diff --git a/claude-ops/scripts/account-rotation/daemon.mjs b/claude-ops/scripts/account-rotation/daemon.mjsindex f2ea6b19..37bf7029 100644--- a/claude-ops/scripts/account-rotation/daemon.mjs+++ b/claude-ops/scripts/account-rotation/daemon.mjs@@ -1691,7 +1691,12 @@ async function mainLoop() {// Deferred bg-session respawn sweep (every 2 min): sessions that were// busy at rotation time get respawned once they go idle, or force-// respawned after 90 min so they never wedge on an expired token.- if (Date.now() - lastRespawnSweep > 120_000) {+ // Opt-in (default OFF): bg-session respawn sweep assumes daemon-hosted+ // `claude --bg` sessions and per-session leases exist. On a fresh install+ // neither does, so this stays a no-op until explicitly enabled — set+ // CLAUDE_ENABLE_BG_RESPAWN=1 to turn it on. Mirrors the opt-in gate in+ // session-router.mjs / bg-respawn.mjs.+ if (process.env.CLAUDE_ENABLE_BG_RESPAWN === '1' && Date.now() - lastRespawnSweep > 120_000) {lastRespawnSweep = Date.now();try {const handled = sweepDeferredRespawns((m) => log(m));@@ -1793,7 +1798,11 @@ async function mainLoop() {await doRotation(reason);lastRotatedAt = Date.now();await sleep(RATE_LIMIT_COOLDOWN);- } else {+ } else if (process.env.CLAUDE_ENABLE_BG_SESSION_ROUTER === '1') {+ // Opt-in (default OFF): per-session account leasing only makes sense+ // once CLAUDE_SESSION_ROUTING is in use (see session-router.mjs). Keep+ // it disabled by default so a fresh install never starts reassigning+ // leases/respawning sessions on its own.await checkSessionLeaseRotations(config, state);}} catch (err) {diff --git a/claude-ops/scripts/account-rotation/rotation-policy.mjs b/claude-ops/scripts/account-rotation/rotation-policy.mjsindex 80ffbef0..566a9855 100644--- a/claude-ops/scripts/account-rotation/rotation-policy.mjs+++ b/claude-ops/scripts/account-rotation/rotation-policy.mjs@@ -30,3 +30,25 @@ export function liveUtilMax(u) {if (!isLiveUtilOk(u)) return null;return Math.max(u.pct5h, u.pct7d);}++/**+ * Return max(5h, 7d) from a persisted utilization snapshot.+ *+ * New snapshots store `pct`/`reset` for 5h and `pct7`/`reset7` for 7d.+ * Older daemon snapshots stored the already-combined max in `pct`, so the+ * missing weekly field remains backward compatible.+ */+export function cachedUtilizationMax(cached, now = Date.now()) {+ if (!cached || typeof cached !== 'object') return null;++ const windowValue = (pctField, resetField) => {+ const pct = Number(cached[pctField]);+ if (!Number.isFinite(pct)) return null;+ const reset = Number(cached[resetField]);+ if (Number.isFinite(reset) && reset > 0 && reset * 1000 <= now) return 0;+ return pct;+ };++ const values = [windowValue('pct', 'reset'), windowValue('pct7', 'reset7')].filter((value) => value !== null);+ return values.length ? Math.max(...values) : null;+}