# ofte — tasks

The live checklist. `[x]` done, `[ ]` to do, `[~]` started or partly done. Phase descriptions and reasoning are in `PLAN.md`; open questions for Austin are in `DECISIONS.md`. Keep this file current at the end of every session.

## Phase 0 — foundations (done 2026-10-24)

- [x] Read the toolbox conventions (`README.md`, `BACKLOG.md`, `KNOWN-ISSUES.md`, Facet's docs and learnings, Redbox's structure, the build script).
- [x] Research: Neon free plan, Managed Better Auth and the Data API with row-level security (see `PLAN.md` 3.8); storage quotas; notifications limits for web apps.
- [x] Docs: `PLAN.md`, `DECISIONS.md`, `DATA-MODEL.md`, `README.md`, `TASKS.md`, `LEARNINGS.md`, `info.md`, `meta.json`.
- [x] Folder layout (`assets/js/core`, `data`, `ui`, `views`), test harnesses (Node unit tests, Playwright flows).

## Phase 1 — local-first app (v0.1 built 2026-10-24)

### Core (unit tested)
- [x] Time: day keys with day-start hour, step rounding, ranges, weeks, months, formatting, DST-safe arithmetic.
- [x] Nutrient catalog (30 nutrients, FDA daily values, directions), detail levels, custom nutrients.
- [x] Nutrition math: items from foods, quick items, unit options (serving, g, oz), per-meal edits, totals with coverage, supplements in totals, contributors, suggestions, lower alternatives.
- [x] Goals: presets, evaluation, versioning by day, gaps and limits.
- [x] Schema: defaults, normalizers for every record type, migration hook.
- [x] Backup: full and partial export, import validation, merge and replace with stats.
- [x] Reminders: due reminders, snoozes, supplement schedules, meal-gap levels and nudge rules, waking hours, `.ics` export with folding.
- [x] Summaries: day summaries, history series, grouping, goal judging per day, AI Markdown summary.
- [x] Starter library: 65 foods (calorie sanity checked) and 4 meal templates.

### Storage
- [x] IndexedDB store with in-memory cache and ordered writes, error toasts.
- [x] localStorage fallback (tested) and memory-only warning banner.
- [x] Cross-tab updates via BroadcastChannel.
- [x] Restore points (daily automatic, before import, restore and erase; newest 10).
- [x] Drafts for every editor, restored with a banner, cleared on save or discard.
- [x] Persistent-storage request (onboarding and Settings).

### Screens
- [x] Shell: hash router, bottom tab bar with a central Log button, More page, desktop side navigation, light and dark themes, toasts with undo, sheets and confirm dialogs, focus on route change, error card instead of a blank page.
- [x] Onboarding: detail level, goal preset, meal gap, units, starter foods, restore from backup.
- [x] Today: last-ate hero with status, I just ate, quick add, nutrition rings, suggestions, meals, water, supplements, sleep, activity, upcoming reminder, past-day navigation.
- [x] Meal editor: time picker with steps and nudges, meal types, title, cookbook search (foods and templates), quick ballpark items, quantity in serving/g/oz, +/−, per-meal nutrition with reset, totals with coverage, notes, estimate flag, save as template, copy to now, discard, delete with undo.
- [x] Cookbook: foods and meals tabs, search, sort, tags, favorites, archive, starter add and remove; food editor with per serving or per 100 g entry; template editor.
- [x] Goals page with presets and history list.
- [x] History: ranges, grouping, metric picker, goal-line charts, days on target, contributors with suggestions or alternatives, day table, meal search and filters, saved views (default, rename, delete), snapshots, CSV and AI exports.
- [x] Supplements: list, schedule, today checklist, stock and low-stock warning, adherence 7 and 30 days, nutrition toward totals.
- [x] Sleep: log nights, 14-night chart, averages, bedtime consistency, bedtime chart.
- [x] Activity & water: water quick add and history, workouts with chart, body metrics with charts and unit conversion.
- [x] Reminders: toggles, presets, custom reminders with weekdays, supplement reminders, notifications permission, `.ics` download.
- [x] Settings: tracking, units, time, theme, storage status, export (full or selected), import with preview, restore points, AI summary copy or download, rerun setup, erase.
- [x] PWA: manifest, icons, network-first service worker, notification click handling.

