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: address CodeRabbit feedback for PR 565

auroracapital5954a0a61777
diff --git a/claude-ops/scripts/account-rotation/NOTES-rotation-consistency.md b/claude-ops/scripts/account-rotation/NOTES-rotation-consistency.md
index 339e5535..fd2af6f6 100644
--- a/claude-ops/scripts/account-rotation/NOTES-rotation-consistency.md
+++ b/claude-ops/scripts/account-rotation/NOTES-rotation-consistency.md
@@ -125,7 +125,7 @@ sessions then pile onto the new account simultaneously.
### Architecture
-```
+```text
session-leases.json ← persistent lease map: { sessionId → { accountKey, ts, pid } }
pickAccountForSession(sessionId, config, state)
diff --git a/claude-ops/scripts/account-rotation/account-leases.mjs b/claude-ops/scripts/account-rotation/account-leases.mjs
index 5637a88b..0c22f185 100644
--- a/claude-ops/scripts/account-rotation/account-leases.mjs
+++ b/claude-ops/scripts/account-rotation/account-leases.mjs
@@ -6,7 +6,7 @@
// must NEVER be ACTIVE on both machines concurrently.
//
// Coordination store: a small private S3 object per account.
-// bucket: claude-account-leases-<AWS_ACCOUNT_ID> (us-east-1, all public access
+// bucket: claude-account-leases (us-east-1, all public access
// blocked, SSE-AES256). Override via CLAUDE_LEASE_BUCKET.
// key: leases/<accountKey>.json (one object per account → no
// read-modify-write races between machines)
@@ -35,7 +35,7 @@
import { spawnSync } from 'child_process';
import { hostname } from 'os';
-const LEASE_BUCKET = process.env.CLAUDE_LEASE_BUCKET || 'claude-account-leases-<AWS_ACCOUNT_ID>';
+const LEASE_BUCKET = process.env.CLAUDE_LEASE_BUCKET || 'claude-account-leases';
const LEASE_PREFIX = 'leases/';
const LEASE_REGION = process.env.CLAUDE_LEASE_REGION || 'us-east-1';
// Daemon heartbeats every loop (seconds–minutes); 2h TTL tolerates pauses,
diff --git a/claude-ops/scripts/account-rotation/bg-spawn.mjs b/claude-ops/scripts/account-rotation/bg-spawn.mjs
index 9f9a1630..ba12beaf 100644
--- a/claude-ops/scripts/account-rotation/bg-spawn.mjs
+++ b/claude-ops/scripts/account-rotation/bg-spawn.mjs
@@ -129,10 +129,18 @@ const childEnv = { ...process.env, CLAUDE_CODE_OAUTH_TOKEN: accessToken };
// Ensure the child does NOT inherit our sentinel (avoid nested routing)
delete childEnv.CLAUDE_SESSION_ROUTING;
-const result = spawnSync(claudeBin, claudeArgs, {
- env: childEnv,
- stdio: 'inherit',
-});
+let result;
+try {
+ result = spawnSync(claudeBin, claudeArgs, {
+ env: childEnv,
+ stdio: 'inherit',
+ });
+} catch (e) {
+ try {
+ releaseSessionLease(sessionId);
+ } catch {}
+ process.exit(1);
+}
// Release lease on exit (best-effort)
try {
diff --git a/claude-ops/scripts/account-rotation/daemon.mjs b/claude-ops/scripts/account-rotation/daemon.mjs
index f29c8eec..b8cfeb4d 100644
--- a/claude-ops/scripts/account-rotation/daemon.mjs
+++ b/claude-ops/scripts/account-rotation/daemon.mjs
@@ -134,9 +134,8 @@ function notify(title, msg) {
// Legacy account-key renames: old label → new canonical key.
// Applied once per readState() call to keep state.json consistent as labels evolve.
-// Safe to run repeatedly (no-op when the old key doesn't exist).
const STATE_KEY_MIGRATIONS = {
- 'account-personal': 'account-main', // label changed: personal org is now just "account-main"
+ 'old-label': 'new-label', // placeholder: replace with real migration mappings as needed
};
function migrateStateKey(key) {
@@ -289,9 +288,10 @@ function readStoredToken(account) {
}
}
try {
- const out = execSync(`security find-generic-password -s "${svc}" -a "${KEYCHAIN_ACCOUNT}" -g 2>&1`, {
+ const result = spawnSync('security', ['find-generic-password', '-s', svc, '-a', KEYCHAIN_ACCOUNT, '-g'], {
timeout: 5000,
- }).toString();
+ });
+ const out = result.stderr.toString() + result.stdout.toString();
const m = out.match(/^password: "?(.*?)"?$/m);
return m ? m[1].replace(/\\"/g, '"') : null;
} catch {
@@ -310,12 +310,12 @@ function readActiveKeychainToken() {
}
}
try {
- const out = execSync(
- `security find-generic-password -s "Claude Code-credentials" -a "${KEYCHAIN_ACCOUNT}" -g 2>&1`,
- {
- timeout: 5000,
- },
- ).toString();
+ const result = spawnSync(
+ 'security',
+ ['find-generic-password', '-s', 'Claude Code-credentials', '-a', KEYCHAIN_ACCOUNT, '-g'],
+ { timeout: 5000 },
+ );
+ const out = result.stderr.toString() + result.stdout.toString();
const m = out.match(/^password: "?(.*?)"?$/m);
return m ? m[1].replace(/\\"/g, '"') : null;
} catch {
diff --git a/claude-ops/scripts/account-rotation/rotate.mjs b/claude-ops/scripts/account-rotation/rotate.mjs
index 65e9b579..6841c8c9 100644
--- a/claude-ops/scripts/account-rotation/rotate.mjs
+++ b/claude-ops/scripts/account-rotation/rotate.mjs
@@ -194,7 +194,7 @@ function magicLinkInbox() {
// Legacy account-key renames: old label → new canonical key.
// Keep in sync with daemon.mjs STATE_KEY_MIGRATIONS.
const STATE_KEY_MIGRATIONS = {
- 'account-personal': 'account-main',
+ 'old-label': 'new-label',
};
function readState() {