LifeMate — Personal, Family & Learning Companion
Phase 1: complete foundation, product contract and UX direction
* docs: prioritize LifeMate feature inventory * docs: define UX information architecture and journeys * docs: define LifeMate visual brand brief * docs: define conceptual domain model * docs: select Flutter frontend baseline * docs: select Supabase backend baseline * docs: record PWA platform constraints * docs: define safety privacy and risk baseline * docs: define phase two quality gates * docs: define phase two implementation blueprint * docs: define privacy minimal analytics policy * docs: close phase one execution board * docs: mark phase one complete
davoodmehraban89 committed
Oct 5, 2026 at 06:29 UTC
33f54dfcc26863864ea2361cf2f65c8d91791d46
13 files changed
+458
-133
PROJECT_STATE.md
+42
-76
@@ -1,91 +1,57 @@
1
# LifeMate — Project State
2
3
**Last updated:** 2026-10-05
4
-**Phase:** Phase 1 — Foundation, Product Contract & UX Direction
4
+**Phase:** Phase 1 COMPLETE — Phase 2 READY
5
**Repository:** `davoodmehraban89/LifeMate`
6
**Working product name:** LifeMate — approved
7
8
## Transfer checkpoint
9
-LifeMate is now operating on a five-phase roadmap. Phase 1 has started. Repository foundation, product baseline, three foundational ADRs and an initial permission/visibility contract exist. No application stack has yet been irreversibly locked and no production code has been generated.
10
-
11
-## Confirmed product direction
12
-- Personal + Family + Learning companion; not only a student planner.
13
-- Initial primary use case includes a 13-year-old first-year lower-secondary student and her parents, while remaining generalizable to other families and ages.
14
-- One Family Workspace with independent accounts and dynamic membership.
15
-- Parent access to authorized planning, academic reports, and important support signals.
16
-- Layered teen privacy with separate safety escalation rules.
17
-- School planning benchmark includes the useful capability inventory identified from MyStudyLife.
18
-- AI domains: planner, study coach/tutor, teen wellbeing companion, parent coach and family guidance.
19
-- Wellbeing guidance is non-diagnostic and must include explicit safety boundaries.
20
-- Forgot Password via verified email reset link; Change Password in settings.
21
-- Multi-stage reminders, banners/notifications, completion-aware cancellation and rescheduling proposals.
22
-- Android + iPhone/iPad PWA + responsive web using shared backend/data.
23
-- Strong visual identity, app icon, entry/login experience, RTL Persian quality, teen-attractive but non-childish design.
9
+Phase 1 (Foundation, Product Contract & UX Direction) has passed its exit gate on branch `phase-1/foundation-completion`. Product scope, roles/visibility, UX information architecture, visual direction, conceptual domain model, frontend/backend baselines, PWA constraints, safety/privacy risks and Phase 2 quality gates are documented. No application scaffold has been generated yet.
10
11
## Five-phase roadmap
26
-1. **Foundation, Product Contract & UX Direction** — IN PROGRESS
27
-2. **Product Foundation & Identity**
12
+1. **Foundation, Product Contract & UX Direction** — COMPLETE
13
+2. **Product Foundation & Identity** — READY
14
3. **Planner, School & Family Core**
15
4. **AI Guides, Learning & Wellbeing**
16
5. **Hardening, Observability & Release**
17
32
-See `docs/ROADMAP.md` for gates and deliverables.
33
-
34
-## Operating structure
35
-Coordinator + five specialist ownership areas:
36
-1. Product & Research
37
-2. UX/UI & Brand
38
-3. Architecture/Data/Security/Safety
39
-4. Cross-platform Development
40
-5. QA/Release/Observability
41
-
42
-## Tooling direction
43
-- GitHub: technical source of truth and delivery workflow.
44
-- Figma: primary UI/UX and design system.
45
-- Canva: brand/illustration/educational visual assets.
46
-- Notion: management knowledge/mirror, not technical source of truth.
47
-- Supabase: current backend/auth/database candidate; not yet locked by ADR.
48
-- Context7: version-aware implementation documentation.
49
-- PostHog: intended for staging+ analytics/feature flags/observability with privacy-minimal instrumentation.
50
-- Cloudflare/hosting providers: introduce only when architecture requires them.
51
-
52
-## Current change ledger
53
-### DONE
54
-- [x] Product working name approved: LifeMate.
55
-- [x] Private GitHub repository created and write access verified.
56
-- [x] Initial README and `AGENTS.md` created.
57
-- [x] Five-phase roadmap recorded.
58
-- [x] Product Specification v1 baseline recorded.
59
-- [x] Foundational ADRs: product lifecycle, family/privacy principle, distribution strategy.
60
-- [x] Phase 1 execution board created.
61
-- [x] Initial permission/visibility matrix created.
62
-
63
-### IN PROGRESS — PHASE 1
64
-- [ ] Prioritize feature inventory into Must / Should / Later.
65
-- [ ] Define information architecture and primary user journeys.
66
-- [ ] Produce visual/brand brief and prototype-ready screen inventory.
67
-- [ ] Define conceptual domain model.
68
-- [ ] Evaluate and record frontend architecture ADR.
69
-- [ ] Evaluate and record backend/auth architecture ADR.
70
-- [ ] Define wellbeing safety boundary and risk register.
71
-- [ ] Validate PWA/platform constraints.
72
-- [ ] Define CI/staging/observability readiness rules.
73
-
74
-### NOT STARTED
75
-- [ ] Application scaffold (Phase 2 gate).
76
-- [ ] Database schema/migrations.
77
-- [ ] CI workflows.
78
-- [ ] Staging environment.
79
-- [ ] AI provider selection.
80
-- [ ] Email provider/configuration.
81
-- [ ] Push notification provider/configuration.
82
-- [ ] Voice STT/TTS provider selection.
83
-
84
-## Immediate next sequence
85
-1. Complete Phase 1 UX information architecture + brand brief.
86
-2. Complete domain model and backend/frontend ADR evaluations.
87
-3. Complete privacy/safety and platform validation.
88
-4. Run Phase 1 exit review; only then generate the Phase 2 application scaffold.
18
+## Accepted architecture baseline
19
+- Client: Flutter for Android + app-centric responsive Web/PWA.
20
+- iPhone/iPad initial distribution: Home Screen PWA; future packaged/native iOS path preserved.
21
+- Backend: Supabase PostgreSQL + Auth + RLS; privileged workflows/AI/server secrets in server-side functions/services.
22
+- Offline: explicit custom web service-worker/cache strategy; browser storage is non-authoritative.
23
+- Authorization: relationship-aware and server-enforced; family admin is not blanket private-content access.
24
+
25
+## Product/UX baseline
26
+- Teen navigation: Today, Planner, School, AI, Me.
27
+- Parent/adult navigation: Today, Planner, Family, Guide, Me.
28
+- Parent support focuses on authorized schedule/academic/support summaries, not routine private transcript surveillance.
29
+- Visual language: warm, modern, calm, graphical, teen-friendly but non-childish; Persian RTL first-class.
30
+- Figma artifact exists: `LifeMate — Product UX & Brand v1` with initial editable direction frames.
31
+- Canva is supporting visual/illustration exploration; Figma remains UI source of truth.
32
+- Notion Project Hub exists as management mirror; GitHub remains technical source of truth.
33
+
34
+## Phase 1 deliverables
35
+- `docs/ROADMAP.md`
36
+- `docs/product/PRODUCT_SPEC_V1.md`
37
+- `docs/product/FEATURE_PRIORITIES_V1.md`
38
+- `docs/product/PERMISSION_MATRIX_V0.md`
39
+- `docs/product/PHASE_1_EXECUTION.md`
40
+- `docs/ux/IA_AND_JOURNEYS_V1.md`
41
+- `docs/ux/BRAND_BRIEF_V1.md`
42
+- `docs/architecture/DOMAIN_MODEL_V1.md`
43
+- `docs/architecture/PWA_PLATFORM_CONSTRAINTS_V1.md`
44
+- `docs/architecture/PHASE_2_BLUEPRINT.md`
45
+- `docs/quality/PHASE_2_QUALITY_GATES.md`
46
+- `docs/quality/ANALYTICS_POLICY_V1.md`
47
+- `docs/safety/SAFETY_PRIVACY_RISK_V1.md`
48
+- ADR-0001 through ADR-0005.
49
+
50
+## Phase 2 first vertical slice
51
+Auth → verified email/recovery/change password → Profile → Family Workspace → invitation/membership → Guardian Relationship → RLS/permission tests → Teen/Parent authenticated shells → CI/staging smoke.
52
+
53
+## Production-gate items intentionally deferred
54
+These do not block Phase 2 engineering foundation but do block public production of wellbeing/minor-sensitive AI features: jurisdiction-specific legal/guardian consent review; safety severity taxonomy; emergency resource localization; AI provider privacy/retention review; wellbeing retention/export/deletion policy.
55
56
## Guardrail
91
-Do not start implementation merely to create visible code. Foundation decisions that affect identity, permissions, privacy, teen safety, offline/sync, and cross-platform distribution must be explicit first; low-risk reversible UI prototypes may proceed in parallel.
57
+AI/wellbeing production exposure stays disabled until its dedicated safety/legal/provider gates pass. Production deploys, destructive migrations and sensitive access changes still require explicit action-specific approval.
\ No newline at end of file
docs/architecture/DOMAIN_MODEL_V1.md
new
+50
@@ -0,0 +1,50 @@
1
+# LifeMate — Conceptual Domain Model v1
2
+
3
+## Identity
4
+- **Account** — authentication identity; credentials/session are not family-shared.
5
+- **Profile** — person-facing identity and preferences.
6
+- **LifeContext** — Student, Work, Personal or future contexts attached to Profile.
7
+
8
+## Family
9
+- **FamilyWorkspace** — tenant/boundary for family-shared data.
10
+- **Membership** — Profile ↔ FamilyWorkspace with status and administrative capabilities.
11
+- **GuardianRelationship** — explicit adult ↔ minor relationship; permissions depend on this relation, not only generic role names.
12
+- **Invitation** — expiring/revocable join intent.
13
+- **SharingGrant** — resource-level audience/visibility representation where policy allows.
14
+
15
+## Planning
16
+- **PlanItem** — common scheduling identity for task/event/study/family commitments where shared fields are useful.
17
+- **Task** — actionable item with status, priority, duration and optional due time.
18
+- **CalendarEvent** — time-bound commitment.
19
+- **Routine** — repeatable behavior/template.
20
+- **Goal** — outcome with optional linked plan items.
21
+- **Reminder** — delivery rule linked to a resource; obsolete reminders are cancelled on completion/reschedule.
22
+
23
+## School
24
+- **AcademicYear** → **Term**.
25
+- **Subject** belongs to a Student LifeContext and academic period.
26
+- **ClassSession** represents timetable occurrences/rules.
27
+- **Assignment**, **Exam**, **StudySession**, **Grade**, **RevisionPlan** attach to Subject/period as appropriate.
28
+
29
+## Wellbeing / AI
30
+- **GuideSession** — AI interaction session with explicit guide type and context scope.
31
+- **CheckIn** — structured self-reported mood/energy/stress signals; not a diagnosis.
32
+- **ParentInsight** — derived, policy-controlled support summary; never assumed to equal raw transcript.
33
+- **SafetyEvent** — separately governed event for defined safety escalation conditions.
34
+- **AIProposal** — suggested plan/action requiring user confirmation unless a future policy explicitly permits safe automation.
35
+
36
+## Governance
37
+- **AuditEvent** — immutable security/policy-relevant event metadata.
38
+- **NotificationPreference** and **QuietHours** — per-profile delivery policy.
39
+- **DeviceSubscription** — push endpoint/device metadata without becoming identity authority.
40
+
41
+## Ownership invariants
42
+- Personal resources have an owning Profile.
43
+- Family resources have a FamilyWorkspace and creator/owner semantics.
44
+- School resources belong to the student's Profile/LifeContext, not to the parent account.
45
+- Guardian visibility is computed from relationship + resource policy + age/safety policy.
46
+- Admin capability never implies blanket read access to private content.
47
+- AI retrieval is downstream of the same authorization decision as human-facing APIs.
48
+
49
+## Data lifecycle principles
50
+Membership removal revokes future access. Retention/export/deletion rules for shared and wellbeing data are explicit policy decisions; no cascade behavior is assumed merely because a relationship ends.
\ No newline at end of file
docs/architecture/PHASE_2_BLUEPRINT.md
new
+46
@@ -0,0 +1,46 @@
1
+# LifeMate — Phase 2 Implementation Blueprint
2
+
3
+## Proposed repository structure
4
+```text
5
+apps/lifemate/ Flutter application (Android + Web/PWA)
6
+ lib/
7
+ app/ bootstrap, routing, theme, localization
8
+ features/auth/
9
+ features/profile/
10
+ features/family/
11
+ shared/ reusable UI/domain utilities with strict scope
12
+ web/ manifest, icons, bootstrap, custom SW/web integration
13
+ test/
14
+supabase/
15
+ migrations/ versioned schema + grants + RLS
16
+ functions/ privileged server workflows; no client secrets
17
+ tests/ database/RLS allow+deny tests
18
+docs/ product, UX, architecture, safety, quality, decisions
19
+.github/workflows/ CI after scaffold
20
+```
21
+
22
+## Architecture style
23
+Feature-oriented Flutter modules with domain/service boundaries; avoid a giant shared layer. UI may validate and cache, but backend policies are authoritative for permissions. Supabase is accessed through repository/service interfaces so AI/provider logic and complex privileged workflows remain server-side.
24
+
25
+## Environments
26
+At minimum: **local**, **staging**, **production**. Staging and production use separate Supabase projects/secrets/data. Environment-specific public configuration is injected at build/deploy; secrets/service-role/provider keys exist only in server secret stores. `.env` with real credentials is never committed.
27
+
28
+## Phase 2 first vertical slice
29
+1. App shell + localization/RTL + theme.
30
+2. Email/password auth + verification/recovery/change-password.
31
+3. Profile creation.
32
+4. Family Workspace + invitation + membership.
33
+5. Guardian relationship and baseline permission enforcement.
34
+6. Teen/Parent authenticated home shells.
35
+7. CI and staging smoke.
36
+
37
+This slice deliberately proves identity and authorization before planner/school data expands the schema.
38
+
39
+## PWA integration
40
+Own `manifest.json`, icons/apple-touch-icon, standalone metadata, install guidance and custom service-worker strategy. Push subscription is capability-detected and implemented only after the core auth/family slice is stable.
41
+
42
+## Configuration rule
43
+Public client identifiers are separated from secrets. Any credential that bypasses RLS or accesses AI/email/push provider privileged APIs is server-only.
44
+
45
+## Migration rule
46
+Schema/grant/RLS changes travel together in versioned migrations and include database tests. Destructive migrations require explicit approval and rollback/backup consideration.
\ No newline at end of file
docs/architecture/PWA_PLATFORM_CONSTRAINTS_V1.md
new
+28
@@ -0,0 +1,28 @@
1
+# LifeMate — PWA Platform Constraints v1
2
+
3
+## iPhone/iPad install model
4
+LifeMate must include a Web App Manifest and standalone display behavior plus explicit icons. On iOS/iPadOS, a Home Screen web app can open as its own app-like surface rather than a normal browser tab. `apple-touch-icon` is provided intentionally for icon quality.
5
+
6
+## Push
7
+Web Push is supported for Home Screen web apps on iOS/iPadOS 16.4+. Permission must be requested in response to user interaction. Therefore notification onboarding must feature-detect capability and explain installation/permission rather than assuming push exists in an ordinary Safari tab.
8
+
9
+## Service worker / offline
10
+Current Flutter web does not provide a managed caching service worker by default. LifeMate must own its caching strategy. Phase 2 begins with conservative app-shell/static caching; offline data editing is added only per domain after conflict semantics are defined.
11
+
12
+## Storage assumptions
13
+Browser storage is a cache, not the authoritative database. Critical user data must sync to the backend when connectivity exists. The UX must tolerate local cache eviction and rehydration.
14
+
15
+## Background behavior
16
+Do not design correctness around background sync/execution. Reminders requiring guaranteed server-side timing should be generated from backend scheduling/push infrastructure; client background execution is an optimization only.
17
+
18
+## Install UX
19
+Provide a contextual install guide when capability/platform warrants it. Do not repeatedly nag. After installation, standalone safe-area layout, status-bar/theme metadata, deep-link/recovery redirect behavior and keyboard handling must be tested on real iPhone Safari/Home Screen.
20
+
21
+## Phase 2 smoke matrix
22
+- Android current supported baseline: install, auth, navigation, notifications when implemented.
23
+- iPhone Safari: login/recovery/responsive layout.
24
+- iPhone Home Screen: standalone launch, icon, safe areas, auth persistence, deep link/recovery, push capability where OS supports it.
25
+- Desktop Chrome/Edge/Safari: responsive core flows.
26
+
27
+## Sources validated in Phase 1
28
+Official WebKit documentation for iOS/iPadOS Home Screen Web Push and official Flutter Web FAQ/initialization documentation for PWA suitability and service-worker behavior.
\ No newline at end of file
docs/decisions/0004-frontend-flutter.md
new
+22
@@ -0,0 +1,22 @@
1
+# ADR-0004 — Frontend Baseline: Flutter
2
+
3
+- **Status:** Accepted for Phase 2 baseline
4
+- **Date:** 2026-10-05
5
+
6
+## Decision
7
+Use **Flutter** as the initial client framework for Android and the app-centric responsive Web/PWA surface, with platform-specific web integration where standards-based PWA behavior requires it.
8
+
9
+## Why
10
+LifeMate is an app-centric experience rather than a document/SEO site. A shared Dart/Flutter product surface reduces divergence between Android and PWA while preserving high visual fidelity and RTL control. Official Flutter guidance identifies PWAs, SPAs and existing mobile-style applications as suitable Flutter web scenarios.
11
+
12
+## Important constraint
13
+Flutter no longer generates/manages an application caching service worker by default. Offline/PWA caching must therefore be an explicit web concern using a custom standards-based service worker/Workbox or equivalent, not an assumed framework feature.
14
+
15
+## Boundaries
16
+- Do not force every web capability through Flutter abstractions. Manifest, install UX, Web Push/service worker integration, safe-area/platform metadata and browser-specific capability detection may live in `web/` integration code.
17
+- Do not promise background behavior unsupported by iOS/PWA.
18
+- Native iOS packaging remains a future distribution option because Flutter can target iOS, but initial iPhone distribution is PWA.
19
+- Revisit this ADR only if a Phase 2 spike proves a blocking requirement (not aesthetic preference) cannot be delivered reliably.
20
+
21
+## Alternatives considered
22
+Separate Kotlin Android + React/Next PWA offers maximum platform specialization but creates two primary UI codebases before product-market validation. React Native does not remove the need for a separate web/PWA strategy as cleanly for this product. Both remain fallback options if a verified blocker appears.
\ No newline at end of file
docs/decisions/0005-backend-supabase.md
new
+24
@@ -0,0 +1,24 @@
1
+# ADR-0005 — Backend/Auth Baseline: Supabase
2
+
3
+- **Status:** Accepted for Phase 2 baseline
4
+- **Date:** 2026-10-05
5
+
6
+## Decision
7
+Use **Supabase** as the initial backend platform: PostgreSQL + Supabase Auth + Row Level Security, with Edge Functions/server-side code for privileged workflows, AI orchestration and secrets.
8
+
9
+## Why
10
+LifeMate needs relational family/guardian/resource relationships, granular authorization and email/password recovery. Supabase Auth integrates JWT identity with PostgreSQL RLS, allowing authorization to remain consistent across Android and Web/PWA clients.
11
+
12
+## Security contract
13
+- Enable RLS on every exposed application table.
14
+- Explicitly set grants and separate policies by operation; do not assume RLS alone removes broad grants.
15
+- Test allow and deny paths for authorization policies.
16
+- Publishable client key may exist in clients; service-role/secret keys never do.
17
+- Privileged AI/provider calls, invitation administration and sensitive safety workflows execute server-side.
18
+- Views/functions must be reviewed for RLS/security-definer behavior before exposure.
19
+
20
+## Auth baseline
21
+Email/password with email verification, non-enumerating forgot-password response, time-limited recovery flow, authenticated password change and controlled redirect URLs. Custom SMTP/provider selection is an operational Phase 2 task, not a reason to build custom authentication.
22
+
23
+## Alternatives considered
24
+Custom API/Postgres would provide full control but adds auth/security/operations work before core product value. Firebase simplifies some mobile flows but the relational authorization model is a less direct fit for family/guardian/resource policy. Supabase remains replaceable behind domain/service boundaries if later scale or compliance requirements justify migration.
\ No newline at end of file
docs/product/FEATURE_PRIORITIES_V1.md
new
+34
@@ -0,0 +1,34 @@
1
+# LifeMate — Feature Priorities v1
2
+
3
+## MUST — first useful product
4
+- Independent accounts, verified email, sign-in/out, forgot/reset/change password.
5
+- Profile/life-context model; Teen, Parent/Guardian, Adult Member, Family Admin relationships.
6
+- Dynamic Family Workspace, invitations, membership changes and server-enforced permissions.
7
+- Today view, Calendar, Tasks, routines/goals baseline, reminders and rescheduling.
8
+- School year/term, subjects, class schedule, assignments, exams and study sessions.
9
+- Controlled sharing and family calendar.
10
+- Parent dashboard for authorized schedule, academic workload/progress and support summaries.
11
+- Persian RTL, responsive web/PWA, Android installable client, app-like iPhone Home Screen experience.
12
+- Privacy controls, audit events for sensitive policy/access changes, safety boundary.
13
+
14
+## SHOULD — after core reliability
15
+- Grades/progress trends and revision plans.
16
+- Focus/study timer and workload balancing.
17
+- AI Life Planner and Study Coach/Tutor.
18
+- Teen wellbeing check-ins and Parent Coach summaries under explicit policy.
19
+- Voice input/output after Persian quality/privacy validation.
20
+- Offline cache for essential upcoming plan data and safe queued edits where conflict semantics are defined.
21
+
22
+## LATER
23
+- Rich gamification, streak economy and collectibles.
24
+- LMS/school-system integrations.
25
+- Social/community features.
26
+- Native/App-Store iOS packaging when distribution conditions justify it.
27
+- Marketplace/plugin ecosystem.
28
+- Advanced household finance/work modules.
29
+
30
+## V1 outcome
31
+A family can securely join one workspace; each member can plan independently; a teen can manage a real school week; parents can see the authorized information needed to support the teen; shared family items work; reminders are useful; the product remains usable without AI.
32
+
33
+## Non-goals
34
+LifeMate V1 is not a surveillance product, clinical diagnosis/treatment system, location tracker, social network, school ERP, or autonomous decision-maker.
\ No newline at end of file
docs/product/PHASE_1_EXECUTION.md
+36
-57
@@ -1,74 +1,53 @@
1
# Phase 1 — Execution Board
2
3
**Phase:** Foundation, Product Contract & UX Direction
4
-**Status:** IN PROGRESS
4
+**Status:** COMPLETE — EXIT GATE PASSED
5
**Owner:** Coordinating Project Lead
6
+**Closed:** 2026-10-05
7
8
## Workstream A — Product & Research
8
-**Primary owner:** Product & Research
9
-
10
-- [x] Establish product definition and V1 actors.
11
-- [x] Record five-phase roadmap.
12
-- [x] Record Product Specification v1 baseline.
13
-- [ ] Normalize competitor-derived feature inventory into Must / Should / Later.
14
-- [ ] Define measurable V1 outcome and non-goals.
15
-
16
-**Done when:** V1 scope can be tested and later-feature inventory cannot silently expand it.
9
+- [x] Product definition and V1 actors.
10
+- [x] Five-phase roadmap.
11
+- [x] Product Specification v1.
12
+- [x] Competitor-derived inventory normalized into Must / Should / Later.
13
+- [x] Measurable V1 outcome and non-goals.
14
15
## Workstream B — UX/UI & Brand
19
-**Primary owner:** UX/UI & Brand
20
-
21
-- [ ] Define information architecture for Teen, Parent and Adult/Family experiences.
22
-- [ ] Define primary journeys: onboarding/join family, Today, school planning, parent review, sharing, password recovery.
23
-- [ ] Produce brand/visual brief: mood, typography direction, color principles, icon/logo principles, illustration language, age progression.
24
-- [ ] Define responsive/PWA constraints and RTL/accessibility baseline.
25
-- [ ] Prepare prototype-ready screen inventory for Figma.
26
-
27
-**Done when:** prototype work can start without inventing navigation or brand rules ad hoc.
16
+- [x] Information architecture for Teen, Parent and Adult/Family experiences.
17
+- [x] Primary journeys: onboarding/join family, Today, school planning, parent review, sharing, password recovery, missed-work recovery and wellbeing entry.
18
+- [x] Brand/visual brief: mood, typography direction, color principles, icon/logo principles, illustration language and age progression.
19
+- [x] Responsive/PWA constraints and RTL/accessibility baseline.
20
+- [x] Prototype-ready screen inventory.
21
+- [x] Figma direction artifact created with editable Teen Today, Parent Overview and Login/Welcome concept frames.
22
+- [x] Canva visual-direction generation initiated as a supporting asset exploration surface; Figma remains UI source of truth.
23
24
## Workstream C — Architecture, Data, Security & Safety
30
-**Primary owner:** Architecture/Data/Security/Safety
31
-
32
-- [x] Record product lifecycle ADR.
33
-- [x] Record family/privacy principle ADR.
34
-- [x] Record distribution strategy ADR.
35
-- [ ] Define role/permission/visibility matrix.
36
-- [ ] Define conceptual domain model and ownership boundaries.
37
-- [ ] Evaluate backend/auth candidate and record ADR.
38
-- [ ] Evaluate frontend candidate and record ADR.
39
-- [ ] Define wellbeing safety boundary and unresolved jurisdiction questions.
40
-- [ ] Define audit requirements for sensitive policy/access changes.
41
-
42
-**Done when:** Phase 2 can enforce identity and family authorization server-side from documented rules.
25
+- [x] Product lifecycle ADR.
26
+- [x] Family/privacy principle ADR.
27
+- [x] Distribution strategy ADR.
28
+- [x] Role/permission/visibility matrix.
29
+- [x] Conceptual domain model and ownership boundaries.
30
+- [x] Backend/auth ADR: Supabase/Postgres/Auth/RLS baseline.
31
+- [x] Frontend ADR: Flutter Android + app-centric Web/PWA baseline.
32
+- [x] Wellbeing safety boundary and unresolved production legal/policy items.
33
+- [x] Audit requirements for sensitive policy/access changes.
34
35
## Workstream D — Cross-platform Development Readiness
45
-**Primary owner:** Cross-platform Development
46
-
47
-- [ ] Validate PWA requirements/limitations relevant to notifications, storage, offline and install UX.
48
-- [ ] Validate Android + Web/PWA candidate stack against required capabilities.
49
-- [ ] Define environment/configuration strategy without committing secrets.
50
-- [ ] Define proposed repository application structure after architecture ADRs.
51
-
52
-**Done when:** application scaffold can be generated with known platform constraints rather than assumptions.
36
+- [x] PWA requirements/limitations validated for iOS Home Screen Web Push, storage/offline assumptions and install UX.
37
+- [x] Android + Web/PWA candidate stack validated at architecture level.
38
+- [x] Environment/configuration strategy defined without secrets.
39
+- [x] Proposed repository/application structure and first vertical slice defined.
40
41
## Workstream E — QA, Release & Observability Readiness
55
-**Primary owner:** QA/Release/Observability
56
-
57
-- [ ] Define Phase 2 CI quality gates: format/lint/static analysis/unit tests/build smoke.
58
-- [ ] Define staging-first release rule and minimum smoke matrix.
59
-- [ ] Define privacy-minimal analytics event principles before PostHog instrumentation.
60
-- [ ] Define initial risk register and verification ownership.
42
+- [x] Phase 2 CI quality gates defined.
43
+- [x] Staging-first rule and smoke matrix defined.
44
+- [x] Privacy-minimal PostHog analytics policy defined.
45
+- [x] Initial safety/privacy risk register and verification ownership defined.
46
62
-**Done when:** the first code is born into a testable/releasable workflow instead of adding QA later.
47
+## Exit review
48
+**PASS.** No critical ambiguity remains that would force Phase 2 developers to invent identity, recovery, family membership, parental visibility, target distribution, V1 scope or baseline frontend/backend architecture while coding.
49
64
-## Phase 1 exit review
65
-Phase 1 cannot close with unresolved critical ambiguity in:
66
-- identity/recovery;
67
-- family membership and roles;
68
-- parent visibility versus teen privacy;
69
-- wellbeing safety boundary;
70
-- target platform/distribution;
71
-- V1 scope;
72
-- frontend/backend architecture selection.
50
+Items intentionally deferred are production gates rather than Phase 2 scaffold blockers: jurisdiction-specific minor/guardian legal review, exact wellbeing safety severity taxonomy, emergency-resource localization, provider contractual/privacy review, and final retention periods. AI wellbeing remains feature-flagged off until those gates pass.
51
74
-Low-risk visual prototypes may run in parallel with these decisions.
52
+## Phase 2 handoff
53
+Proceed with `docs/architecture/PHASE_2_BLUEPRINT.md` and `docs/quality/PHASE_2_QUALITY_GATES.md`. First executable vertical slice proves Auth → Profile → Family Workspace → Guardian Relationship → server-side permission enforcement before Planner/School schema expansion.
\ No newline at end of file
docs/quality/ANALYTICS_POLICY_V1.md
new
+24
@@ -0,0 +1,24 @@
1
+# LifeMate — Analytics Policy v1
2
+
3
+## Principle
4
+Product analytics answers whether flows work; it does not become a shadow copy of private user content.
5
+
6
+## Allowed event shape
7
+Use stable event names plus low-sensitivity categorical/boolean metadata. Examples: `auth_signup_completed`, `family_invite_accepted`, `task_completed`, `pwa_install_prompt_shown`, `notification_permission_result`, `study_session_completed`.
8
+
9
+## Never send to PostHog/product analytics
10
+- passwords, tokens, recovery links;
11
+- raw AI/wellbeing transcripts;
12
+- journal/private free text;
13
+- assignment/task free-text content unless an explicit future use case is separately approved;
14
+- precise sensitive safety-event narrative;
15
+- email/phone as event properties unless a specific operational requirement and privacy review approve it.
16
+
17
+## Identity
18
+Use internal pseudonymous user/profile identifiers where needed for product analysis. Family identifiers are pseudonymous. Analytics identity does not grant application authorization.
19
+
20
+## Feature flags
21
+AI/wellbeing and other higher-risk capabilities launch behind server-respected feature flags where appropriate. A client flag is not a security boundary.
22
+
23
+## Retention
24
+Analytics retention and deletion behavior must be configured before production based on actual product needs and deployment obligations; default to less data and shorter retention when uncertain.
\ No newline at end of file
docs/quality/PHASE_2_QUALITY_GATES.md
new
+32
@@ -0,0 +1,32 @@
1
+# LifeMate — Phase 2 Quality Gates
2
+
3
+## Pull request gates
4
+Once application code exists, every implementation PR must run:
5
+1. formatting check;
6
+2. Flutter/Dart static analysis;
7
+3. unit/widget tests relevant to changed domain/UI;
8
+4. authorization/database tests when schema/RLS changes;
9
+5. Android debug build smoke;
10
+6. Web release/debug build smoke as appropriate;
11
+7. secret scanning/dependency review available in the repository plan/tooling.
12
+
13
+## Security tests required for identity/family
14
+For each protected resource, test allowed and denied access for: owner profile, related guardian, unrelated family member, removed member, unauthenticated user and privileged server path where applicable. RLS tests must cover SELECT/INSERT/UPDATE/DELETE rather than only happy-path reads.
15
+
16
+## Staging rule
17
+All deployable changes land in staging before production. Staging uses separate environment/secrets/data from production. No production deploy, destructive migration or sensitive access change is implied by merge alone.
18
+
19
+## Observability baseline
20
+- Crash/error reporting with sensitive-data scrubbing.
21
+- PostHog only from an explicit event allowlist.
22
+- Feature flags for risky/AI capabilities.
23
+- No raw wellbeing transcript/private free text in analytics.
24
+
25
+## UX smoke
26
+At minimum verify Teen and Parent core flows at mobile width, Persian RTL, text scaling, keyboard/input, empty/loading/error states and offline/reconnect behavior relevant to the feature.
27
+
28
+## Platform smoke
29
+Android + iPhone Safari + iPhone Home Screen PWA + desktop web for release-critical flows. Browser automation may cover web regressions, but Home Screen/PWA behaviors require real-device validation before production release.
30
+
31
+## Definition of done
32
+A feature is not complete because code exists. It requires passing automated checks, acceptance criteria, relevant platform smoke, updated decisions/state and explicit remaining-risk disclosure.
\ No newline at end of file
docs/safety/SAFETY_PRIVACY_RISK_V1.md
new
+31
@@ -0,0 +1,31 @@
1
+# LifeMate — Safety, Privacy & Risk Baseline v1
2
+
3
+## Product safety boundary
4
+LifeMate may provide general wellbeing reflection, coping ideas, communication prompts and educational support. It must not claim diagnosis, treatment, professional licensure or certainty about a user's mental state. The AI must not encourage emotional dependency or represent itself as a replacement for trusted people/professional care.
5
+
6
+## Privacy model
7
+Raw private wellbeing conversations are not routine parent-report content. Parent support uses authorized structured signals/trends and actionable guidance. Safety escalation is a separate, narrowly governed path; it is not a blanket permission to inspect private history.
8
+
9
+## High-priority risks
10
+1. **Authorization leak across family members** — mitigate with relationship-aware server RLS, deny-path tests and audit events.
11
+2. **Overexposure of teen wellbeing content** — separate raw sessions, derived parent insights and safety events; explicit policy tests.
12
+3. **AI overclaim/clinical framing** — system policy, response evaluation, prohibited claims and escalation behavior.
13
+4. **False reassurance / missed urgent risk** — safety-specific detection/escalation design, conservative wording, clear human/emergency pathways appropriate to deployment jurisdiction.
14
+5. **Notification harm/pressure** — quiet hours, configurable frequency, supportive copy, no punitive streak pressure.
15
+6. **Account takeover/recovery abuse** — verified recovery channel, non-enumerating responses, rate limits, secure redirect/session handling.
16
+7. **Sensitive telemetry leakage** — analytics allowlist; never send raw wellbeing transcript, password, auth token or private free text to product analytics.
17
+8. **AI provider data exposure** — server-side provider calls, minimal context, provider retention/privacy review before production.
18
+9. **Child consent/legal mismatch** — deployment jurisdiction and age/guardian consent rules require explicit legal review before public production involving minors.
19
+10. **Family relationship dispute** — guardian changes/removal need controlled workflow; role label alone is not proof of legal guardianship.
20
+
21
+## Safety event principles
22
+- Define categories and severity before implementation; do not let the LLM invent escalation thresholds dynamically.
23
+- Store minimum necessary event metadata and access it through a dedicated audited path.
24
+- User-facing messaging should be transparent about when ordinary privacy may be overridden by the configured safety policy.
25
+- No automated punitive action against a child.
26
+
27
+## Phase 1 unresolved-but-owned items
28
+These are not blockers to Phase 2 scaffolding but are blockers to public production of wellbeing features: deployment jurisdiction/legal review; precise guardian consent rules; safety severity taxonomy; emergency resource localization; wellbeing retention/export/deletion policy; AI provider contractual/privacy review.
29
+
30
+## Release rule
31
+AI wellbeing features remain feature-flagged off in production until their dedicated safety test suite and policy review pass.
\ No newline at end of file
docs/ux/BRAND_BRIEF_V1.md
new
+34
@@ -0,0 +1,34 @@
1
+# LifeMate — Brand & Visual Brief v1
2
+
3
+## Brand idea
4
+**LifeMate = همراه رشد، نه ناظر.** The visual language combines calm, momentum, independence and connection.
5
+
6
+## Audience behavior
7
+The initial teen experience must feel attractive to a 13-year-old without using preschool/childish motifs. The same identity must remain credible at 16, 20 and adulthood. Parent surfaces share the brand but prioritize clarity and actionability.
8
+
9
+## Visual direction
10
+- Soft geometric forms, rounded but not toy-like.
11
+- Controlled illustration: meaningful empty states, learning moments and onboarding; avoid decorative overload.
12
+- Primary direction: deep plum/indigo anchor + lavender support + mint success/calm + restrained peach warmth + light neutral cloud surfaces.
13
+- Dark mode must be designed, not mechanically inverted.
14
+- Typography direction: **Vazirmatn** for Persian UI where licensing/package validation passes; Latin companion chosen for metric harmony.
15
+- Iconography: rounded, consistent stroke; no cartoon school clichés as the core brand mark.
16
+
17
+## Logo/app icon principles
18
+The mark should express **path + companion + growth** using a simple abstract form readable at favicon/app-icon size. Avoid book/pencil/graduation-cap as the primary symbol because LifeMate is broader than school. The icon must work on Android adaptive icon, PWA manifest icons, apple-touch-icon and favicon.
19
+
20
+## Experience tone
21
+Teen: encouraging, calm, graphical, choice-oriented. Parent: concise, trustworthy, actionable. AI: warm but never manipulative, dependency-seeking or presented as a human clinician.
22
+
23
+## Motion
24
+Use short purposeful transitions to explain hierarchy/status. No attention-hijacking animation, reward explosions or endless streak pressure. Respect reduced motion.
25
+
26
+## Figma artifact
27
+Phase 1 design file: `LifeMate — Product UX & Brand v1`.
28
+Initial editable board includes color direction and concept frames for Teen Today, Parent Overview and Login/Welcome. This is a direction board, not a final UI kit.
29
+
30
+## Canva role
31
+Canva is approved for supporting illustration/educational visual asset exploration. Final UI layout, tokens, components and interaction specifications remain controlled in Figma so implementation does not depend on flattened artwork.
32
+
33
+## Acceptance
34
+A future screen should be rejected if it feels like a generic school ERP, a surveillance dashboard, or a small-child game. It should feel like a polished personal companion that happens to understand school and family.
\ No newline at end of file
docs/ux/IA_AND_JOURNEYS_V1.md
new
+55
@@ -0,0 +1,55 @@
1
+# LifeMate — Information Architecture & Primary Journeys v1
2
+
3
+## Navigation model
4
+### Teen / personal mobile
5
+Bottom navigation: **Today · Planner · School · AI · Me**. Family-shared context appears inside Today/Planner and a Family section under Me; it is not allowed to dominate the teen experience.
6
+
7
+### Parent / adult mobile
8
+Bottom navigation: **Today · Planner · Family · Guide · Me**. School/teen support is entered from the relevant child inside Family rather than treating the adult as a student.
9
+
10
+### Web / tablet
11
+Adaptive navigation rail/sidebar with the same destinations. Content hierarchy changes responsively; permissions and domain semantics do not.
12
+
13
+## Core surfaces
14
+- **Today:** next action, time-sensitive items, study/family commitments, lightweight check-in.
15
+- **Planner:** calendar, tasks, routines/goals, reminder controls.
16
+- **School:** timetable, subjects, assignments, exams, study/revision.
17
+- **Family:** members, shared calendar/items, invitations, role/visibility settings, child support views.
18
+- **AI/Guide:** context-aware guides with visible scope and privacy cues.
19
+- **Me/Settings:** profile, life contexts, account/security, notifications, privacy, appearance, language.
20
+
21
+## Journey 1 — New family owner
22
+Create account → verify email → create Family Workspace → choose own role → invite members → review default visibility policy → land on Today. Invitations are revocable/expiring and never transmit a password.
23
+
24
+## Journey 2 — Teen joins family
25
+Open invitation → create/attach independent account → verify email as applicable → see plain-language explanation of what parents can and cannot see → set school context → land on Teen Today. Privacy explanation is part of onboarding, not buried in legal text.
26
+
27
+## Journey 3 — Build a school week
28
+Create academic year/term → add subjects → add repeating class schedule → add assignments/exams → LifeMate surfaces Today/Week workload → teen schedules study sessions → reminders follow schedule changes.
29
+
30
+## Journey 4 — Parent support review
31
+Parent opens Family → selects child → sees authorized upcoming workload, completion/progress and support summary → receives suggested conversation/support action → cannot silently open routine private wellbeing transcripts.
32
+
33
+## Journey 5 — Share a plan item
34
+Creator makes task/event → chooses Private / Selected Members / Parent-Guardian / Family where applicable → recipients see clear source/owner → changes notify only affected members → creator can change future visibility subject to safety/audit policy.
35
+
36
+## Journey 6 — Password recovery
37
+Forgot password → enter email → generic success response prevents account enumeration → secure time-limited recovery link → set new password → existing session/security policy applied → confirmation shown.
38
+
39
+## Journey 7 — Missed work recovery
40
+Task/study session becomes overdue → no shaming copy → offer complete / reschedule / break into steps / ask Study Coach → dependent reminders update after confirmed change.
41
+
42
+## Journey 8 — Wellbeing conversation
43
+Teen enters Guide → sees privacy scope → conversation/check-in → general reflective support → if ordinary: remains private under policy; if safety threshold is met: separate safety flow is invoked with clear user-facing messaging appropriate to the event.
44
+
45
+## Accessibility & RTL baseline
46
+- Persian RTL is native layout direction, not mirrored as an afterthought.
47
+- Minimum touch target 44×44 CSS px / platform-equivalent.
48
+- Do not encode status by color alone.
49
+- Dynamic text scaling must not clip primary actions.
50
+- Motion must respect reduced-motion preference.
51
+- Contrast target: WCAG 2.2 AA for normal product UI.
52
+- Teen copy is supportive and concise; avoid punitive productivity language.
53
+
54
+## Prototype screen inventory
55
+Welcome/Login; Forgot Password; Reset Password; Create/Join Family; Teen Privacy Explainer; Teen Today; Parent Today; Planner Day/Week; Task Editor; School Overview; Subject; Assignment/Exam Editor; Study Session; Family Overview; Child Support Summary; Sharing Sheet; AI Guide Home; Wellbeing Privacy Sheet; Settings/Security/Notifications/Privacy.
\ No newline at end of file