### Tests
- [x] 14 unit test groups for the core, passing in New York, London, Kolkata and Auckland time zones.
- [x] 17 end-to-end checks on a phone viewport and desktop (see `README.md`).

### Known gaps in v0.1 (small, next session)
- [x] Sleep: a wake-up time after 12:00 was read as the previous day. Fixed in v0.2: every sleep time is a full date and time.
- [ ] Workout distance uses miles when weight is in pounds; give distance its own unit setting.
- [ ] Editors do not refresh if the same record changes in another tab while open (the draft banner covers drafts, but a live notice would be better).
- [ ] Deleting a supplement keeps its dose history; History shows the count but not the name. Consider archive instead of delete.
- [ ] Today's nutrition ring for a nutrient with only a maximum fills toward the maximum; consider a different visual for limits.
- [ ] The service worker only caches files listed in `CORE` plus what was visited; keep the list in sync when adding modules.
- [ ] Add e2e coverage for the template editor, unit switching (g/oz) and the cross-tab path.

## For Austin (not urgent)

- [ ] Investigate Hearth (`austinpranger/hearth`, frozen copy at `tools/private/hearth-old/`) for features worth folding into ofte: its weekly meal-plan grid, shared household lists, household members and roles, the admin "who sees which sections" controls, push alerts (it already has a service worker for Web Push), and the per-person privacy controls. Note anything you want in `DECISIONS.md`.

## v0.2 — additive features (built 2026-10-24)

- [x] Data format 2 with a boot-time migration runner (restore point first, migration log in Settings → Data & updates), IndexedDB version 2 (adds stores only), and tests that import a format 1 backup and upgrade a real format 1 browser database.
- [x] Modules: every tracker can be switched on or off without losing data (Settings → Modules; also in onboarding). New modules: Symptoms (on by default), Mood & energy, Meditation, Breathwork, Social & relationships, Routines, Journal.
- [x] Universal Log menu from the center button; new records default to the time Save is pressed, with a pencil to change the date and time.
- [x] Sleep: free-form sessions (screens off, asleep, awake, each optional and a full date and time), taps that pair into sessions, naps, several sleeps a day, optional "count toward day".
- [x] Kitchen: whole ingredients and packaged items with stock, category guess, amount, location, recurring purchase and barcode; ingredient lists on foods and meal templates (with "start from this meal's foods"); what can I make (ready, 1–2 missing); shopping list (add missing, check off as bought, copy or share, repeating items return).
- [x] Food review: table and card views of everything eaten, frequency and recency, per-serving nutrients with "high in" flags, symptoms logged within a window afterwards, verdicts, tags, notes and alternatives, filters, sorting by any column, saved views, CSV and an AI export with a ready-made request for healthier swaps.
- [x] Settings hub: Modules, Developing (in-app roadmap, known issues, requests, disclaimers; content in `assets/js/content/developing.js`), Data & updates (format, migration log, old backups, data check), Online lookups, Terms and Privacy drafts (`assets/js/content/legal.js`).
- [x] Barcode lookups (opt-in): camera or photo where the browser can detect barcodes, typed number everywhere; Open Food Facts fills a new food or links a Kitchen package to a cookbook food.
- [x] `CLAUDE.md` with the data stability contract; `SETUP-NEON.md` with the account verification, setup steps and push-server plan.

