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
slice2a-persona-merge (#604)
Aurora Capital60b68e4673ff
diff --git a/claude-ops/bin/ops-healify-bi-refresh b/claude-ops/bin/ops-healify-bi-refreshindex af364d1e..f5e70962 100755--- a/claude-ops/bin/ops-healify-bi-refresh+++ b/claude-ops/bin/ops-healify-bi-refresh@@ -21,18 +21,13 @@ if command -v eas >/dev/null 2>&1 && [[ -d "$HEALIFY_APP" ]]; thenfisentry_json='{"ok":false,"note":"sentry-cli unavailable","projects":[]}'-SENTRY_ORG="${SENTRY_ORG:-}"-SENTRY_PROJECTS="${SENTRY_PROJECTS:-}"-if command -v sentry-cli >/dev/null 2>&1 && [[ -n "$SENTRY_ORG" && -n "$SENTRY_PROJECTS" ]]; then+if command -v sentry-cli >/dev/null 2>&1; thensentry_json="$(- IFS=',' read -ra projects <<< "$SENTRY_PROJECTS"- for project in "${projects[@]}"; do- project="${project//[[:space:]]/}"- [[ -n "$project" ]] || continue- out="$(timeout 25 sentry-cli issues list --org "$SENTRY_ORG" --project "$project" --query 'is:unresolved' 2>&1 || true)"+ for project in healify-api healify-mobile healify-admin; do+ out="$(timeout 25 sentry-cli issues list --org healify --project "$project" --query 'is:unresolved' 2>&1 || true)"if printf '%s' "$out" | grep -qi 'No issues found'; thenjq -nc --arg project "$project" '{project:$project,ok:true,unresolved:0,highPriority:0,note:"No unresolved issues"}'- elif printf '%s' "$out" | grep -qi 'error\|unauthorized\|forbidden\|not found'; then+ elif printf '%s' "$out" | grep -qi 'error\\|unauthorized\\|forbidden\\|not found'; thennote="$(printf '%s' "$out" | sed -n '1,2p' | tr '\n' ' ' | sed 's/"/'\''/g')"jq -nc --arg project "$project" --arg note "$note" '{project:$project,ok:false,unresolved:null,highPriority:null,note:$note}'else@@ -41,8 +36,6 @@ if command -v sentry-cli >/dev/null 2>&1 && [[ -n "$SENTRY_ORG" && -n "$SENTRY_Pfidone | jq -sc '{ok:true,projects:.}')"-elif command -v sentry-cli >/dev/null 2>&1; then- sentry_json='{"ok":false,"note":"SENTRY_ORG and SENTRY_PROJECTS env vars required","projects":[]}'fiopdash_json='{"ok":false,"note":"operating dashboard source probe unavailable"}'@@ -80,12 +73,9 @@ except Exception as exc:print(json.dumps({"ok": False, "note": f"PyJWT unavailable: {exc}", "apps": []}))sys.exit(0)-APP_IDS = [a.strip() for a in os.environ.get("APP_STORE_CONNECT_APP_IDS", "").split(",") if a.strip()]-KEY_ID = os.environ.get("APP_STORE_CONNECT_API_KEY_ID") or os.environ.get("APP_STORE_CONNECT_KEY_ID") or ""-ISSUER_ID = os.environ.get("APP_STORE_CONNECT_ISSUER_ID") or ""-if not APP_IDS or not KEY_ID or not ISSUER_ID:- print(json.dumps({"ok": False, "note": "Set APP_STORE_CONNECT_APP_IDS, APP_STORE_CONNECT_API_KEY_ID, and APP_STORE_CONNECT_ISSUER_ID env vars", "apps": []}))- sys.exit(0)+APP_IDS = ["6746675266", "6751717479"]+KEY_ID = os.environ.get("APP_STORE_CONNECT_API_KEY_ID") or os.environ.get("APP_STORE_CONNECT_KEY_ID") or "22C7Z973Z3"+ISSUER_ID = os.environ.get("APP_STORE_CONNECT_ISSUER_ID") or "6a7e769c-e3f3-4198-b152-960c60a27295"KEY_PATH = os.environ.get("APP_STORE_CONNECT_API_KEY_PATH") or os.path.expanduser(f"~/.fastlane/app_store_connect/AuthKey_{KEY_ID}.p8")def token():@@ -133,17 +123,18 @@ isjson "$sentry_json" || sentry_json='{"ok":false,"note":"invalid Sentry JSON","isjson "$opdash_json" || opdash_json='{"ok":false,"note":"invalid opdash JSON"}'isjson "$asc_extra_json" || asc_extra_json='{"ok":false,"note":"invalid ASC JSON","apps":[]}'-if jq -nc \+jq -nc \--arg generatedAt "$(date -u '+%Y-%m-%dT%H:%M:%SZ')" \--argjson eas "$eas_json" \--argjson sentry "$sentry_json" \--argjson opdash "$opdash_json" \--argjson ascExtra "$asc_extra_json" \- '{generatedAt:$generatedAt,eas:$eas,sentry:$sentry,opdash:$opdash,ascExtra:$ascExtra}' >"$TMP"; then- mv "$TMP" "$OUT"- printf '%s\n' "$OUT"-else+ '{generatedAt:$generatedAt,eas:$eas,sentry:$sentry,opdash:$opdash,ascExtra:$ascExtra}' >"$TMP"+JQ_RC=$?+if [ "$JQ_RC" -ne 0 ] || ! jq empty "$TMP" 2>/dev/null; thenrm -f "$TMP"- printf 'healify-bi refresh: merge failed; keeping existing cache at %s\n' "$OUT" >&2+ echo "ops-healify-bi-refresh: cache assembly failed (rc=$JQ_RC) — $OUT left unchanged" >&2exit 1fi+mv "$TMP" "$OUT"+printf '%s\n' "$OUT"diff --git a/claude-ops/bin/ops-user-profiler b/claude-ops/bin/ops-user-profilerindex aace77a5..93b218eb 100755--- a/claude-ops/bin/ops-user-profiler+++ b/claude-ops/bin/ops-user-profiler@@ -159,3 +159,145 @@ jq -n \}' > "$PREFILL" 2>/dev/null || echo '{}' > "$PREFILL"echo "ops-user-profiler: wrote $SCAN + $PREFILL (os=$OS pkg=$PKG)"++# ── persona merge write-back (R7: atomic + locked + confidence ladder) ──────+# Merge a `.persona` block (ops-persona/1) INTO preferences.json without+# clobbering higher-confidence data. Confidence ladder (highest wins):+# confirmed > user_config > web_enriched > scan_inferred+# This profiler only ever produces scan_inferred / user_config-tier values, so+# `confirmed` and web-enriched fields written by the wizard/enrichment agent are+# never overwritten here. Siblings (partner_registry, channels, toggles, mined+# persona subkeys) are preserved. Idempotent: re-running converges.+PREFS="$DATA/preferences.json"+NOW=$(date -u +%Y-%m-%dT%H:%M:%SZ 2>/dev/null || echo "")++EXIST_PREFS=$(cat "$PREFS" 2>/dev/null); isjson "$EXIST_PREFS" || EXIST_PREFS='{}'+SCAN_JSON=$(cat "$SCAN" 2>/dev/null); isjson "$SCAN_JSON" || SCAN_JSON='{}'++# Style values read from the user's OWN prior preferences are user_config-tier;+# values inferred from Claude config alone are scan_inferred-tier.+WS_SOURCE="claude-config"+{ [ -n "$PRIOR_VERBOSITY" ] || [ -n "$PRIOR_YOLO" ]; } && WS_SOURCE="user_config"++MERGED=$(jq -n \+ --arg now "$NOW" \+ --arg ws_source "$WS_SOURCE" \+ --argjson prefs "$EXIST_PREFS" \+ --argjson scan "$SCAN_JSON" '+ # source → confidence rank (unknown source = 0, never wins)+ def rank(s): ({confirmed:4,user_config:3,web_enriched:2,websearch:2,unconfirmed:2,+ scan_inferred:1,scan:1,git:1,"claude-config":1,transcript:1}[s]) // 0;+ # keep existing section unless the incoming one is strictly higher confidence+ def keep(e; i): if i==null then e+ elif e==null then i+ elif rank(e.source) >= rank(i.source) then e+ else i end;++ # per-command familiarity signal (scan_inferred): "core" = always-relevant,+ # "familiar" = a dependency the command needs is present, "new" = not seen yet.+ def cmdspec: [+ {cmd:"ops:setup", needs:[]},+ {cmd:"ops:go", needs:[]},+ {cmd:"ops:inbox", needs:["whatsapp","slack","gog","telegram","discord"]},+ {cmd:"ops:comms", needs:["whatsapp","slack","gog","telegram"]},+ {cmd:"ops:deploy", needs:["gh","aws","vercel","docker"]},+ {cmd:"ops:fires", needs:["aws"]},+ {cmd:"ops:monitor", needs:["sentry","datadog"]},+ {cmd:"ops:revenue", needs:["stripe","revenuecat"]},+ {cmd:"ops:marketing",needs:["meta","klaviyo","ga4"]},+ {cmd:"ops:home", needs:["homey"]},+ {cmd:"ops:unifi", needs:["unifi"]},+ {cmd:"ops:release", needs:["gh","eas","fastlane"]}+ ];++ ( (($scan.tooling_present // []) + ($scan.mcp_configured // []) ++ ($scan.env_vendor_names // []) + ($scan.hooks_installed // []))+ | map(ascii_downcase) ) as $present+ | ( cmdspec | map(+ { key: .cmd,+ value: {+ familiarity: ( if (.needs|length)==0 then "core"+ elif any(.needs[]; . as $n | $present | any(test($n))) then "familiar"+ else "new" end ),+ source: "scan_inferred"+ } }+ ) | from_entries ) as $cmd_base+ | ($cmd_base + (($prefs.persona.command_expertise // {})+ | with_entries(select(rank(.value.source) > rank("scan_inferred"))))) as $command_expertise++ | { display_name: ($scan.identity_hints.git_name // "Owner"),+ full_name: null,+ emails: ([$scan.identity_hints.git_email] | map(select(. != null and . != ""))),+ gh_account: ($scan.identity_hints.gh_account // ""),+ confidence: (if (($scan.identity_hints.git_name // "") != "") then "medium" else "low" end),+ source: "git" } as $inc_identity++ | { verbosity: ( ($scan.style_hints.prior_verbosity // "") | if . == "" then "compact" else . end ),+ autonomy: ($scan.style_hints.autonomy // "careful"),+ yolo_enabled: ( if ($scan.style_hints.prior_yolo // "") == "true" then true+ elif ($scan.style_hints.prior_yolo // "") == "false" then false+ else (($scan.style_hints.autonomy // "") == "yolo") end ),+ preferred_model: ( ($scan.style_hints.claude_model // "")+ | if . == "" then null+ elif test("opus";"i") then "opus"+ elif test("haiku";"i") then "haiku"+ elif test("sonnet";"i") then "sonnet"+ else null end ),+ tone: null,+ source: $ws_source,+ autonomy_evidence: ("perm_mode=" + ($scan.style_hints.perm_mode // "")+ + " allow=" + (($scan.style_hints.allow_count // 0)|tostring)+ + " deny=" + (($scan.style_hints.deny_count // 0)|tostring)) } as $inc_ws++ | { os: ($scan.host.os // "unknown"),+ pkg_mgr: ($scan.host.pkg_mgr // "none"),+ shell: ($scan.host.shell // "sh"),+ profile_file: ($scan.host.profile_file // ""),+ hooks_installed: ($scan.hooks_installed // []),+ plugins_installed: ($scan.plugins_installed // []),+ mcps_configured: ($scan.mcp_configured // []),+ clis_present: ($scan.tooling_present // []) } as $inc_env++ | ($prefs.persona // {}) as $e+ | $prefs + { persona: (+ $e+ + { schema: "ops-persona/1", updated_at: $now }+ + { identity: keep($e.identity; $inc_identity) }+ + { working_style: keep($e.working_style; $inc_ws) }+ + { environment: $inc_env }+ + { command_expertise: $command_expertise }+ ) }+ ' 2>"${OPS_PROFILER_JQERR:-/dev/null}")+JQ_RC=$?++if [ "$JQ_RC" -ne 0 ] || ! isjson "$MERGED"; then+ echo "ops-user-profiler: persona merge produced invalid JSON (rc=$JQ_RC) — preferences.json left unchanged" >&2+else+ TMP=$(mktemp "$DATA/.preferences.XXXXXX.json" 2>/dev/null) || TMP=""+ if [ -z "$TMP" ]; then+ echo "ops-user-profiler: could not create temp file in $DATA — skipping persona write" >&2+ else+ printf '%s\n' "$MERGED" > "$TMP"+ LOCK="$PREFS.lock"+ _WROTE=0+ if command -v flock >/dev/null 2>&1; then+ ( flock -x 200; mv -f "$TMP" "$PREFS" ) 200>"$LOCK"+ _WROTE=1+ else+ # mkdir-mutex fallback (mkdir is atomic on POSIX)+ _tries=0+ until mkdir "$PREFS.mutex" 2>/dev/null; do+ _tries=$((_tries+1)); [ "$_tries" -ge 50 ] && break; sleep 0.1+ done+ if [ -d "$PREFS.mutex" ]; then+ mv -f "$TMP" "$PREFS"+ rmdir "$PREFS.mutex" 2>/dev/null || true+ _WROTE=1+ else+ echo "ops-user-profiler: could not acquire preferences lock — skipping persona write" >&2+ fi+ fi+ [ -f "$TMP" ] && rm -f "$TMP" 2>/dev/null || true+ [ "$_WROTE" -eq 1 ] && echo "ops-user-profiler: merged .persona into $PREFS (ws_source=$WS_SOURCE)"+ fi+fidiff --git a/claude-ops/skills/setup/PERSONA-SCHEMA.md b/claude-ops/skills/setup/PERSONA-SCHEMA.mdindex 624ff123..f5cd4c47 100644--- a/claude-ops/skills/setup/PERSONA-SCHEMA.md+++ b/claude-ops/skills/setup/PERSONA-SCHEMA.md@@ -71,6 +71,20 @@ This is **generic for any user** — every field is _discovered_ (git identity,// worth installing, with why + how{ "tool": "stripe", "why": "you have STRIPE_* keys but no stripe CLI", "install": "dnf install stripe" },],+ "command_expertise": {+ // per ops:command familiarity signal — drives how much the wizard explains+ // each command and which it surfaces first. Keyed by command id (no slash).+ // familiarity: "core" = always-relevant (ops:setup, ops:go) — never pruned+ // "familiar" = a dependency the command needs is present (CLI/MCP/+ // env-vendor/hook detected) → user likely uses it+ // "new" = no detected dependency → introduce it, don't assume+ // source: confidence tier of THIS entry (see merge contract). The profiler+ // writes "scan_inferred"; the wizard upgrades to "confirmed" when the+ // user corrects/acknowledges it.+ "ops:setup": { "familiarity": "core", "source": "scan_inferred" },+ "ops:deploy": { "familiarity": "familiar", "source": "scan_inferred" },+ "ops:revenue": { "familiarity": "new", "source": "scan_inferred" },+ },},}```