Sondra pasted a BookifAI session handoff (Fable-mode money-path audit: 3 findings, plan reordered so money-path fixes come before nav/UX). She then greenlit Phase 0 with "fix everything in place, don't stop to ask unless 100% crucial," and separately ordered Agent Opus permanently off the board ("we've already taken care of it"). Scope this session = Phase 0 only (the 3 money holes) + Agent Opus cleanup. Phases 1–4 untouched.
authorize-export re-checks book_meters.entitlement === 'paid' under the caller's JWT (RLS proves ownership+payment). ExportOptions.tsx now guards all 5 download formats (KDP/PDF/Word/txt/HTML) through a guardExport() call. Closes the realistic DevTools-flip freeloader. Residual (Phase 0b): file still assembled client-side, so a dev who RE's the bundle can extract their OWN text (illustrations stay server-gated) — deliberately NOT one-shot on a live money app.purchases.refunded_at + revoke_purchase(p_session) RPC (service_role, idempotent, floors credits at 0, reverts single book to unpaid). stripe-webhook/index.ts now handles charge.refunded + charge.dispute.created, mapping payment_intent → checkout session → revoke.profiles.ai_text_day/ai_text_day_count + claim_ai_text_quota(p_user,p_limit=100) RPC (service_role, fail-CLOSED on error). Wired into generate-title, generate-toc, ideation-chat (text actions only, not generate_cover), and the LEGACY edit path of generate-chapter. Book-writing chapter path left untouched (already slot-gated).we_1TrRAWRvzUwDwHkjpjU3bffO was checkout.session.completed-only; updated via STRIPE_API_KEY_MAIN (rk_live) to also send charge.refunded + charge.dispute.created. Clawback now actually fires.umnlokuehteqwrheoyai, migration 20260710020000_money_path_hardening, 6 functions via Supabase CLI; CF Pages bookifai). Committed LOCALLY only: 1d07930 (remote is lovable-remix upstream — not pushed, matches prior practice).c:\Users\srver\AIOS-Workspace\aios-starter-kit\reference\fable-mode-money-path-audit.md — findings log; read the 2026-07-10 entries (audit + "Phase 0 fixes SHIPPED") for full detail incl. residuals.c:\Users\srver\AIOS-Workspace\aios-starter-kit\Sondra Brain\wiki\memory\open-questions.md — top section "BookifAI — Phase 0 money-path fixes SHIPPED" lists residuals + Phases 1–4 backlog.c:\Users\srver\AIOS-Workspace\aios-starter-kit\PROJECTS\Bookify AI Studio\app\supabase\functions\authorize-export\index.ts — new gate.c:\Users\srver\AIOS-Workspace\aios-starter-kit\PROJECTS\Bookify AI Studio\app\supabase\functions\_shared\quota.ts — daily text quota helper.c:\Users\srver\AIOS-Workspace\aios-starter-kit\PROJECTS\Bookify AI Studio\app\supabase\migrations\20260710020000_money_path_hardening.sqlc:\Users\srver\AIOS-Workspace\aios-starter-kit\PROJECTS\Bookify AI Studio\app\src\components\create-book\ExportOptions.tsx — guardExport() + 5 call sites.c:\Users\srver\AIOS-Workspace\aios-starter-kit\PROJECTS\Bookify AI Studio\handoffs\ (Fable-mode audit handoff, dated 2026-07-10).PROJECTS\Bookify AI Studio\app on main, 1 local commit ahead (1d07930), unpushed.curl -s -o /dev/null -w "%{http_code}" -X POST https://umnlokuehteqwrheoyai.supabase.co/functions/v1/authorize-export -H "Content-Type: application/json" -d '{"projectId":"x"}' → 401 (gateway, no JWT).{"ok":false,"error":"Not authenticated"}. With a logged-in unpaid book → 402 not_paid. Paid book → {"ok":true}.umnlokuehteqwrheoyai): select public.revoke_purchase('nope') → false; select public.claim_ai_text_quota('00000000-0000-0000-0000-000000000000'::uuid,100) → allowed=true reason=no_profile. Both RPCs granted to service_role only.authorize-export (grep the referenced assets/index-*.js).we_1TrRAWRvzUwDwHkjpjU3bffO enabled_events = [checkout.session.completed, charge.refunded, charge.dispute.created].* + DOMPurify sanitize AI HTML (DOMPurify already bundled); Phase 3 Admin dashboard + onboarding + template cards + "any book" copy; Phase 3.5 Import-Your-Book (mammoth.js needs Sondra's OK before install); Phase 4 Google consent branding. Re-run money-path audit + /app-safety-check after any money change.Money-path (Phase 0) is done and live; the natural next task is Phase 1 (shared nav Shell like Pain-2-Profit + widen the landing page) — but confirm with Sondra since she's non-technical and was overwhelmed; do not auto-start Phase 0b or push the local commit without her ask.
Generated for the CEO Dashboard · source: PROJECTS/Bookify AI Studio/handoffs/money-path-phase0-2026-07-10.md 🤍