Inspiration

Impulse purchases aren't a math problem; they're a moment problem. We were inspired by behavioral science research showing that a short, intentional pause immediately before checkout can materially reduce regretful spending. Guardian operationalizes that insight with a friction pattern that's adaptive (amount-based), personalized (merchant- and time-aware), and delightful (good UX, fast feedback), backed by analytics, an AI guidance layer, and quantum computing.

What it does

Intercepts purchase intent with a "Context Lock" that gates Approve behind a mindful pause (5/7/10 seconds based on spend magnitude) and shows a personalized nudge. Predicts upcoming purchases using a merchant-aware model (average inter-purchase intervals + amount priors), biased to afternoon/evening - when users are most likely to spend. Surfaces concise, actionable guidance via GuardyBot, a constrained AI coach seeded with the user’s analytics summary; tips can be auto-generated or user-added/curated. Presents a clean daily view: net today, saved vs spent ratio, predicted spending with brand logos, and removable tips.

How we built it

App Architecture • Frontend: SwiftUI + Combine • State Management: AppDataStore (EnvironmentObject) as the single source of truth • Design: Stateless, modular views (FinanceCard, TodayOverviewCard, PredictedSpending) for clean separation of concerns

Backend • Platform: Supabase + PostgreSQL, Python + Flask • Features: OTP authentication, scalable and secure data substrate • Ready for: Row-Level Security (RLS), edge functions, and webhooks

APIs & Intelligence • OpenRouter (Production): Used for text guidance and goal generation with strict, plain-text prompts • Gemini (Design-Ready): Integrated for future natural-language financial insights

Quantum Analytics (Experimental) • Quantum-inspired optimization (QAOA-style) to explore merchant transition structures as a cost Hamiltonian • Used to benchmark and tune classical predictors

Algorithms • Transaction ingestion with timestamps and merchant grouping • Inter-purchase interval estimation and average spend per merchant • Time-of-day priors (15:00–21:00) reflecting real-world spending patterns • Outlier guards and amount caps for stability in sparse/noisy data • Deterministic heuristics for context labeling (e.g., Nike → Clothing/Shoes, Amazon → Online Delivery)

Behavior Engine • Amount-adaptive timer: <$20 → 5s, $20–30 → 7s, >$30 → 10s • Safe timer lifecycle: invalidate on completion, approval/cancellation, or onDisappear

Challenges we ran into

Friction vs. flow: Adaptive timers + haptics preserved trust while maintaining efficacy. Sparse history: Stabilized predictions with capped averages, interval priors, and time-of-day bias. Timer crashes: Centralized ownership and invalidation eliminated EXC_BAD_ACCESS. AI specificity: Tight prompts + formatting constraints prevented verbose, generic guidance. Hover UI: Replaced sheets/popovers with true overlays to avoid UI reflow.

Accomplishments that we're proud of

Merchant-aware prediction model that feels human (brand logos, time-of-day, aligned amounts) yet is transparent and fast. A complete behavioral loop: analytics → prediction → AI tips → real-time interception → measurable savings. Production-caliber mobile UX: precise alignment, glass overlays, safe timers, and haptics. A backend that’s actually ready to scale: Postgres + Supabase now; designed for edge inference and RLS later.

What we learned

Micro-frictions must feel “fair”; tying the pause to the amount increases acceptance.

Simple, stable, and interpretable models, combined with domain priors, outperform opaque complexity at this stage. Constraining LLMs (tone, length, format) makes them product-ready. Small details (digit alignment, non-shifting overlays, lifecycle-safe timers) materially upgrade perceived quality.

What's next for Guardian

Browser extension: Analyze carts on popular sites in real time, flag “low-utility” items, limit quantities, and surface cheaper substitutes or waitlist nudges.

Richer risk scoring: Weekday/seasonality features; merchant transition graphs; confidence surfaces.

Quantum pathway: Keep using QAOA-style simulations to stress-test classical settings and identify subproblems that might benefit from specialized solvers as the ecosystem matures.

Built With

Share this project:

Updates