Inspiration

Every week we try new habits — keeping our phone away for the first hour, cutting off coffee at noon, taking a walk after lunch — and judge whether they "work" by gut feel. Weekday mood swings, carryover from poor sleep, and confirmation bias easily fool us. Most habit apps either count streaks or overclaim causality. We wanted to bring clinical n-of-1 trial design to everyday life in a way that stays 100% honest — including saying "Not sure yet" when the data isn't enough.

What it does

Hunch turns a personal hunch into a fair 7, 14, or 21-day experiment that runs entirely in your browser (no accounts, no server, no AI hype):

  • Fair Schedule Generator: Splits days evenly ($\pm 1$) between Usual (A) and Test (B) using a seeded PRNG (mulberry32), capping streaks at 3 identical days in a row and optionally inserting washout rest days between switches.
  • 10-Second Daily Check-in: Mobile-first evening logger with 64px rating buttons, optional notes, and clickable progress dots to log or edit past days.
  • Honest Statistical Verdict: Computes the observed difference in means, runs a 10,000-shuffle permutation test and 5,000-resample bootstrap, and maps results to plain-language verdicts (Too early, Not sure yet, Probably helps, Probably hurts, No clear effect).
  • Power & Extension: Flags wide intervals that cross zero, estimates how many extra days would settle the question, and extends the schedule by 7 balanced days in one click.
  • Transparency & Portability: Includes a How we know page, a local rule-based Hunch Helper Q&A widget, printable reports, clipboard summaries, and CSV/JSON export.

How we built it

  • Frontend: Vite, React 19, TypeScript, React Router, Zustand (localStorage persistence), and custom CSS design tokens (chalk, paper, ink, cobalt, coral, mint) with Bricolage Grotesque, Instrument Sans, and DM Mono.
  • Statistical Engine (src/engine):
    • Observed effect: $$\Delta_{\text{obs}} = \bar{x}_B - \bar{x}_A$$
    • Two-sided permutation $p$-value across $M = 10{,}000$ label shuffles: $$p = \frac{1}{M}\sum_{m=1}^{M} \mathbf{1}!\left(|\Delta_m| \ge |\Delta_{\text{obs}}|\right)$$
    • Sample-size / extra-days heuristic for $\approx 80\%$ power ($\alpha = 0.05$): $$n_{\text{group}} \approx \left\lceil \frac{2\,(z_{0.975} + z_{0.80})^2\,s_{\text{pooled}}^2}{\Delta^2} \right\rceil$$
  • Testing & Deployment: 21 Vitest unit tests, 3 Playwright E2E & 390px mobile tests, and production deployment on Vercel.

Challenges we ran into

Designing a washout-aware schedule generator that simultaneously guarantees A/B balance within $\pm 1$, caps consecutive identical days at 3, and places a rest day at every transition across 7, 14, and 21-day durations required replacing naive random sampling with balanced block partitioning.

Accomplishments that we're proud of

  • Treating "Not sure yet" and "Too early" as first-class outcomes instead of hiding uncertainty.
  • Running 10,000 permutation shuffles and 5,000 bootstrap resamples instantaneously on-device with zero backend.
  • Full keyboard accessibility (4px cobalt focus rings, skip-to-content, aria-live updates), prefers-reduced-motion support, and zero horizontal overflow at 390px.

What we learned

Experimental design (randomization, washout days, and a minimum 4-days-per-group rule) matters far more than complex charts. Seeing the 10,000-shuffle null distribution immediately shows why a small gap over a few days isn't proof.

What's next for Hunch

  • .ics calendar export for daily evening check-in reminders.
  • Optional paired-week randomization for habits with strong weekday effects.
  • Zero-server shareable report links encoded in the URL hash.

Built With

Share this project:

Updates

Submission history