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: scope Claude Code-credentials keychain lookup to $USER account (#492)

Aurora Capital0a6ff68b2ff8
diff --git a/claude-ops/scripts/account-rotation/force-rotate.sh b/claude-ops/scripts/account-rotation/force-rotate.sh
index 407deab6..00a55ca7 100755
--- a/claude-ops/scripts/account-rotation/force-rotate.sh
+++ b/claude-ops/scripts/account-rotation/force-rotate.sh
@@ -79,7 +79,10 @@ fi
# the daemon also auto-corrects every 2min, but this surfaces it during manual
# rotation). Don't block on failure; just log.
{
- LIVE_TOK=$(security find-generic-password -s "Claude Code-credentials" -w 2>/dev/null | python3 -c "import sys,json; print(json.loads(sys.stdin.read()).get('claudeAiOauth',{}).get('accessToken',''))" 2>/dev/null)
+ # Scope to $USER: the keychain can hold multiple "Claude Code-credentials"
+ # items and an unscoped lookup may return an mcpOAuth-only blob first.
+ LIVE_TOK=$(security find-generic-password -s "Claude Code-credentials" -a "$USER" -w 2>/dev/null | python3 -c "import sys,json; print(json.loads(sys.stdin.read()).get('claudeAiOauth',{}).get('accessToken',''))" 2>/dev/null)
+ [ -z "$LIVE_TOK" ] && LIVE_TOK=$(security find-generic-password -s "Claude Code-credentials" -w 2>/dev/null | python3 -c "import sys,json; print(json.loads(sys.stdin.read()).get('claudeAiOauth',{}).get('accessToken',''))" 2>/dev/null)
STATE_ACCT=$(python3 -c "import json; print(json.load(open('$DIR/state.json')).get('activeAccount',''))" 2>/dev/null)
if [ -n "$LIVE_TOK" ] && [ -n "$STATE_ACCT" ]; then
LIVE_ACCT=$(curl -s -m 4 -H "Authorization: Bearer $LIVE_TOK" -H "anthropic-beta: oauth-2025-04-20" https://api.anthropic.com/api/oauth/profile 2>/dev/null | python3 -c "import sys,json; print(json.loads(sys.stdin.read()).get('account',{}).get('email',''))" 2>/dev/null)
diff --git a/claude-ops/scripts/ops-memory-extractor.sh b/claude-ops/scripts/ops-memory-extractor.sh
index 9557ad2b..0f488458 100755
--- a/claude-ops/scripts/ops-memory-extractor.sh
+++ b/claude-ops/scripts/ops-memory-extractor.sh
@@ -108,9 +108,19 @@ except Exception:
fi
if command -v security &>/dev/null; then
- local blob token
- blob=$(security find-generic-password -s "Claude Code-credentials" -w 2>/dev/null || true)
- if [[ -n "${blob}" ]]; then
+ local blob token _kc_acct
+ # Scope to the current user's account first: the keychain can hold multiple
+ # "Claude Code-credentials" items (e.g. an mcpOAuth-only blob under another
+ # account), and an unscoped lookup returns whichever matches first — which
+ # may lack claudeAiOauth even when a valid token exists under $USER.
+ token=""
+ for _kc_acct in "$USER" ""; do
+ if [[ -n "${_kc_acct}" ]]; then
+ blob=$(security find-generic-password -s "Claude Code-credentials" -a "${_kc_acct}" -w 2>/dev/null || true)
+ else
+ blob=$(security find-generic-password -s "Claude Code-credentials" -w 2>/dev/null || true)
+ fi
+ [[ -z "${blob}" ]] && continue
token=$(printf '%s' "${blob}" | python3 -c "
import json, sys, time
try:
@@ -124,13 +134,14 @@ try:
except Exception:
pass
" 2>/dev/null || true)
- if [[ -n "${token}" ]]; then
- OPS_AUTH_HEADER="Authorization: Bearer ${token}"
- OPS_AUTH_MODE="oauth"
- OPS_AUTH_EXTRA_HEADERS=(-H "anthropic-beta: oauth-2025-04-20")
- log "Auth: Claude Code OAuth (subscription — no per-token billing)"
- return 0
- fi
+ [[ -n "${token}" ]] && break
+ done
+ if [[ -n "${token}" ]]; then
+ OPS_AUTH_HEADER="Authorization: Bearer ${token}"
+ OPS_AUTH_MODE="oauth"
+ OPS_AUTH_EXTRA_HEADERS=(-H "anthropic-beta: oauth-2025-04-20")
+ log "Auth: Claude Code OAuth (subscription — no per-token billing)"
+ return 0
fi
fi