### Next small things (v0.3 candidates)
- [ ] Kitchen: amounts per recipe that subtract from stock when you log the meal (opt-in), and a "used up" quick action.
- [ ] Food review: per-symptom view (which foods most often come before bloating, headaches...), and comparing a food's symptom rate with the baseline.
- [ ] Barcode on iPhone: add a small on-device decoder (for example a WebAssembly ZXing build, loaded only when needed) since Safari has no BarcodeDetector.
- [ ] Routines: reminders per routine and a streak view; meditation and breathwork timers.
- [ ] History: event-module charts on the same chart as nutrients (for example symptoms against sugar).
- [ ] Today: let people reorder or hide cards.
- [ ] Legal: fill placeholders and get a lawyer's review before inviting people outside the family.

## v0.2.1 — showcase and a new mark (2026-10-26)

- [x] New mark: a plate whose rim fills like a clock while a fork sweeps round as the hand. App icons, favicon and maskable icon regenerated by `dev/make-icons.mjs`, which now also writes the Toolbox card thumbnail (animated, with a still version for reduced motion).
- [x] Showcase at `/ofte/showcase/`: `explainer-v1` (26 s, square, primary) and `logo-v1` (4 s loop; wide, vertical and square).
- [ ] Bring the app's look and feel up to the explainer: the ten steps in `DESIGN-DIRECTION.md` (Night theme, line icons, plate-clock hero, in-app nudge, Log bloom, one toast at a time, Kitchen checklist, Food review answer-first, brand in app, check against the video). Not started; waiting on Austin.
- [ ] Later: wide and vertical cuts of the explainer (re-lay the scenes for those shapes rather than letterboxing the square stage), and a version with real screen recordings once the UI settles.

## Phase 2 — polish and depth

- [x] Barcode scanning (`BarcodeDetector` where supported, manual entry otherwise) with Open Food Facts lookup to create a food. Built in v0.2 as an opt-in setting.
- [ ] USDA FoodData Central search to import generic foods with full nutrient profiles (API key via a tiny proxy).
- [ ] Recipes with yield (a pot of chili into 6 servings) built from cookbook foods; household measures per food (cups, tbsp).
- [ ] Meal photos (downscaled, IndexedDB blobs), excluded from JSON export or exported separately.
- [ ] Hunger, fullness, mood and energy around meals; correlations in History (for example sleep vs. late eating).
- [ ] Weekly review screen with gentle streaks; customizable Today cards.
- [ ] Eating window reminders (first meal by, last meal by) using `goals.eatingWindow` (stored already, not yet used for nudges).
- [ ] Accessibility pass (screen reader labels on charts, reduced motion already respected) and committed screenshot baselines.

## Phase 3 — accounts and sync (needs Austin's go-ahead)

- [ ] Spike first: prove Managed Better Auth sign-in from `app.austinpranger.com` in a single-page app (see `SETUP-NEON.md`).
- [ ] Create the Neon project and enable Managed Better Auth and the Data API following `SETUP-NEON.md`; apply the schema and RLS from `DATA-MODEL.md`; run the two-account isolation test.
- [ ] Sign in, sign up, sign out, account page; first sign-in merges this device's data.
- [ ] Sync engine: dirty tracking, push, pull since cursor, tombstones, last-writer-wins, offline queue, "synced N minutes ago".
- [ ] Web Push for reminders and the meal-gap nudge while closed (VAPID keys, scheduled function).
- [ ] Decide where it lives (stay at `/ofte` or its own repo and subdomain; `DECISIONS.md` question 5).

## Phase 4 — AI integration

- [x] AI-readable Markdown summary export (built in phase 1).
- [ ] JSON Schema for the export file.
- [ ] Per-account MCP server: read tools (`get_day_summary`, `search_log`, `get_goals`, `suggest_foods`) and a confirmed write tool (`log_meal`).
- [ ] Natural-language and photo logging with confirmation.

## Phase 5 — family and friends

- [ ] Households, invites, roles; shared cookbook and meal plans; private logs by default.
- [ ] Meal plan calendar (planned vs eaten) and grocery lists.
