The Local provider speaks the standard JSON wire: response_format by default, one self-healing fallback per endpoint when a server rejects it (dialect cached per base URL) — LiteLLM, OpenRouter, vLLM, LM Studio and plain Ollama all work from the same form, and the form + provider docs now say so. A gateway that shims a Claude-family model behind a synthesized tool call is parsed from the tool-call arguments instead of yielding silently empty insights. The insight token budget is configurable (INSIGHTS_MAX_TOKENS, default 2500, clamped 500-8000) and unified across all six call sites; a reply cut off mid-JSON returns a distinct truncation error instead of a generic parse failure. A briefing withheld by the number-grounding check now says so on the card instead of pretending nothing was generated. The provider test button answers 4xx with a bad_request category instead of claiming the endpoint was unreachable. Sleep repair follow-up: measurements carries a second full unique index — the natural key (type, measured_at, source, sleep_stage) — so a key-format migration could tombstone the old rows while their re-keyed replacements collided with that index and were silently dropped (live incident: a full-history re-sync erased a user's sleep). Planned creates now run a natural-key rescue probe: a match, live or tombstoned, is updated in place — fresh value, the new externalId, deletedAt cleared. A rescue-probe failure holds the watermark so nothing is lost past the overlap.
src/components/
React components. The UI primitives are shadcn/ui (new-york style, zinc base) over Radix + Tailwind 4 + Lucide; everything above the primitives is feature-grouped by surface. Components are server components unless they need a hook, state, or browser API, in which case they open with "use client". Charts use Recharts 3 — replacing the chart library requires explicit approval.
Primitives and shell
ui/— shadcn/ui primitives (button, dialog, sheet, table, …). Generated by the shadcn CLI; keep edits minimal and on-style.layout/— the app shell: sidebar, topbar, bottom nav.providers.tsx,version-poller.tsx— top-level context providers and the self-healing stale-shell poller.i18n/— translation context + locale switcher.
Feature groups
insights/— insight status, assessment cards, Coach surface, advisor cards (the largest group).medications/— medication cards, the schedule wizard, intake timeline, detail history.settings/— the section components behind each settings page.measurements/,mood/,dashboard/— entry forms, lists, dashboard tiles.charts/— Recharts wrappers.monitoring/— Umami / GlitchTip client bootstrap.gamification/,targets/,comparison/,doctor-report/,clinician/,onboarding/,admin/— the remaining per-surface groups.
Conventions
Kebab-case filenames; React component exports stay PascalCase regardless. (A handful of PascalCase-filename outliers under medications/ + onboarding/ are pre-existing drift, noted in ../../CLAUDE.md.) Every t() call needs a matching key in messages/en.json — guarded by i18n-call-site-coverage.test.ts. Data reads go through TanStack Query with keys from @/lib/query-keys and unwrap (await res.json()).data. Tests live in __tests__/.