diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..bcbe30a --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,262 @@ +# LifeOS / GymApp - AI Assistant Guide + +> Ten plik pomaga AI (Claude, GPT, etc.) efektywnie pracowaΔ‡ z projektem. + +## Quick Facts + +| Aspect | Value | +|--------|-------| +| **Nazwa** | LifeOS (package: lifeos) | +| **Typ** | Flutter mobile app (iOS + Android) | +| **Architektura** | Clean Architecture + Riverpod | +| **Baza danych** | Drift (SQLite) + Supabase | +| **Status** | MVP 1.0 in progress (~45% complete) | + +--- + +## πŸ“ Documentation Index + +### Gdzie szukaΔ‡ informacji? + +``` +docs/ +β”œβ”€β”€ 00-START-HERE.md ← ZACZNIJ TUTAJ (entry point) +β”œβ”€β”€ BMAD-STRUCTURE.md ← Jak zorganizowana jest dokumentacja +β”‚ +β”œβ”€β”€ 1-BASELINE/ ← WYMAGANIA I ARCHITEKTURA +β”‚ β”œβ”€β”€ product/ +β”‚ β”‚ β”œβ”€β”€ PRD-overview.md ← Executive summary, success criteria +β”‚ β”‚ β”œβ”€β”€ PRD-fitness-requirements.md ← FR30-FR46 +β”‚ β”‚ β”œβ”€β”€ PRD-life-coach-requirements.md ← FR6-FR29 +β”‚ β”‚ β”œβ”€β”€ PRD-mind-requirements.md ← FR47-FR76 +β”‚ β”‚ └── PRD-nfr.md ← Non-functional requirements +β”‚ └── architecture/ +β”‚ β”œβ”€β”€ ARCH-overview.md ← Tech stack, decisions D1-D13 +β”‚ β”œβ”€β”€ ARCH-database-schema.md ← Drift tables, Supabase +β”‚ β”œβ”€β”€ ARCH-ai-infrastructure.md ← AI prompts, CMI +β”‚ └── ARCH-security.md ← E2EE, GDPR, RLS +β”‚ +β”œβ”€β”€ 2-MANAGEMENT/ ← EPICS, STATUS, TODO +β”‚ β”œβ”€β”€ project-status.md ← AKTUALNY STATUS PROJEKTU +β”‚ β”œβ”€β”€ MVP-AUDIT-REPORT.md ← Audit kodu vs dokumentacji +β”‚ β”œβ”€β”€ MVP-TODO.md ← Master TODO list +β”‚ β”œβ”€β”€ MVP-SCOPE-ANALYSIS.md ← Analiza scope MVP 1.0 +β”‚ └── epics/ +β”‚ β”œβ”€β”€ epic-1-core-platform.md +β”‚ β”œβ”€β”€ epic-2-life-coach.md +β”‚ β”œβ”€β”€ epic-3-fitness.md +β”‚ β”œβ”€β”€ epic-4-mind.md +β”‚ β”œβ”€β”€ epic-5-cross-module.md +β”‚ β”œβ”€β”€ epic-6-gamification.md +β”‚ β”œβ”€β”€ epic-7-onboarding-subscriptions.md +β”‚ β”œβ”€β”€ epic-8-notifications.md +β”‚ └── epic-9-settings.md +β”‚ +β”œβ”€β”€ 4-DEVELOPMENT/ ← DEVELOPER GUIDES +β”‚ └── setup/QUICK-START-5MIN.md +β”‚ +└── 5-ARCHIVE/ ← STARA DOKUMENTACJA (nie uΕΌywaΔ‡) +``` + +### Szybkie linki + +| Pytanie | Plik | +|---------|------| +| Co to za projekt? | `docs/00-START-HERE.md` | +| Jaki jest aktualny status? | `docs/2-MANAGEMENT/project-status.md` | +| Co zostaΕ‚o do zrobienia? | `docs/2-MANAGEMENT/MVP-TODO.md` | +| Jakie sΔ… wymagania moduΕ‚u X? | `docs/1-BASELINE/product/PRD-*.md` | +| Jak dziaΕ‚a baza danych? | `docs/1-BASELINE/architecture/ARCH-database-schema.md` | +| SzczegΓ³Ε‚y story Y? | `docs/2-MANAGEMENT/epics/epic-*.md` | + +--- + +## πŸ—οΈ Code Structure + +``` +lib/ +β”œβ”€β”€ main.dart ← Entry point +β”œβ”€β”€ core/ ← Shared infrastructure +β”‚ β”œβ”€β”€ ai/ ← AI service (OpenAI, prompts) +β”‚ β”œβ”€β”€ auth/ ← Supabase auth +β”‚ β”œβ”€β”€ database/ ← Drift tables & providers +β”‚ β”œβ”€β”€ sync/ ← Offline sync (partial) +β”‚ β”œβ”€β”€ router/ ← GoRouter navigation +β”‚ └── theme/ ← App theme +β”‚ +└── features/ ← Feature modules + β”œβ”€β”€ fitness/ ← πŸ‹οΈ ~90% complete + β”‚ β”œβ”€β”€ data/ ← Repositories, models + β”‚ β”œβ”€β”€ domain/ ← Entities, use cases + β”‚ └── presentation/ ← Pages, providers, widgets + β”‚ + β”œβ”€β”€ life_coach/ ← 🎯 ~75% complete + β”‚ β”œβ”€β”€ ai/ ← Daily plan generator + β”‚ β”œβ”€β”€ chat/ ← AI coaching chat + β”‚ β”œβ”€β”€ goals/ ← Goal suggestions + β”‚ β”œβ”€β”€ data/ ← Repositories + β”‚ β”œβ”€β”€ domain/ ← Entities, use cases + β”‚ └── presentation/ ← Pages, providers + β”‚ + β”œβ”€β”€ mind_emotion/ ← 🧘 ~25% complete + β”‚ β”œβ”€β”€ data/ ← Meditation repos + β”‚ β”œβ”€β”€ domain/ ← Entities + β”‚ └── presentation/ ← Library screen (player TODO) + β”‚ + β”œβ”€β”€ exercise/ ← πŸ“š ~20% (no persistence) + β”œβ”€β”€ settings/ ← βš™οΈ ~25% (basic) + └── onboarding/ ← πŸ‘‹ ~5% (placeholder) +``` + +--- + +## πŸ“œ Documentation Rules + +### Kiedy aktualizowaΔ‡ dokumentacjΔ™? + +| Trigger | Akcja | +|---------|-------| +| Nowa funkcja zaimplementowana | Update `project-status.md` | +| Story ukoΕ„czone | Update epic file (status: βœ… Done) | +| Nowy bug/issue | Dodaj do `MVP-TODO.md` | +| Zmiana architektury | Update `ARCH-*.md` | +| Nowe wymagania | Update `PRD-*.md` | + +### Jak aktualizowaΔ‡? + +1. **project-status.md** - ZmieΕ„ procenty w tabelach +2. **epic-X.md** - ZmieΕ„ status story (⏳ Planned β†’ πŸ”„ In Progress β†’ βœ… Done) +3. **MVP-TODO.md** - ZmieΕ„ ❌ na βœ… dla ukoΕ„czonych taskΓ³w + +### Format AI-INDEX + +KaΕΌdy plik MD powinien mieΔ‡ komentarz AI-INDEX: +```markdown + +``` +To pomaga AI szybko znaleΕΊΔ‡ odpowiedni plik. + +--- + +## ⚠️ Known Issues (Stan na 2025-12-02) + +### KRYTYCZNE + +1. **Provider Conflict** - `daily_plan_provider.dart` uΕΌywa MockGoalsRepository + - Fix: ZamieΕ„ na GoalsRepositoryImpl + - Plik: `lib/features/life_coach/ai/providers/daily_plan_provider.dart` + +2. **Hardcoded User IDs** - W meditation_providers.dart + - `userId: 'current_user_id'` - powinno byΔ‡ z auth provider + - Plik: `lib/features/mind_emotion/presentation/providers/meditation_providers.dart` + +### Do zrobienia + +- Meditation Player screen (nie istnieje) +- Breathing exercises screen (nie istnieje) +- Exercise library persistence (brak Drift tables) + +--- + +## πŸš€ MVP 1.0 Scope + +### In Scope +- βœ… Auth (email) +- βœ… Fitness (full) +- βœ… Life Coach (daily plan, check-ins, goals, chat) +- πŸ”„ Mind (mood in check-in, meditation player, breathing) +- πŸ”„ Basic settings + +### Out of Scope (MVP 1.1) +- ❌ Onboarding flow +- ❌ IAP/Subscriptions +- ❌ Push notifications +- ❌ Cross-Module Intelligence +- ❌ Social features + +--- + +## πŸ”§ Tech Stack Quick Reference + +| Layer | Technology | +|-------|------------| +| UI | Flutter 3.x, Material 3 | +| State | Riverpod 3.0 (riverpod_annotation) | +| Database | Drift (SQLite) | +| Backend | Supabase (Auth, PostgreSQL, Storage) | +| AI | OpenAI API (gpt-4o-mini) | +| Navigation | GoRouter | +| Charts | fl_chart | +| Audio | just_audio (not integrated yet) | + +--- + +## πŸ“ Conventions + +### File Naming +``` +feature_name/ +β”œβ”€β”€ data/ +β”‚ β”œβ”€β”€ models/ β†’ feature_model.dart +β”‚ β”œβ”€β”€ repositories/ β†’ feature_repository_impl.dart +β”‚ └── datasources/ β†’ feature_datasource.dart +β”œβ”€β”€ domain/ +β”‚ β”œβ”€β”€ entities/ β†’ feature_entity.dart +β”‚ β”œβ”€β”€ repositories/ β†’ feature_repository.dart (interface) +β”‚ └── usecases/ β†’ verb_noun_usecase.dart +└── presentation/ + β”œβ”€β”€ pages/ β†’ feature_page.dart + β”œβ”€β”€ providers/ β†’ feature_provider.dart + └── widgets/ β†’ feature_widget.dart +``` + +### Commit Messages +``` +feat: Add meditation player screen +fix: Resolve provider conflict in daily_plan_provider +docs: Update project status after Epic 3 completion +refactor: Extract breathing animation to separate widget +``` + +--- + +## πŸ€– AI Instructions + +### Przed rozpoczΔ™ciem pracy: +1. Przeczytaj `docs/2-MANAGEMENT/project-status.md` - aktualny stan +2. Przeczytaj `docs/2-MANAGEMENT/MVP-TODO.md` - co zostaΕ‚o do zrobienia +3. SprawdΕΊ odpowiedni epic file dla szczegΓ³Ε‚Γ³w story + +### Po zakoΕ„czeniu pracy: +1. Update `project-status.md` jeΕ›li zmieniΕ‚ siΔ™ % completion +2. Update epic file jeΕ›li story zostaΕ‚o ukoΕ„czone +3. Update `MVP-TODO.md` - oznacz task jako βœ… +4. Commit z opisowym message + +### JeΕ›li tworzysz nowy plik: +1. Dodaj AI-INDEX comment na poczΔ…tku +2. ŚledΕΊ naming conventions +3. UΕΌyj Clean Architecture pattern +4. Dodaj do odpowiedniego folderu + +--- + +## πŸ“ž Quick Commands + +```bash +# Run app +flutter run + +# Generate Drift code +dart run build_runner build + +# Run tests +flutter test + +# Analyze code +flutter analyze +``` + +--- + +*Ostatnia aktualizacja: 2025-12-02* diff --git a/docs/00-START-HERE.md b/docs/00-START-HERE.md new file mode 100644 index 0000000..0494254 --- /dev/null +++ b/docs/00-START-HERE.md @@ -0,0 +1,131 @@ +# LifeOS / GymApp - Dokumentacja Projektu + + + +**Status:** W trakcie implementacji (~66% FRs) +**Wersja:** 2.0 (BMAD Framework) +**Ostatnia aktualizacja:** 2025-12-02 + +--- + +## Szybki Start + +### Dla AI AgentΓ³w +``` +1. Przeczytaj ten plik dla kontekstu +2. UΕΌyj indeksΓ³w (AI-INDEX) do wyszukiwania +3. SprawdΕΊ 2-MANAGEMENT/project-status.md dla aktualnego stanu +4. SprawdΕΊ odpowiedni folder dla szczegΓ³Ε‚Γ³w +``` + +### Dla DeveloperΓ³w +``` +1. 4-DEVELOPMENT/setup/QUICK-START-5MIN.md - szybki start +2. 4-DEVELOPMENT/standards/ - standardy kodu +3. 2-MANAGEMENT/project-status.md - co jest do zrobienia +``` + +--- + +## O Projekcie + +**LifeOS** to modularny ekosystem AI-powered life coaching Ε‚Δ…czΔ…cy: +- **Fitness Coach** - Smart Pattern Memory, workout tracking +- **Life Coach** - Daily planning, goals, AI chat +- **Mind & Emotion** - Meditation, mood tracking, CBT + +**Killer Feature:** Cross-Module Intelligence - moduΕ‚y komunikujΔ… siΔ™ ze sobΔ… dla holistycznej optymalizacji. + +--- + +## Struktura Dokumentacji BMAD + +``` +docs/ +β”œβ”€β”€ 00-START-HERE.md ← JESTEŚ TUTAJ +β”œβ”€β”€ BMAD-STRUCTURE.md # WyjaΕ›nienie struktury +β”‚ +β”œβ”€β”€ 1-BASELINE/ # Fundamenty (PRD, Architecture, Design) +β”‚ β”œβ”€β”€ product/ # Wymagania produktowe +β”‚ β”œβ”€β”€ architecture/ # Decyzje architektoniczne +β”‚ └── design-system/ # UI/UX guidelines +β”‚ +β”œβ”€β”€ 2-MANAGEMENT/ # ZarzΔ…dzanie projektem +β”‚ β”œβ”€β”€ epics/ # User stories podzielone na epiki +β”‚ β”œβ”€β”€ backlog/ # Sprint backlogs i summaries +β”‚ └── reports/ # Raporty statusu i audytΓ³w +β”‚ +β”œβ”€β”€ 3-ARCHITECTURE/ # SzczegΓ³Ε‚y techniczne +β”‚ β”œβ”€β”€ system-design/ # Design per moduΕ‚ +β”‚ β”œβ”€β”€ deployment/ # Deploy, Firebase, CI/CD +β”‚ └── integration/ # API, third-party services +β”‚ +β”œβ”€β”€ 4-DEVELOPMENT/ # Poradniki dla devΓ³w +β”‚ β”œβ”€β”€ setup/ # Quick start, environment +β”‚ β”œβ”€β”€ standards/ # Code standards, testing +β”‚ β”œβ”€β”€ patterns/ # Design patterns, AI patterns +β”‚ └── modules/ # Jak pracowaΔ‡ z kaΕΌdym moduΕ‚em +β”‚ +└── 5-ARCHIVE/ # Historia i deprecated + β”œβ”€β”€ historical/ # Historyczne planowanie + └── deprecated/ # ZastΔ…pione pliki +``` + +--- + +## Kluczowe Dokumenty + +| Cel | Plik | Opis | +|-----|------|------| +| **Status projektu** | `2-MANAGEMENT/project-status.md` | Aktualny postΔ™p, co zrobiΔ‡ | +| **Wymagania** | `1-BASELINE/product/PRD-overview.md` | PrzeglΔ…d produktu i FRs | +| **Architektura** | `1-BASELINE/architecture/ARCH-overview.md` | Decyzje i patterns | +| **Quick start** | `4-DEVELOPMENT/setup/QUICK-START-5MIN.md` | Setup w 5 minut | +| **Epiki** | `2-MANAGEMENT/epics/` | User stories per epic | + +--- + +## Nawigacja AI (Indeksy) + +KaΕΌdy dokument zawiera `` dla szybkiego wyszukiwania. + +**PrzykΕ‚ady wyszukiwania:** +- `AI-INDEX: authentication` β†’ pliki o auth +- `AI-INDEX: fitness` β†’ pliki o Fitness module +- `AI-INDEX: database` β†’ pliki o bazie danych +- `AI-INDEX: deployment` β†’ pliki o deploy + +--- + +## Metryki Projektu + +| Metryka | WartoΕ›Δ‡ | +|---------|---------| +| **Implementacja FRs** | ~66% (81/123) | +| **Core Infrastructure** | ~90% | +| **Life Coach** | ~75% | +| **Fitness Coach** | ~82% | +| **Mind & Emotion** | ~40% | +| **Cross-Module Intel** | ~25% | + +--- + +## Tech Stack + +- **Framework:** Flutter 3.38+, Dart 3.10+ +- **State:** Riverpod 3.0 +- **Local DB:** Drift (SQLite) - offline-first +- **Backend:** Supabase (PostgreSQL) +- **AI:** Hybrid (Llama/Claude/GPT-4) + +--- + +## Linki + +- **Kod:** `/lib/` (287+ plikΓ³w Dart) +- **Migracje:** `/supabase/migrations/` +- **Testy:** `/test/` + +--- + +*Dokumentacja zgodna z BMAD Framework v2.0* diff --git a/docs/1-BASELINE/README.md b/docs/1-BASELINE/README.md new file mode 100644 index 0000000..0243796 --- /dev/null +++ b/docs/1-BASELINE/README.md @@ -0,0 +1,39 @@ +# 1-BASELINE - Dokumentacja Fundamentalna + + + +**Opis:** Fundamenty projektu - wymagania, architektura, design system. + +--- + +## ZawartoΕ›Δ‡ + +### product/ - Product Requirements +- [PRD-overview.md](product/PRD-overview.md) - PrzeglΔ…d produktu, success metrics +- [PRD-fitness-requirements.md](product/PRD-fitness-requirements.md) - FR30-FR46 +- [PRD-life-coach-requirements.md](product/PRD-life-coach-requirements.md) - FR6-FR29 +- [PRD-mind-requirements.md](product/PRD-mind-requirements.md) - FR47-FR76 +- [PRD-nfr.md](product/PRD-nfr.md) - 37 Non-functional requirements + +### architecture/ - Architecture Docs +- [ARCH-overview.md](architecture/ARCH-overview.md) - PrzeglΔ…d, 13 decyzji +- [ARCH-database-schema.md](architecture/ARCH-database-schema.md) - Schema, RLS, Drift +- [ARCH-ai-infrastructure.md](architecture/ARCH-ai-infrastructure.md) - AI orchestration, CMI +- [ARCH-security.md](architecture/ARCH-security.md) - E2EE, GDPR, security + +### design-system/ - UI/UX (TBD) +- Design guidelines +- Component library +- Branding + +--- + +## Kiedy czytaΔ‡? + +| Cel | Plik | +|-----|------| +| Zrozumienie produktu | PRD-overview.md | +| Wymagania moduΕ‚u | PRD-[module].md | +| Architektura systemu | ARCH-overview.md | +| Baza danych | ARCH-database-schema.md | +| Security | ARCH-security.md | diff --git a/docs/1-BASELINE/architecture/ARCH-ai-infrastructure.md b/docs/1-BASELINE/architecture/ARCH-ai-infrastructure.md new file mode 100644 index 0000000..6eba3a6 --- /dev/null +++ b/docs/1-BASELINE/architecture/ARCH-ai-infrastructure.md @@ -0,0 +1,439 @@ +# AI Infrastructure - Architecture + + + +**Wersja:** 2.0 +**Decision:** D4 - Supabase Edge Functions for AI Orchestration + +--- + +## Spis TreΕ›ci + +1. [Overview](#1-overview) +2. [AI Orchestration Layer](#2-ai-orchestration-layer) +3. [Cross-Module Intelligence](#3-cross-module-intelligence) +4. [Cost Management](#4-cost-management) +5. [AI Prompts](#5-ai-prompts) +6. [Implementation Details](#6-implementation-details) + +--- + +## 1. Overview + +### AI Strategy + +**Hybrid AI Model** - Different models for different tiers: + +| Tier | Model | Cost | Use Case | +|------|-------|------|----------| +| **FREE** | Llama 3 (self-hosted) | ~$0 | Basic conversations | +| **Standard** | Claude 3.5 Sonnet | $0.003/call | Quality conversations | +| **Premium** | GPT-4 Turbo | $0.01/call | Best quality | + +### Key Principles + +1. **Server-Side Routing:** API keys never exposed to client +2. **Cost Control:** Server-side quotas enforcement +3. **Flexibility:** Model changes without app update +4. **Fallback:** Degrade gracefully if API fails + +--- + +## 2. AI Orchestration Layer + +### Architecture + +``` +β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” +β”‚ Flutter App β”‚ +β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ +β”‚ β”‚ AI Service (lib/core/ai/) β”‚ β”‚ +β”‚ β”‚ - generateDailyPlan() β”‚ β”‚ +β”‚ β”‚ - chat() β”‚ β”‚ +β”‚ β”‚ - generateInsight() β”‚ β”‚ +β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ +β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ + ↓ POST /ai-orchestrator +β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” +β”‚ Supabase Edge Function β”‚ +β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ +β”‚ β”‚ AI Orchestrator (Deno) β”‚ β”‚ +β”‚ β”‚ β”‚ β”‚ +β”‚ β”‚ 1. Authenticate user (JWT) β”‚ β”‚ +β”‚ β”‚ 2. Check subscription tier β”‚ β”‚ +β”‚ β”‚ 3. Check daily quota β”‚ β”‚ +β”‚ β”‚ 4. Route to appropriate model β”‚ β”‚ +β”‚ β”‚ 5. Return response + update quota β”‚ β”‚ +β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ +β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ + ↓ +β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” +β”‚ AI Providers β”‚ +β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ +β”‚ β”‚ Llama 3 β”‚ β”‚ Claude β”‚ β”‚ GPT-4 β”‚ β”‚ +β”‚ β”‚ (Free) β”‚ β”‚ (Standard)β”‚ β”‚ (Premium) β”‚ β”‚ +β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ +β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ +``` + +### Edge Function: AI Orchestrator + +```typescript +// supabase/functions/ai-orchestrator/index.ts + +import { serve } from 'https://deno.land/std@0.168.0/http/server.ts' +import { createClient } from '@supabase/supabase-js' + +serve(async (req) => { + const { prompt, context, feature } = await req.json() + + // 1. Authenticate + const authHeader = req.headers.get('Authorization') + const supabase = createClient(SUPABASE_URL, SUPABASE_KEY, { + global: { headers: { Authorization: authHeader } } + }) + + const { data: { user } } = await supabase.auth.getUser() + if (!user) return new Response('Unauthorized', { status: 401 }) + + // 2. Check subscription tier + const { data: subscription } = await supabase + .from('subscriptions') + .select('tier') + .eq('user_id', user.id) + .single() + + const tier = subscription?.tier || 'free' + + // 3. Check daily quota + const quota = await checkQuota(user.id, tier) + if (!quota.allowed) { + return new Response(JSON.stringify({ + error: 'quota_exceeded', + message: 'Daily AI limit reached', + resetAt: quota.resetAt + }), { status: 429 }) + } + + // 4. Route to model + let response + switch (tier) { + case 'plus': + response = await callGPT4(prompt, context) + break + case 'pack': + case 'single': + response = await callClaude(prompt, context) + break + default: + response = await callLlama(prompt, context) + } + + // 5. Update quota + await incrementQuota(user.id) + + return new Response(JSON.stringify(response)) +}) +``` + +### Quotas by Tier + +| Tier | Daily AI Calls | Model | +|------|----------------|-------| +| FREE | 3-5 | Llama 3 | +| Single (2.99 EUR) | 20-30 | Claude | +| Pack (5.00 EUR) | 50 | Claude | +| Plus (7.00 EUR) | Unlimited (soft 200) | GPT-4 | + +--- + +## 3. Cross-Module Intelligence + +### CMI Pipeline + +**Killer Feature:** Detect patterns across modules and generate insights. + +``` +1. DATA AGGREGATION (Event-Driven + Debounced) + ↓ + Fitness: workout_completed β†’ Trigger aggregation + Mind: meditation_completed β†’ Trigger aggregation + Life Coach: tasks_updated β†’ Trigger aggregation + ↓ + Debounce 5 minutes β†’ MetricsAggregationService + ↓ + Insert/Update user_daily_metrics row + +2. PATTERN DETECTION (Weekly Schedule) + ↓ + Fetch last 30 days of user_daily_metrics + ↓ + Calculate Pearson correlations for metric pairs: + - (workout_completed, stress_level) + - (meditation_completed, mood_score) + - (stress_level, completion_rate) + ↓ + Filter significant: |r| > 0.5 AND p-value < 0.05 + +3. AI INSIGHT GENERATION + ↓ + For top 3 correlations: + - Build prompt with 30-day context + - Call AI API (GPT-4 for premium, Claude for standard) + - Parse JSON response: { insight, recommendation } + ↓ + Save to detected_patterns table + +4. USER NOTIFICATION (FCM) + ↓ + If confidence_score > 0.7: + - Send FCM push notification + - Deep link to CMI Dashboard +``` + +### Pattern Detection Example + +**Detected Correlation:** +```json +{ + "metric_a": "workout_completed", + "metric_b": "stress_level", + "correlation_coefficient": -0.72, + "p_value": 0.003, + "sample_size": 28 +} +``` + +**AI-Generated Insight:** +```json +{ + "insight": "Your stress drops 40% on days you work out πŸ’ͺ", + "recommendation": "Try scheduling workouts before high-stress meetings" +} +``` + +**Push Notification:** +``` +Title: "Pattern Detected 🧠" +Body: "Your stress drops 40% on days you work out πŸ’ͺ" +Action: "View Insight" β†’ Deep link to /cmi-dashboard +``` + +### Correlation Pairs + +| Metric A | Metric B | Expected Correlation | +|----------|----------|---------------------| +| workout_completed | stress_level | Negative | +| meditation_completed | mood_score | Positive | +| sleep_quality | workout_intensity | Positive | +| stress_level | completion_rate | Negative | +| meditation_duration | sleep_quality | Positive | + +--- + +## 4. Cost Management + +### Monthly Cost Analysis (10k users) + +**Assumptions:** +- Pattern detection: 1x/user/week = 40k runs/month +- AI calls per run: 3 insights = 120k calls/month +- 20% paid users at avg $5/month + +**Costs:** +``` +AI API (Claude): 120k Γ— $0.003 = $360/month +Revenue: 10k Γ— 20% Γ— $5 = $10,000/month +AI % of Revenue: 3.6% βœ… (well under 30% budget) +``` + +### Cost Control Mechanisms + +1. **Quotas:** Server-side enforcement per tier +2. **Caching:** Cache common prompts/responses +3. **Batching:** Aggregate insights weekly, not daily +4. **Fallback:** Degrade to cheaper model if budget exceeded + +### Budget Alert System + +```typescript +// Alert if AI costs exceed threshold +async function checkAICostBudget() { + const monthlySpend = await getMonthlyAISpend() + const monthlyRevenue = await getMonthlyRevenue() + const ratio = monthlySpend / monthlyRevenue + + if (ratio > 0.25) { // 25% warning + await sendSlackAlert('AI costs at 25% of revenue') + } + if (ratio > 0.30) { // 30% critical + await sendSlackAlert('AI costs exceeded 30% budget!') + await reduceFreeQuotas() + } +} +``` + +--- + +## 5. AI Prompts + +### Daily Plan Generation + +``` +You are an AI life coach helping the user plan their day. + +User Context: +- Sleep quality: {sleep_quality}/5 +- Current mood: {mood}/5 +- Energy level: {energy}/5 +- Stress level: {stress_level}/5 +- Active goals: {goals} +- Scheduled workout: {workout} +- Yesterday's completion: {completion_rate}% + +Generate a personalized daily plan with: +1. Top 3 priorities for today +2. Suggested activities based on energy/mood +3. Time recommendations (morning/afternoon/evening) +4. Cross-module suggestions (workout, meditation if needed) + +Respond in JSON format: +{ + "priorities": [{ "title": "", "reason": "" }], + "activities": [{ "title": "", "time": "", "duration": "" }], + "suggestions": [{ "module": "", "action": "" }] +} +``` + +### CMI Insight Generation + +``` +You are analyzing wellness patterns for a user. + +Pattern detected: +- Metric A: {metric_a} +- Metric B: {metric_b} +- Correlation: {correlation} ({positive/negative}) +- Confidence: {confidence}% +- Sample size: {sample_size} days + +User's 30-day summary: +{summary_json} + +Generate a user-friendly insight and actionable recommendation. + +Respond in JSON format: +{ + "insight": "One sentence describing the pattern with emoji", + "recommendation": "One actionable suggestion" +} +``` + +### Chat Personalities + +**Sage (Calm):** +``` +You are a calm, thoughtful life coach named Sage. +Use gentle language, ask reflective questions. +Encourage self-discovery over direct advice. +Avoid pushy or aggressive motivation. +``` + +**Momentum (Energetic):** +``` +You are an energetic, motivational coach named Momentum. +Use action-oriented language, celebrate wins. +Push for progress while staying supportive. +Be encouraging but not overwhelming. +``` + +--- + +## 6. Implementation Details + +### Flutter AI Service + +```dart +// lib/core/ai/ai_service.dart + +class AIService { + final SupabaseClient _supabase; + + Future generateDailyPlan({ + required String userId, + required UserContext context, + }) async { + final response = await _supabase.functions.invoke( + 'ai-orchestrator', + body: { + 'feature': 'daily_plan', + 'prompt': _buildDailyPlanPrompt(context), + 'context': context.toJson(), + }, + ); + + if (response.status == 429) { + throw AIQuotaExceededException( + message: 'Daily AI limit reached', + resetAt: DateTime.parse(response.data['resetAt']), + ); + } + + return DailyPlan.fromJson(response.data); + } + + Future chat({ + required String message, + required List history, + required AIPersonality personality, + }) async { + final response = await _supabase.functions.invoke( + 'ai-orchestrator', + body: { + 'feature': 'chat', + 'prompt': message, + 'context': { + 'history': history.map((m) => m.toJson()).toList(), + 'personality': personality.name, + }, + }, + ); + + return response.data['response']; + } +} +``` + +### Riverpod Provider + +```dart +// lib/core/ai/providers/ai_providers.dart + +@riverpod +AIService aiService(AIServiceRef ref) { + return AIService(ref.watch(supabaseClientProvider)); +} + +@riverpod +Future dailyPlan(DailyPlanRef ref, String userId) async { + final aiService = ref.watch(aiServiceProvider); + final context = await ref.watch(userContextProvider(userId).future); + + return aiService.generateDailyPlan( + userId: userId, + context: context, + ); +} +``` + +--- + +## PowiΔ…zane Dokumenty + +- [ARCH-overview.md](./ARCH-overview.md) - Architecture overview +- [ARCH-database-schema.md](./ARCH-database-schema.md) - CMI tables +- [PRD-life-coach-requirements.md](../product/PRD-life-coach-requirements.md) - AI chat requirements + +--- + +*Hybrid AI Model | Server-Side Orchestration | <30% Cost Budget* diff --git a/docs/1-BASELINE/architecture/ARCH-database-schema.md b/docs/1-BASELINE/architecture/ARCH-database-schema.md new file mode 100644 index 0000000..b862c02 --- /dev/null +++ b/docs/1-BASELINE/architecture/ARCH-database-schema.md @@ -0,0 +1,617 @@ +# Database Schema - Architecture + + + +**Wersja:** 2.0 +**Backend:** Supabase (PostgreSQL) + Drift (SQLite) + +--- + +## Spis TreΕ›ci + +1. [Overview](#1-overview) +2. [Core Tables](#2-core-tables) +3. [Module Tables](#3-module-tables) +4. [Row Level Security (RLS)](#4-row-level-security-rls) +5. [Drift Mirror](#5-drift-mirror) +6. [Sync Strategy](#6-sync-strategy) +7. [Migrations](#7-migrations) + +--- + +## 1. Overview + +### Database Strategy + +| Layer | Technology | Purpose | +|-------|------------|---------| +| **Cloud** | PostgreSQL (Supabase) | Primary store, sync, RLS | +| **Local** | SQLite (Drift) | Offline-first, instant UI | +| **Sync** | Custom Queue | Background sync | + +### Key Principles + +1. **Offline-First:** Drift writes first, sync to Supabase +2. **RLS Everywhere:** Row-level security for multi-tenancy +3. **Shared Schema:** `user_daily_metrics` for Cross-Module Intelligence +4. **E2EE Fields:** Encrypted blobs for sensitive data + +--- + +## 2. Core Tables + +### users (Supabase Auth built-in) + +```sql +id UUID PRIMARY KEY +email TEXT UNIQUE +created_at TIMESTAMPTZ +``` + +### user_daily_metrics (Cross-Module Intelligence - SHARED) + +**Purpose:** Aggregated metrics from all modules for pattern detection. + +```sql +CREATE TABLE user_daily_metrics ( + id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), + user_id UUID REFERENCES auth.users(id) NOT NULL, + date DATE NOT NULL, + + -- Fitness metrics + workout_completed BOOLEAN DEFAULT FALSE, + workout_duration_minutes INTEGER DEFAULT 0, + calories_burned INTEGER DEFAULT 0, + sets_completed INTEGER DEFAULT 0, + workout_intensity DECIMAL(3,2), -- 0.0-1.0 + + -- Mind metrics + meditation_completed BOOLEAN DEFAULT FALSE, + meditation_duration_minutes INTEGER DEFAULT 0, + mood_score INTEGER, -- 1-10 (nullable) + stress_level INTEGER, -- 1-10 (nullable) + journal_entries_count INTEGER DEFAULT 0, + + -- Life Coach metrics + daily_plan_generated BOOLEAN DEFAULT FALSE, + tasks_completed INTEGER DEFAULT 0, + tasks_total INTEGER DEFAULT 0, + completion_rate DECIMAL(3,2), -- 0.0-1.0 + ai_conversations_count INTEGER DEFAULT 0, + + aggregated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), + + UNIQUE(user_id, date) +); +``` + +### detected_patterns (Cross-Module Intelligence) + +**Purpose:** Store detected correlations and AI-generated insights. + +```sql +CREATE TABLE detected_patterns ( + id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), + user_id UUID REFERENCES auth.users(id) NOT NULL, + pattern_type TEXT NOT NULL, -- 'correlation', 'trend', 'anomaly' + + metric_a TEXT NOT NULL, -- e.g., 'workout_completed' + metric_b TEXT NOT NULL, -- e.g., 'stress_level' + correlation_coefficient DECIMAL(4,3), -- -1.0 to 1.0 + confidence_score DECIMAL(3,2), -- 0.0-1.0 + + start_date DATE NOT NULL, + end_date DATE NOT NULL, + sample_size INTEGER NOT NULL, + + insight_text TEXT, -- AI-generated + recommendation_text TEXT, -- AI-generated + + viewed_at TIMESTAMPTZ, + dismissed_at TIMESTAMPTZ, + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), + + UNIQUE(user_id, metric_a, metric_b, end_date) +); +``` + +### subscriptions + +```sql +CREATE TABLE subscriptions ( + id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), + user_id UUID REFERENCES auth.users(id) NOT NULL, + tier TEXT NOT NULL, -- 'free', 'single', 'pack', 'plus' + modules TEXT[] DEFAULT '{}', -- ['fitness'], ['fitness', 'mind'] + stripe_subscription_id TEXT, + started_at TIMESTAMPTZ NOT NULL, + expires_at TIMESTAMPTZ, + cancelled_at TIMESTAMPTZ, + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), + + UNIQUE(user_id) +); +``` + +### streaks + +```sql +CREATE TABLE streaks ( + id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), + user_id UUID REFERENCES auth.users(id) NOT NULL, + streak_type TEXT NOT NULL, -- 'workout', 'meditation', 'check_in' + current_count INTEGER DEFAULT 0, + longest_count INTEGER DEFAULT 0, + last_activity_date DATE, + freeze_used_this_week BOOLEAN DEFAULT FALSE, + freeze_used_at TIMESTAMPTZ, + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), + + UNIQUE(user_id, streak_type) +); +``` + +--- + +## 3. Module Tables + +### Fitness Module + +**workouts** +```sql +CREATE TABLE workouts ( + id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), + user_id UUID REFERENCES auth.users(id) NOT NULL, + name TEXT NOT NULL, + scheduled_at TIMESTAMPTZ, + started_at TIMESTAMPTZ, + completed_at TIMESTAMPTZ, + duration_minutes INTEGER, + calories_burned INTEGER, + notes TEXT, + template_id UUID, + synced_at TIMESTAMPTZ, + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW() +); +``` + +**workout_exercises** +```sql +CREATE TABLE workout_exercises ( + id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), + workout_id UUID REFERENCES workouts(id) ON DELETE CASCADE, + exercise_id UUID REFERENCES exercises(id), + order_index INTEGER NOT NULL, + notes TEXT, + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW() +); +``` + +**workout_sets** +```sql +CREATE TABLE workout_sets ( + id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), + workout_exercise_id UUID REFERENCES workout_exercises(id) ON DELETE CASCADE, + set_number INTEGER NOT NULL, + reps INTEGER, + weight DECIMAL(6,2), + rpe INTEGER, -- 1-10 rate of perceived exertion + completed BOOLEAN DEFAULT FALSE, + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW() +); +``` + +**exercises** (Library) +```sql +CREATE TABLE exercises ( + id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), + name TEXT NOT NULL, + description TEXT, + muscle_group TEXT NOT NULL, + secondary_muscles TEXT[], + equipment TEXT, + difficulty TEXT, -- 'beginner', 'intermediate', 'advanced' + instructions TEXT, + video_url TEXT, + is_custom BOOLEAN DEFAULT FALSE, + user_id UUID, -- NULL for system exercises + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW() +); +``` + +**exercise_favorites** +```sql +CREATE TABLE exercise_favorites ( + id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), + user_id UUID REFERENCES auth.users(id) NOT NULL, + exercise_id UUID REFERENCES exercises(id) ON DELETE CASCADE, + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), + + UNIQUE(user_id, exercise_id) +); +``` + +**workout_templates** +```sql +CREATE TABLE workout_templates ( + id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), + user_id UUID, -- NULL for system templates + name TEXT NOT NULL, + description TEXT, + exercises_json JSONB NOT NULL, -- [{ exercise_id, sets, reps, weight }] + is_preset BOOLEAN DEFAULT FALSE, + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW() +); +``` + +**body_measurements** +```sql +CREATE TABLE body_measurements ( + id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), + user_id UUID REFERENCES auth.users(id) NOT NULL, + date DATE NOT NULL, + weight DECIMAL(5,2), + weight_unit TEXT DEFAULT 'kg', + body_fat_percent DECIMAL(4,2), + chest DECIMAL(5,2), + waist DECIMAL(5,2), + hips DECIMAL(5,2), + arms DECIMAL(5,2), + legs DECIMAL(5,2), + photos_json JSONB, -- [{ url, type: 'front'|'side'|'back' }] + notes TEXT, + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW() +); +``` + +### Life Coach Module + +**daily_plans** +```sql +CREATE TABLE daily_plans ( + id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), + user_id UUID REFERENCES auth.users(id) NOT NULL, + date DATE NOT NULL, + tasks JSONB NOT NULL, -- [{ id, title, completed, priority, category }] + generated_by TEXT, -- 'llama', 'claude', 'gpt4' + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), + + UNIQUE(user_id, date) +); +``` + +**goals** +```sql +CREATE TABLE goals ( + id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), + user_id UUID REFERENCES auth.users(id) NOT NULL, + title TEXT NOT NULL, + description TEXT, + category TEXT, -- 'fitness', 'mental_health', 'career', etc. + target_value INTEGER, + current_value INTEGER DEFAULT 0, + target_date DATE, + completed_at TIMESTAMPTZ, + archived_at TIMESTAMPTZ, + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW() +); +``` + +**goal_progress** +```sql +CREATE TABLE goal_progress ( + id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), + goal_id UUID REFERENCES goals(id) ON DELETE CASCADE, + value INTEGER NOT NULL, + note TEXT, + recorded_at TIMESTAMPTZ NOT NULL DEFAULT NOW() +); +``` + +**check_ins** +```sql +CREATE TABLE check_ins ( + id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), + user_id UUID REFERENCES auth.users(id) NOT NULL, + type TEXT NOT NULL, -- 'morning', 'evening' + mood INTEGER, -- 1-5 + energy INTEGER, -- 1-5 + sleep_quality INTEGER, -- 1-5 + notes TEXT, + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW() +); +``` + +**ai_conversations** +```sql +CREATE TABLE ai_conversations ( + id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), + user_id UUID REFERENCES auth.users(id) NOT NULL, + messages JSONB NOT NULL, -- [{ role, content, timestamp }] + model TEXT NOT NULL, -- 'llama', 'claude', 'gpt4' + context_type TEXT, -- 'daily_plan', 'goal', 'general' + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW() +); +``` + +### Mind Module + +**meditation_sessions** +```sql +CREATE TABLE meditation_sessions ( + id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), + user_id UUID REFERENCES auth.users(id) NOT NULL, + meditation_id UUID, + duration_minutes INTEGER NOT NULL, + completed BOOLEAN DEFAULT TRUE, + completed_at TIMESTAMPTZ NOT NULL, + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW() +); +``` + +**meditation_favorites** +```sql +CREATE TABLE meditation_favorites ( + id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), + user_id UUID REFERENCES auth.users(id) NOT NULL, + meditation_id UUID NOT NULL, + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), + + UNIQUE(user_id, meditation_id) +); +``` + +**meditation_downloads** +```sql +CREATE TABLE meditation_downloads ( + id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), + user_id UUID REFERENCES auth.users(id) NOT NULL, + meditation_id UUID NOT NULL, + file_path TEXT NOT NULL, + file_size INTEGER, + downloaded_at TIMESTAMPTZ NOT NULL DEFAULT NOW() +); +``` + +**mood_logs** +```sql +CREATE TABLE mood_logs ( + id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), + user_id UUID REFERENCES auth.users(id) NOT NULL, + mood INTEGER NOT NULL, -- 1-5 + stress INTEGER, -- 1-5 + triggers TEXT[], -- ['work', 'relationships', etc.] + note TEXT, + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW() +); +``` + +**journal_entries** (E2EE) +```sql +CREATE TABLE journal_entries ( + id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), + user_id UUID REFERENCES auth.users(id) NOT NULL, + encrypted_content TEXT NOT NULL, -- AES-256-GCM blob + encryption_iv TEXT NOT NULL, -- Initialization vector + mood_at_time INTEGER, + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW() +); +``` + +**mental_health_screenings** +```sql +CREATE TABLE mental_health_screenings ( + id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), + user_id UUID REFERENCES auth.users(id) NOT NULL, + type TEXT NOT NULL, -- 'gad7', 'phq9' + score INTEGER NOT NULL, + answers JSONB NOT NULL, -- [{ question_id, answer }] + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW() +); +``` + +--- + +## 4. Row Level Security (RLS) + +### Enable RLS on All Tables + +```sql +ALTER TABLE user_daily_metrics ENABLE ROW LEVEL SECURITY; +ALTER TABLE detected_patterns ENABLE ROW LEVEL SECURITY; +ALTER TABLE subscriptions ENABLE ROW LEVEL SECURITY; +ALTER TABLE workouts ENABLE ROW LEVEL SECURITY; +ALTER TABLE workout_exercises ENABLE ROW LEVEL SECURITY; +ALTER TABLE workout_sets ENABLE ROW LEVEL SECURITY; +ALTER TABLE exercise_favorites ENABLE ROW LEVEL SECURITY; +ALTER TABLE body_measurements ENABLE ROW LEVEL SECURITY; +ALTER TABLE daily_plans ENABLE ROW LEVEL SECURITY; +ALTER TABLE goals ENABLE ROW LEVEL SECURITY; +ALTER TABLE check_ins ENABLE ROW LEVEL SECURITY; +ALTER TABLE ai_conversations ENABLE ROW LEVEL SECURITY; +ALTER TABLE meditation_sessions ENABLE ROW LEVEL SECURITY; +ALTER TABLE mood_logs ENABLE ROW LEVEL SECURITY; +ALTER TABLE journal_entries ENABLE ROW LEVEL SECURITY; +``` + +### User Data Isolation Policy + +```sql +-- Standard policy: Users can only access their own data +CREATE POLICY "Users can only access their own data" + ON user_daily_metrics FOR ALL + USING (auth.uid() = user_id); + +CREATE POLICY "Users can only access their own workouts" + ON workouts FOR ALL + USING (auth.uid() = user_id); + +-- Apply to all user-owned tables +``` + +### Subscription-Based Access + +```sql +-- Premium features locked by subscription +CREATE POLICY "Premium meditation access" + ON meditation_sessions FOR SELECT + USING ( + auth.uid() = user_id AND + ( + SELECT tier FROM subscriptions + WHERE user_id = auth.uid() + ) IN ('single', 'pack', 'plus') + ); +``` + +### Public Read for System Data + +```sql +-- Exercises library is public (read) +CREATE POLICY "Exercises are public" + ON exercises FOR SELECT + USING (is_custom = FALSE OR user_id = auth.uid()); + +-- Workout templates: public presets + user's custom +CREATE POLICY "Templates access" + ON workout_templates FOR SELECT + USING (is_preset = TRUE OR user_id = auth.uid()); +``` + +--- + +## 5. Drift Mirror + +### Drift Tables (Local SQLite) + +**Structure identical to PostgreSQL** for seamless sync. + +```dart +// lib/core/database/tables.dart + +class WorkoutsTable extends Table { + UuidColumn get id => uuid()(); + TextColumn get userId => text()(); + TextColumn get name => text()(); + DateTimeColumn get scheduledAt => dateTime().nullable()(); + DateTimeColumn get startedAt => dateTime().nullable()(); + DateTimeColumn get completedAt => dateTime().nullable()(); + IntColumn get durationMinutes => integer().nullable()(); + IntColumn get caloriesBurned => integer().nullable()(); + TextColumn get notes => text().nullable()(); + BoolColumn get synced => boolean().withDefault(const Constant(false))(); + DateTimeColumn get createdAt => dateTime()(); +} +``` + +### Sync Status Tracking + +```dart +class SyncQueueTable extends Table { + IntColumn get id => integer().autoIncrement()(); + TextColumn get tableName => text()(); + TextColumn get recordId => text()(); + TextColumn get operation => text()(); // 'insert', 'update', 'delete' + TextColumn get data => text()(); // JSON payload + IntColumn get priority => integer().withDefault(const Constant(0))(); + IntColumn get retryCount => integer().withDefault(const Constant(0))(); + DateTimeColumn get createdAt => dateTime()(); +} +``` + +--- + +## 6. Sync Strategy + +### Write Flow + +``` +1. User action (e.g., log workout) + ↓ +2. Save to Drift (local) β†’ Instant UI update + ↓ +3. Add to SyncQueue (priority based on data type) + ↓ +4. SyncService detects WiFi/connection + ↓ +5. Process queue: Send to Supabase + ↓ +6. Mark as synced in Drift +``` + +### Priority Levels + +| Priority | Data Type | Sync Urgency | +|----------|-----------|--------------| +| 0 (Highest) | Auth changes, payments | Immediate | +| 1 | Workouts, check-ins | Next available | +| 2 | Mood logs, favorites | Background | +| 3 | Analytics events | Low priority | + +### Conflict Resolution + +```dart +// Last-write-wins based on updated_at timestamp +Future resolveConflict( + LocalRecord local, + RemoteRecord remote, +) async { + if (remote.updatedAt.isAfter(local.updatedAt)) { + // Remote wins - update local + await localDb.update(remote); + } else { + // Local wins - push to remote + await remoteDb.upsert(local); + } +} +``` + +--- + +## 7. Migrations + +### Migration Files Location + +``` +supabase/migrations/ +β”œβ”€β”€ 001_initial_schema.sql # Core tables +β”œβ”€β”€ 002_add_exercise_favorites.sql +β”œβ”€β”€ 003_seed_exercises.sql # 500+ exercises +β”œβ”€β”€ 004_fix_security_definer.sql +β”œβ”€β”€ 20250117000001_workout_templates.sql +β”œβ”€β”€ 20250117000002_mental_health_screenings.sql +β”œβ”€β”€ 20250117000003_subscriptions.sql +β”œβ”€β”€ 20250117000004_streaks.sql +β”œβ”€β”€ 20250117000005_ai_conversations.sql +β”œβ”€β”€ 20250117000006_mood_logs.sql +β”œβ”€β”€ 20250122_enable_realtime_sync.sql +β”œβ”€β”€ 20250122_gdpr_storage_and_soft_delete.sql +β”œβ”€β”€ 20251122_create_meditation_tables.sql +└── 20251122_seed_meditation_data.sql +``` + +### Running Migrations + +```bash +# Apply all pending migrations +supabase db push + +# Create new migration +supabase migration new + +# Reset database (dev only) +supabase db reset +``` + +--- + +## PowiΔ…zane Dokumenty + +- [ARCH-overview.md](./ARCH-overview.md) - Architecture overview +- [ARCH-security.md](./ARCH-security.md) - E2EE, GDPR details +- [PRD-nfr.md](../product/PRD-nfr.md) - NFR requirements + +--- + +*20+ Tables | RLS Enabled | Offline-First with Drift* diff --git a/docs/1-BASELINE/architecture/ARCH-overview.md b/docs/1-BASELINE/architecture/ARCH-overview.md new file mode 100644 index 0000000..f8cac26 --- /dev/null +++ b/docs/1-BASELINE/architecture/ARCH-overview.md @@ -0,0 +1,354 @@ +# LifeOS Architecture - Overview + + + +**Wersja:** 2.0 +**Status:** βœ… Zatwierdzona do implementacji + +--- + +## Spis TreΕ›ci + +1. [Executive Summary](#1-executive-summary) +2. [Kluczowe Decyzje Architektoniczne](#2-kluczowe-decyzje-architektoniczne) +3. [High-Level Architecture](#3-high-level-architecture) +4. [Tech Stack](#4-tech-stack) +5. [Project Structure](#5-project-structure) +6. [NFR Validation](#6-nfr-validation) +7. [PowiΔ…zane Dokumenty](#7-powiΔ…zane-dokumenty) + +--- + +## 1. Executive Summary + +### PrzeglΔ…d Projektu + +**LifeOS** (Life Operating System) to moduΕ‚owy ekosystem aplikacji mobilnej z 3 moduΕ‚ami MVP: +- **Life Coach AI** (FREE) - daily planner, konwersacyjny coach +- **Fitness Coach AI** (2.99 EUR/mies.) - tracking treningΓ³w, Smart Pattern Memory +- **Mind & Emotion** (2.99 EUR/mies.) - medytacje, mood tracking, journaling + +**Killer Feature:** Cross-Module Intelligence - system analizy korelacji miΔ™dzy moduΕ‚ami. + +### Kluczowe Metryki + +| Aspekt | Target | Architektura | +|--------|--------|--------------| +| **Performance** | App launch <2s, offline <100ms | βœ… Write-through cache, Drift | +| **Security** | E2EE dla wraΕΌliwych danych | βœ… AES-256-GCM client-side | +| **Scalability** | 10k concurrent, <500 EUR/10k | βœ… Supabase, CDN | +| **Battery** | <5% w 8h | βœ… Opportunistic sync | +| **Coverage** | 123 FRs, 37 NFRs | βœ… 100% | + +--- + +## 2. Kluczowe Decyzje Architektoniczne + +### Critical Decisions (D1-D5) + +| ID | Decyzja | WybΓ³r | Uzasadnienie | +|----|---------|-------|--------------| +| **D1** | Modular Architecture | Hybrid (features/ + clean arch) | SkalowalnoΕ›Δ‡ + separation | +| **D2** | Cross-Module Data | Shared PostgreSQL + Drift mirror | CMI + offline-first | +| **D3** | Offline Sync | Write-Through Cache + Sync Queue | <100ms response | +| **D4** | AI Orchestration | Supabase Edge Functions | Security + cost control | +| **D5** | E2EE | Client-Side AES-256-GCM | Privacy dla journali | + +### Important Decisions (D6-D13) + +| ID | Decyzja | WybΓ³r | +|----|---------|-------| +| **D6** | Provider Structure | Feature-First z clean naming | +| **D7** | Database Schema | Shared Core + Module Extensions | +| **D8** | API Layer | Hybrid (CRUD + Edge Functions) | +| **D9** | Theme Switching | Auto-switching per module | +| **D10** | Feature Flags | Enum-Based Feature Gates | +| **D11** | Background Sync | Opportunistic (lifecycle triggers) | +| **D12** | Push Notifications | Firebase Cloud Messaging (FCM) | +| **D13** | Caching | Tiered Lazy Loading + LRU | + +### D1: Modular Architecture Pattern + +**Struktura:** +``` +lib/features/ + life_coach/ + presentation/ # UI (screens, widgets, providers) + domain/ # Business logic (models, use cases) + data/ # Data sources (local, remote, DTOs) + fitness/ + mind/ + cross_module_intelligence/ +``` + +**Uzasadnienie:** +- Feature isolation dla niezaleΕΌnych moduΕ‚Γ³w +- Clean architecture zapewnia testability +- Łatwe dodawanie nowych moduΕ‚Γ³w (Phase 2) + +### D3: Offline-First Sync Strategy + +**Mechanizm:** +1. **Write:** Save to Drift (local) β†’ instant feedback +2. **Queue:** Priority-based sync queue +3. **Sync:** Opportunistic (WiFi preferred, retry on failure) + +**Conflict resolution:** Last-write-wins based on timestamp + +### D4: AI Orchestration + +**Flow:** +``` +Flutter App β†’ Supabase Edge Function β†’ Route based on tier + ↓ + Free tier β†’ Llama 3 (self-hosted) + Standard β†’ Claude (Anthropic API) + Premium β†’ GPT-4 (OpenAI API) +``` + +**KorzyΕ›ci:** +- API keys never exposed to client +- Server-side quota enforcement +- Model changes without app update + +--- + +## 3. High-Level Architecture + +``` +β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” +β”‚ Flutter App (iOS/Android) β”‚ +β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ +β”‚ Presentation Layer (Riverpod + Material 3) β”‚ +β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ +β”‚ β”‚ Life Coach β”‚ Fitness β”‚ Mind β”‚ CMI β”‚ β”‚ +β”‚ β”‚ Module β”‚ Module β”‚ Module β”‚ Dashboard β”‚ β”‚ +β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ +β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ +β”‚ Domain Layer (Use Cases + Business Logic) β”‚ +β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ +β”‚ β”‚ GenerateDailyPlanUseCase β”‚ StartWorkoutUseCase β”‚ β”‚ +β”‚ β”‚ DetectPatternsUseCase β”‚ PlayMeditationUseCase β”‚ β”‚ +β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ +β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ +β”‚ Data Layer (Repositories + Data Sources) β”‚ +β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ +β”‚ β”‚ Drift (SQLite) β”‚ Supabase (PostgreSQL + Realtime) β”‚ β”‚ +β”‚ β”‚ Offline-First β”‚ Cloud Sync + RLS β”‚ β”‚ +β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ +β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ + β–² β–Ό +β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” +β”‚ Supabase Backend (Cloud) β”‚ +β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ +β”‚ Edge Functions (Deno) β”‚ +β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ +β”‚ β”‚ AI Orchestrator β”‚ Generate Plan β”‚ Analyze Metrics β”‚ β”‚ +β”‚ β”‚ (Llama/Claude/ β”‚ (GPT-4/Claude) β”‚ (Pattern Detect) β”‚ β”‚ +β”‚ β”‚ GPT-4 routing) β”‚ β”‚ β”‚ β”‚ +β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ +β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ +β”‚ PostgreSQL Database + RLS Policies β”‚ +β”‚ Auth (Email, Google, Apple) + Storage (CDN) β”‚ +β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ + β–² β–Ό +β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” +β”‚ External Services β”‚ +β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ +β”‚ Firebase Cloud Messaging (FCM) - Push Notifications β”‚ +β”‚ Stripe - Payment Processing β”‚ +β”‚ Posthog - Analytics & Telemetry β”‚ +β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ +``` + +### Data Flow - Complete Workout Example + +``` +1. User taps "Complete Workout" + ↓ +2. Riverpod Provider: workoutProvider.completeWorkout() + ↓ +3. Use Case: CompleteWorkoutUseCase.call() + ↓ +4. Repository: FitnessRepository.saveWorkout() + ↓ +5. Drift insert β†’ workouts table + βœ… INSTANT feedback (<100ms) + ↓ +6. Sync Queue: Add (priority: HIGH) + ↓ +7. Opportunistic sync (WiFi available) + ↓ +8. Supabase insert β†’ workouts table + ↓ +9. Metrics Aggregation β†’ user_daily_metrics + ↓ +10. CMI Pattern Detection (weekly) + ↓ +11. AI Edge Function β†’ Generate insight + ↓ +12. FCM β†’ Push notification +``` + +--- + +## 4. Tech Stack + +### Frontend (Flutter) + +| Technology | Version | Purpose | +|------------|---------|---------| +| **Flutter** | 3.38+ | Cross-platform (iOS, Android) | +| **Dart** | 3.10+ | Programming language | +| **Riverpod** | 3.0+ | State management | +| **Drift** | Latest | Local SQLite ORM | +| **freezed** | Latest | Immutable models | +| **go_router** | Latest | Routing + deep linking | +| **flutter_secure_storage** | Latest | Encrypted storage | + +### Backend (Supabase) + +| Component | Technology | Purpose | +|-----------|------------|---------| +| **Database** | PostgreSQL 17+ | Primary data store + RLS | +| **Realtime** | Supabase Realtime | WebSocket subscriptions | +| **Auth** | Supabase Auth | Email, Google, Apple | +| **Storage** | Supabase Storage | Media files + CDN | +| **Edge Functions** | Deno | AI orchestration | + +### External Services + +| Service | Purpose | Cost | +|---------|---------|------| +| **FCM** | Push notifications | Free | +| **Stripe** | Payments | 2.9% + €0.30 | +| **Posthog** | Analytics | Free tier | +| **Claude** | AI (standard) | $0.003/call | +| **GPT-4** | AI (premium) | $0.01/call | +| **Llama 3** | AI (free tier) | Self-hosted | + +--- + +## 5. Project Structure + +``` +lifeos/ +β”œβ”€β”€ lib/ +β”‚ β”œβ”€β”€ main.dart +β”‚ β”œβ”€β”€ app.dart +β”‚ β”‚ +β”‚ β”œβ”€β”€ core/ # Shared utilities +β”‚ β”‚ β”œβ”€β”€ auth/ +β”‚ β”‚ β”œβ”€β”€ sync/ # Offline-first sync (D3) +β”‚ β”‚ β”œβ”€β”€ cache/ # Tiered cache (D13) +β”‚ β”‚ β”œβ”€β”€ database/ # Drift local DB +β”‚ β”‚ β”œβ”€β”€ api/ # Supabase client +β”‚ β”‚ β”œβ”€β”€ ai/ # AI service layer (D4) +β”‚ β”‚ β”œβ”€β”€ subscription/ # Feature gates (D10) +β”‚ β”‚ β”œβ”€β”€ notifications/ # FCM (D12) +β”‚ β”‚ β”œβ”€β”€ theme/ # Adaptive themes (D9) +β”‚ β”‚ β”œβ”€β”€ error/ # Result pattern +β”‚ β”‚ β”œβ”€β”€ logging/ +β”‚ β”‚ β”œβ”€β”€ utils/ +β”‚ β”‚ β”œβ”€β”€ routing/ +β”‚ β”‚ └── widgets/ +β”‚ β”‚ +β”‚ β”œβ”€β”€ features/ # Feature modules (D1) +β”‚ β”‚ β”œβ”€β”€ onboarding/ +β”‚ β”‚ β”œβ”€β”€ life_coach/ +β”‚ β”‚ β”‚ β”œβ”€β”€ presentation/ +β”‚ β”‚ β”‚ β”œβ”€β”€ domain/ +β”‚ β”‚ β”‚ └── data/ +β”‚ β”‚ β”œβ”€β”€ fitness/ +β”‚ β”‚ β”œβ”€β”€ mind/ +β”‚ β”‚ β”œβ”€β”€ cross_module_intelligence/ +β”‚ β”‚ β”œβ”€β”€ goals/ +β”‚ β”‚ β”œβ”€β”€ subscription/ +β”‚ β”‚ └── settings/ +β”‚ β”‚ +β”‚ └── generated/ +β”‚ +β”œβ”€β”€ test/ # Unit + Widget tests +β”œβ”€β”€ integration_test/ # E2E tests +β”œβ”€β”€ supabase/ +β”‚ β”œβ”€β”€ functions/ # Edge Functions +β”‚ └── migrations/ # PostgreSQL schema +β”œβ”€β”€ assets/ +β”œβ”€β”€ l10n/ # i18n (PL, EN) +└── pubspec.yaml +``` + +### Epic to Directory Mapping + +| Epic | Directory | +|------|-----------| +| Epic 1: Core Platform | `features/onboarding/` | +| Epic 2: Life Coach | `features/life_coach/` | +| Epic 3: Fitness | `features/fitness/` | +| Epic 4: Mind | `features/mind/` | +| Epic 5: CMI | `features/cross_module_intelligence/` | +| Epic 6: Gamification | `features/goals/` | +| Epic 7: Subscriptions | `features/subscription/` | +| Epic 8: Notifications | `core/notifications/` | +| Epic 9: Settings | `features/settings/` | + +--- + +## 6. NFR Validation + +### Performance (NFR-P1-P6) + +| NFR | Target | Solution | Status | +|-----|--------|----------|--------| +| P1 | App size <50MB | Tiered cache, 15MB bundled | βœ… | +| P2 | Cold start <2s | Flutter skeleton, minimal init | βœ… | +| P4 | Offline <100ms | Write-through cache, Drift | βœ… | +| P5 | UI response <100ms | Riverpod optimistic updates | βœ… | +| P6 | Battery <5% in 8h | Opportunistic sync | βœ… | + +### Security (NFR-S1-S3) + +| NFR | Target | Solution | Status | +|-----|--------|----------|--------| +| S1 | E2EE journals | AES-256-GCM client-side | βœ… | +| S2 | GDPR | RLS, export/delete endpoints | βœ… | +| S3 | Multi-device | Supabase Realtime, last-write-wins | βœ… | + +### Cost (NFR-SC4) + +| Component | 10k users | % Revenue | +|-----------|-----------|-----------| +| Supabase | €0 (free tier) | 0% | +| AI API (CMI) | €360/month | 3.6% | +| Stripe fees | €290/month | 2.9% | +| **Total** | **€650/month** | **6.5%** βœ… | + +--- + +## 7. PowiΔ…zane Dokumenty + +### Architecture Details + +| Dokument | ZawartoΕ›Δ‡ | +|----------|-----------| +| [ARCH-database-schema.md](./ARCH-database-schema.md) | Database schema, RLS, Drift | +| [ARCH-ai-infrastructure.md](./ARCH-ai-infrastructure.md) | AI orchestration, CMI | +| [ARCH-security.md](./ARCH-security.md) | E2EE, GDPR, security | + +### Product + +| Dokument | ZawartoΕ›Δ‡ | +|----------|-----------| +| [PRD-overview.md](../product/PRD-overview.md) | Product requirements | +| [PRD-nfr.md](../product/PRD-nfr.md) | Non-functional requirements | + +### Development + +| Dokument | ZawartoΕ›Δ‡ | +|----------|-----------| +| [QUICK-START-5MIN.md](../../4-DEVELOPMENT/setup/QUICK-START-5MIN.md) | Quick start guide | +| [clean-architecture.md](../../4-DEVELOPMENT/patterns/clean-architecture.md) | Clean arch patterns | + +--- + +*13 Architectural Decisions | 123 FRs covered | 37 NFRs satisfied* diff --git a/docs/1-BASELINE/architecture/ARCH-security.md b/docs/1-BASELINE/architecture/ARCH-security.md new file mode 100644 index 0000000..a11fe37 --- /dev/null +++ b/docs/1-BASELINE/architecture/ARCH-security.md @@ -0,0 +1,490 @@ +# Security Architecture + + + +**Wersja:** 2.0 +**Decision:** D5 - Client-Side AES-256-GCM for E2EE + +--- + +## Spis TreΕ›ci + +1. [Security Overview](#1-security-overview) +2. [Authentication](#2-authentication) +3. [End-to-End Encryption (E2EE)](#3-end-to-end-encryption-e2ee) +4. [Row Level Security (RLS)](#4-row-level-security-rls) +5. [GDPR Compliance](#5-gdpr-compliance) +6. [Threat Model](#6-threat-model) +7. [Implementation](#7-implementation) + +--- + +## 1. Security Overview + +### Security Principles + +1. **Zero Trust:** Assume breach, encrypt sensitive data +2. **Client-Side E2EE:** Server never sees plaintext journals +3. **RLS Everywhere:** Row-level security for data isolation +4. **Minimal Exposure:** Only expose what's necessary + +### Data Classification + +| Classification | Examples | Protection | +|----------------|----------|------------| +| **Highly Sensitive** | Journals, mental health | E2EE (AES-256-GCM) | +| **Sensitive** | Mood, stress, workouts | RLS, TLS | +| **General** | Exercise library, templates | TLS | + +### Encryption at Rest and Transit + +| Location | Encryption | +|----------|------------| +| **In Transit** | HTTPS/TLS 1.3 | +| **At Rest (Supabase)** | AES-256 (managed) | +| **At Rest (Device)** | Drift SQLite + Secure Storage | +| **Sensitive Fields** | Client-side E2EE | + +--- + +## 2. Authentication + +### Supabase Auth + +| Provider | Platform | Status | +|----------|----------|--------| +| Email + Password | All | βœ… | +| Google OAuth 2.0 | All | βœ… | +| Apple Sign-In | iOS | βœ… | + +### Password Requirements + +``` +Minimum 8 characters +1 uppercase letter +1 number +1 special character (!@#$%^&*) +``` + +### Session Management + +| Setting | Value | +|---------|-------| +| Session Duration | 30 days inactivity | +| Token Storage | flutter_secure_storage | +| Auto-Refresh | Before expiration | +| Logout | Clears all tokens | + +### MFA (Phase 1) + +- Email-based 2FA +- Optional for users +- Required for admin + +### Implementation + +```dart +// lib/core/auth/auth_service.dart + +class AuthService { + final SupabaseClient _supabase; + final FlutterSecureStorage _secureStorage; + + Future signInWithEmail(String email, String password) async { + final response = await _supabase.auth.signInWithPassword( + email: email, + password: password, + ); + + if (response.session != null) { + await _secureStorage.write( + key: 'session_token', + value: response.session!.accessToken, + ); + return AuthResult.success(response.user!); + } + + return AuthResult.failure('Invalid credentials'); + } + + Future signOut() async { + await _supabase.auth.signOut(); + await _secureStorage.deleteAll(); + } +} +``` + +--- + +## 3. End-to-End Encryption (E2EE) + +### What's Encrypted + +| Data Type | Encrypted | Reason | +|-----------|-----------|--------| +| **Journal Entries** | βœ… E2EE | Highly personal | +| **Mental Health Notes** | βœ… E2EE | Medical sensitivity | +| **Private Goals (user-marked)** | βœ… E2EE | User preference | +| **Mood Score (1-10)** | ❌ | Needed for CMI patterns | +| **Stress Level (1-10)** | ❌ | Needed for CMI patterns | +| **Workout Data** | ❌ | Needed for progress tracking | + +### Encryption Flow + +``` +User writes journal entry + ↓ +AES-256-GCM encryption (client-side) + Key: Derived from user password + salt + ↓ +Encrypted blob β†’ Supabase Storage + ↓ +Key stored in flutter_secure_storage + (iOS Keychain / Android KeyStore) +``` + +### Key Derivation + +```dart +// lib/core/encryption/encryption_service.dart + +class EncryptionService { + static const int _keyLength = 32; // 256 bits + static const int _saltLength = 16; + static const int _nonceLength = 12; + static const int _iterations = 100000; + + Future deriveKey(String password, Uint8List salt) async { + final pbkdf2 = Pbkdf2( + macAlgorithm: Hmac.sha256(), + iterations: _iterations, + bits: _keyLength * 8, + ); + + return await pbkdf2.deriveKey( + secretKey: SecretKey(utf8.encode(password)), + nonce: salt, + ); + } + + Future encrypt(String plaintext, SecretKey key) async { + final algorithm = AesGcm.with256bits(); + final nonce = algorithm.newNonce(); + + final secretBox = await algorithm.encrypt( + utf8.encode(plaintext), + secretKey: key, + nonce: nonce, + ); + + return EncryptedData( + ciphertext: base64.encode(secretBox.cipherText), + nonce: base64.encode(nonce), + mac: base64.encode(secretBox.mac.bytes), + ); + } + + Future decrypt(EncryptedData data, SecretKey key) async { + final algorithm = AesGcm.with256bits(); + + final secretBox = SecretBox( + base64.decode(data.ciphertext), + nonce: base64.decode(data.nonce), + mac: Mac(base64.decode(data.mac)), + ); + + final plaintext = await algorithm.decrypt( + secretBox, + secretKey: key, + ); + + return utf8.decode(plaintext); + } +} +``` + +### Key Storage + +```dart +// iOS: Keychain +// Android: KeyStore (hardware-backed on supported devices) + +class KeyStorageService { + final FlutterSecureStorage _storage = FlutterSecureStorage( + aOptions: AndroidOptions( + encryptedSharedPreferences: true, + ), + iOptions: IOSOptions( + accessibility: KeychainAccessibility.first_unlock_this_device, + ), + ); + + Future storeEncryptionKey(String userId, Uint8List key) async { + await _storage.write( + key: 'enc_key_$userId', + value: base64.encode(key), + ); + } + + Future getEncryptionKey(String userId) async { + final encoded = await _storage.read(key: 'enc_key_$userId'); + return encoded != null ? base64.decode(encoded) : null; + } +} +``` + +--- + +## 4. Row Level Security (RLS) + +### RLS Policies + +**All user-owned tables have RLS enabled:** + +```sql +-- Enable RLS +ALTER TABLE journal_entries ENABLE ROW LEVEL SECURITY; + +-- Users can only access their own data +CREATE POLICY "Users own their journal entries" + ON journal_entries FOR ALL + USING (auth.uid() = user_id); + +-- Users can insert their own data +CREATE POLICY "Users can insert their own entries" + ON journal_entries FOR INSERT + WITH CHECK (auth.uid() = user_id); +``` + +### Subscription-Based Access + +```sql +-- Premium features require subscription +CREATE POLICY "Premium meditation access" + ON meditation_sessions FOR SELECT + USING ( + auth.uid() = user_id AND + EXISTS ( + SELECT 1 FROM subscriptions + WHERE user_id = auth.uid() + AND tier IN ('single', 'pack', 'plus') + AND (expires_at IS NULL OR expires_at > NOW()) + ) + ); +``` + +### Admin Access (Service Role) + +```sql +-- Only service role can bypass RLS +-- Used for Edge Functions, migrations +``` + +--- + +## 5. GDPR Compliance + +### User Rights + +| Right | Implementation | +|-------|----------------| +| **Right to Access** | Export all data (JSON + CSV) | +| **Right to Rectification** | Edit profile, goals, entries | +| **Right to Erasure** | Delete account + all data | +| **Right to Portability** | Export in machine-readable format | + +### Data Export Endpoint + +```typescript +// supabase/functions/gdpr-export/index.ts + +serve(async (req) => { + const { data: { user } } = await supabase.auth.getUser() + + const exportData = { + profile: await getProfile(user.id), + workouts: await getWorkouts(user.id), + goals: await getGoals(user.id), + check_ins: await getCheckIns(user.id), + mood_logs: await getMoodLogs(user.id), + // Note: Journal entries returned as encrypted blobs + journal_entries: await getJournalEntries(user.id), + } + + // Generate ZIP file + const zip = await createZip(exportData) + + return new Response(zip, { + headers: { + 'Content-Type': 'application/zip', + 'Content-Disposition': 'attachment; filename=lifeos_export.zip' + } + }) +}) +``` + +### Data Deletion + +```typescript +// supabase/functions/gdpr-delete/index.ts + +serve(async (req) => { + const { data: { user } } = await supabase.auth.getUser() + + // Soft delete with 30-day retention + await supabase + .from('users_pending_deletion') + .insert({ + user_id: user.id, + requested_at: new Date(), + delete_at: new Date(Date.now() + 30 * 24 * 60 * 60 * 1000) + }) + + // Sign out user + await supabase.auth.admin.deleteUser(user.id) + + return new Response(JSON.stringify({ + message: 'Deletion scheduled', + delete_at: '30 days from now' + })) +}) + +// Cron job: Actually delete after 30 days +``` + +### Privacy Policy + +- Clear, visible in app +- GDPR-compliant language +- Explains what data collected +- Explains how data used +- Explains user rights +- No selling to third parties + +### Data Retention + +| Data Type | Retention | +|-----------|-----------| +| Active user data | While account active | +| Deleted user data | 30 days (backup) | +| Analytics | Anonymous, 2 years | +| Logs | 90 days | + +--- + +## 6. Threat Model + +### Covered Threats + +| Threat | Mitigation | Status | +|--------|------------|--------| +| **Supabase breach** | E2EE - encrypted data unreadable | βœ… | +| **MITM attack** | HTTPS/TLS 1.3 + cert pinning | βœ… | +| **Device theft** | Biometric unlock + secure storage | βœ… | +| **SQL injection** | Supabase RLS, parameterized queries | βœ… | +| **XSS** | Input sanitization | βœ… | +| **API abuse** | Rate limiting (100 req/min) | βœ… | +| **Credential stuffing** | Rate limiting + lockout | βœ… | + +### Attack Surface + +``` +β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” +β”‚ Attack Surface β”‚ +β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ +β”‚ β”‚ +β”‚ [Flutter App] ──TLS──> [Supabase API] ──> [PostgreSQL] β”‚ +β”‚ β”‚ β”‚ β”‚ β”‚ +β”‚ β”‚ β”‚ β”‚ β”‚ +β”‚ Secure Storage Rate Limiting RLS β”‚ +β”‚ (Keys, Tokens) (100 req/min) (User Isolation) β”‚ +β”‚ β”‚ β”‚ β”‚ β”‚ +β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ +β”‚ β”‚ β”‚ +β”‚ [Edge Functions] β”‚ +β”‚ β”‚ β”‚ +β”‚ AI API Keys β”‚ +β”‚ (Never exposed to client) β”‚ +β”‚ β”‚ +β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ +``` + +### Security Audits + +- **Frequency:** Quarterly (P1) +- **Scope:** Penetration testing, code review +- **Tools:** OWASP ZAP, Burp Suite, SonarQube + +--- + +## 7. Implementation + +### Certificate Pinning (P1) + +```dart +// lib/core/api/http_client.dart + +class SecureHttpClient { + static final _expectedCert = ''' +-----BEGIN CERTIFICATE----- +MIIDrzCCA... (Supabase SSL certificate) +-----END CERTIFICATE----- +'''; + + static HttpClient createClient() { + final client = HttpClient(); + client.badCertificateCallback = (cert, host, port) { + return cert.pem == _expectedCert; + }; + return client; + } +} +``` + +### Input Sanitization + +```dart +// lib/core/utils/sanitizer.dart + +class Sanitizer { + static String sanitizeText(String input) { + // Remove potential XSS + return input + .replaceAll('<', '<') + .replaceAll('>', '>') + .replaceAll('"', '"') + .replaceAll("'", '''); + } + + static String sanitizeForDatabase(String input) { + // Supabase handles this, but extra safety + return input.replaceAll(RegExp(r'[;\'"\\]'), ''); + } +} +``` + +### Security Headers + +```typescript +// Supabase Edge Functions response headers + +const securityHeaders = { + 'X-Content-Type-Options': 'nosniff', + 'X-Frame-Options': 'DENY', + 'X-XSS-Protection': '1; mode=block', + 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains', + 'Content-Security-Policy': "default-src 'self'", +}; +``` + +--- + +## PowiΔ…zane Dokumenty + +- [ARCH-overview.md](./ARCH-overview.md) - Architecture overview +- [ARCH-database-schema.md](./ARCH-database-schema.md) - RLS details +- [PRD-nfr.md](../product/PRD-nfr.md) - Security NFRs + +--- + +*E2EE for Sensitive Data | RLS Everywhere | GDPR Compliant* diff --git a/docs/1-BASELINE/product/PRD-fitness-requirements.md b/docs/1-BASELINE/product/PRD-fitness-requirements.md new file mode 100644 index 0000000..9affb9d --- /dev/null +++ b/docs/1-BASELINE/product/PRD-fitness-requirements.md @@ -0,0 +1,309 @@ +# Fitness Module - Product Requirements + + + +**ModuΕ‚:** Fitness Coach +**Cena:** 2.99 EUR/month +**Status:** ~82% zaimplementowane + +--- + +## Spis TreΕ›ci + +1. [Module Overview](#1-module-overview) +2. [Functional Requirements](#2-functional-requirements) +3. [User Flows](#3-user-flows) +4. [Cross-Module Integration](#4-cross-module-integration) +5. [Technical Notes](#5-technical-notes) + +--- + +## 1. Module Overview + +### Core Value Proposition + +**Smart Pattern Memory** - first fitness tracker saving users **17 hours/year** through intelligent workout pre-fill, achieving **3x industry retention**. + +### Key Features + +| Feature | Priority | Value | +|---------|----------|-------| +| **Smart Pattern Memory** | P0 (MVP) | Killer feature - pre-fills last workout | +| Workout Logging | P0 (MVP) | Fast UX, <2s per set | +| Exercise Library | P0 (MVP) | 500+ exercises | +| Progress Charts | P0 (MVP) | FREE for all users | +| Workout Templates | P0 (MVP) | 20+ pre-built | +| Body Measurements | P0 (MVP) | Weight, body fat, photos | +| Form Videos | P1 | Exercise instructions | +| Cross-Module Intel | P0 (MVP) | Stress data from Mind | + +### Competitive Advantage + +| Feature | GymApp | Strong | FitBod | +|---------|--------|--------|--------| +| Progress Charts | FREE | Paid | Paid | +| Smart Pre-fill | Yes | Limited | Yes | +| Price | 2.99 EUR | 9.99 EUR | 12.99 EUR | + +--- + +## 2. Functional Requirements + +### 2.1 Workout Logging (FR30-FR37) + +**FR30: Log Workouts with Sets, Reps, Weight** +- User can log exercise sets with: + - Reps (1-999) + - Weight (0-999 kg/lbs) + - Optional: RPE (1-10), notes +- Supports bodyweight exercises (weight = 0) +- Supports supersets and circuits + +**FR31: Smart Pattern Memory (KILLER FEATURE)** +- System automatically pre-fills last workout data when user selects exercise: + - Last sets count + - Last reps per set + - Last weight per set + - Date of last performance +- User can accept or modify in <2 seconds +- Works offline (Drift/SQLite) + +**FR32: Exercise Library Search** +- User can search 500+ exercises by: + - Name (fuzzy search) + - Muscle group (primary, secondary) + - Equipment type + - Difficulty level +- Results appear <200ms after typing stops + +**FR33: Custom Exercises** +- User can add custom exercises with: + - Name (required) + - Muscle group (required) + - Equipment (optional) + - Instructions (optional) +- Custom exercises synced across devices + +**FR34: Workout Duration & Rest** +- System tracks total workout duration automatically +- Rest timer between sets: + - Configurable defaults (30s, 60s, 90s, 120s) + - Auto-start after completing set + - Visual + haptic notification + +**FR35: Workout Notes** +- User can add notes to: + - Individual sets + - Workout sessions +- Notes searchable in history + +**FR36: Offline Logging** +- ALL workout logging works 100% offline +- Sync when internet available +- No data loss guarantee + +**FR37: Edit/Delete Workouts** +- User can edit past workouts: + - Change sets, reps, weight + - Add/remove exercises + - Change date +- User can delete workouts (soft delete, recoverable 30 days) + +### 2.2 Progress Tracking (FR38-FR42) + +**FR38: Progress Charts (FREE)** +- User can view: + - Weight lifted over time (1RM estimation) + - Volume per exercise (sets Γ— reps Γ— weight) + - Personal Records (PRs) +- Time filters: 30d, 90d, 6mo, 1yr, All Time +- **Always FREE - competitive advantage** + +**FR39: Body Measurements** +- User can track: + - Body weight (kg/lbs) + - Body fat % (optional) + - Measurements: chest, waist, arms, legs + - Progress photos (encrypted storage) +- Charts for all measurements + +**FR40: Workout History** +- User can view history by: + - Date (calendar view) + - Exercise (all sessions for specific exercise) +- Details: duration, volume, exercises, notes + +**FR41: Personal Records (PRs)** +- System automatically calculates PRs: + - 1RM (Epley formula: weight Γ— (1 + reps/30)) + - Max weight for any rep range + - Volume PRs +- PR badges and celebrations + +**FR42: Data Export** +- Export workout data to CSV: + - Date, exercise, sets, reps, weight, duration + - Compatible with Excel, Google Sheets +- GDPR compliance + +### 2.3 Templates & Library (FR43-FR46) + +**FR43: Pre-built Templates (20+)** +- Push/Pull/Legs +- Upper/Lower Split +- Full Body +- Strength Focus +- Hypertrophy Focus +- Beginner programs +- Advanced programs + +**FR44: Custom Templates** +- User can create templates from: + - Current workout (save as template) + - Scratch (add exercises) +- Edit, duplicate, delete templates + +**FR45: Favorite Exercises** +- User can mark exercises as favorites +- Quick access from workout screen +- Synced across devices + +**FR46: Exercise Instructions (P1)** +- Text instructions for form +- Visual diagrams +- Video tutorials (P2) +- Form tips and common mistakes + +--- + +## 3. User Flows + +### 3.1 Start Workout Flow + +``` +1. User taps "Start Workout" +2. Options: + a. Empty workout β†’ Add exercises + b. From template β†’ Select template + c. Continue last β†’ Resume previous workout pattern +3. Timer starts +4. User adds exercises from library +5. Smart Pattern Memory pre-fills last data +6. User logs sets (tap to confirm or adjust) +7. Rest timer auto-starts +8. User completes workout +9. Summary screen with PRs highlighted +10. Data synced (or queued for offline) +``` + +### 3.2 Quick Log Flow (2-Second Goal) + +``` +1. User taps exercise name +2. Smart Pattern Memory shows: "Last: 3Γ—8Γ—80kg (Nov 28)" +3. User taps checkmark β†’ All 3 sets logged with same data +4. OR User adjusts one value β†’ Tap checkmark +5. Total time: <2 seconds per exercise +``` + +### 3.3 View Progress Flow + +``` +1. User navigates to Progress tab +2. Selects exercise (e.g., Bench Press) +3. Views: + - 1RM chart over time + - Volume chart + - PR history +4. Filters: Last 30d / 90d / 6mo / Year / All +5. Optional: Export to CSV +``` + +--- + +## 4. Cross-Module Integration + +### 4.1 Receives from Mind Module + +| Data | Usage | +|------|-------| +| Stress Level (1-5) | Adjust workout intensity suggestions | +| Sleep Quality (1-5) | Suggest rest day or lighter workout | +| Mood | Adapt motivation messaging | + +### 4.2 Sends to Life Coach + +| Data | Usage | +|------|-------| +| Workout Completed | Update daily plan status | +| Volume/Duration | Feed Cross-Module Intelligence | +| PRs Achieved | Celebrate in weekly summary | + +### 4.3 Cross-Module Insights (FR77-FR84) + +| Trigger | Insight | +|---------|---------| +| High stress + heavy workout planned | "Consider light session today" | +| Poor sleep + morning workout | "Suggest afternoon instead" | +| High volume week + elevated stress | "Recovery day recommended" | + +--- + +## 5. Technical Notes + +### Database Tables + +```sql +-- Drift (SQLite) tables for offline-first +workout_sessions (id, user_id, started_at, ended_at, notes, synced) +workout_exercises (id, session_id, exercise_id, order, notes) +workout_sets (id, workout_exercise_id, set_number, reps, weight, rpe, completed) +exercises (id, name, muscle_group, equipment, instructions, is_custom) +exercise_favorites (id, user_id, exercise_id) +workout_templates (id, user_id, name, exercises_json, is_preset) +body_measurements (id, user_id, date, weight, body_fat, photos_json) +``` + +### Smart Pattern Memory Query + +```sql +-- Get last workout data for exercise +SELECT wset.reps, wset.weight, wset.set_number, ws.started_at +FROM workout_sets wset +JOIN workout_exercises we ON wset.workout_exercise_id = we.id +JOIN workout_sessions ws ON we.session_id = ws.id +WHERE we.exercise_id = ? AND ws.user_id = ? +ORDER BY ws.started_at DESC +LIMIT 10 +``` + +### 1RM Calculation (Epley Formula) + +```dart +double calculate1RM(double weight, int reps) { + if (reps == 1) return weight; + return weight * (1 + reps / 30.0); +} +``` + +### Performance Requirements + +| Metric | Target | +|--------|--------| +| Smart Pattern Query | <500ms p95 | +| Exercise Search | <200ms after typing | +| Set Logging | <100ms response | +| History Load (90 days) | <1s | + +--- + +## PowiΔ…zane Dokumenty + +- [PRD-overview.md](./PRD-overview.md) - PrzeglΔ…d produktu +- [ARCH-overview.md](../architecture/ARCH-overview.md) - Architektura +- [epic-3-fitness.md](../../2-MANAGEMENT/epics/epic-3-fitness.md) - Fitness epic stories +- [fitness-module.md](../../3-ARCHITECTURE/system-design/fitness-module.md) - Technical design + +--- + +*FR30-FR46 | 17 Functional Requirements | ~82% implemented* diff --git a/docs/1-BASELINE/product/PRD-life-coach-requirements.md b/docs/1-BASELINE/product/PRD-life-coach-requirements.md new file mode 100644 index 0000000..2689279 --- /dev/null +++ b/docs/1-BASELINE/product/PRD-life-coach-requirements.md @@ -0,0 +1,408 @@ +# Life Coach Module - Product Requirements + + + +**ModuΕ‚:** Life Coach AI +**Cena:** FREE (base tier) +**Status:** ~75% zaimplementowane + +--- + +## Spis TreΕ›ci + +1. [Module Overview](#1-module-overview) +2. [Functional Requirements](#2-functional-requirements) +3. [User Flows](#3-user-flows) +4. [AI Integration](#4-ai-integration) +5. [Cross-Module Integration](#5-cross-module-integration) +6. [Technical Notes](#6-technical-notes) + +--- + +## 1. Module Overview + +### Core Value Proposition + +**Daily AI-powered planning** that considers sleep, mood, stress, and workouts to create personalized daily plans. Always FREE to drive adoption. + +### Key Features + +| Feature | Priority | Value | +|---------|----------|-------| +| Daily Plan Generation | P0 (MVP) | AI-generated based on context | +| Goal Tracking | P0 (MVP) | Max 3 goals (free), unlimited (premium) | +| Morning Check-in | P0 (MVP) | 1-minute ritual, builds habit | +| Evening Reflection | P0 (MVP) | Review day, plan tomorrow | +| AI Conversations | P0 (MVP) | 3-5/day (free), unlimited (premium) | +| Progress Dashboard | P0 (MVP) | Charts, streaks, achievements | + +### Free vs Premium + +| Feature | FREE | Premium | +|---------|------|---------| +| Daily Planning | βœ… | βœ… | +| Goals | Max 3 | Unlimited | +| AI Conversations/day | 3-5 (Llama) | Unlimited (Claude/GPT-4) | +| Check-ins | βœ… | βœ… | +| Progress Charts | βœ… | βœ… | +| Weekly Reports | βœ… | βœ… | + +--- + +## 2. Functional Requirements + +### 2.1 Daily Planning (FR6-FR10) + +**FR6: Personalized Daily Plan Generation** +- System generates daily plan considering: + - Sleep quality (from check-in or wearable) + - Current mood (1-5 scale) + - Energy level (1-5 scale) + - Stress level (from Mind module) + - Scheduled workouts + - Active goals + - Historical patterns +- Generated via AI (Llama for free, Claude/GPT-4 for premium) + +**FR7: View Daily Plan on Home Screen** +- User sees daily plan immediately on app open +- Plan includes: + - Prioritized tasks + - Suggested activities + - Time blocks (optional) + - Cross-module suggestions (workout, meditation) + +**FR8: Mark Plan Items Complete** +- User can mark items as: + - Done βœ“ + - Skipped β†’ + - Rescheduled β†· +- Progress percentage updates in real-time + +**FR9: Manual Plan Adjustments** +- User can: + - Add custom tasks + - Remove suggested items + - Reorder priorities + - Change time allocations +- System learns from adjustments + +**FR10: Adaptive Planning** +- System learns from: + - Completion patterns + - Manual adjustments + - Time-of-day preferences + - Day-of-week patterns +- Improves suggestions over time + +### 2.2 Goal Tracking (FR11-FR17) + +**FR11: Create Goals** +- User can create goals: + - Free tier: Max 3 active goals + - Premium: Unlimited goals +- Goal fields: + - Title (required) + - Description (optional) + - Category (Fitness, Mental Health, Career, etc.) + - Target date (optional) + - Milestones (optional) + +**FR12: Goal Categories** +- Predefined categories: + - Fitness + - Mental Health + - Career + - Relationships + - Learning + - Finance + - Custom + +**FR13: Target Dates** +- User can set deadline for goal +- System calculates pace needed +- Reminders as deadline approaches + +**FR14: Progress Tracking** +- User can update progress (0-100%) +- Manual updates or auto-calculated from milestones +- Visual progress bar + +**FR15: Daily Task Suggestions** +- System suggests daily tasks that contribute to goals +- AI-generated based on goal type and timeline +- Included in daily plan + +**FR16: Goal Completion** +- User marks goal as completed +- Celebration animation +- Added to achievements history + +**FR17: Archive/Delete Goals** +- User can archive goals (hidden but retained) +- User can delete goals (soft delete, 30-day recovery) + +### 2.3 AI Conversations (FR18-FR24) + +**FR18: Chat with AI Coach** +- User can have natural conversations for: + - Motivation and encouragement + - Advice on challenges + - Problem-solving + - Goal refinement + - Emotional support + +**FR19: Free Tier Limits** +- 3-5 AI conversations per day +- Uses Llama model (cost-efficient) +- Resets at midnight local time + +**FR20: Premium Unlimited** +- Unlimited conversations +- Choice of AI: Claude or GPT-4 +- Higher quality responses + +**FR21: AI Personality** +- User can choose personality: + - **Sage:** Calm, thoughtful, reflective + - **Momentum:** Energetic, motivational, action-oriented +- Personality affects tone and suggestions + +**FR22: Context Awareness** +- AI references: + - Previous conversations + - User's goals + - Recent mood/stress data + - Workout history + - Check-in responses + +**FR23: Conversation History** +- User can view past conversations +- Searchable by date/keyword +- Exportable + +**FR24: Delete History** +- User can delete individual conversations +- User can clear all history +- GDPR compliance + +### 2.4 Check-ins (FR25-FR29) + +**FR25: Morning Check-in** +- 1-minute ritual (target) +- Questions: + - Mood (1-5 + emoji) + - Energy (1-5) + - Sleep quality (1-5) + - Optional note +- Triggers daily plan generation + +**FR26: Evening Reflection** +- 2-minute ritual (target) +- Questions: + - Day satisfaction (1-5) + - Accomplishments (free text) + - Tomorrow intentions + - Gratitude (optional) +- Feeds next day's plan + +**FR27: Check-in Data Usage** +- Data informs: + - Daily plan generation + - Cross-module insights + - Weekly reports + - AI conversation context + +**FR28: Skip Without Penalty** +- User can skip check-ins +- No streak penalty for skipping +- System uses last known data + +**FR29: Check-in Trends** +- Visualize mood/energy over time +- Weekly/monthly charts +- Correlations shown (sleep vs mood) + +--- + +## 3. User Flows + +### 3.1 Morning Ritual Flow + +``` +1. User opens app (morning) +2. If check-in not done β†’ Morning check-in prompt +3. User rates: Mood (emoji tap), Energy (slider), Sleep (slider) +4. Optional: Add note +5. Tap "Generate My Day" +6. AI creates daily plan (2-3 seconds) +7. Plan displayed on home screen +8. User reviews and adjusts as needed +``` + +### 3.2 Evening Reflection Flow + +``` +1. User opens app (evening) OR notification at 8pm +2. Evening reflection prompt +3. User rates day satisfaction +4. Types accomplishments (optional) +5. Sets tomorrow intentions (optional) +6. Gratitude prompt (optional) +7. Day summary shown +8. "Ready for tomorrow" confirmation +``` + +### 3.3 Goal Creation Flow + +``` +1. User taps "Add Goal" +2. Enters goal title +3. Selects category +4. Sets target date (optional) +5. Adds milestones (optional) +6. AI suggests daily tasks +7. Goal created and added to tracking +``` + +### 3.4 AI Chat Flow + +``` +1. User taps chat icon +2. Free tier: Shows remaining conversations (e.g., "3/5 today") +3. User types message +4. AI responds (2-3 seconds) +5. Conversation continues +6. User can rate response (thumbs up/down) +7. Conversation saved to history +``` + +--- + +## 4. AI Integration + +### 4.1 Model Selection + +| Tier | Model | Response Time | Quality | +|------|-------|---------------|---------| +| FREE | Llama 3 (self-hosted) | <2s | Good | +| Premium | Claude 3.5 Sonnet | <3s | Excellent | +| Premium | GPT-4 Turbo | <4s | Excellent | + +### 4.2 AI Prompts + +**Daily Plan Generation:** +``` +Given user context: +- Sleep: {sleep_quality}/5 +- Mood: {mood}/5 +- Energy: {energy}/5 +- Active goals: {goals} +- Scheduled workout: {workout} +- Yesterday's completion: {completion_rate}% + +Generate a personalized daily plan with: +1. Top 3 priorities +2. Suggested activities +3. Time recommendations +4. Cross-module suggestions +``` + +**Chat Personality - Sage:** +``` +You are a calm, thoughtful life coach. Use gentle language, +ask reflective questions, encourage self-discovery. +Avoid pushy or aggressive motivation. +``` + +**Chat Personality - Momentum:** +``` +You are an energetic, motivational life coach. Use action-oriented +language, celebrate wins, push for progress. Be encouraging but +not overwhelming. +``` + +### 4.3 Cost Management + +| Model | Cost/1K tokens | Daily Budget | +|-------|----------------|--------------| +| Llama | ~$0 (self-hosted) | Unlimited | +| Claude | ~$0.003 | $0.50/user/month | +| GPT-4 | ~$0.01 | $1.00/user/month | + +**Budget Rule:** AI costs <30% of revenue + +--- + +## 5. Cross-Module Integration + +### 5.1 Receives from Fitness + +| Data | Usage | +|------|-------| +| Workout completed | Update daily plan | +| PRs achieved | Celebrate in plan | +| Volume/frequency | Adjust suggestions | + +### 5.2 Receives from Mind + +| Data | Usage | +|------|-------| +| Stress level | Adjust plan intensity | +| Mood trends | Adapt AI tone | +| Meditation completed | Update plan | + +### 5.3 Sends to Other Modules + +| Data | Recipient | Usage | +|------|-----------|-------| +| Daily goals | Fitness | Suggest workout | +| Stress detected | Mind | Suggest meditation | +| Sleep quality | Both | Adjust intensity | + +--- + +## 6. Technical Notes + +### Database Tables + +```sql +-- Drift (SQLite) tables +daily_plans (id, user_id, date, plan_json, completed_items, created_at) +goals (id, user_id, title, description, category, target_date, progress, status) +goal_milestones (id, goal_id, title, completed, completed_at) +check_ins (id, user_id, type, mood, energy, sleep, notes, created_at) +ai_conversations (id, user_id, messages_json, model, created_at) +``` + +### Performance Requirements + +| Metric | Target | +|--------|--------| +| Daily Plan Generation | <3s p95 | +| AI Chat Response | <3s p95 (Claude) | +| Check-in Submit | <500ms | +| Goal Operations | <200ms | + +### Offline Support + +| Feature | Offline? | +|---------|----------| +| View daily plan | βœ… (cached) | +| Mark items complete | βœ… | +| Morning check-in | βœ… | +| AI chat | ❌ (requires internet) | +| Goal tracking | βœ… | + +--- + +## PowiΔ…zane Dokumenty + +- [PRD-overview.md](./PRD-overview.md) - PrzeglΔ…d produktu +- [ARCH-ai-infrastructure.md](../architecture/ARCH-ai-infrastructure.md) - AI infrastructure +- [epic-2-life-coach.md](../../2-MANAGEMENT/epics/epic-2-life-coach.md) - Life Coach stories +- [life-coach-module.md](../../3-ARCHITECTURE/system-design/life-coach-module.md) - Technical design + +--- + +*FR6-FR29 | 24 Functional Requirements | ~75% implemented* diff --git a/docs/1-BASELINE/product/PRD-mind-requirements.md b/docs/1-BASELINE/product/PRD-mind-requirements.md new file mode 100644 index 0000000..7d93b98 --- /dev/null +++ b/docs/1-BASELINE/product/PRD-mind-requirements.md @@ -0,0 +1,434 @@ +# Mind & Emotion Module - Product Requirements + + + +**ModuΕ‚:** Mind & Emotion Coach +**Cena:** 2.99 EUR/month +**Status:** ~40% zaimplementowane + +--- + +## Spis TreΕ›ci + +1. [Module Overview](#1-module-overview) +2. [Functional Requirements](#2-functional-requirements) +3. [User Flows](#3-user-flows) +4. [Content Library](#4-content-library) +5. [Cross-Module Integration](#5-cross-module-integration) +6. [Technical Notes](#6-technical-notes) + +--- + +## 1. Module Overview + +### Core Value Proposition + +**Holistic mental wellness** combining meditation, mood tracking, CBT chat, and journaling in one integrated module that communicates with Fitness and Life Coach. + +### Key Features + +| Feature | Priority | Free? | Value | +|---------|----------|-------|-------| +| Mood Tracking | P0 (MVP) | βœ… Always FREE | Daily check-in, trends | +| Stress Tracking | P0 (MVP) | βœ… Always FREE | Shared with Fitness | +| Guided Meditations | P0 (MVP) | 3 rotating | 20-30 MVP | +| Breathing Exercises | P0 (MVP) | βœ… | 5 techniques | +| CBT Chat | P0 (MVP) | 1/day | Unlimited (premium) | +| Journaling | P0 (MVP) | Premium | E2E encrypted | +| Mental Health Screening | P0 (MVP) | βœ… | GAD-7, PHQ-9 | +| Sleep Meditations | P0 (MVP) | Premium | 10+ stories | +| Gratitude Exercises | P0 (MVP) | βœ… | "3 Good Things" | + +### Mental Health Disclaimer + +**IMPORTANT:** LifeOS is NOT a replacement for professional mental health care. +- Crisis resources always visible (UK: 116 123, Poland: 116 123) +- High-risk scores prompt professional help recommendations +- No medical diagnosis or treatment + +--- + +## 2. Functional Requirements + +### 2.1 Meditation (FR47-FR54) + +**FR47: Guided Meditation Library** +- MVP: 20-30 meditations +- P1: 100+ meditations +- Lengths: 5, 10, 15, 20 minutes +- Themes: Stress, Sleep, Focus, Anxiety, Gratitude +- Professional voice narration + +**FR48: Filter Meditations** +- Filter by: + - Length (5/10/15/20 min) + - Theme (Stress/Sleep/Focus/Anxiety/Gratitude) + - Type (Guided/Unguided/Body Scan/Visualization) + - Favorites only +- Sort by: Popular, Newest, Recommended + +**FR49: Free Tier Access** +- 3 rotating meditations available free +- Rotation: Weekly (every Monday) +- Premium preview: 30-second clips of locked content + +**FR50: Premium Full Access** +- All meditations unlocked +- New content monthly +- Exclusive premium meditations + +**FR51: Offline Playback** +- Downloaded meditations play offline +- Cache up to 100MB total +- Auto-download favorites +- Quality selection (high/medium/low) + +**FR52: Completion Tracking** +- Track meditation sessions completed +- Total minutes meditated +- Streaks (consecutive days) +- Calendar view + +**FR53: Favorite Meditations** +- User can favorite meditations +- Quick access from favorites tab +- Synced across devices + +**FR54: AI Recommendations** +- System recommends based on: + - Current mood (from check-in) + - Stress level + - Time of day + - Previous preferences + - Recent sleep quality + +### 2.2 Mood & Stress Tracking (FR55-FR60) + +**FR55: Daily Mood Tracking (ALWAYS FREE)** +- 1-5 scale with emoji +- Quick tap interface +- Multiple entries per day allowed +- Time-stamped +- No paywall ever + +**FR56: Stress Level Tracking** +- 1-5 scale +- Tracked separately from mood +- Shared with Fitness & Life Coach +- Informs cross-module insights + +**FR57: Notes and Triggers** +- Optional notes on entries +- Suggested triggers (Work, Relationships, Health, Finance) +- Custom triggers +- Searchable history + +**FR58: Trends Visualization** +- Weekly mood chart +- Monthly trends +- Correlations shown: + - Mood vs Sleep + - Mood vs Workouts + - Stress vs Meditation + +**FR59: Cross-Module Data Sharing** +- Mood/stress shared with: + - Life Coach (daily plan adjustments) + - Fitness (workout intensity suggestions) +- User can disable sharing in settings + +**FR60: Correlation Insights** +- System calculates correlations: + - "Your mood is 40% better on days you exercise" + - "Stress drops 25% after meditation" + - "Best sleep quality follows evening meditation" + +### 2.3 CBT & Journaling (FR61-FR65) + +**FR61: CBT Chat** +- AI-guided cognitive behavioral therapy conversations +- Focus areas: Anxiety, Negative thoughts, Stress, Relationships +- Techniques: Thought challenging, Reframing, Grounding +- Free: 1 conversation/day +- Premium: Unlimited + +**FR62: Private Journaling** +- End-to-end encrypted (E2EE) +- Rich text editor +- Daily prompts (optional) +- Photo attachments (encrypted) + +**FR63: AI Journal Analysis (Opt-in)** +- Sentiment analysis +- Theme detection +- Coping strategy suggestions +- Requires explicit consent + +**FR64: Journal History** +- Searchable by date/keyword +- Calendar view +- Tag filtering +- Mood at time of entry shown + +**FR65: Journal Export** +- Export to PDF +- Export to JSON +- GDPR compliance + +### 2.4 Mental Health Screening (FR66-FR70) + +**FR66: GAD-7 Anxiety Screening** +- 7-question validated questionnaire +- Score interpretation +- Recommended frequency: Every 2 weeks +- Track scores over time + +**FR67: PHQ-9 Depression Screening** +- 9-question validated questionnaire +- Score interpretation +- Recommended frequency: Every 2 weeks +- Track scores over time + +**FR68: Score History** +- Chart of scores over time +- Trend analysis +- Compare to population norms + +**FR69: Crisis Resources** +- Automatically shown for high scores: + - GAD-7 > 15 (severe anxiety) + - PHQ-9 > 20 (severe depression) +- Crisis hotlines (UK, Poland, EU) +- "Talk to someone now" button + +**FR70: Professional Help Recommendation** +- For moderate-severe scores +- Links to find therapists +- Explanation of what scores mean +- Encouragement to seek help + +### 2.5 Breathing & Sleep (FR71-FR76) + +**FR71: Breathing Exercises (5 Techniques)** +| Technique | Pattern | Use Case | +|-----------|---------|----------| +| Box Breathing | 4-4-4-4 | Calm anxiety | +| 4-7-8 Breathing | 4-7-8 | Sleep prep | +| Calming Breath | 4-6 | Stress relief | +| Energizing Breath | 2-2-2-2 | Morning energy | +| Sleep Breathing | 4-8 | Fall asleep | + +**FR72: Breathing Visual Guides** +- Animated breathing circles +- Haptic feedback +- Audio cues (optional) +- Customizable duration (1-10 min) + +**FR73: Sleep Meditations** +- 10-30 minute sleep stories +- Ambient backgrounds +- Voice + music +- Auto-stop at end or fade out + +**FR74: Sleep Timer** +- User sets timer (15/30/45/60 min) +- Gradual volume decrease +- Auto-stop playback +- Works with any audio + +**FR75: Ambient Sounds** +- Rain, Ocean, Forest, Fire, White noise +- Mixable (rain + fire) +- Loopable +- Download for offline + +**FR76: Gratitude Exercises** +- "3 Good Things" daily prompt +- Morning gratitude intention +- Evening gratitude reflection +- Gratitude journal section + +--- + +## 3. User Flows + +### 3.1 Quick Mood Entry Flow + +``` +1. User taps "How are you feeling?" +2. Emoji mood selector (1-5) +3. Optional: Stress level (1-5) +4. Optional: Add note or trigger +5. Tap "Save" +6. Entry added to history +7. If low mood β†’ Suggest meditation +``` + +### 3.2 Meditation Flow + +``` +1. User opens Mind tab +2. Sees: "Recommended for you" based on mood +3. Browses library or selects recommendation +4. Taps meditation card +5. Preview screen: duration, description +6. Taps "Start" +7. 3-second countdown with breathing animation +8. Meditation plays (audio + visual guide) +9. Completion screen with streak update +10. Prompt: "How do you feel now?" +``` + +### 3.3 CBT Chat Flow + +``` +1. User taps "Talk to AI Therapist" +2. Free tier check: "1 session remaining today" +3. AI greeting: "What's on your mind today?" +4. User describes situation +5. AI uses CBT techniques: + - Identify thoughts + - Challenge distortions + - Reframe perspective +6. Session summary with takeaways +7. Option to save insights +``` + +### 3.4 Journaling Flow + +``` +1. User taps "New Journal Entry" +2. Daily prompt shown (optional) +3. User writes freely +4. Mood tag added automatically +5. Optional: Add photo +6. Tap "Save" (encrypted immediately) +7. Entry visible in history +8. AI analysis available (if opted in) +``` + +--- + +## 4. Content Library + +### 4.1 Meditation Themes + +| Theme | MVP Count | P1 Count | +|-------|-----------|----------| +| Stress Relief | 5 | 20 | +| Sleep | 5 | 20 | +| Focus | 3 | 15 | +| Anxiety | 4 | 15 | +| Gratitude | 3 | 15 | +| Body Scan | 2 | 10 | +| Morning | 2 | 10 | +| **Total** | **24** | **105** | + +### 4.2 Breathing Techniques + +| Technique | Duration Options | Difficulty | +|-----------|-----------------|------------| +| Box Breathing | 2, 5, 10 min | Beginner | +| 4-7-8 | 2, 5, 10 min | Beginner | +| Calming | 2, 5 min | Beginner | +| Energizing | 2 min | Intermediate | +| Sleep | 5, 10 min | Beginner | + +### 4.3 Sleep Content + +| Type | MVP Count | +|------|-----------| +| Sleep Stories | 5 | +| Sleep Meditations | 5 | +| Ambient Sounds | 6 | + +--- + +## 5. Cross-Module Integration + +### 5.1 Sends to Fitness + +| Data | Usage | +|------|-------| +| Stress level | Adjust workout intensity | +| Sleep quality | Suggest rest vs workout | +| Recent anxiety | Consider lighter exercise | + +### 5.2 Sends to Life Coach + +| Data | Usage | +|------|-------| +| Mood | Daily plan adjustments | +| Meditation completed | Update plan | +| Journal sentiment | AI coach context | + +### 5.3 Cross-Module Insights + +| Trigger | Insight | +|---------|---------| +| High stress detected | "Consider 5-min breathing exercise" | +| Mood trending down | "Your mood improves 40% after workouts" | +| Poor sleep + stress | "Evening meditation may help sleep" | + +--- + +## 6. Technical Notes + +### Database Tables + +```sql +-- Drift (SQLite) tables +mood_logs (id, user_id, mood, stress, note, triggers_json, created_at) +meditation_sessions (id, user_id, meditation_id, duration, completed_at) +meditation_favorites (id, user_id, meditation_id) +meditation_downloads (id, user_id, meditation_id, file_path, size) +journal_entries (id, user_id, content_encrypted, mood, created_at) +mental_health_screenings (id, user_id, type, score, answers_json, created_at) +breathing_sessions (id, user_id, technique, duration, created_at) +``` + +### E2E Encryption (Journals) + +```dart +// Client-side encryption using user's key +final encryptedContent = AES256GCM.encrypt( + plaintext: journalContent, + key: userDerivedKey, // From user password + nonce: randomNonce, +); +// Server never sees plaintext +``` + +### Performance Requirements + +| Metric | Target | +|--------|--------| +| Meditation Start | <100ms | +| Audio Buffering | <500ms | +| Mood Entry Save | <200ms | +| Journal Encrypt/Save | <500ms | +| Screening Calculate | <100ms | + +### Offline Support + +| Feature | Offline? | +|---------|----------| +| Mood tracking | βœ… | +| Downloaded meditations | βœ… | +| Breathing exercises | βœ… | +| Journal writing | βœ… | +| CBT chat | ❌ (requires AI) | +| New meditation browse | ❌ | + +--- + +## PowiΔ…zane Dokumenty + +- [PRD-overview.md](./PRD-overview.md) - PrzeglΔ…d produktu +- [ARCH-security.md](../architecture/ARCH-security.md) - E2E encryption details +- [epic-4-mind.md](../../2-MANAGEMENT/epics/epic-4-mind.md) - Mind module stories +- [mind-module.md](../../3-ARCHITECTURE/system-design/mind-module.md) - Technical design + +--- + +*FR47-FR76 | 30 Functional Requirements | ~40% implemented* diff --git a/docs/1-BASELINE/product/PRD-nfr.md b/docs/1-BASELINE/product/PRD-nfr.md new file mode 100644 index 0000000..4d97ce6 --- /dev/null +++ b/docs/1-BASELINE/product/PRD-nfr.md @@ -0,0 +1,365 @@ +# Non-Functional Requirements (NFR) + + + +**Wersja:** 2.0 +**Status:** βœ… 37 NFRs zdefiniowanych + +--- + +## Spis TreΕ›ci + +1. [Performance](#1-performance) +2. [Security](#2-security) +3. [Scalability](#3-scalability) +4. [Integration](#4-integration) +5. [Accessibility](#5-accessibility) +6. [Reliability](#6-reliability) +7. [Compliance](#7-compliance) +8. [Monitoring](#8-monitoring) +9. [NFR Summary](#9-nfr-summary) + +--- + +## 1. Performance + +### NFR-P1: App Responsiveness + +| Metric | Target | +|--------|--------| +| Cold start time | <2s (p95) | +| Hot start time | <500ms (p95) | +| Screen transitions | <300ms | +| Button tap response | <100ms | + +### NFR-P2: Smart Pattern Memory Query + +| Metric | Target | +|--------|--------| +| Pre-fill last workout | <500ms p95 | +| Exercise search | <200ms after typing | +| Workout history load (90d) | <1s | + +**Rationale:** Smart Pattern Memory is killer feature - must be instant. + +### NFR-P3: AI Response Times + +| Model | Target | Acceptable | +|-------|--------|------------| +| Llama (self-hosted) | <2s p95 | <3s | +| Claude API | <3s p95 | <4s | +| GPT-4 API | <4s p95 | <5s | +| Timeout | 10s | Show retry option | + +### NFR-P4: Offline Performance + +| Feature | Requirement | +|---------|-------------| +| Fitness logging | 100% offline | +| Mood tracking | 100% offline | +| Cached meditation | <100ms to start | +| Data sync on reconnect | <5s typical | + +### NFR-P5: App Size & Memory + +| Metric | Target | +|--------|--------| +| Initial download | <50MB | +| Memory (background) | <150MB | +| Memory (active) | <250MB | +| Meditation cache | <100MB total | + +--- + +## 2. Security + +### NFR-S1: Data Encryption + +| Data Type | Encryption | +|-----------|------------| +| Journal entries | E2EE (AES-256-GCM) | +| Mental health assessments | E2EE (AES-256-GCM) | +| Passwords | bcrypt (Supabase Auth) | +| Data in transit | HTTPS/TLS 1.3 | +| Data at rest | AES-256 (Supabase) | + +### NFR-S2: Authentication & Sessions + +| Aspect | Requirement | +|--------|-------------| +| Session expiration | 30 days inactivity | +| Password requirements | Min 8 chars, 1 uppercase, 1 number, 1 special | +| Social auth | OAuth 2.0 (Google, Apple) | +| MFA | P1 (email-based 2FA) | + +### NFR-S3: GDPR Compliance + +| Right | Implementation | +|-------|----------------| +| Right to access | Export all data (JSON + CSV) | +| Right to deletion | Delete within 7 days | +| Data retention | Purge 30 days after deletion | +| Privacy policy | Clear, visible, GDPR-compliant | + +### NFR-S4: Vulnerability Protection + +| Protection | Implementation | +|------------|----------------| +| API rate limiting | 100 req/min per user | +| SQL injection | Supabase RLS policies | +| XSS | Input sanitization | +| Security audits | Quarterly (P1) | + +### NFR-S5: Privacy + +| Principle | Implementation | +|-----------|----------------| +| No data selling | Never sell to third parties | +| AI analysis | Opt-in only for journal sentiment | +| Analytics | Anonymous only (no PII) | +| Third-party SDKs | Minimal (Supabase, Firebase, Sentry) | + +--- + +## 3. Scalability + +### NFR-SC1: User Capacity + +| Year | Target Users | Database | +|------|--------------|----------| +| Year 1 | 5,000 active | PostgreSQL (Supabase) | +| Year 2 | 25,000 active | Same, vertical scaling | +| Year 3 | 75,000 active | Same, scales to 100k+ | + +### NFR-SC2: API Scalability + +| Service | Limit | +|---------|-------| +| Supabase API | 10,000 req/sec | +| Supabase Realtime | 10,000 concurrent | +| AI calls (Free) | 3-5/day/user | +| AI calls (Standard) | 20-30/day/user | +| AI calls (Premium) | Unlimited (soft cap 200/day) | + +### NFR-SC3: Data Storage + +| Metric | Estimate | +|--------|----------| +| Per-user storage | 50MB/year | +| Year 3 total (75k users) | 3.75TB | +| Supabase cost | ~$79/month | + +### NFR-SC4: Cost Management + +| Category | Target % of Revenue | +|----------|---------------------| +| AI costs | <30% | +| Infrastructure | <20% | +| Total COGS | <50% | + +--- + +## 4. Integration + +### NFR-I1: Wearable Integration (P1) + +| Platform | Data | +|----------|------| +| Apple Health | Sleep, HRV, steps, workouts | +| Google Fit | Sleep, steps, workouts | +| Sync frequency | Every app open + 1x/hour background | +| Fallback | Manual entry | + +### NFR-I2: Export Integrations + +| Format | Data | +|--------|------| +| CSV | Workouts, measurements | +| JSON + PDF | Journal entries | +| ZIP (GDPR) | All user data | + +### NFR-I3: Third-Party APIs + +| Provider | Fallback | +|----------|----------| +| OpenAI | Degrade to Claude | +| Anthropic | Degrade to Llama | +| Self-hosted Llama | Always available | +| API versioning | Pin to stable, test before upgrade | + +--- + +## 5. Accessibility + +### NFR-A1: Screen Reader Support + +| Platform | Support Level | +|----------|---------------| +| iOS VoiceOver | Full core flows | +| Android TalkBack | Full core flows | +| Semantic labels | All interactive elements | +| Tab order | Logical navigation | + +### NFR-A2: Visual Accessibility + +| Standard | Requirement | +|----------|-------------| +| Color contrast | WCAG AA (4.5:1 body, 3:1 large) | +| Text scaling | Up to 200% system font | +| Dark mode | P1 | + +### NFR-A3: Motor Accessibility + +| Aspect | Requirement | +|--------|-------------| +| Touch targets | Min 44x44pt (iOS) / 48x48dp (Android) | +| Time-based interactions | None required | + +### NFR-A4: Language Support + +| Language | Status | +|----------|--------| +| English (EN-US, EN-GB) | MVP | +| Polish (PL) | MVP | +| German, Spanish, French | P1 | + +--- + +## 6. Reliability + +### NFR-R1: Uptime + +| Metric | Target | +|--------|--------| +| Uptime | 99.5% (43h downtime/year) | +| Supabase SLA | 99.9% | +| Maintenance window | 2-5am UK/Poland | + +### NFR-R2: Error Handling + +| Aspect | Requirement | +|--------|-------------| +| Crash rate | <0.5% | +| Error tracking | Sentry (backend) | +| User-facing errors | Clear, actionable, no jargon | +| Graceful degradation | Offline mode, cached responses | + +### NFR-R3: Data Integrity + +| Aspect | Implementation | +|--------|----------------| +| Sync conflicts | Last-write-wins | +| Data validation | Server-side for all writes | +| Backups | Daily automated | +| Disaster recovery | Point-in-time to 7 days | + +--- + +## 7. Compliance + +### NFR-C1: GDPR (EU) + +| Requirement | Implementation | +|-------------|----------------| +| DPA | Signed with Supabase | +| Privacy policy | Prominently displayed | +| Consent | Opt-in analytics | +| User rights | Access, rectify, delete, port | + +### NFR-C2: App Store Compliance + +| Store | Requirements | +|-------|--------------| +| iOS | App Store Guidelines 2025 | +| Android | Play Developer Policies | +| Privacy labels | Accurate data disclosure | +| IAP | Platform guidelines (30%/15%) | + +### NFR-C3: Content Rating + +| Rating | Justification | +|--------|---------------| +| PEGI 12+ / ESRB Teen | Mental health content | +| No gambling | βœ… | +| No violence | βœ… | + +### NFR-C4: Mental Health Disclaimer + +| Requirement | Implementation | +|-------------|----------------| +| Disclaimer | "Not replacement for professional care" | +| Crisis resources | UK: 116 123, Poland: 116 123 | +| High-risk thresholds | GAD-7 >15, PHQ-9 >20 | +| Professional help | Recommend at moderate-severe | + +--- + +## 8. Monitoring + +### NFR-M1: Analytics Events + +| Category | Events | +|----------|--------| +| User behavior | workout_logged, meditation_completed, goal_set | +| Retention | DAU, WAU, MAU, D1/D3/D7/D30 | +| Conversion | free_to_paid_funnel | +| Performance | screen_load_time, api_response_time | + +### NFR-M2: Crash & Error Monitoring + +| Tool | Purpose | +|------|---------| +| Firebase Crashlytics | iOS + Android crashes | +| Sentry | Backend errors (Edge Functions) | +| Alert threshold | >1% crash rate β†’ page dev | + +### NFR-M3: Business Metrics Dashboard + +| Metric | Frequency | +|--------|-----------| +| MRR, ARR | Daily | +| Churn rate | Weekly | +| CAC, LTV, LTV:CAC | Monthly | +| Subscription distribution | Daily | +| AI cost per user | Weekly | + +--- + +## 9. NFR Summary + +### By Category + +| Category | Count | +|----------|-------| +| Performance | 5 | +| Security | 5 | +| Scalability | 4 | +| Integration | 3 | +| Accessibility | 4 | +| Reliability | 3 | +| Compliance | 4 | +| Monitoring | 3 | +| **TOTAL** | **37** | + +### Critical NFRs (Must Have for MVP) + +| NFR | Reason | +|-----|--------| +| NFR-P2 | Smart Pattern Memory is killer feature | +| NFR-P4 | Offline-first is core architecture | +| NFR-S1 | E2EE for mental health data | +| NFR-S3 | GDPR compliance (EU market) | +| NFR-C4 | Mental health safety | +| NFR-R2 | <0.5% crash rate | + +--- + +## PowiΔ…zane Dokumenty + +- [PRD-overview.md](./PRD-overview.md) - PrzeglΔ…d produktu +- [ARCH-security.md](../architecture/ARCH-security.md) - Security architecture +- [ARCH-database-schema.md](../architecture/ARCH-database-schema.md) - Database schema + +--- + +*37 Non-Functional Requirements | Performance, Security, Scalability, Accessibility, Reliability, Compliance* diff --git a/docs/1-BASELINE/product/PRD-overview.md b/docs/1-BASELINE/product/PRD-overview.md new file mode 100644 index 0000000..a6e22f7 --- /dev/null +++ b/docs/1-BASELINE/product/PRD-overview.md @@ -0,0 +1,370 @@ +# LifeOS - Product Requirements Document - Overview + + + +**Wersja:** 2.0 (BMAD Reorganized) +**Data:** 2025-01-16 +**Status:** βœ… Zatwierdzona do implementacji + +--- + +## Spis TreΕ›ci + +1. [Executive Summary](#1-executive-summary) +2. [Klasyfikacja Projektu](#2-klasyfikacja-projektu) +3. [Success Criteria](#3-success-criteria) +4. [Product Scope - MVP](#4-product-scope---mvp) +5. [Pricing Model](#5-pricing-model) +6. [Mobile Requirements](#6-mobile-requirements) +7. [UX Principles](#7-ux-principles) +8. [PowiΔ…zane Dokumenty](#8-powiΔ…zane-dokumenty) + +--- + +## 1. Executive Summary + +**LifeOS** to pierwszy na Ε›wiecie modularny ekosystem AI-powered life coaching, Ε‚Δ…czΔ…cy: +- **Fitness Coach** - tracking treningΓ³w, Smart Pattern Memory +- **Life Coach** - daily planning, goals, AI chat +- **Mind & Emotion** - meditation, mood tracking, CBT + +### Killer Feature: Cross-Module Intelligence + +Jedyna aplikacja gdzie moduΕ‚y komunikujΔ… siΔ™ ze sobΔ…: +- Fitness dostosowuje intensywnoΕ›Δ‡ treningu na podstawie stresu z Mind +- Life Coach sugeruje medytacjΔ™ gdy spada jakoΕ›Δ‡ snu +- Mind rekomenduje rest day gdy volume treningowy jest wysoki +- AI widzi peΕ‚ny kontekst: sen + stres + nastrΓ³j + treningi + cele + +**Ε»aden konkurent nie ma tej funkcjonalnoΕ›ci.** Calm oferuje tylko medytacjΔ™. Noom tylko coaching. Freeletics tylko fitness. LifeOS Ε‚Δ…czy wszystko z 60-70% oszczΔ™dnoΕ›ciami kosztΓ³w. + +--- + +## 2. Klasyfikacja Projektu + +| Aspekt | WartoΕ›Δ‡ | +|--------|---------| +| **Technical Type** | Mobile App (iOS + Android) | +| **Domain** | General Wellness | +| **Complexity** | Low (brak wymogΓ³w regulatory FDA/HIPAA) | + +### Technology Stack + +| Komponent | Technologia | +|-----------|-------------| +| **Framework** | Flutter 3.38+ (cross-platform) | +| **Platforms** | iOS 14+, Android 10+ | +| **State Management** | Riverpod 3.0 | +| **Local Database** | Drift (SQLite) - offline-first | +| **Backend** | Supabase (PostgreSQL) | +| **Real-time Sync** | Supabase Realtime | +| **AI** | Hybrid (Llama/Claude/GPT-4) | + +### Architectural Pattern + +**Modular Monolith:** +- Single app z moduΕ‚ami jako features +- WspΓ³lny core platform (auth, data sync, AI orchestration) +- ModuΕ‚y mogΔ… byΔ‡ wΕ‚Δ…czane/wyΕ‚Δ…czane przez subscriptions + +### Target Market + +| Aspekt | WartoΕ›Δ‡ | +|--------|---------| +| **Primary Markets** | UK + Poland | +| **Expansion** | EU β†’ Global | +| **Target Users** | 22-45 lat, professionals, wellness enthusiasts | +| **TAM** | $23.99B (Wellness + Life Coaching + Mental Health) | +| **UK + Poland SAM** | $235M | + +--- + +## 3. Success Criteria + +### North Star Metric + +**Day 30 Retention: 10-12%** (3x industry average 3.3%) + +**Dlaczego ten metric?** +- Retention = product-market fit validation +- Industry average dla wellness apps: 3.3% +- Noom (najlepszy): ~8% +- **LifeOS target: 10-12%** + +### Jak osiΔ…gniemy 10-12% retention + +| Driver | Mechanizm | +|--------|-----------| +| **Smart Pattern Memory** | Instant value, saves 5 min/workout | +| **Streak Mechanics** | Bronze (7d), Silver (30d), Gold (100d) + 1 freeze/week | +| **Daily Check-ins** | Morning/evening ritual builds habit | +| **Cross-Module Insights** | "Your best lifts happen after 8+ hours sleep" | +| **Weekly Reports** | Concrete evidence ("+5kg squat, stress -23%") | + +### Success Milestones + +| Milestone | Timeframe | GO Criteria | NO-GO | +|-----------|-----------|-------------|-------| +| **MVP Validation** | Month 3 | Retention β‰₯5%, Rating β‰₯4.3, CAC ≀£15, 500-1k downloads | Retention <3% β†’ pivot | +| **UK Expansion** | Month 6 | Retention β‰₯8%, Conversion β‰₯3%, MRR +10% MoM, NPS β‰₯40 | Retention <5% β†’ reassess | +| **P1 Features** | Month 12 | Retention β‰₯10%, Conversion β‰₯5%, MRR β‰₯Β£3k | Social features fail | +| **AI Investment** | Month 18 | Conversion β‰₯7%, ARR β‰₯Β£100k, NPS β‰₯50, AI costs <30% | AI doesn't improve conversion 2%+ | + +### Business Metrics + +| Metric | Year 1 | Year 2 | Year 3 | +|--------|--------|--------|--------| +| **ARR** | Β£15k | Β£75k | Β£225k | +| **Downloads** | 5,000 | 25,000 | 75,000 | +| **Conversion** | 5% | 6% | 7% | + +### Unit Economics + +| Metric | Target | +|--------|--------| +| **ARPU** | Β£40-50/year | +| **CAC** | <Β£30 (organic primary) | +| **LTV** | Β£80-100 (2-year retention) | +| **LTV:CAC** | >3:1 | + +### Quality Metrics + +| Metric | Target | +|--------|--------| +| **App Store Rating** | 4.5+ | +| **NPS** | 50+ | +| **Crash Rate** | <0.5% | +| **Smart Pattern Query** | <500ms p95 | +| **AI Response (Llama)** | <2s p95 | +| **AI Response (Claude/GPT-4)** | <3s p95 | + +--- + +## 4. Product Scope - MVP + +### ModuΕ‚ 1: Life Coach (FREE Tier) + +**Core Value:** Daily plan + goal tracking + AI chat + +| Feature | Opis | +|---------|------| +| Daily Plan | Considering sleep, stress, mood, workouts | +| Goal Tracking | Max 3 goals (free tier) | +| Morning/Evening Check-ins | Mood, energy, sleep quality | +| AI Conversations | 3-5/day z Llama | +| Progress Tracking | Basic charts | +| Habit Streaks | Freeze mechanics (1/week) | +| Push Notifications | Reminders, insights | + +### ModuΕ‚ 2: Fitness Coach (2.99 EUR/month) + +**Core Value:** Smart Pattern Memory + workout tracking + +| Feature | Opis | +|---------|------| +| **Smart Pattern Memory** | Pre-fills last workout (KILLER FEATURE) | +| Manual Workout Logging | Fast UX, 2-second log | +| Exercise Library | 500+ exercises | +| Progress Charts | Weight, volume, PRs (FREE!) | +| Workout Templates | 20+ pre-built | +| Body Measurements | Weight, body fat, photos | +| Workout History | Full history | +| Rest Timer | Between sets | +| Custom Templates | User-created | +| Export Data | CSV format | +| **Cross-Module** | Receives stress from Mind | + +### ModuΕ‚ 3: Mind & Emotion (2.99 EUR/month) + +**Core Value:** Meditation + mood tracking + CBT chat + +| Feature | Opis | +|---------|------| +| Guided Meditations | 20-30 MVP (5/10/15/20 min) | +| Themes | Stress, Sleep, Focus, Anxiety, Gratitude | +| Breathing Exercises | 5 techniques (Box, 4-7-8, etc.) | +| Mood Tracking | Always FREE (1-5 scale + emoji) | +| Stress Tracking | Shared with Fitness & Life Coach | +| CBT Chat with AI | 1/day free, unlimited premium | +| Journaling | E2E encrypted, AI insights | +| Sleep Meditations | 10-30 min stories | +| Mental Health Screening | GAD-7, PHQ-9 | +| Gratitude Exercises | "3 Good Things" | +| **Cross-Module** | Shares mood/stress, receives suggestions | + +### MVP Success Criteria + +| Metric | Target | +|--------|--------| +| Day 30 Retention | β‰₯5% | +| Downloads | 500-1,000 (UK + Poland) | +| App Store Rating | β‰₯4.3 | +| Cross-Module Insights | 1+/week for 50%+ paid users | + +--- + +## 5. Pricing Model + +### Modular Pricing (MVP) + +| Tier | Price | Features | +|------|-------|----------| +| **FREE** | 0 EUR | Life Coach basic | +| **Single Module** | 2.99 EUR/month | Fitness OR Mind | +| **3-Module Pack** | 5.00 EUR/month | Life Coach + Fitness + Mind | +| **Full Access** | 7.00 EUR/month | All + Premium AI (GPT-4 unlimited) | + +### Competitive Advantage + +| Competitor Stack | Cost/Year | LifeOS Equivalent | +|------------------|-----------|-------------------| +| Calm + Headspace + Noom + Strong | Β£320 | Β£60 (3-Module Pack) | +| **Savings** | - | **60-70%** | + +### Key Differentiators + +1. **Cross-Module Intelligence** - 12-18 month lead time for competitors +2. **Modular Pricing** - Pay only for what you need +3. **Hybrid AI** - User choice (Llama/Claude/GPT-4) with 30% cost budget +4. **60-70% Cost Savings** - vs multi-app stack +5. **Genuine Free Tier** - Life Coach always free (not crippled trial) + +--- + +## 6. Mobile Requirements + +### Platform Requirements + +| Platform | Min Version | Coverage | +|----------|-------------|----------| +| **iOS** | 14+ | 95% iOS users | +| **Android** | 10+ (API 29) | 90% Android users | + +### Target Devices + +- iPhones: iPhone 8+ +- iPads: iPad Air 3+ (responsive) +- Android Phones: 5.5" - 6.7" +- Android Tablets: 7" - 10" (lower priority) + +### Performance Targets + +| Metric | Target | +|--------|--------| +| **App Size** | <50MB initial | +| **Cold Start** | <2s | +| **Hot Start** | <500ms | +| **Memory (background)** | <150MB | +| **Memory (active)** | <250MB | + +### Permissions + +**Required (MVP):** +- Internet access (AI chat, sync) +- Local storage (offline-first) +- Push notifications (reminders, alerts) + +**Optional:** +- Camera (P3 - body photos, form check) +- Health data (P1 - Apple Health, Google Fit) +- Microphone (P2 - voice AI) +- Location (P2 - outdoor workouts) + +### Offline Mode + +| Module | Offline Support | +|--------|-----------------| +| **Fitness** | 100% offline (Drift/SQLite) | +| **Mind** | Partial (cached audio, mood tracking) | +| **Life Coach** | Hybrid (check-ins offline, AI requires internet) | + +--- + +## 7. UX Principles + +### Visual Personality + +**Design Inspiration:** Nike + Headspace fusion +- Nike: Bold, energetic, motivational (Fitness) +- Headspace: Calm, friendly, approachable (Mind) +- Hybrid: Professional yet warm, data-driven yet empathetic + +### Color Palette + +| Color | Hex | Usage | +|-------|-----|-------| +| **Primary** | #1E3A8A | Deep Blue - trust, stability | +| **Accent 1** | #14B8A6 | Energetic Teal - energy, growth | +| **Accent 2** | #F97316 | Orange - motivation (Fitness) | +| **Accent 3** | #9333EA | Purple - mindfulness (Mind) | +| **Neutrals** | #F9FAFB β†’ #111827 | Gray scale | + +### Key Interaction Patterns + +| Pattern | Goal | Implementation | +|---------|------|----------------| +| **Fast Workout Logging** | <2s per set | Smart Pattern Memory pre-fill | +| **Calming Meditation Start** | 1 tap start | "Continue" or AI-recommended | +| **Morning Check-in** | 1-minute | 3 quick taps: Mood, Energy, Sleep | +| **Cross-Module Insights** | Non-intrusive | 1 card/day max, swipeable | +| **Streak Celebration** | Reinforce habit | Full-screen confetti, badges | + +### Navigation + +**Bottom Tab Bar:** +1. Home (Life Coach) - Daily plan, goals, check-ins +2. Fitness - Workout logging, progress, templates +3. Mind - Meditation, mood tracking, journaling +4. Profile - Settings, subscription, stats, export + +--- + +## 8. PowiΔ…zane Dokumenty + +### Requirements (SzczegΓ³Ε‚y) + +| Dokument | ZawartoΕ›Δ‡ | +|----------|-----------| +| [PRD-fitness-requirements.md](./PRD-fitness-requirements.md) | FR30-FR46: Fitness module | +| [PRD-life-coach-requirements.md](./PRD-life-coach-requirements.md) | FR6-FR29: Life Coach module | +| [PRD-mind-requirements.md](./PRD-mind-requirements.md) | FR47-FR76: Mind module | +| [PRD-nfr.md](./PRD-nfr.md) | NFR1-NFR37: Non-functional requirements | + +### Architecture + +| Dokument | ZawartoΕ›Δ‡ | +|----------|-----------| +| [ARCH-overview.md](../architecture/ARCH-overview.md) | PrzeglΔ…d architektury | +| [ARCH-database-schema.md](../architecture/ARCH-database-schema.md) | Schemat bazy danych | + +### Epics & Stories + +| Dokument | ZawartoΕ›Δ‡ | +|----------|-----------| +| [epic-1-core-platform.md](../../2-MANAGEMENT/epics/epic-1-core-platform.md) | Core Platform stories | +| [epic-2-life-coach.md](../../2-MANAGEMENT/epics/epic-2-life-coach.md) | Life Coach stories | +| [epic-3-fitness.md](../../2-MANAGEMENT/epics/epic-3-fitness.md) | Fitness stories | +| [epic-4-mind.md](../../2-MANAGEMENT/epics/epic-4-mind.md) | Mind stories | + +--- + +## FR Coverage Summary + +| Category | FRs | Count | +|----------|-----|-------| +| Account & Auth | FR1-FR5 | 5 | +| Life Coach | FR6-FR29 | 24 | +| Fitness | FR30-FR46 | 17 | +| Mind | FR47-FR76 | 30 | +| Cross-Module Intel | FR77-FR84 | 8 | +| Gamification | FR85-FR90 | 6 | +| Subscriptions | FR91-FR97 | 7 | +| Data & Privacy | FR98-FR103 | 6 | +| Notifications | FR104-FR110 | 7 | +| Onboarding | FR111-FR115 | 5 | +| Settings | FR116-FR123 | 8 | +| **TOTAL** | | **123 FRs** | + +--- + +*Dokument stworzony przez BMAD Methodology - reorganizacja 2025-12-02* diff --git a/docs/2-MANAGEMENT/MVP-AUDIT-REPORT.md b/docs/2-MANAGEMENT/MVP-AUDIT-REPORT.md new file mode 100644 index 0000000..aceabb6 --- /dev/null +++ b/docs/2-MANAGEMENT/MVP-AUDIT-REPORT.md @@ -0,0 +1,332 @@ +# MVP Audit Report: Documentation vs Code + + + +**Data audytu:** 2025-12-02 +**Autor:** Claude AI +**Cel:** Identyfikacja rozbieΕΌnoΕ›ci miΔ™dzy dokumentacjΔ… a rzeczywistym stanem kodu + +--- + +## Executive Summary + +| Metric | Dokumentacja | Kod | RozbieΕΌnoΕ›Δ‡ | +|--------|-------------|-----|-------------| +| Overall Progress | ~66% | **~45%** | -21% | +| Epic 1 (Core) | 90% | **85%** | -5% | +| Epic 2 (Life Coach) | 75% | **70%** | -5% | +| Epic 3 (Fitness) | 82% | **90%** | +8% | +| Epic 4 (Mind) | 40% | **15%** | -25% | +| Epic 5 (CMI) | 25% | **10%** | -15% | +| Epic 6 (Gamification) | 30% | **5%** | -25% | +| Epic 7 (Onboarding) | 80% | **5%** | -75% | +| Epic 8 (Notifications) | 0% | **0%** | 0% | +| Epic 9 (Settings) | 80% | **30%** | -50% | + +**Kluczowy wniosek:** Dokumentacja znaczΔ…co przeszacowuje postΔ™p w Epic 4, 6, 7, 9. + +--- + +## SzczegΓ³Ε‚owa Analiza per Epic + +### EPIC 1: Core Platform Foundation + +| Story | Doc Status | Code Status | Uwagi | +|-------|------------|-------------|-------| +| 1.1 Account Creation | βœ… Done | βœ… **DONE** | Supabase Auth dziaΕ‚a | +| 1.2 Login & Session | βœ… Done | βœ… **DONE** | Email + OAuth prepared | +| 1.3 Password Reset | βœ… Done | ⚠️ **PARTIAL** | TODO w kodzie: `// TODO: Implement password reset flow` | +| 1.4 User Profile | βœ… Done | βœ… **DONE** | Profile editing works | +| 1.5 Data Sync | βœ… Done | ⚠️ **PARTIAL** | SyncQueue table exists, logika NIE zaimplementowana | +| 1.6 GDPR | βœ… Done | βœ… **DONE** | Export/Delete use cases exist | + +**Rzeczywisty status: 70%** (nie 90%) + +**Braki:** +- [ ] Password Reset flow - nie dziaΕ‚a deep link +- [ ] Data Sync - SyncQueue jest, ale sync service nie wywoΕ‚uje + +--- + +### EPIC 2: Life Coach MVP + +| Story | Doc Status | Code Status | Uwagi | +|-------|------------|-------------|-------| +| 2.1 Morning Check-in | βœ… Done | βœ… **DONE** | morning_check_in_page.dart (104 lines) | +| 2.2 AI Daily Plan | βœ… Done | βœ… **DONE** | daily_plan_generator.dart + prompts | +| 2.3 Goal Creation | βœ… Done | ⚠️ **MOCK** | `MockGoalsRepository` throws UnimplementedError | +| 2.4 AI Chat | βœ… Done | ❌ **STUB** | ChatSessions table exists, UI NIE istnieje | +| 2.5 Evening Reflection | βœ… Done | βœ… **DONE** | evening_reflection_page.dart (98 lines) | +| 2.6 Streak Tracking | βœ… Done | ⚠️ **PARTIAL** | Streaks table exists, UI minimal | +| 2.7 Progress Dashboard | πŸ”„ In Progress | ⚠️ **STUB** | progress_dashboard_page.dart (137 lines) - basic | +| 2.8 Manual Adjustment | πŸ”„ In Progress | βœ… **DONE** | daily_plan_edit_page.dart (339 lines) | +| 2.9 Goal Suggestions | ⏳ Planned | ❌ **NOT STARTED** | - | +| 2.10 Weekly Summary | ⏳ Planned | ❌ **NOT STARTED** | - | + +**Rzeczywisty status: 55%** (nie 75%) + +**Krytyczne braki:** +- [ ] AI Chat UI - brak `coach_chat_page.dart` +- [ ] Goals uΕΌywa MockRepository - MUSI byΔ‡ zamienione na prawdziwe +- [ ] Weekly Summary - nie istnieje + +**NiezgodnoΕ›ci logiczne:** +1. Story 2.4 "AI Chat" oznaczone jako Done, ale w kodzie NIE MA UI dla chat +2. Story 2.3 "Goals" oznaczone jako Done, ale uΕΌywa Mock ktΓ³ry rzuca bΕ‚Δ™dy + +--- + +### EPIC 3: Fitness Coach MVP + +| Story | Doc Status | Code Status | Uwagi | +|-------|------------|-------------|-------| +| 3.1 Smart Pattern Memory | βœ… Done | βœ… **DONE** | SmartPrefillProvider dziaΕ‚a | +| 3.2 Exercise Library | βœ… Done | ⚠️ **STUB** | UI exists, brak persistence | +| 3.3 Workout Logging | βœ… Done | βœ… **DONE** | workout_logging_page.dart (270 lines) | +| 3.4 History View | βœ… Done | βœ… **DONE** | workout_log_page.dart (456 lines) | +| 3.5 Progress Charts | βœ… Done | βœ… **DONE** | FitnessChartsProvider + fl_chart | +| 3.6 Body Measurements | βœ… Done | βœ… **DONE** | measurements_page.dart (159 lines) | +| 3.7 Templates | πŸ”„ In Progress | βœ… **DONE** | templates_page.dart (96 lines) | +| 3.8 Quick Log | πŸ”„ In Progress | βœ… **DONE** | quick_log_page.dart (125 lines) | +| 3.9 Exercise Instructions | ⏳ Planned | ❌ **NOT STARTED** | - | +| 3.10 Cross-Module Stress | ⏳ Planned | ❌ **NOT STARTED** | - | + +**Rzeczywisty status: 75%** (dokumentacja mΓ³wi 82%) + +**Braki:** +- [ ] Exercise Library - brak Drift table, brak persistence +- [ ] Exercise Instructions - nie istnieje +- [ ] Cross-module integration - nie istnieje + +**Pozytywne rozbieΕΌnoΕ›ci:** +- Templates i Quick Log sΔ… bardziej zaawansowane niΕΌ dokumentacja sugeruje + +--- + +### EPIC 4: Mind & Emotion MVP + +| Story | Doc Status | Code Status | Uwagi | +|-------|------------|-------------|-------| +| 4.1 Meditation Library | πŸ”„ In Progress | ⚠️ **UI ONLY** | meditation_library_screen.dart - bez playera | +| 4.2 Meditation Player | βœ… Done | ❌ **NOT DONE** | BRAK meditation_player_screen.dart | +| 4.3 Mood Tracking | βœ… Done | ⚠️ **PARTIAL** | MoodLogs table exists, UI unclear | +| 4.4 CBT Chat | ⏳ Planned | ❌ **NOT STARTED** | - | +| 4.5 E2E Journaling | ⏳ Planned | ❌ **NOT STARTED** | - | +| 4.6 Mental Health Screening | βœ… Done | ⚠️ **TABLE ONLY** | MentalHealthScreenings table, brak UI | +| 4.7 Breathing Exercises | ⏳ Planned | ❌ **NOT STARTED** | - | +| 4.8 Sleep Meditations | ⏳ Planned | ❌ **NOT STARTED** | - | +| 4.9 Gratitude | ⏳ Planned | ❌ **NOT STARTED** | - | +| 4.10 AI Recommendations | ⏳ Planned | ❌ **NOT STARTED** | - | +| 4.11 Mood-Workout Insights | ⏳ Planned | ❌ **NOT STARTED** | - | +| 4.12 Cross-Module Sharing | ⏳ Planned | ❌ **NOT STARTED** | - | + +**Rzeczywisty status: 10%** (dokumentacja mΓ³wi 40%) + +**KRYTYCZNY PROBLEM:** +- Story 4.2 "Meditation Player" oznaczone jako βœ… Done, ale **NIE ISTNIEJE** +- `just_audio` dependency dodane, ale nie uΕΌywane +- CaΕ‚y moduΕ‚ to praktycznie scaffold + +**Braki do MVP:** +- [ ] Meditation Player (KRYTYCZNE) +- [ ] Mood Tracking UI +- [ ] Breathing Exercises +- [ ] Meditation content (placeholder OK) + +--- + +### EPIC 5: Cross-Module Intelligence + +| Story | Doc Status | Code Status | Uwagi | +|-------|------------|-------------|-------| +| 5.1 Insight Engine | πŸ”„ In Progress | ⚠️ **TABLE ONLY** | user_daily_metrics + detected_patterns tables exist | +| 5.2 Insight Card UI | ⏳ Planned | ❌ **NOT STARTED** | - | +| 5.3 Stressβ†’Light Workout | ⏳ Planned | ❌ **NOT STARTED** | - | +| 5.4 Sleepβ†’Afternoon | ⏳ Planned | ❌ **NOT STARTED** | - | +| 5.5 Sleep-Performance | ⏳ Planned | ❌ **NOT STARTED** | - | + +**Rzeczywisty status: 5%** (dokumentacja mΓ³wi 25%) + +**Uwagi:** +- Database schema jest, ale logika pattern detection nie +- To jest P1 dla MVP, nie P0 + +--- + +### EPIC 6: Gamification & Retention + +| Story | Doc Status | Code Status | Uwagi | +|-------|------------|-------------|-------| +| 6.1 Streak Tracking | πŸ”„ In Progress | ⚠️ **TABLE ONLY** | Streaks table exists, UI minimal | +| 6.2 Milestone Badges | πŸ”„ In Progress | ❌ **NOT STARTED** | - | +| 6.3 Streak Break Alerts | ⏳ Planned | ❌ **NOT STARTED** | - | +| 6.4 Celebration Animations | ⏳ Planned | ❌ **NOT STARTED** | Lottie dependency jest | +| 6.5 Shareable Cards | ⏳ Planned | ❌ **NOT STARTED** | - | +| 6.6 Weekly Summary | ⏳ Planned | ❌ **NOT STARTED** | - | + +**Rzeczywisty status: 5%** (nie 30%) + +--- + +### EPIC 7: Onboarding & Subscriptions + +| Story | Doc Status | Code Status | Uwagi | +|-------|------------|-------------|-------| +| 7.1 Onboarding Journey | βœ… Complete | ❌ **PLACEHOLDER** | `OnboardingPlaceholder` w routerze | +| 7.2 Initial Goals | βœ… Complete | ❌ **NOT STARTED** | - | +| 7.3 Permissions Tutorial | βœ… Complete | ❌ **NOT STARTED** | - | +| 7.4 Free Tier | βœ… Complete | ⚠️ **PARTIAL** | Subscriptions table, brak tier checks | +| 7.5 14-Day Trial | βœ… Complete | ❌ **NOT STARTED** | - | +| 7.6 IAP Subscription | βœ… Complete | ❌ **NOT STARTED** | in_app_purchase dependency, nie zintegrowane | +| 7.7 Cancel & Degradation | βœ… Complete | ❌ **NOT STARTED** | - | + +**Rzeczywisty status: 5%** (dokumentacja mΓ³wi 80%!) + +**KRYTYCZNY PROBLEM:** +- Wszystkie 7 stories oznaczone jako "Complete" +- W rzeczywistoΕ›ci jest tylko **placeholder w routerze** +- IAP nie zintegrowane + +--- + +### EPIC 8: Notifications & Engagement + +| Story | Doc Status | Code Status | Uwagi | +|-------|------------|-------------|-------| +| 8.1-8.5 | Not Started | ❌ **NOT STARTED** | Firebase disabled, FCM nie skonfigurowane | + +**Rzeczywisty status: 0%** (zgodne z dokumentacjΔ…) + +--- + +### EPIC 9: Settings & Profile + +| Story | Doc Status | Code Status | Uwagi | +|-------|------------|-------------|-------| +| 9.1 Personal Settings | βœ… Complete | ⚠️ **PARTIAL** | Profile editing dziaΕ‚a | +| 9.2 Notification Prefs | βœ… Complete | ❌ **NOT STARTED** | Brak UI | +| 9.3 Unit Preferences | βœ… Complete | ❌ **NOT STARTED** | Brak UI | +| 9.4 Subscription Mgmt | βœ… Complete | ❌ **NOT STARTED** | Brak UI | +| 9.5 Data Privacy | βœ… Complete | ⚠️ **PARTIAL** | data_privacy_page.dart exists | + +**Rzeczywisty status: 25%** (dokumentacja mΓ³wi 80%) + +--- + +## NiezgodnoΕ›ci Logiczne + +### 1. Mock Repositories w "Production" +```dart +// lib/features/life_coach/goals/data/ +MockGoalsRepository // Throws UnimplementedError +MockCheckInRepository // Throws UnimplementedError +MockPreferencesRepository // Returns sample data +``` +**Problem:** Stories oznaczone jako "Done" uΕΌywajΔ… mockΓ³w ktΓ³re crashujΔ… app. + +### 2. Hardcoded User IDs +```dart +// meditation_providers.dart +userId: 'current_user_id' // TODO: Get from auth +UserTier: UserTier.premium // TODO: Get from subscription +``` +**Problem:** Brak integracji z auth provider. + +### 3. Story 4.2 "Meditation Player" = βœ… Done +**RzeczywistoΕ›Δ‡:** Plik `meditation_player_screen.dart` NIE ISTNIEJE. +`just_audio` dependency jest, ale nie jest uΕΌywana. + +### 4. Epic 7 - Wszystkie stories "Complete" +**RzeczywistoΕ›Δ‡:** W kodzie jest `OnboardingPlaceholder` z tekstem: +```dart +Text('Onboarding Flow - To be implemented in Epic 7') +``` + +### 5. Data Sync "Done" vs SyncQueue +**RzeczywistoΕ›Δ‡:** SyncQueue table istnieje, ale: +- Brak SyncManager service +- Brak logic do wysyΕ‚ania queue do Supabase +- Brak conflict resolution + +--- + +## Rekomendowany Scope MVP + +### MVP 1.0 (Realistic) + +**Core Module:** +- [x] Auth (email) - DONE +- [x] Profile management - DONE +- [ ] Fix password reset - 2h +- [ ] Fix mock repositories - 4h + +**Life Coach:** +- [x] Daily Plan AI generation - DONE +- [x] Morning/Evening check-ins - DONE +- [x] Daily plan editing - DONE +- [ ] Goals z prawdziwym repo - 4h +- [ ] AI Chat UI - 8h (opcjonalne dla MVP) + +**Fitness:** +- [x] Smart Pattern Memory - DONE +- [x] Workout logging - DONE +- [x] Progress charts - DONE +- [x] Body measurements - DONE +- [x] Templates - DONE +- [ ] Exercise Library persistence - 4h + +**Mind (Simplified):** +- [ ] Mood tracking UI - 4h +- [ ] Meditation player - 8h +- [ ] Placeholder meditations - 2h +- [ ] Breathing exercises - 6h + +**Deferred to MVP 1.1:** +- Onboarding flow (users can start without it) +- IAP/Subscriptions (users get full access initially) +- Push notifications +- Cross-Module Intelligence +- Weekly Reports +- Social sharing + +--- + +## Estimated Hours to MVP 1.0 + +| Task | Hours | +|------|-------| +| Fix mock repos | 4h | +| Fix hardcoded IDs | 2h | +| Goals real repo | 4h | +| Exercise library persistence | 4h | +| Mood tracking UI | 4h | +| Meditation player | 8h | +| Breathing exercises | 6h | +| Polish & testing | 8h | +| **TOTAL** | **40h** | + +--- + +## Action Items + +### Immediate (P0) +1. ❌ ZamieΕ„ MockGoalsRepository na prawdziwΔ… implementacjΔ™ +2. ❌ ZamieΕ„ MockCheckInRepository na prawdziwΔ… implementacjΔ™ +3. ❌ Fix hardcoded user IDs β†’ inject from auth provider +4. ❌ Zaktualizuj dokumentacjΔ™ project-status.md + +### Short-term (P1) +5. ❌ Exercise Library - dodaj Drift persistence +6. ❌ Meditation Player - implementuj z just_audio +7. ❌ Mood Tracking - dodaj UI +8. ❌ Breathing Exercises - podstawowe 5 technik + +### Deferred (P2) +9. ❌ Onboarding flow +10. ❌ IAP integration +11. ❌ Push notifications +12. ❌ CMI insights + +--- + +*Raport wygenerowany automatycznie przez Claude AI* diff --git a/docs/2-MANAGEMENT/MVP-SCOPE-ANALYSIS.md b/docs/2-MANAGEMENT/MVP-SCOPE-ANALYSIS.md new file mode 100644 index 0000000..1f8c820 --- /dev/null +++ b/docs/2-MANAGEMENT/MVP-SCOPE-ANALYSIS.md @@ -0,0 +1,293 @@ +# MVP 1.0 Scope Analysis - SzczegΓ³Ε‚owa Weryfikacja + + + +**Data:** 2025-12-02 +**Cel:** Weryfikacja logiki, taskΓ³w i zaΕ‚oΕΌeΕ„ przed implementacjΔ… + +--- + +## KOREKTA DO AUDYTU + +Po gΕ‚Δ™bszej analizie kodu, znalazΕ‚em ΕΌe **poprzedni audit byΕ‚ czΔ™Ε›ciowo bΕ‚Δ™dny**: + +| Element | Poprzedni Audit | RzeczywistoΕ›Δ‡ | +|---------|-----------------|---------------| +| GoalsRepository | "Mock" | βœ… **REAL** - `GoalsRepositoryImpl` z Drift | +| CheckInRepository | "Mock" | βœ… **REAL** - `CheckInRepositoryImpl` z Drift | +| Coach Chat Page | "Nie istnieje" | βœ… **ISTNIEJE** - peΕ‚ny UI z messagingiem | +| Meditation Player | "Nie istnieje" | ❌ **Potwierdzone** - NIE istnieje | + +**PRAWDZIWY problem:** Konflikt providerΓ³w (szczegΓ³Ε‚y poniΕΌej) + +--- + +## KRYTYCZNY PROBLEM: Konflikt ProviderΓ³w + +### Opis problemu + +Mamy **DWA pliki** definiujΔ…ce te same providery z **RΓ“Ε»NYMI implementacjami**: + +**Plik 1:** `lib/features/life_coach/presentation/providers/goals_provider.dart` +```dart +@riverpod +GoalsRepository goalsRepository(Ref ref) { + return GoalsRepositoryImpl(database); // βœ… REAL +} +``` + +**Plik 2:** `lib/features/life_coach/ai/providers/daily_plan_provider.dart` +```dart +@riverpod +GoalsRepository goalsRepository(Ref ref) { + return MockGoalsRepository(); // ❌ MOCK +} +``` + +### Konsekwencje + +| Screen | UΕΌywa | Implementacja | +|--------|-------|---------------| +| Goals List | `goals_provider.dart` | βœ… Real (Drift) | +| Create Goal | `goals_provider.dart` | βœ… Real (Drift) | +| Daily Plan Generator | `daily_plan_provider.dart` | ❌ Mock | +| Morning Check-in | `check_in_provider.dart` | βœ… Real (Drift) | + +**Efekt:** Daily Plan AI generator NIE widzi prawdziwych celΓ³w uΕΌytkownika! + +### Fix wymagany +```dart +// W daily_plan_provider.dart - zamieΕ„: +@riverpod +GoalsRepository goalsRepository(Ref ref) { + return MockGoalsRepository(); +} + +// Na: +@riverpod +GoalsRepository dpGoalsRepository(Ref ref) { + final database = ref.watch(appDatabaseProvider); + return GoalsRepositoryImpl(database); +} +``` + +--- + +## ANALIZA PER EPIC DLA MVP 1.0 + +### EPIC 1: Core Platform + +| Story | Doc Status | Code Status | Uwagi | +|-------|------------|-------------|-------| +| 1.1 Account Creation | βœ… Done | βœ… **DONE** | Supabase Auth | +| 1.2 Login & Session | βœ… Done | βœ… **DONE** | Email + OAuth prepared | +| 1.3 Password Reset | βœ… Done | ⚠️ **PARTIAL** | Deep link nie testowany | +| 1.4 User Profile | βœ… Done | βœ… **DONE** | Profile editing | +| 1.5 Data Sync | βœ… Done | ⚠️ **PARTIAL** | Queue jest, logic nie | +| 1.6 GDPR | βœ… Done | βœ… **DONE** | Export/Delete | + +**Rzeczywisty status:** 80% (lepiej niΕΌ poprzednio szacowaΕ‚em) + +**Taski MVP:** +- [ ] Test password reset deep link +- [ ] Ewentualnie: Sync logic (moΕΌe byΔ‡ deferred) + +--- + +### EPIC 2: Life Coach + +| Story | Doc Status | Code Status | Uwagi | +|-------|------------|-------------|-------| +| 2.1 Morning Check-in | βœ… Done | βœ… **DONE** | UI + Real repo | +| 2.2 AI Daily Plan | βœ… Done | ⚠️ **USES MOCK** | Generator dziaΕ‚a, ale z mock goals | +| 2.3 Goal Creation | βœ… Done | βœ… **DONE** | Real repository | +| 2.4 AI Chat | βœ… Done | βœ… **DONE** | UI istnieje! | +| 2.5 Evening Reflection | βœ… Done | βœ… **DONE** | UI + Real repo | +| 2.6 Streak Tracking | βœ… Done | ⚠️ **LOGIC ONLY** | Brak UI, logika w repo | +| 2.7 Progress Dashboard | πŸ”„ | ⚠️ **BASIC** | Podstawowy UI | +| 2.8 Manual Adjustment | πŸ”„ | βœ… **DONE** | Drag & drop | + +**Rzeczywisty status:** 75% + +**Taski MVP:** +- [ ] **P0:** Fix provider conflict (zamieΕ„ Mockβ†’Real w daily_plan_provider) +- [ ] P1: Streak UI na Home screen +- [ ] P2: Progress dashboard improvements + +--- + +### EPIC 3: Fitness + +| Story | Doc Status | Code Status | Uwagi | +|-------|------------|-------------|-------| +| 3.1 Smart Pattern Memory | βœ… Done | βœ… **DONE** | Provider + logic | +| 3.2 Exercise Library | βœ… Done | ⚠️ **UI ONLY** | Brak Drift persistence | +| 3.3 Workout Logging | βœ… Done | βœ… **DONE** | Full implementation | +| 3.4 History View | βœ… Done | βœ… **DONE** | List + detail | +| 3.5 Progress Charts | βœ… Done | βœ… **DONE** | fl_chart integrated | +| 3.6 Body Measurements | βœ… Done | βœ… **DONE** | Full CRUD | +| 3.7 Templates | πŸ”„ | βœ… **DONE** | Full CRUD | +| 3.8 Quick Log | πŸ”„ | βœ… **DONE** | Working | + +**Rzeczywisty status:** 90% (najlepszy moduΕ‚!) + +**Taski MVP:** +- [ ] P1: Exercise Library persistence (Drift tables) +- [ ] P2: Exercise instructions (moΕΌe byΔ‡ deferred) + +--- + +### EPIC 4: Mind & Emotion + +| Story | Doc Status | Code Status | Uwagi | +|-------|------------|-------------|-------| +| 4.1 Meditation Library | πŸ”„ | βœ… **DONE** | UI complete | +| 4.2 Meditation Player | βœ… Done | ❌ **NOT DONE** | NIE ISTNIEJE | +| 4.3 Mood Tracking | βœ… Done | ⚠️ **IN CHECK-IN** | Jest w morning check-in | + +**Rzeczywisty status:** 25% + +**Taski MVP:** +- [ ] **P0:** Meditation Player screen +- [ ] P1: Standalone Mood tracking UI (opcjonalne - jest w check-in) +- [ ] P1: Breathing exercises + +--- + +## PYTANIA DO CIEBIE + +### 1. Mood Tracking Location + +**Obecna sytuacja:** Mood i stress tracking jest **WBUDOWANY** w Morning Check-in: +```dart +// morning_check_in_page.dart +- Rate mood (1-5 emoji slider) +- Rate energy (1-5 emoji slider) +- Rate sleep quality (1-5 emoji slider) +``` + +**Pytanie:** Czy potrzebujemy DODATKOWEGO standalone mood tracking w Mind module? +- **Opcja A:** Wystarczy w check-in (szybciej) +- **Opcja B:** Dodatkowy ekran w Mind (wiΔ™cej pracy, ~4h) + +--- + +### 2. Breathing Exercises Scope + +**Dokumentacja mΓ³wi:** 5 technik (Box, 4-7-8, Calming, Energizing, Sleep) + +**Pytanie:** Czy dla MVP wystarczΔ… 2-3 techniki? +- Box Breathing (najpopularniejsza) +- 4-7-8 (do snu) +- Calming (na stres) + +PozostaΕ‚e moΕΌna dodaΔ‡ w 1.1. + +--- + +### 3. Meditation Content + +**Pytanie:** SkΔ…d weΕΊmiemy audio dla medytacji MVP? +- **Opcja A:** Placeholder z free ambient sounds (np. freesound.org) +- **Opcja B:** Tylko timer bez audio (silent meditation) +- **Opcja C:** Masz juΕΌ content? + +--- + +### 4. Exercise Library - 500 exercises + +**Dokumentacja mΓ³wi:** 500+ exercises + +**Pytanie:** SkΔ…d majΔ… pochodziΔ‡ dane Δ‡wiczeΕ„? +- **Opcja A:** Hardcoded JSON file (quick) +- **Opcja B:** API zewnΔ™trzne (wger.de API?) +- **Opcja C:** Masz juΕΌ bazΔ™ danych Δ‡wiczeΕ„? + +Dla MVP wystarczy ~50-100 Δ‡wiczeΕ„. + +--- + +### 5. AI Chat - API Keys + +**Pytanie:** Czy AI Chat powinien dziaΕ‚aΔ‡ w MVP bez kluczy API? +- **Opcja A:** WyΕ‚Δ…czyΔ‡ chat do czasu kluczy +- **Opcja B:** Mock responses (placeholder) +- **Opcja C:** UΕΌyΔ‡ free LLM (np. local Llama via Ollama) + +--- + +### 6. Offline Mode + +**Pytanie:** Jak waΕΌny jest offline mode dla MVP? + +**Obecna sytuacja:** +- Drift DB dziaΕ‚a offline βœ… +- SyncQueue table istnieje βœ… +- Sync logic NIE zaimplementowana ❌ + +**Opcje:** +- **A:** MVP bez sync (dziaΕ‚a offline, ale bez sync do cloud) +- **B:** Basic sync (upload tylko, bez conflict resolution) +- **C:** Full sync (wiΔ™cej pracy, ~8-10h) + +--- + +## PROPONOWANA KOLEJNOΕšΔ† TASKΓ“W + +### Phase 0: Fixes (4h) +1. **Fix provider conflict** (1h) - KRYTYCZNE +2. Test password reset (1h) +3. Fix hardcoded user IDs w meditation_providers (1h) +4. Verify all providers use real repos (1h) + +### Phase 1: Mind Module (16h) +1. **Meditation Player** (8h) + - Player screen z just_audio + - Play/pause/seek + - Background playback + - Session completion tracking + +2. **Breathing Exercises** (6h) + - 3 techniki (Box, 4-7-8, Calming) + - Animated circle + - Timer z fazami + +3. **Placeholder meditations** (2h) + - 5-10 entries w DB + - Free ambient audio + +### Phase 2: Improvements (8h) +1. Exercise Library persistence (4h) +2. Streak UI na Home (2h) +3. Polish & testing (2h) + +**Total: ~28h** (mniej niΕΌ wczeΕ›niejsze 48h po korekcie audytu) + +--- + +## ZAŁOΕ»ENIA + +1. **API Keys** - nie sΔ… potrzebne dla MVP (mock responses OK) +2. **Meditation content** - placeholdery wystarczΔ… +3. **Exercise library** - 50-100 Δ‡wiczeΕ„ wystarczy +4. **Sync** - offline-first bez cloud sync dla MVP +5. **Onboarding** - skip dla MVP +6. **IAP** - skip dla MVP (free access) + +--- + +## DECISION LOG + +| Decyzja | Status | Notes | +|---------|--------|-------| +| Mood tracking location | ❓ PENDING | Czy w check-in wystarczy? | +| Breathing exercises count | ❓ PENDING | 3 vs 5 technik | +| Meditation audio source | ❓ PENDING | Placeholder vs content | +| Exercise data source | ❓ PENDING | JSON vs API | +| AI Chat w/o API keys | ❓ PENDING | Mock vs disable | +| Offline sync | ❓ PENDING | None vs basic | + +--- + +*Analiza utworzona: 2025-12-02* +*Czekam na odpowiedzi przed implementacjΔ…* diff --git a/docs/2-MANAGEMENT/MVP-TODO.md b/docs/2-MANAGEMENT/MVP-TODO.md new file mode 100644 index 0000000..8b0774a --- /dev/null +++ b/docs/2-MANAGEMENT/MVP-TODO.md @@ -0,0 +1,329 @@ +# MVP TODO List - Master Backlog + + + +**Utworzono:** 2025-12-02 +**Cel:** MVP 1.0 - dziaΕ‚ajΔ…ca aplikacja bez pΕ‚atnoΕ›ci +**Szacowany czas:** ~48h + +--- + +## Legenda + +- ❌ Not Started +- πŸ”„ In Progress +- βœ… Done +- 🚫 Blocked +- ⏸️ Deferred + +--- + +## PHASE 1: Critical Fixes (P0) + +### 1.1 Replace Mock Repositories +**Priority:** P0 | **Est:** 6h | **Status:** ❌ + +| Task | File | Status | +|------|------|--------| +| Replace MockGoalsRepository | `lib/features/life_coach/goals/data/` | ❌ | +| Replace MockCheckInRepository | `lib/features/life_coach/check_in/data/` | ❌ | +| Replace MockPreferencesRepository | `lib/features/life_coach/` | ❌ | + +**Acceptance Criteria:** +- [ ] GoalsRepository queries Drift database +- [ ] CheckInRepository queries Drift database +- [ ] PreferencesRepository queries user_settings table +- [ ] No `UnimplementedError` thrown + +--- + +### 1.2 Fix Hardcoded User IDs +**Priority:** P0 | **Est:** 2h | **Status:** ❌ + +| Task | File | Status | +|------|------|--------| +| Inject userId from auth | `meditation_providers.dart` | ❌ | +| Inject UserTier from subscription | `meditation_providers.dart` | ❌ | +| Review all providers for hardcoding | `lib/features/**/*_provider*.dart` | ❌ | + +**Pattern to apply:** +```dart +// BEFORE +userId: 'current_user_id' // TODO + +// AFTER +final authState = ref.watch(authStateProvider); +final userId = authState.user?.id ?? ''; +``` + +--- + +### 1.3 Exercise Library Persistence +**Priority:** P0 | **Est:** 4h | **Status:** ❌ + +| Task | Status | +|------|--------| +| Create Exercises Drift table | ❌ | +| Create ExerciseFavorites Drift table | ❌ | +| Implement ExerciseRepository with Drift | ❌ | +| Connect UI to repository | ❌ | +| Save custom exercises to DB | ❌ | +| Toggle favorites with persistence | ❌ | + +--- + +## PHASE 2: Life Coach Completion (P1) + +### 2.1 Goals Real Implementation +**Priority:** P1 | **Est:** 4h | **Status:** ❌ + +| Task | Status | +|------|--------| +| GoalsRepositoryImpl with Drift | ❌ | +| CRUD operations | ❌ | +| Progress tracking | ❌ | +| Goals limit (3 free, unlimited premium) | ❌ | +| Archive/complete goals | ❌ | + +--- + +### 2.2 AI Chat UI (Optional for MVP) +**Priority:** P1 | **Est:** 8h | **Status:** ❌ + +| Task | Status | +|------|--------| +| Create `coach_chat_page.dart` | ❌ | +| Message input widget | ❌ | +| Message list widget | ❌ | +| AI response integration | ❌ | +| Chat history persistence | ❌ | +| Typing indicator | ❌ | + +**Note:** MoΕΌna pominΔ…Δ‡ dla MVP 1.0, Daily Plan wystarczy. + +--- + +### 2.3 Streak UI Enhancement +**Priority:** P1 | **Est:** 3h | **Status:** ❌ + +| Task | Status | +|------|--------| +| Streak card na Home | ❌ | +| Progress bar to milestone | ❌ | +| Current/longest streak display | ❌ | + +--- + +## PHASE 3: Mind Module (P1) + +### 3.1 Meditation Player +**Priority:** P1 | **Est:** 8h | **Status:** ❌ + +| Task | Status | +|------|--------| +| Create `meditation_player_screen.dart` | ❌ | +| Integrate `just_audio` package | ❌ | +| Play/pause/seek controls | ❌ | +| Progress bar | ❌ | +| Background playback | ❌ | +| Session completion tracking | ❌ | +| Breathing animation (optional) | ❌ | + +**Dependencies:** +- `just_audio: ^0.9.36` (already in pubspec) + +--- + +### 3.2 Mood Tracking UI +**Priority:** P1 | **Est:** 4h | **Status:** ❌ + +| Task | Status | +|------|--------| +| Create `mood_tracking_page.dart` | ❌ | +| Mood slider (1-5 with emojis) | ❌ | +| Stress slider (1-5) | ❌ | +| Notes field | ❌ | +| Save to MoodLogs table | ❌ | +| History view | ❌ | +| Simple trend chart | ❌ | + +--- + +### 3.3 Breathing Exercises +**Priority:** P1 | **Est:** 6h | **Status:** ❌ + +| Task | Status | +|------|--------| +| Create `breathing_exercise_page.dart` | ❌ | +| Breathing animation (circle expand/contract) | ❌ | +| 5 techniques: Box, 4-7-8, Calming, Energizing, Sleep | ❌ | +| Timer with phases | ❌ | +| Haptic feedback | ❌ | +| Duration selector (1-10 min) | ❌ | + +--- + +### 3.4 Placeholder Meditations +**Priority:** P1 | **Est:** 2h | **Status:** ❌ + +| Task | Status | +|------|--------| +| Create 5 placeholder meditation entries | ❌ | +| Use free ambient sounds (URL or local) | ❌ | +| Categories: Stress, Sleep, Focus, Anxiety, Gratitude | ❌ | +| 5min, 10min, 15min durations | ❌ | + +--- + +## PHASE 4: Polish & Testing (P1) + +### 4.1 Core Fixes +**Priority:** P1 | **Est:** 4h | **Status:** ❌ + +| Task | Status | +|------|--------| +| Password reset deep link | ❌ | +| Error handling improvements | ❌ | +| Loading states consistency | ❌ | +| Empty states design | ❌ | + +--- + +### 4.2 Navigation & UX +**Priority:** P1 | **Est:** 3h | **Status:** ❌ + +| Task | Status | +|------|--------| +| Bottom navigation consistency | ❌ | +| Back button handling | ❌ | +| Deep links testing | ❌ | +| Splash screen | ❌ | + +--- + +### 4.3 Testing +**Priority:** P1 | **Est:** 8h | **Status:** ❌ + +| Task | Status | +|------|--------| +| Unit tests for repositories | ❌ | +| Widget tests for critical screens | ❌ | +| Integration test: Auth flow | ❌ | +| Integration test: Workout logging | ❌ | +| Integration test: Daily plan | ❌ | + +--- + +## DEFERRED TO MVP 1.1 (P2) + +### Onboarding Flow +| Task | Status | +|------|--------| +| Welcome screen | ⏸️ | +| Journey selection | ⏸️ | +| Initial goals | ⏸️ | +| AI personality choice | ⏸️ | +| Permissions | ⏸️ | +| Tutorial | ⏸️ | + +--- + +### In-App Purchases +| Task | Status | +|------|--------| +| RevenueCat/Stripe integration | ⏸️ | +| Subscription tiers | ⏸️ | +| Trial logic | ⏸️ | +| Graceful degradation | ⏸️ | + +--- + +### Push Notifications +| Task | Status | +|------|--------| +| Firebase re-enable | ⏸️ | +| FCM setup | ⏸️ | +| Device token storage | ⏸️ | +| Daily reminders | ⏸️ | +| Streak alerts | ⏸️ | + +--- + +### Cross-Module Intelligence +| Task | Status | +|------|--------| +| Pattern detection algorithm | ⏸️ | +| AI insight generation | ⏸️ | +| Insight cards UI | ⏸️ | +| CMI Dashboard | ⏸️ | + +--- + +### Advanced Features +| Task | Status | +|------|--------| +| CBT Chat | ⏸️ | +| E2E Encrypted Journaling | ⏸️ | +| Mental Health Screenings UI | ⏸️ | +| Weekly Summary Reports | ⏸️ | +| Social Sharing | ⏸️ | +| Badge System | ⏸️ | + +--- + +## Implementation Order + +``` +Week 1: PHASE 1 (Critical Fixes) +β”œβ”€β”€ 1.1 Replace Mock Repositories +β”œβ”€β”€ 1.2 Fix Hardcoded IDs +└── 1.3 Exercise Library Persistence + +Week 2: PHASE 2 + 3 (Features) +β”œβ”€β”€ 2.1 Goals Real Implementation +β”œβ”€β”€ 3.1 Meditation Player +β”œβ”€β”€ 3.2 Mood Tracking UI +└── 3.3 Breathing Exercises + +Week 3: PHASE 4 (Polish) +β”œβ”€β”€ 3.4 Placeholder Meditations +β”œβ”€β”€ 4.1 Core Fixes +β”œβ”€β”€ 4.2 Navigation & UX +└── 4.3 Testing +``` + +--- + +## Definition of Done (MVP 1.0) + +- [ ] User can register/login with email +- [ ] User can log workouts with Smart Pattern Memory +- [ ] User can view progress charts +- [ ] User can generate AI daily plans +- [ ] User can complete morning/evening check-ins +- [ ] User can create/track goals (real DB) +- [ ] User can track mood/stress +- [ ] User can play meditation (placeholder content) +- [ ] User can do breathing exercises +- [ ] No crashes from Mock repositories +- [ ] All hardcoded IDs replaced +- [ ] Basic test coverage (>50%) + +--- + +## Notes + +### Gdy zaczynasz task: +1. ZmieΕ„ status na πŸ”„ +2. StwΓ³rz branch: `feature/task-name` +3. Po zakoΕ„czeniu: PR + merge + +### Gdy koΕ„czysz task: +1. ZmieΕ„ status na βœ… +2. Zaktualizuj ten plik +3. Commit z referencjΔ… do task ID + +--- + +*Master TODO utworzone: 2025-12-02* +*NastΔ™pna aktualizacja: Po kaΕΌdym zakoΕ„czonym PHASE* diff --git a/docs/2-MANAGEMENT/README.md b/docs/2-MANAGEMENT/README.md new file mode 100644 index 0000000..3a52a1b --- /dev/null +++ b/docs/2-MANAGEMENT/README.md @@ -0,0 +1,35 @@ +# 2-MANAGEMENT - ZarzΔ…dzanie Projektem + + + +**Opis:** Status projektu, epiki, sprinty, raporty. + +--- + +## ZawartoΕ›Δ‡ + +### Root +- [project-status.md](project-status.md) - **Aktualny status projektu** + +### epics/ - User Stories per Epic +- [epic-1-core-platform.md](epics/epic-1-core-platform.md) - Core Platform (Auth, Sync) +- [epic-2-life-coach.md](epics/epic-2-life-coach.md) - Life Coach MVP +- [epic-3-fitness.md](epics/epic-3-fitness.md) - Fitness Coach MVP +- [epic-4-mind.md](epics/epic-4-mind.md) - Mind & Emotion MVP +- [epic-5-cross-module.md](epics/epic-5-cross-module.md) - Cross-Module Intelligence + +### backlog/ - Sprint Summaries +- Sprint summaries (TBD) + +### reports/ - Audits & Status +- Audit reports (TBD) + +--- + +## Kiedy czytaΔ‡? + +| Cel | Plik | +|-----|------| +| Co jest do zrobienia? | project-status.md | +| Stories dla moduΕ‚u | epics/epic-N-*.md | +| Historia sprintΓ³w | backlog/ | diff --git a/docs/2-MANAGEMENT/epics/epic-1-core-platform.md b/docs/2-MANAGEMENT/epics/epic-1-core-platform.md new file mode 100644 index 0000000..c78d071 --- /dev/null +++ b/docs/2-MANAGEMENT/epics/epic-1-core-platform.md @@ -0,0 +1,194 @@ +# Epic 1: Core Platform Foundation + + + +**Epic ID:** EPIC-1 +**Status:** βœ… ~90% Complete +**Priority:** P0 (MVP Critical) +**Stories:** 6 + +--- + +## Overview + +| Aspect | Value | +|--------|-------| +| **Goal** | Establish core auth, data sync, and GDPR compliance foundation | +| **Value** | Users can create accounts, log in securely, sync data across devices | +| **FRs Covered** | FR1-FR5 (Auth), FR98-FR103 (Data & Privacy) | +| **Dependencies** | None (foundation epic) | +| **Sprint** | Sprint 1 | + +--- + +## User Stories + +| ID | Story | Points | Status | Sprint | +|----|-------|--------|--------|--------| +| 1.1 | User Account Creation | 5 | βœ… Done | 1 | +| 1.2 | User Login & Session Management | 3 | βœ… Done | 1 | +| 1.3 | Password Reset Flow | 3 | βœ… Done | 1 | +| 1.4 | User Profile Management | 5 | βœ… Done | 1 | +| 1.5 | Data Sync Across Devices | 8 | βœ… Done | 1 | +| 1.6 | GDPR Compliance (Export & Deletion) | 5 | βœ… Done | 1 | + +**Total Points:** 29 + +--- + +## Story Details + +### Story 1.1: User Account Creation + +**As a** new user +**I want** to create an account using email or social authentication +**So that** I can start using LifeOS and have my data synced + +**Acceptance Criteria:** +1. Register with email + password (min 8 chars, 1 uppercase, 1 number, 1 special) +2. Register with Google OAuth 2.0 (Android + iOS) +3. Register with Apple Sign-In (iOS) +4. Email verification sent (expires 24h) +5. User profile created with defaults +6. Redirect to onboarding after success +7. Error handling: Email exists, invalid format, weak password +8. Supabase Auth integration working + +**Technical Notes:** +- Supabase Auth (email + social providers) +- PostgreSQL user table with RLS +- Flutter Supabase SDK + +--- + +### Story 1.2: User Login & Session Management + +**As a** returning user +**I want** to log in securely and stay logged in +**So that** I don't re-authenticate every app open + +**Acceptance Criteria:** +1. Login with email + password +2. Login with Google OAuth 2.0 +3. Login with Apple Sign-In +4. Session persists 30 days +5. Auto-login on app restart if valid +6. Manual logout clears session +7. Error handling: Invalid credentials, not verified +8. "Remember me" option + +**Technical Notes:** +- Session token in flutter_secure_storage +- Auto-refresh before expiration + +--- + +### Story 1.3: Password Reset Flow + +**As a** user who forgot password +**I want** to reset via email +**So that** I can regain access + +**Acceptance Criteria:** +1. Request reset from login screen +2. Email with reset link (expires 1h) +3. Deep link opens password change screen +4. New password validation +5. Auto-login after success +6. Old password invalidated +7. Error handling: Email not found, link expired + +--- + +### Story 1.4: User Profile Management + +**As a** user +**I want** to update my profile +**So that** my account reflects current details + +**Acceptance Criteria:** +1. Update name +2. Update email (requires re-verification) +3. Update avatar (upload from gallery/camera) +4. Change password (requires current password) +5. Changes synced across devices +6. Avatar upload to Supabase Storage (max 5MB) +7. Error handling + +--- + +### Story 1.5: Data Sync Across Devices + +**As a** user with multiple devices +**I want** my data synced in real-time +**So that** I can seamlessly switch devices + +**Acceptance Criteria:** +1. Workout data synced (<5s latency) +2. Mood logs synced +3. Goals synced +4. Meditation progress synced +5. Offline sync (queued, synced when online) +6. Conflict resolution: Last-write-wins +7. Sync status indicator + +**Technical Notes:** +- Supabase Realtime subscriptions +- Drift (SQLite) for offline-first +- Sync queue for offline writes + +--- + +### Story 1.6: GDPR Compliance + +**As a** user concerned about privacy +**I want** to export or delete my data +**So that** I comply with GDPR rights + +**Acceptance Criteria:** +1. Request data export from Profile β†’ Data & Privacy +2. Export generates ZIP (JSON + CSV) +3. Includes: workouts, mood, goals, meditations, journals, account +4. Download link via email (expires 7 days) +5. Request account deletion (password required) +6. Deletion removes all data within 7 days +7. Irreversible warning shown +8. Purge from backups after 30 days + +--- + +## Definition of Done + +- [x] All stories implemented +- [x] Unit tests >80% coverage +- [x] Integration tests passing +- [x] Auth flows work on iOS + Android +- [x] Offline sync working +- [x] GDPR export/delete functional +- [x] RLS policies verified + +--- + +## Technical Decisions + +| Decision | Choice | +|----------|--------| +| Auth Provider | Supabase Auth | +| Session Storage | flutter_secure_storage | +| Offline DB | Drift (SQLite) | +| Sync | Supabase Realtime + Queue | +| Conflict Resolution | Last-write-wins | + +--- + +## Dependencies + +| Dependency | Status | +|------------|--------| +| Supabase project setup | βœ… | +| Flutter SDK 3.38+ | βœ… | +| Database migrations | βœ… | + +--- + +**Source:** `docs/ecosystem/epics.md` (lines 44-264) diff --git a/docs/2-MANAGEMENT/epics/epic-2-life-coach.md b/docs/2-MANAGEMENT/epics/epic-2-life-coach.md new file mode 100644 index 0000000..511fd6a --- /dev/null +++ b/docs/2-MANAGEMENT/epics/epic-2-life-coach.md @@ -0,0 +1,209 @@ +# Epic 2: Life Coach MVP + + + +**Epic ID:** EPIC-2 +**Status:** πŸ”„ ~75% Complete +**Priority:** P0 (MVP Critical) +**Stories:** 10 + +--- + +## Overview + +| Aspect | Value | +|--------|-------| +| **Goal** | Deliver AI-powered daily planning, goal tracking, check-ins, and AI coaching | +| **Value** | Users can plan their day, track goals, complete rituals, chat with AI | +| **FRs Covered** | FR6-FR29 (Life Coach module) | +| **Dependencies** | Epic 1 (auth, data sync) | +| **Sprint** | Sprint 2 | + +--- + +## User Stories + +| ID | Story | Points | Status | Sprint | +|----|-------|--------|--------|--------| +| 2.1 | Morning Check-in Flow | 5 | βœ… Done | 2 | +| 2.2 | AI Daily Plan Generation | 8 | βœ… Done | 2 | +| 2.3 | Goal Creation & Tracking | 5 | βœ… Done | 2 | +| 2.4 | AI Conversational Coaching | 8 | βœ… Done | 2 | +| 2.5 | Evening Reflection Flow | 5 | βœ… Done | 2 | +| 2.6 | Streak Tracking (Check-ins) | 5 | βœ… Done | 2 | +| 2.7 | Progress Dashboard | 5 | πŸ”„ In Progress | 2 | +| 2.8 | Daily Plan Manual Adjustment | 3 | πŸ”„ In Progress | 2 | +| 2.9 | Goal Suggestions (AI) | 5 | ⏳ Planned | 3 | +| 2.10 | Weekly Summary Report | 5 | ⏳ Planned | 3 | + +**Total Points:** 54 | **Completed:** 41 + +--- + +## Story Details + +### Story 2.1: Morning Check-in Flow + +**As a** user starting my day +**I want** to complete a quick morning check-in +**So that** AI can generate a personalized daily plan + +**Acceptance Criteria:** +1. Modal appears on first app open (if not done today) +2. Rate mood (1-5 emoji slider) +3. Rate energy (1-5 emoji slider) +4. Rate sleep quality (1-5 emoji slider) +5. Optional note field +6. Haptic feedback on selection +7. "Generate My Plan" CTA triggers AI +8. "Skip for today" option +9. Saves to database +10. Accessible: VoiceOver reads emoji values + +**Target:** <60 seconds completion + +--- + +### Story 2.2: AI Daily Plan Generation + +**As a** user who completed morning check-in +**I want** AI to generate a personalized daily plan +**So that** I know what to focus on today + +**Acceptance Criteria:** +1. AI analyzes: mood, energy, sleep, stress, workouts +2. Generates 5-8 tasks/suggestions +3. Considers user's goals +4. Adapts to mood (high energy = more tasks) +5. Shows insight ("Your sleep was good!") +6. Saves to database +7. Items can be marked complete +8. Model based on tier (Free: Llama, Premium: GPT-4) +9. Timeout handling with fallback plan + +--- + +### Story 2.3: Goal Creation & Tracking + +**As a** user with personal goals +**I want** to create and track up to 3 goals (free) +**So that** I can measure progress + +**Acceptance Criteria:** +1. Create goals from Goals screen +2. Fields: Title, Category, Target date, Description +3. Free: Max 3, Premium: Unlimited +4. Progress tracked (0-100%) +5. Mark as completed (celebration) +6. Archive or delete +7. Goals shown on Home tab +8. AI daily plan references goals + +--- + +### Story 2.4: AI Conversational Coaching + +**As a** user needing motivation +**I want** to chat with AI life coach +**So that** I get personalized guidance + +**Acceptance Criteria:** +1. Chat from Home β†’ "Chat with AI" +2. Send text messages +3. AI responds with advice/encouragement +4. AI has context (goals, mood, activity) +5. Personality: Sage (calm) vs Momentum (energetic) +6. Free: 3-5/day, Premium: Unlimited +7. History saved and viewable +8. Delete history (GDPR) +9. Response time: <2s (Llama), <3s (Claude) +10. Timeout handling + +--- + +### Story 2.5: Evening Reflection Flow + +**As a** user ending my day +**I want** to complete evening reflection +**So that** I review accomplishments and prepare tomorrow + +**Acceptance Criteria:** +1. Prompt at set time (default 8pm) +2. Review daily plan completion +3. Add accomplishments text +4. Note tomorrow priorities +5. Optional gratitude +6. Saves to database +7. "Skip for today" option +8. Data used for next day's plan + +**Target:** <2 minutes completion + +--- + +### Story 2.6: Streak Tracking + +**As a** user building habits +**I want** to see my check-in streak +**So that** I'm motivated to maintain consistency + +**Acceptance Criteria:** +1. Streak counter on Home tab +2. Increments when both check-ins done +3. Breaks if both missed +4. 1 freeze per week (automatic) +5. Freeze availability shown +6. Milestones: Bronze (7d), Silver (30d), Gold (100d) +7. Celebration animation +8. Synced across devices +9. Push notification if about to break + +--- + +## Definition of Done + +- [x] Morning check-in implemented +- [x] AI daily plan generation working +- [x] Goals CRUD functional +- [x] AI chat with context +- [x] Evening reflection implemented +- [x] Streaks tracking working +- [ ] Progress charts complete +- [ ] Manual plan adjustment +- [ ] Weekly summary reports +- [ ] 80% test coverage + +--- + +## Technical Architecture + +``` +lib/features/life_coach/ +β”œβ”€β”€ ai/ +β”‚ β”œβ”€β”€ daily_plan_generator.dart +β”‚ β”œβ”€β”€ prompts/daily_plan_prompt.dart +β”‚ └── providers/daily_plan_provider.dart +β”œβ”€β”€ chat/ +β”‚ β”œβ”€β”€ conversational_coach.dart +β”‚ └── presentation/pages/coach_chat_page.dart +β”œβ”€β”€ goals/ +β”‚ └── presentation/pages/goals_list_page.dart +└── presentation/ + β”œβ”€β”€ pages/daily_plan_page.dart + β”œβ”€β”€ pages/morning_check_in_page.dart + └── pages/evening_reflection_page.dart +``` + +--- + +## AI Integration + +| Feature | Model (Free) | Model (Premium) | +|---------|--------------|-----------------| +| Daily Plan | Llama 3 | Claude/GPT-4 | +| AI Chat | Llama 3 | Claude/GPT-4 | +| Goal Suggestions | Llama 3 | Claude | + +--- + +**Source:** `docs/ecosystem/epics.md` (lines 267-598) diff --git a/docs/2-MANAGEMENT/epics/epic-3-fitness.md b/docs/2-MANAGEMENT/epics/epic-3-fitness.md new file mode 100644 index 0000000..a26d40e --- /dev/null +++ b/docs/2-MANAGEMENT/epics/epic-3-fitness.md @@ -0,0 +1,246 @@ +# Epic 3: Fitness Coach MVP + + + +**Epic ID:** EPIC-3 +**Status:** πŸ”„ ~82% Complete +**Priority:** P0 (MVP Critical) +**Stories:** 10 + +--- + +## Overview + +| Aspect | Value | +|--------|-------| +| **Goal** | Deliver Smart Pattern Memory workout logging + exercise library + progress tracking | +| **Value** | Users save 17h/year with instant workout pre-fill, 3x retention vs competitors | +| **FRs Covered** | FR30-FR46 (Fitness module) | +| **Dependencies** | Epic 1 (auth, offline sync) | +| **Sprints** | Sprint 1 (30%), Sprint 2 (35%), Sprint 3 (25%) | + +**KILLER FEATURE:** Smart Pattern Memory - pre-fills last workout in <2 seconds + +--- + +## User Stories + +| ID | Story | Points | Status | Sprint | +|----|-------|--------|--------|--------| +| 3.1 | Smart Pattern Memory Pre-fill | 8 | βœ… Done | 1 | +| 3.2 | Exercise Library (500+ exercises) | 5 | βœ… Done | 1 | +| 3.3 | Workout Logging with Rest Timer | 8 | βœ… Done | 1 | +| 3.4 | Workout History Detail View | 5 | βœ… Done | 2 | +| 3.5 | Progress Charts (1RM, Volume, PRs) | 8 | βœ… Done | 2 | +| 3.6 | Body Measurements Tracking | 5 | βœ… Done | 2 | +| 3.7 | Workout Templates (Pre-built + Custom) | 5 | πŸ”„ In Progress | 3 | +| 3.8 | Quick Log (Rapid Entry) | 3 | πŸ”„ In Progress | 3 | +| 3.9 | Exercise Instructions & Form Tips | 5 | ⏳ Planned | 3 | +| 3.10 | Cross-Module: Receive Stress from Mind | 5 | ⏳ Planned | 3 | + +**Total Points:** 57 | **Completed:** 47 + +--- + +## Story Details + +### Story 3.1: Smart Pattern Memory Pre-fill (KILLER FEATURE) + +**As a** user logging workouts +**I want** last workout data auto-filled +**So that** I can log in <2 seconds per exercise + +**Acceptance Criteria:** +1. Select exercise β†’ Auto-fill last sets/reps/weight +2. Shows: "Last: 3Γ—8Γ—80kg (Nov 28)" +3. User can confirm with 1 tap +4. User can adjust if needed +5. Works offline (Drift query) +6. Query time <500ms p95 +7. Falls back to empty if no history +8. Remembers last 3 workouts per exercise + +**User Flow:** +``` +1. Tap exercise name +2. Smart Pattern Memory shows last data +3. Tap checkmark β†’ All sets logged +4. Total time: <2 seconds +``` + +--- + +### Story 3.2: Exercise Library + +**As a** user starting workouts +**I want** to search 500+ exercises +**So that** I can find the right exercises + +**Acceptance Criteria:** +1. Search by name (fuzzy matching) +2. Filter by muscle group +3. Filter by equipment +4. Filter by difficulty +5. Results <200ms after typing +6. Show primary/secondary muscles +7. Add to favorites +8. Add custom exercises +9. Synced across devices +10. Works offline (cached) + +--- + +### Story 3.3: Workout Logging with Rest Timer + +**As a** user in the gym +**I want** to log sets and use rest timer +**So that** I track my workouts accurately + +**Acceptance Criteria:** +1. Log sets with reps + weight +2. Support bodyweight exercises +3. Optional: RPE, notes per set +4. Rest timer after each set +5. Configurable defaults (30s, 60s, 90s, 120s) +6. Visual + haptic notification +7. Works 100% offline +8. Sync when online + +--- + +### Story 3.4: Workout History Detail View + +**As a** user reviewing progress +**I want** to view workout history +**So that** I can see what I did before + +**Acceptance Criteria:** +1. List workouts by date +2. Calendar view option +3. Tap workout β†’ Detail view +4. Shows: exercises, sets, reps, weight, duration +5. Edit past workouts +6. Delete workouts (soft delete) +7. Search/filter by exercise + +--- + +### Story 3.5: Progress Charts (FREE) + +**As a** user tracking strength gains +**I want** to see progress charts +**So that** I can visualize improvements + +**Acceptance Criteria:** +1. 1RM estimation chart (Epley formula) +2. Volume chart (sets Γ— reps Γ— weight) +3. PR history +4. Time filters: 30d, 90d, 6mo, 1yr, All +5. Tap data point β†’ See details +6. Trendline (linear regression) +7. **Always FREE** (competitive advantage) +8. Export to CSV + +--- + +### Story 3.6: Body Measurements + +**As a** user tracking physique +**I want** to log body measurements +**So that** I monitor body composition + +**Acceptance Criteria:** +1. Track: weight, body fat %, measurements +2. Progress photos (encrypted storage) +3. Charts over time +4. Support kg/lbs toggle +5. Unit conversion automatic +6. Synced across devices + +--- + +### Story 3.7: Workout Templates + +**As a** user with routine workouts +**I want** to use templates +**So that** I don't recreate workouts each time + +**Acceptance Criteria:** +1. 20+ pre-built templates (PPL, Upper/Lower, etc.) +2. Create custom templates +3. Save workout as template +4. Start workout from template +5. Edit, duplicate, delete templates + +--- + +## Definition of Done + +- [x] Smart Pattern Memory <500ms +- [x] 500+ exercises loaded +- [x] Workout logging works offline +- [x] Progress charts render correctly +- [x] Body measurements tracking +- [ ] Templates CRUD complete +- [ ] Exercise instructions added +- [ ] Cross-module integration +- [ ] 80% test coverage + +--- + +## Technical Architecture + +``` +lib/features/fitness/ +β”œβ”€β”€ data/ +β”‚ β”œβ”€β”€ repositories/ +β”‚ β”‚ └── fitness_repository.dart +β”‚ └── datasources/ +β”‚ β”œβ”€β”€ local_fitness_datasource.dart +β”‚ └── remote_fitness_datasource.dart +β”œβ”€β”€ domain/ +β”‚ β”œβ”€β”€ models/ +β”‚ β”‚ β”œβ”€β”€ workout.dart +β”‚ β”‚ β”œβ”€β”€ exercise.dart +β”‚ β”‚ └── workout_set.dart +β”‚ └── usecases/ +β”‚ β”œβ”€β”€ smart_pattern_memory_usecase.dart +β”‚ └── log_workout_usecase.dart +└── presentation/ + β”œβ”€β”€ pages/ + β”‚ β”œβ”€β”€ workout_log_page.dart + β”‚ β”œβ”€β”€ exercise_library_page.dart + β”‚ └── progress_charts_page.dart + └── providers/ + └── fitness_providers.dart +``` + +--- + +## Database Tables + +```sql +workout_sessions (id, user_id, started_at, ended_at, notes, synced) +workout_exercises (id, session_id, exercise_id, order, notes) +workout_sets (id, workout_exercise_id, set_number, reps, weight, rpe) +exercises (id, name, muscle_group, equipment, instructions) +exercise_favorites (id, user_id, exercise_id) +workout_templates (id, user_id, name, exercises_json) +body_measurements (id, user_id, date, weight, body_fat, photos_json) +``` + +--- + +## Performance Requirements + +| Metric | Target | +|--------|--------| +| Smart Pattern Query | <500ms p95 | +| Exercise Search | <200ms | +| Set Logging | <100ms response | +| History Load (90d) | <1s | +| Offline | 100% functional | + +--- + +**Source:** `docs/modules/module-fitness/epics.md` (lines 140-2580) diff --git a/docs/2-MANAGEMENT/epics/epic-4-mind.md b/docs/2-MANAGEMENT/epics/epic-4-mind.md new file mode 100644 index 0000000..7ccb2dd --- /dev/null +++ b/docs/2-MANAGEMENT/epics/epic-4-mind.md @@ -0,0 +1,245 @@ +# Epic 4: Mind & Emotion MVP + + + +**Epic ID:** EPIC-4 +**Status:** πŸ”„ ~40% Complete +**Priority:** P0 (MVP Critical) +**Stories:** 12 + +--- + +## Overview + +| Aspect | Value | +|--------|-------| +| **Goal** | Deliver meditation library, mood tracking, CBT chat, and mental health support | +| **Value** | Holistic mental wellness integrated with Fitness and Life Coach | +| **FRs Covered** | FR47-FR76 (Mind module) | +| **Dependencies** | Epic 1 (auth, E2E encryption for journals) | +| **Sprint** | Sprint 4 | + +--- + +## User Stories + +| ID | Story | Points | Status | Sprint | +|----|-------|--------|--------|--------| +| 4.1 | Guided Meditation Library (20-30 MVP) | 8 | πŸ”„ In Progress | 4 | +| 4.2 | Meditation Player with Breathing Animation | 5 | βœ… Done | 4 | +| 4.3 | Mood & Stress Tracking (Always FREE) | 5 | βœ… Done | 4 | +| 4.4 | CBT Chat with AI | 8 | ⏳ Planned | 4 | +| 4.5 | Private Journaling (E2E Encrypted) | 8 | ⏳ Planned | 4 | +| 4.6 | Mental Health Screening (GAD-7, PHQ-9) | 5 | βœ… Done | 4 | +| 4.7 | Breathing Exercises (5 Techniques) | 5 | ⏳ Planned | 4 | +| 4.8 | Sleep Meditations & Ambient Sounds | 5 | ⏳ Planned | 4 | +| 4.9 | Gratitude Exercises | 3 | ⏳ Planned | 4 | +| 4.10 | AI Meditation Recommendations | 5 | ⏳ Planned | 4 | +| 4.11 | Mood-Workout Correlation Insights | 5 | ⏳ Planned | 4 | +| 4.12 | Cross-Module: Share Mood/Stress | 5 | ⏳ Planned | 4 | + +**Total Points:** 67 | **Completed:** 27 + +--- + +## Story Details + +### Story 4.1: Guided Meditation Library + +**As a** user seeking meditation +**I want** to browse guided meditations +**So that** I can find the right meditation for my needs + +**Acceptance Criteria:** +1. Library with 20-30 meditations (MVP) +2. Filter by length: 5, 10, 15, 20 min +3. Filter by theme: Stress, Sleep, Focus, Anxiety, Gratitude +4. Free tier: 3 rotating meditations +5. Premium: Full access +6. Preview: 30-second clips for locked +7. Favorites list +8. Download for offline (up to 100MB cache) +9. New content monthly (P1) + +--- + +### Story 4.2: Meditation Player + +**As a** user starting meditation +**I want** a calming player with visual guides +**So that** I can follow along easily + +**Acceptance Criteria:** +1. Full-screen player +2. Audio playback with progress bar +3. Breathing animation (optional) +4. Background playback supported +5. Sleep timer +6. Play offline (downloaded) +7. Volume control +8. Track completion β†’ Update streaks + +--- + +### Story 4.3: Mood & Stress Tracking (ALWAYS FREE) + +**As a** user tracking mental state +**I want** to log mood and stress daily +**So that** I can see trends over time + +**Acceptance Criteria:** +1. Mood (1-5 with emoji) - Always FREE +2. Stress level (1-5) +3. Optional notes/triggers +4. Multiple entries per day +5. Weekly/monthly trend charts +6. Shared with Fitness & Life Coach (cross-module) +7. Works offline +8. No paywall ever for mood tracking + +--- + +### Story 4.4: CBT Chat with AI + +**As a** user dealing with negative thoughts +**I want** to chat with AI therapist +**So that** I can challenge and reframe thoughts + +**Acceptance Criteria:** +1. CBT-guided conversations +2. Techniques: Thought challenging, Reframing, Grounding +3. Free: 1 conversation/day +4. Premium: Unlimited +5. Save insights from sessions +6. Crisis resources shown when needed +7. Clear disclaimer: Not replacement for therapy + +--- + +### Story 4.5: Private Journaling (E2EE) + +**As a** user journaling thoughts +**I want** my entries encrypted +**So that** no one can read them except me + +**Acceptance Criteria:** +1. End-to-end encrypted (AES-256-GCM) +2. Server never sees plaintext +3. Rich text editor +4. Daily prompts (optional) +5. Photo attachments (encrypted) +6. AI analysis (opt-in only) +7. Search by date/keyword +8. Export to PDF/JSON + +--- + +### Story 4.6: Mental Health Screening + +**As a** user monitoring mental health +**I want** validated screening tools +**So that** I can track anxiety/depression symptoms + +**Acceptance Criteria:** +1. GAD-7 (anxiety) - 7 questions +2. PHQ-9 (depression) - 9 questions +3. Score interpretation +4. Track scores over time +5. Crisis resources for high scores (GAD-7 >15, PHQ-9 >20) +6. Recommend professional help +7. Clear disclaimer + +--- + +### Story 4.7: Breathing Exercises + +**As a** user managing stress +**I want** guided breathing exercises +**So that** I can calm down quickly + +**Techniques:** +| Name | Pattern | Use Case | +|------|---------|----------| +| Box Breathing | 4-4-4-4 | Calm anxiety | +| 4-7-8 | 4-7-8 | Sleep prep | +| Calming | 4-6 | Stress relief | +| Energizing | 2-2-2-2 | Morning energy | +| Sleep | 4-8 | Fall asleep | + +**Acceptance Criteria:** +1. 5 techniques available +2. Animated visual guide +3. Haptic feedback +4. Duration: 1-10 min +5. Works offline + +--- + +## Definition of Done + +- [x] Meditation player working +- [x] Mood tracking implemented +- [x] GAD-7/PHQ-9 functional +- [ ] Full meditation library loaded +- [ ] CBT chat implemented +- [ ] E2E encrypted journaling +- [ ] Breathing exercises +- [ ] Sleep meditations +- [ ] Cross-module sharing +- [ ] 80% test coverage + +--- + +## Technical Architecture + +``` +lib/features/mind_emotion/ +β”œβ”€β”€ data/ +β”‚ β”œβ”€β”€ repositories/ +β”‚ β”‚ β”œβ”€β”€ meditation_repository.dart +β”‚ β”‚ └── mood_repository.dart +β”‚ └── datasources/ +β”‚ └── local_mind_datasource.dart +β”œβ”€β”€ domain/ +β”‚ β”œβ”€β”€ models/ +β”‚ β”‚ β”œβ”€β”€ meditation.dart +β”‚ β”‚ β”œβ”€β”€ mood_log.dart +β”‚ β”‚ └── journal_entry.dart +β”‚ └── usecases/ +β”‚ └── encrypt_journal_usecase.dart +└── presentation/ + β”œβ”€β”€ pages/ + β”‚ β”œβ”€β”€ meditation_library_page.dart + β”‚ β”œβ”€β”€ mood_tracking_page.dart + β”‚ └── journal_page.dart + └── providers/ + └── mind_providers.dart +``` + +--- + +## Database Tables + +```sql +meditation_sessions (id, user_id, meditation_id, duration, completed_at) +meditation_favorites (id, user_id, meditation_id) +meditation_downloads (id, user_id, meditation_id, file_path) +mood_logs (id, user_id, mood, stress, triggers, note, created_at) +journal_entries (id, user_id, encrypted_content, iv, created_at) +mental_health_screenings (id, user_id, type, score, answers, created_at) +``` + +--- + +## Security Requirements + +| Data | Protection | +|------|------------| +| Journal entries | E2EE (AES-256-GCM) | +| Mental health notes | E2EE | +| Mood score | RLS (numeric only for CMI) | +| Stress level | RLS (numeric only for CMI) | + +--- + +**Source:** `docs/ecosystem/epics.md` + `docs/modules/module-fitness/epics.md` diff --git a/docs/2-MANAGEMENT/epics/epic-5-cross-module.md b/docs/2-MANAGEMENT/epics/epic-5-cross-module.md new file mode 100644 index 0000000..4e92fbc --- /dev/null +++ b/docs/2-MANAGEMENT/epics/epic-5-cross-module.md @@ -0,0 +1,237 @@ +# Epic 5: Cross-Module Intelligence (Killer Feature) + + + +**Epic ID:** EPIC-5 +**Status:** πŸ”„ ~25% Complete +**Priority:** P0 (MVP Critical - Differentiator) +**Stories:** 5 + +--- + +## Overview + +| Aspect | Value | +|--------|-------| +| **Goal** | Detect patterns across modules and generate AI-powered insights | +| **Value** | KILLER FEATURE - only app where modules communicate (12-18 month lead) | +| **FRs Covered** | FR77-FR84 (Cross-Module Intelligence) | +| **Dependencies** | Epic 2 (Life Coach), Epic 3 (Fitness), Epic 4 (Mind) | +| **Sprint** | Sprint 5 | + +--- + +## What Makes This Special + +**No competitor has this:** +- Calm = only meditation +- Noom = only coaching +- Freeletics = only fitness +- **LifeOS = all modules TALK to each other** + +**Examples:** +- "Your stress drops 40% on days you work out" +- "Best workouts happen after 8+ hours sleep" +- "Meditation before bed improves sleep quality 25%" + +--- + +## User Stories + +| ID | Story | Points | Status | Sprint | +|----|-------|--------|--------|--------| +| 5.1 | Insight Engine (Pattern Detection) | 13 | πŸ”„ In Progress | 5 | +| 5.2 | Insight Card UI (Swipeable) | 5 | ⏳ Planned | 5 | +| 5.3 | High Stress β†’ Suggest Light Workout | 5 | ⏳ Planned | 5 | +| 5.4 | Poor Sleep β†’ Suggest Afternoon Workout | 5 | ⏳ Planned | 5 | +| 5.5 | Sleep-Performance Correlation | 5 | ⏳ Planned | 5 | + +**Total Points:** 33 | **Completed:** 8 + +--- + +## Story Details + +### Story 5.1: Insight Engine (Pattern Detection) + +**As a** data-driven user +**I want** the system to detect patterns in my behavior +**So that** I understand correlations between fitness, mood, and habits + +**Acceptance Criteria:** +1. Aggregate daily metrics from all modules +2. Calculate Pearson correlations for metric pairs +3. Filter significant: |r| > 0.5 AND p-value < 0.05 +4. Run weekly (not daily to save costs) +5. Store detected patterns +6. AI generates human-readable insight text +7. Max 1 insight notification per day +8. Insights shown on dashboard + +**Metric Pairs:** +| Metric A | Metric B | Expected | +|----------|----------|----------| +| workout_completed | stress_level | Negative | +| meditation_completed | mood_score | Positive | +| sleep_quality | workout_intensity | Positive | +| stress_level | completion_rate | Negative | + +--- + +### Story 5.2: Insight Card UI + +**As a** user viewing insights +**I want** swipeable insight cards +**So that** I can act on recommendations + +**Acceptance Criteria:** +1. Card-based UI on Home tab +2. Max 1 insight card per day +3. Swipe right: Save/Act +4. Swipe left: Dismiss +5. Tap: View details +6. Shows: Insight + Recommendation +7. "Learn more" β†’ CMI Dashboard + +--- + +### Story 5.3: High Stress β†’ Suggest Light Workout + +**As a** stressed user with heavy workout planned +**I want** the system to suggest lighter exercise +**So that** I don't overtrain when stressed + +**Trigger:** +- Mind module: stress_level β‰₯ 4/5 +- Fitness module: heavy workout scheduled + +**Insight:** +"High stress detected. Consider a light yoga session instead of heavy lifting today." + +--- + +### Story 5.4: Poor Sleep β†’ Afternoon Workout + +**As a** sleep-deprived user with morning workout +**I want** suggestion to reschedule +**So that** I optimize workout timing + +**Trigger:** +- Life Coach: sleep_quality ≀ 2/5 +- Fitness: morning workout planned + +**Insight:** +"Sleep was rough last night. Afternoon workouts might be more effective today." + +--- + +### Story 5.5: Sleep-Performance Correlation + +**As a** user tracking both sleep and workouts +**I want** to see how sleep affects my lifts +**So that** I understand the importance of rest + +**Insight:** +"Your best lifts happen after 8+ hours of sleep. Last 30 days show 40% better performance with good rest." + +--- + +## Technical Architecture + +### CMI Pipeline + +``` +1. DATA AGGREGATION (Event-Driven + Debounced) + ↓ + Fitness: workout_completed β†’ Trigger + Mind: meditation_completed β†’ Trigger + Life Coach: tasks_updated β†’ Trigger + ↓ + Debounce 5 min β†’ MetricsAggregationService + ↓ + Update user_daily_metrics row + +2. PATTERN DETECTION (Weekly Cron) + ↓ + Fetch 30 days of user_daily_metrics + ↓ + Calculate Pearson correlations + ↓ + Filter significant patterns + +3. AI INSIGHT GENERATION + ↓ + For top 3 correlations: + - Build prompt with context + - Call AI API (Claude/GPT-4) + - Parse response + ↓ + Save to detected_patterns table + +4. NOTIFICATION + ↓ + If confidence > 0.7: + - FCM push notification + - Deep link to dashboard +``` + +--- + +## Database Schema + +```sql +-- Aggregated daily metrics (shared across modules) +user_daily_metrics ( + user_id, date, + -- Fitness + workout_completed, workout_duration, sets_completed, + -- Mind + meditation_completed, mood_score, stress_level, + -- Life Coach + tasks_completed, completion_rate, ai_conversations_count, + aggregated_at +) + +-- Detected patterns +detected_patterns ( + user_id, + pattern_type, -- 'correlation', 'trend', 'anomaly' + metric_a, metric_b, + correlation_coefficient, -- -1.0 to 1.0 + confidence_score, + insight_text, + recommendation_text, + viewed_at, dismissed_at +) +``` + +--- + +## Cost Analysis + +**10k users scenario:** +- Pattern detection: 40k runs/month +- AI calls: 120k calls/month +- Claude cost: $0.003/call + +**Monthly cost:** $360 +**Revenue (20% paid Γ— $5):** $10,000 +**AI % of revenue:** 3.6% βœ… (under 30% budget) + +--- + +## Definition of Done + +- [x] user_daily_metrics table created +- [x] Metrics aggregation service +- [ ] Pattern detection algorithm +- [ ] AI insight generation +- [ ] Insight card UI +- [ ] Push notifications for insights +- [ ] CMI Dashboard +- [ ] Performance: <1s pattern calculation +- [ ] 80% test coverage + +--- + +**Source:** `docs/ecosystem/architecture.md` + `docs/ecosystem/epics.md` diff --git a/docs/2-MANAGEMENT/epics/epic-6-gamification.md b/docs/2-MANAGEMENT/epics/epic-6-gamification.md new file mode 100644 index 0000000..154a7a0 --- /dev/null +++ b/docs/2-MANAGEMENT/epics/epic-6-gamification.md @@ -0,0 +1,226 @@ +# Epic 6: Gamification & Retention + + + +**Goal:** Implement gamification mechanics (streaks, badges, celebrations) and weekly summary reports to drive retention. + +**Value:** Users stay engaged through visible progress, milestone celebrations, and concrete evidence of improvement. + +**FRs Covered:** FR85-FR90 (Gamification & Retention) + +**Dependencies:** Epic 2, Epic 3, Epic 4 (modules must exist to track streaks) + +**Stories:** 6 + +--- + +## Story 6.1: Streak Tracking System (Workouts, Meditations, Check-ins) + +**Phase:** MVP +**Status:** πŸ”„ In Progress + +**As a** user building habits +**I want** to see my streaks for workouts, meditations, and check-ins +**So that** I'm motivated to maintain consistency + +### Acceptance Criteria + +1. 3 streak types: Workout streak, Meditation streak, Check-in streak +2. Streak increments when user completes activity (daily) +3. Streak breaks if user misses a day (no activity) +4. Streak freeze: 1 per week per streak type (automatic on first miss) +5. Freeze availability shown: "Freeze available: 1 this week" +6. Streak resets on Sunday (new week, new freeze) +7. Longest streak saved (personal record) +8. Current streak shown on Home tab (fire emoji) + +**FRs:** FR85, FR86, FR87 + +### UX Notes +- Streak card on Home tab +- Fire emoji + number (e.g., "7-day streak!") +- Progress bar to next milestone (Bronze 7d, Silver 30d, Gold 100d) + +### Technical Notes +- streaks table (user_id, type, current_streak, longest_streak, freeze_used_this_week, last_activity_date) +- Cron job daily (checks if streak should increment or break) + +--- + +## Story 6.2: Milestone Badges (Bronze, Silver, Gold) + +**Phase:** MVP +**Status:** πŸ”„ In Progress + +**As a** user reaching a streak milestone +**I want** to earn badges +**So that** I feel recognized for my commitment + +### Acceptance Criteria + +1. Milestone badges: Bronze (7 days), Silver (30 days), Gold (100 days) +2. Badges awarded for each streak type (9 total badges possible) +3. Badge unlock: Full-screen celebration (confetti animation) +4. Badge shown in profile: "Badges Earned" section +5. Badge icons: Bronze, Silver, Gold medals +6. Shareable badge card (generate image, share to social media) +7. Push notification on badge unlock: "Silver Meditation Badge earned!" + +**FRs:** FR86, FR88 + +### UX Notes +- Confetti animation: Lottie, 2 seconds +- Badge unlock screen: Full-screen modal, badge zooms in +- "Share Achievement" button (optional) + +### Technical Notes +- badges table (user_id, type, tier='bronze'|'silver'|'gold', earned_at) +- Badge detection: Check current_streak against milestones +- Confetti: Lottie animation file + +--- + +## Story 6.3: Streak Break Alerts (Push Notification) + +**Phase:** MVP +**Status:** Planned + +**As a** user about to break a streak +**I want** a reminder notification +**So that** I don't lose my progress + +### Acceptance Criteria + +1. Push notification sent if streak about to break (8pm, if activity not done today) +2. Notification message: "Streak Alert! Your 15-day meditation streak is about to break. Meditate now!" +3. Tap notification β†’ Opens relevant module (Meditation player, Workout log, Check-in modal) +4. Notification NOT sent if freeze available (automatic freeze used instead) +5. User can disable streak alerts in settings + +**FRs:** FR87, FR106 + +### UX Notes +- Notification tone: Encouraging, not guilt-tripping +- Deep link to quick action (1-tap to complete) + +### Technical Notes +- Cron job 8pm daily (check streaks, send notifications) +- Deep link: Open app to specific screen +- Notification service: Supabase + Firebase Cloud Messaging + +--- + +## Story 6.4: Celebration Animations (Confetti, Badge Pop) + +**Phase:** MVP +**Status:** Planned + +**As a** user achieving a milestone +**I want** a celebration animation +**So that** I feel rewarded and motivated + +### Acceptance Criteria + +1. Confetti animation on: Badge unlock, PR achievement, Goal completion +2. Animation: Lottie confetti (colorful, 2 seconds) +3. Badge pop: Badge icon zooms in with bounce effect +4. Haptic feedback: Medium vibration during celebration +5. Sound effect: Optional chime (can disable in settings) +6. Celebration doesn't block user (can dismiss early) + +**FRs:** FR88 + +### UX Notes +- Confetti colors: Match module theme (Orange for Fitness, Purple for Mind) +- Badge bounce: Elastic easing (playful, not jarring) + +### Technical Notes +- Lottie animations (confetti.json) +- Flutter animations: ScaleTransition for badge pop +- Haptic: HapticFeedback.mediumImpact() + +--- + +## Story 6.5: Shareable Milestone Cards (Social Sharing) + +**Phase:** MVP +**Status:** Planned + +**As a** user earning a badge or achieving a goal +**I want** to share my achievement +**So that** I can celebrate with friends + +### Acceptance Criteria + +1. "Share Achievement" button on badge unlock screen +2. Generate shareable image card: + - Badge icon (centered) + - Achievement title ("30-Day Meditation Streak!") + - User name (optional, can remove) + - "Achieved with LifeOS" branding (bottom) +3. Share to: Instagram Stories, Facebook, Twitter, WhatsApp, Copy link +4. Image saved to user's gallery (optional) +5. No personal data in image (GDPR compliant) + +**FRs:** FR89 + +### UX Notes +- Card design: LifeOS branding (Deep Blue background, Teal accents) +- Badge prominent (large, centered) +- Clean typography (Inter Bold) + +### Technical Notes +- Image generation: screenshot package (Flutter) or server-side image generation +- Share: share_plus package (Flutter) +- Image stored temporarily (deleted after 24h) + +--- + +## Story 6.6: Weekly Summary Report (All Modules) + +**Phase:** MVP +**Status:** Planned + +**As a** user tracking progress across all modules +**I want** a weekly summary report +**So that** I can see concrete evidence of my improvements + +### Acceptance Criteria + +1. Weekly report generated every Monday morning (6am) +2. Push notification: "Your week in review is ready!" +3. Report includes: + - **Fitness:** Workouts completed, +XKG on exercise (PR), Total volume (+X%) + - **Mind:** Meditations completed (avg duration), Stress: -X% vs last week, Mood avg + - **Life Coach:** Check-ins completed (X/7), Goals progressed (X%), Daily plan completion (X% avg) + - **Streaks:** Workout streak, Meditation streak, Check-in streak + - **Top Insight:** "Your best workouts happened after 8+ hours sleep." +4. Report shareable (generate image, share to social) +5. Report saved in history ("View Past Weeks") +6. Report accessible from Home tab (card shown Monday-Tuesday) + +**FRs:** FR90 + +### UX Notes +- Report card: Clean, data-focused +- Stats with trend arrows (up, down, stable) +- Color-coded by module (Orange for Fitness, Purple for Mind, Deep Blue for Life Coach) + +### Technical Notes +- Cron job Monday 6am (Supabase Edge Function) +- Aggregate queries on past 7 days (all modules) +- Push notification via Firebase Cloud Messaging +- weekly_reports table (user_id, week_start_date, report_data JSON, created_at) + +--- + +## Related Documents + +- [PRD-overview.md](../../1-BASELINE/product/PRD-overview.md) - Product overview +- [epic-2-life-coach.md](./epic-2-life-coach.md) - Life Coach (check-in streaks) +- [epic-3-fitness.md](./epic-3-fitness.md) - Fitness (workout streaks) +- [epic-4-mind.md](./epic-4-mind.md) - Mind (meditation streaks) + +--- + +*6 Stories | FR85-FR90 | Gamification & Retention* diff --git a/docs/2-MANAGEMENT/epics/epic-7-onboarding-subscriptions.md b/docs/2-MANAGEMENT/epics/epic-7-onboarding-subscriptions.md new file mode 100644 index 0000000..bc60727 --- /dev/null +++ b/docs/2-MANAGEMENT/epics/epic-7-onboarding-subscriptions.md @@ -0,0 +1,282 @@ +# Epic 7: Onboarding & Subscriptions + + + +**Goal:** Deliver smooth onboarding flow, 14-day trial, subscription management, and payment processing. + +**Value:** Users get personalized onboarding, can try premium features, and subscribe easily. + +**FRs Covered:** FR91-FR97 (Subscriptions), FR111-FR115 (Onboarding) + +**Dependencies:** Epic 1 (auth) + +**Stories:** 7 + +--- + +## Story 7.1: Onboarding Flow - Choose Your Journey + +**Phase:** MVP +**Status:** Complete + +**As a** new user +**I want** personalized onboarding based on my goals +**So that** the app emphasizes the module most relevant to me + +### Acceptance Criteria + +1. Onboarding starts after account creation (Story 1.1) +2. Screen 1: Welcome ("Welcome to LifeOS") +3. Screen 2: Choose journey (4 options): + - "I want to get fit" (Fitness-first) + - "I want to reduce stress" (Mind-first) + - "I want to organize my life" (Life Coach-first) + - "I want it all" (Full ecosystem) +4. Onboarding flow adapts based on choice: + - Fitness-first β†’ Show workout logging tutorial first + - Mind-first β†’ Show meditation tutorial first + - Life Coach-first β†’ Show morning check-in tutorial first + - Full ecosystem β†’ Balanced overview of all 3 modules +5. Progress dots shown (5 screens total) +6. User can skip onboarding (link at bottom) + +**FRs:** FR111, FR112 + +### UX Notes +- Welcome screen: Hero image (LifeOS logo, gradient background) +- Journey cards: Large, tappable (44x44pt minimum) +- Progress dots: Bottom center + +### Technical Notes +- onboarding_state table (user_id, journey_choice, completed) +- User preference saved for personalization + +--- + +## Story 7.2: Onboarding - Set Initial Goals & Choose AI Personality + +**Phase:** MVP +**Status:** Complete + +**As a** new user +**I want** to set 1-3 initial goals and choose AI personality +**So that** the app is personalized from day one + +### Acceptance Criteria + +1. Screen 3: Set goals (1-3) +2. Goal input: Title + Category (dropdown) +3. Examples shown based on journey choice: + - Fitness: "Lose 10kg", "Run 5km" + - Mind: "Meditate daily", "Reduce anxiety" + - Life Coach: "Wake up at 6am", "Read 20 pages/day" +4. Screen 4: Choose AI personality (2 options): + - Sage (Calm, wise, supportive) - "Let's take this one step at a time" + - Momentum (Energetic, motivational) - "Let's crush this! You've got this!" +5. User can preview AI personality (sample message shown) +6. Selection saved (affects all AI interactions) + +**FRs:** FR21, FR113 + +### UX Notes +- Goal form: Simple text input + category dropdown +- "+ Add another goal" button (max 3) +- AI personality cards: Large, with sample message preview +- Tap card to select (highlighted border) + +### Technical Notes +- Goals created in goals table (Story 2.3) +- AI personality saved in user_settings table (ai_personality='sage'|'momentum') + +--- + +## Story 7.3: Onboarding - Permissions & Interactive Tutorial + +**Phase:** MVP +**Status:** Complete + +**As a** new user +**I want** to grant permissions and see a quick tutorial +**So that** I understand how to use the app + +### Acceptance Criteria + +1. Screen 5: Permissions (push notifications, health data access P1) +2. Push notifications: + - Explanation: "Daily reminders, streak alerts, smart insights (max 1/day)" + - "Enable Notifications" button + - "Maybe Later" link +3. Interactive tutorial (based on journey): + - Fitness: Log 1 sample workout (guided walkthrough) + - Mind: Complete 2-min breathing exercise + - Life Coach: Complete first morning check-in +4. Tutorial completion: Celebration ("You're all set!") +5. Tutorial skippable ("Skip Tutorial" link) +6. 14-day trial banner shown: "Try all premium features free for 14 days" + +**FRs:** FR114, FR115 + +### UX Notes +- Permissions: Clear explanations (not scary) +- Tutorial: Overlay tooltips pointing to UI elements +- "Next" button to advance tutorial steps + +### Technical Notes +- Permission requests: iOS notifications permission, Android permission +- Tutorial state saved (completed=true after tutorial) +- Trial activation: Set trial_end_date = now + 14 days + +--- + +## Story 7.4: Free Tier (Life Coach Basic) + +**Phase:** MVP +**Status:** Complete + +**As a** free tier user +**I want** access to Life Coach basic features +**So that** I can try LifeOS without paying + +### Acceptance Criteria + +1. Free tier ALWAYS includes: + - Life Coach: Daily planning, 3 goals max, Morning/evening check-ins, AI chat (3-5/day with Llama) + - Mind: Mood tracking (ALWAYS FREE) + - Fitness: Basic workout logging (no Smart Pattern Memory, limited templates) +2. Free tier limitations shown clearly (not hidden) +3. Premium features shown in "locked" state (with "Upgrade" CTA) +4. No credit card required for free tier +5. Free tier never expires (user can stay free forever) + +**FRs:** FR91, FR92 + +### UX Notes +- Locked features: Gray overlay + lock icon + "Premium" badge +- Tap locked feature β†’ Upgrade modal +- Free tier = full Life Coach (not crippled) + +### Technical Notes +- subscription_tier column (user table): 'free' (default) +- Feature checks: if (tier == 'free') { limit } + +--- + +## Story 7.5: 14-Day Trial (All Premium Features) + +**Phase:** MVP +**Status:** Complete + +**As a** new user +**I want** 14-day trial of all premium features +**So that** I can decide if LifeOS is worth paying for + +### Acceptance Criteria + +1. Trial auto-starts after onboarding (no credit card required) +2. Trial includes: + - Fitness: Full Smart Pattern Memory, all templates, unlimited workouts + - Mind: Full meditation library (100+ meditations), unlimited CBT chat (Claude/GPT-4) + - Life Coach: Unlimited goals, unlimited AI chat (Claude/GPT-4) +3. Trial countdown shown: "13 days left in trial" +4. Trial end reminder: Push notification 3 days before trial ends +5. Trial end: Features revert to free tier (graceful degradation, no data loss) +6. User can subscribe anytime during trial (trial ends immediately) + +**FRs:** FR96 + +### UX Notes +- Trial banner: Subtle, not annoying (top of Home tab) +- "Subscribe Now" CTA in trial banner +- Trial countdown: "X days left" + +### Technical Notes +- trial_end_date column (user table) +- Feature checks: if (now < trial_end_date || tier == 'premium') { allow } +- Cron job: Check trial expiration daily + +--- + +## Story 7.6: Subscription Management (In-App Purchase) + +**Phase:** MVP +**Status:** Complete + +**As a** user wanting premium features +**I want** to subscribe to a module or plan +**So that** I can unlock full LifeOS + +### Acceptance Criteria + +1. Subscription tiers (in-app purchase): + - 2.99 EUR/month: Any 1 module (Fitness OR Mind) + - 5.00 EUR/month: 3-Module Pack (Life Coach + Fitness + Mind) + - 7.00 EUR/month: Full Access + Premium AI (GPT-4 unlimited) +2. Subscription screen accessible from Profile β†’ "Subscription" +3. Current plan shown (Free, 1-Module, 3-Module, Full Access) +4. Upgrade/downgrade options shown +5. Regional pricing: UK (GBP), Poland (PLN), EU (EUR) +6. Purchase via App Store (iOS) or Google Play (Android) +7. Subscription auto-renews monthly (user can cancel anytime) +8. Subscription status synced across devices (Supabase) + +**FRs:** FR92, FR93, FR94 + +### UX Notes +- Pricing cards: Clear tiers (Free, 1-Module, 3-Module, Full) +- "Popular" badge on 3-Module Pack +- "Current Plan" highlighted (Teal border) +- "Subscribe" button (Teal) + +### Technical Notes +- In-app purchase: in_app_purchase package (Flutter) +- RevenueCat or Supabase webhook for subscription status +- subscription_tier column updated on purchase + +--- + +## Story 7.7: Cancel Subscription & Graceful Degradation + +**Phase:** MVP +**Status:** Complete + +**As a** subscribed user +**I want** to cancel my subscription anytime +**So that** I have flexibility without losing my data + +### Acceptance Criteria + +1. "Cancel Subscription" button on Subscription screen +2. Cancellation warning: "Your subscription will end on [date]. You'll keep premium until then." +3. User confirms cancellation (not instant, end of billing period) +4. Subscription status: "Active until [date]" (grace period) +5. After cancellation: Features revert to free tier +6. Graceful degradation: + - Goals >3 β†’ Read-only (can't create new, can view old) + - Meditation library β†’ Locked (3 rotating free meditations) + - AI chat β†’ Limited to 3-5/day (Llama) +7. NO data loss (all workouts, moods, journals remain) +8. User can re-subscribe anytime (data intact) + +**FRs:** FR95, FR97 + +### UX Notes +- Cancel button: Red (warning color) +- Confirmation modal: Clear explanation of what happens +- "Keep Subscription" option (prevent accidental cancel) + +### Technical Notes +- subscription_status column: 'active', 'cancelled', 'expired' +- Grace period: subscription_end_date stored +- Feature checks: if (now < subscription_end_date) { allow premium } + +--- + +## Related Documents + +- [PRD-overview.md](../../1-BASELINE/product/PRD-overview.md) - Product overview +- [epic-1-core-platform.md](./epic-1-core-platform.md) - Core Platform (auth) +- [ARCH-overview.md](../../1-BASELINE/architecture/ARCH-overview.md) - Architecture + +--- + +*7 Stories | FR91-FR97, FR111-FR115 | Onboarding & Subscriptions* diff --git a/docs/2-MANAGEMENT/epics/epic-8-notifications.md b/docs/2-MANAGEMENT/epics/epic-8-notifications.md new file mode 100644 index 0000000..6e5268e --- /dev/null +++ b/docs/2-MANAGEMENT/epics/epic-8-notifications.md @@ -0,0 +1,227 @@ +# Epic 8: Notifications & Engagement + + + +**Goal:** Implement push notifications for reminders, streak alerts, cross-module insights, and weekly reports. + +**Value:** Users stay engaged through timely reminders and high-value notifications (max 1 insight/day to avoid fatigue). + +**FRs Covered:** FR104-FR110 (Notifications) + +**Dependencies:** Epic 2, Epic 3, Epic 4, Epic 5 (modules + insights must exist) + +**Stories:** 5 + +--- + +## Story 8.1: Push Notification Infrastructure + +**Phase:** MVP +**Status:** Not Started + +**As the system** +**I want** to send push notifications to users +**So that** they stay engaged with timely reminders + +### Acceptance Criteria + +1. Push notification service integrated (Firebase Cloud Messaging) +2. Notifications work on iOS and Android +3. User can grant/deny permission on first launch +4. Device tokens stored in database (user_id, device_token, platform) +5. Notifications sent via Supabase Edge Functions (cron jobs) +6. Notification categories: Reminders, Streaks, Insights, Reports +7. User can enable/disable each category in settings + +**FRs:** FR104, FR105 + +### UX Notes +- Permission request: Clear explanation ("Get reminders and stay motivated") +- Settings screen: Toggle for each notification type + +### Technical Notes +- Firebase Cloud Messaging setup (iOS + Android) +- device_tokens table (user_id, token, platform, created_at) +- Supabase Edge Functions for sending notifications + +--- + +## Story 8.2: Daily Reminders (Morning Check-in, Workout, Meditation) + +**Phase:** MVP +**Status:** Not Started + +**As a** user with scheduled activities +**I want** daily reminders +**So that** I don't forget my morning check-in or workout + +### Acceptance Criteria + +1. Morning check-in reminder (default 8am, user customizable) +2. Evening reflection reminder (default 8pm, user customizable) +3. Workout reminder (if workout scheduled in daily plan) +4. Meditation reminder (if meditation goal set) +5. Reminder message examples: + - "Good morning! Complete your check-in to start your day" + - "Time for your workout! Leg day awaits" + - "Evening reflection - Review your day in 2 minutes" +6. Tap notification β†’ Opens relevant screen (Deep link) +7. User can customize reminder times (settings) +8. User can disable specific reminders + +**FRs:** FR105 + +### UX Notes +- Notifications: Friendly, encouraging tone +- Deep links: Direct to action (check-in modal, workout log, meditation player) + +### Technical Notes +- Cron jobs: Schedule notifications based on user preferences +- notification_settings table (user_id, morning_checkin_time, evening_reflection_time, workout_reminder, meditation_reminder) +- Deep links: Custom URL scheme (lifeos://check-in, lifeos://workout, etc.) + +--- + +## Story 8.3: Streak Alerts (About to Break, Freeze, Milestone) + +**Phase:** MVP +**Status:** Not Started + +**As a** user with active streaks +**I want** alerts when my streak is at risk +**So that** I can maintain my progress + +### Acceptance Criteria + +1. Streak alert sent if activity not completed by 8pm +2. Alert message: "Streak Alert! Your 15-day meditation streak is about to break. Meditate now!" +3. Alert NOT sent if freeze available (automatic freeze used instead) +4. Freeze used notification: "Streak freeze used! You have 0 freezes left this week." +5. Milestone alert: "Milestone! You've reached a 30-day workout streak. Silver badge unlocked!" +6. Tap notification β†’ Opens relevant module +7. User can disable streak alerts (settings) + +**FRs:** FR106 + +### UX Notes +- Alerts: Motivating, not guilt-tripping +- Freeze notification: Reassuring ("We've got you covered") + +### Technical Notes +- Cron job 8pm daily: Check streaks, send alerts +- Milestone notifications sent immediately on achievement + +--- + +## Story 8.4: Cross-Module Insight Notifications (Max 1/day) + +**Phase:** MVP +**Status:** Not Started + +**As a** user receiving cross-module insights +**I want** a push notification for high-priority insights +**So that** I can act on them immediately + +### Acceptance Criteria + +1. Insight notification sent for critical insights only (e.g., overtraining risk) +2. Max 1 insight notification per day (prevents fatigue) +3. Notification message: "Insight: High stress + heavy workout today. Consider a light session." +4. Tap notification β†’ Opens Home tab with insight card visible +5. User can disable insight notifications (settings) +6. Insight shown in-app even if notification disabled + +**FRs:** FR107 + +### UX Notes +- Notification: Clear, actionable message +- Not spammy (max 1/day) + +### Technical Notes +- Insight notification flag (insights table: notification_sent BOOLEAN) +- Sent immediately when high-priority insight generated + +--- + +## Story 8.5: Weekly Summary Notification & Quiet Hours + +**Phase:** MVP +**Status:** Not Started + +**As a** user +**I want** a weekly summary notification +**And** quiet hours for notifications +**So that** I'm not disturbed at night + +### Acceptance Criteria + +1. Weekly summary notification sent every Monday 8am +2. Notification message: "Your week in review is ready! +5kg squat, stress -23%, 4 workouts" +3. Tap notification β†’ Opens Home tab with weekly report card +4. Quiet hours setting (default 10pm - 7am, user customizable) +5. No notifications sent during quiet hours (except emergencies) +6. Notifications batched during quiet hours (sent when quiet hours end) +7. User can disable quiet hours (settings) + +**FRs:** FR108, FR109 + +### UX Notes +- Weekly notification: Exciting, shows concrete stats +- Quiet hours: Respect user's sleep (good UX) + +### Technical Notes +- Cron job Monday 8am: Send weekly summary notification +- Quiet hours check before sending any notification +- notification_settings table: quiet_hours_start, quiet_hours_end + +--- + +## Technical Implementation Notes + +### Firebase Setup Required + +```yaml +# Required Firebase configuration +- iOS: GoogleService-Info.plist +- Android: google-services.json +- FCM Server Key for Edge Functions +``` + +### Device Token Management + +```sql +CREATE TABLE device_tokens ( + id UUID PRIMARY KEY, + user_id UUID REFERENCES users(id), + token TEXT NOT NULL, + platform TEXT NOT NULL, -- 'ios' | 'android' + created_at TIMESTAMPTZ DEFAULT NOW() +); +``` + +### Edge Function Pattern + +```typescript +// supabase/functions/send-notification/index.ts +serve(async (req) => { + const { user_id, title, body, data } = await req.json() + + const tokens = await getDeviceTokens(user_id) + + for (const token of tokens) { + await sendFCM(token, { title, body, data }) + } +}) +``` + +--- + +## Related Documents + +- [PRD-nfr.md](../../1-BASELINE/product/PRD-nfr.md) - NFR requirements +- [epic-5-cross-module.md](./epic-5-cross-module.md) - Cross-Module Intelligence +- [epic-6-gamification.md](./epic-6-gamification.md) - Gamification (streaks) + +--- + +*5 Stories | FR104-FR110 | Notifications & Engagement | Status: Not Started* diff --git a/docs/2-MANAGEMENT/epics/epic-9-settings.md b/docs/2-MANAGEMENT/epics/epic-9-settings.md new file mode 100644 index 0000000..41d4a01 --- /dev/null +++ b/docs/2-MANAGEMENT/epics/epic-9-settings.md @@ -0,0 +1,233 @@ +# Epic 9: Settings & Profile + + + +**Goal:** Deliver user settings, preferences, account management, and data privacy controls. + +**Value:** Users can customize app, manage subscription, and control data privacy (GDPR compliance). + +**FRs Covered:** FR116-FR123 (Settings & Profile) + +**Dependencies:** Epic 1 (auth), Epic 7 (subscriptions) + +**Stories:** 5 + +--- + +## Story 9.1: Personal Settings (Name, Email, Password, Avatar) + +**Phase:** MVP +**Status:** Complete + +**As a** user +**I want** to update my personal information +**So that** my account is current + +### Acceptance Criteria + +1. Settings screen accessible from Profile tab +2. Personal info section: Name, Email, Password, Avatar +3. Edit mode: Tap field β†’ Inline editing +4. Name: Max 50 chars, validation (no special chars) +5. Email: Validation (valid format), requires re-verification if changed +6. Password: Change password (requires current password confirmation) +7. Avatar: Upload from gallery or camera (max 5MB, JPG/PNG) +8. Changes saved to Supabase (synced across devices) +9. Success message: "Settings updated successfully" + +**FRs:** FR116, FR4 + +### UX Notes +- Settings screen: List of sections (Personal Info, Notifications, Subscription, etc.) +- Edit mode: Pencil icon β†’ Inline editing +- Avatar: Circular image with "Change photo" overlay + +### Technical Notes +- Update user table (name, email, avatar_url) +- Email change triggers verification email +- Avatar upload to Supabase Storage + +--- + +## Story 9.2: Notification Preferences + +**Phase:** MVP +**Status:** Complete + +**As a** user +**I want** to control which notifications I receive +**So that** I'm not overwhelmed + +### Acceptance Criteria + +1. Notification settings section (Settings β†’ Notifications) +2. Toggle for each notification type: + - Morning check-in reminder + - Evening reflection reminder + - Workout reminder + - Meditation reminder + - Streak alerts + - Cross-module insights + - Weekly summary +3. Customize times: Morning reminder time, Evening reminder time +4. Quiet hours: Start time, End time (default 10pm - 7am) +5. Changes saved immediately (optimistic UI) +6. Test notification button ("Send test notification") + +**FRs:** FR117 + +### UX Notes +- Toggle switches: iOS style (green when ON) +- Time pickers: Native OS pickers (iOS wheel, Android clock) +- "Test notification" button: Sends sample notification immediately + +### Technical Notes +- notification_settings table updated +- Test notification: Send via Firebase Cloud Messaging immediately + +--- + +## Story 9.3: Unit Preferences (kg/lbs, cm/inches) + +**Phase:** MVP +**Status:** Complete + +**As a** user from different regions +**I want** to choose my preferred units +**So that** data is displayed in familiar format + +### Acceptance Criteria + +1. Unit settings section (Settings β†’ Units) +2. Weight unit: kg or lbs (toggle) +3. Distance unit: km or miles (toggle, P1 for running) +4. Height unit: cm or inches (toggle) +5. Unit changes apply immediately across app +6. Historical data converted automatically (e.g., 100kg β†’ 220lbs) +7. Workout logs re-rendered with new units + +**FRs:** FR118 + +### UX Notes +- Toggle switches: "kg / lbs" +- Immediate feedback: "Weight unit changed to lbs" + +### Technical Notes +- user_settings table: weight_unit, distance_unit, height_unit +- Conversion functions: kgToLbs(), cmToInches() +- Display logic: Check user preference before rendering + +--- + +## Story 9.4: Subscription & Billing Management + +**Phase:** MVP +**Status:** Complete + +**As a** subscribed user +**I want** to manage my subscription +**So that** I can upgrade, downgrade, or cancel + +### Acceptance Criteria + +1. Subscription section (Settings β†’ Subscription) +2. Current plan shown: Tier name, Price, Billing date +3. Upgrade options: "Upgrade to Full Access" button +4. Downgrade options: "Switch to 1-Module" button +5. Cancel subscription button (red, bottom) +6. Billing history: List of past charges (date, amount, receipt) +7. Receipt download button (PDF) +8. Manage subscription β†’ Opens App Store/Google Play subscription management (iOS/Android) + +**FRs:** FR119 + +### UX Notes +- Current plan: Highlighted card (Teal border) +- Upgrade/downgrade: Clear CTAs +- Billing history: Scrollable list (date, amount, status) + +### Technical Notes +- Query subscription status from RevenueCat or Supabase +- Billing history: Store in subscriptions table (transaction history) +- Receipt: Generate PDF (Supabase Edge Function) + +--- + +## Story 9.5: Data Privacy & Cross-Module Settings + +**Phase:** MVP +**Status:** Complete + +**As a** privacy-conscious user +**I want** to control data sharing and AI analysis +**So that** I maintain privacy + +### Acceptance Criteria + +1. Data & Privacy section (Settings β†’ Data & Privacy) +2. Toggle: "Allow modules to share data" (default ON) + - If OFF: Cross-module insights disabled (warning shown) +3. Toggle: "AI analysis of journal entries" (default OFF) + - If OFF: Sentiment analysis disabled (E2E encryption only) +4. Toggle: "Send anonymous analytics" (default ON) + - App usage data (no PII) +5. "Export All Data" button β†’ Generate ZIP (Story 1.6) +6. "Delete Account" button (red, bottom) β†’ Confirmation modal +7. Privacy Policy link +8. GDPR compliance message: "Your data is yours. We never sell it." + +**FRs:** FR122, FR123, FR102 + +### UX Notes +- Clear explanations for each toggle +- Warning if user disables cross-module sharing: "Some features won't work" +- Privacy Policy: Opens in-app browser + +### Technical Notes +- user_settings table: share_data_across_modules, ai_journal_analysis, send_analytics +- Feature checks: if (!share_data_across_modules) { disable insights } + +--- + +## Settings Structure + +``` +Settings +β”œβ”€β”€ Personal Info +β”‚ β”œβ”€β”€ Name +β”‚ β”œβ”€β”€ Email +β”‚ β”œβ”€β”€ Password +β”‚ └── Avatar +β”œβ”€β”€ Notifications +β”‚ β”œβ”€β”€ Reminders (toggles) +β”‚ β”œβ”€β”€ Reminder Times +β”‚ └── Quiet Hours +β”œβ”€β”€ Units +β”‚ β”œβ”€β”€ Weight (kg/lbs) +β”‚ β”œβ”€β”€ Distance (km/miles) +β”‚ └── Height (cm/inches) +β”œβ”€β”€ Subscription +β”‚ β”œβ”€β”€ Current Plan +β”‚ β”œβ”€β”€ Upgrade/Downgrade +β”‚ β”œβ”€β”€ Billing History +β”‚ └── Cancel +└── Data & Privacy + β”œβ”€β”€ Cross-module sharing + β”œβ”€β”€ AI analysis + β”œβ”€β”€ Analytics + β”œβ”€β”€ Export Data + β”œβ”€β”€ Delete Account + └── Privacy Policy +``` + +--- + +## Related Documents + +- [PRD-nfr.md](../../1-BASELINE/product/PRD-nfr.md) - NFR requirements (GDPR) +- [ARCH-security.md](../../1-BASELINE/architecture/ARCH-security.md) - Security architecture +- [epic-7-onboarding-subscriptions.md](./epic-7-onboarding-subscriptions.md) - Subscriptions + +--- + +*5 Stories | FR116-FR123 | Settings & Profile | Status: 80% Complete* diff --git a/docs/2-MANAGEMENT/project-status.md b/docs/2-MANAGEMENT/project-status.md new file mode 100644 index 0000000..96dd6e4 --- /dev/null +++ b/docs/2-MANAGEMENT/project-status.md @@ -0,0 +1,219 @@ +# LifeOS / GymApp - Project Status + + + +**Ostatnia aktualizacja:** 2025-12-02 (po audycie kodu) +**Status:** πŸ”„ W trakcie implementacji + +--- + +## Executive Summary + +| Metryka | Dokumentacja | RzeczywistoΕ›Δ‡ | +|---------|--------------|---------------| +| **Overall Progress** | ~66% | **~45%** | +| **Pliki Dart** | 287+ | 214+ | +| **Epiki** | 9 | 9 | +| **Stories gotowe** | 42/66 | **~25/66** | + +**UWAGA:** Po audycie kodu 2025-12-02 odkryto znaczΔ…ce rozbieΕΌnoΕ›ci. +SzczegΓ³Ε‚y: [MVP-AUDIT-REPORT.md](./MVP-AUDIT-REPORT.md) + +--- + +## Module Status (Zweryfikowany) + +| ModuΕ‚ | Dokumentacja | Kod | Uwagi | +|-------|-------------|-----|-------| +| **Core Infrastructure** | 90% | **85%** | Password reset, sync logic | +| **Life Coach** | 75% | **55%** | Mock repos, brak Chat UI | +| **Fitness Coach** | 82% | **90%** | Najlepszy moduΕ‚! | +| **Mind & Emotion** | 40% | **10%** | Brak playera, tylko UI scaffold | +| **Cross-Module Intel** | 25% | **5%** | Tylko tabele DB | +| **Gamification** | 83% | **5%** | Tylko Streaks table | +| **Subscriptions** | 86% | **5%** | IAP nie zintegrowane | +| **Notifications** | 0% | **0%** | Zgodne | +| **Onboarding** | 80% | **5%** | Placeholder only | + +--- + +## Epic Progress (Zweryfikowany) + +| Epic | Doc | Code | Delta | +|------|-----|------|-------| +| Epic 1: Core Platform | 100% | **70%** | -30% | +| Epic 2: Life Coach | 70% | **55%** | -15% | +| Epic 3: Fitness | 80% | **75%** | -5% | +| Epic 4: Mind | 42% | **10%** | -32% | +| Epic 5: Cross-Module | 20% | **5%** | -15% | +| Epic 6: Gamification | 83% | **5%** | -78% | +| Epic 7: Onboarding/Subs | 86% | **5%** | -81% | +| Epic 8: Notifications | 0% | **0%** | 0% | +| Epic 9: Settings | 80% | **25%** | -55% | + +--- + +## Co NAPRAWDĘ dziaΕ‚a + +### DONE (potwierdzone w kodzie): +- [x] **Auth:** Email login, registration, profile (Supabase) +- [x] **Fitness:** Workout logging, rest timer, history +- [x] **Fitness:** Smart Pattern Memory (pre-fill) +- [x] **Fitness:** Progress charts (fl_chart) +- [x] **Fitness:** Body measurements +- [x] **Fitness:** Templates +- [x] **Life Coach:** AI Daily Plan generation +- [x] **Life Coach:** Morning/Evening check-ins +- [x] **Life Coach:** Daily plan editing (drag & drop) +- [x] **Database:** 23+ Drift tables defined +- [x] **Database:** SyncQueue infrastructure + +### PARTIAL (wymaga pracy): +- [ ] **Life Coach Goals:** UI jest, ale MockRepository +- [ ] **Life Coach AI Chat:** Table jest, brak UI +- [ ] **Mind Meditation:** Library UI jest, brak playera +- [ ] **Password Reset:** TODO w kodzie +- [ ] **Data Sync:** SyncQueue table, brak logic + +### NOT DONE (mimo dokumentacji): +- [ ] **Meditation Player** - dokumentacja mΓ³wi "Done" +- [ ] **Onboarding Flow** - dokumentacja mΓ³wi "Complete" +- [ ] **IAP/Subscriptions** - dokumentacja mΓ³wi "Complete" +- [ ] **Gamification Badges** - dokumentacja mΓ³wi "In Progress" + +--- + +## Known Issues (Krytyczne) + +### 1. Mock Repositories +``` +MockGoalsRepository β†’ throws UnimplementedError +MockCheckInRepository β†’ throws UnimplementedError +MockPreferencesRepository β†’ returns hardcoded data +``` +**Impact:** App moΕΌe crashowaΔ‡ przy goal operations. + +### 2. Hardcoded IDs +```dart +userId: 'current_user_id' // TODO in 4 places +UserTier: UserTier.premium // TODO +``` +**Impact:** Brak personalizacji per user. + +### 3. Missing Critical Files +``` +- meditation_player_screen.dart β†’ NOT EXISTS +- coach_chat_page.dart β†’ NOT EXISTS +- onboarding screens β†’ PLACEHOLDER only +``` + +--- + +## Priority Queue (Zweryfikowane) + +### P0 - Blockers dla MVP + +| Task | Hours | Status | +|------|-------|--------| +| Replace MockGoalsRepository | 4h | ❌ | +| Replace MockCheckInRepository | 2h | ❌ | +| Fix hardcoded user IDs | 2h | ❌ | +| Exercise Library persistence | 4h | ❌ | + +### P1 - Core MVP Features + +| Task | Hours | Status | +|------|-------|--------| +| Meditation Player | 8h | ❌ | +| Mood Tracking UI | 4h | ❌ | +| Breathing Exercises | 6h | ❌ | +| AI Chat UI (Life Coach) | 8h | ❌ | + +### P2 - Post-MVP + +| Task | Status | +|------|--------| +| Onboarding flow | ❌ Deferred | +| IAP/Subscriptions | ❌ Deferred | +| Push notifications | ❌ Deferred | +| Cross-Module Intelligence | ❌ Deferred | +| Weekly reports | ❌ Deferred | + +--- + +## MVP 1.0 Scope + +**Target:** Minimalna dziaΕ‚ajΔ…ca aplikacja bez pΕ‚atnoΕ›ci + +### In Scope: +- Auth (email only) +- Fitness (full) +- Life Coach (daily plan + check-ins + goals) +- Mind (mood + meditation player + breathing) +- Settings (basic profile) + +### Out of Scope (MVP 1.1): +- Social login (Google, Apple) +- Onboarding flow +- IAP/Subscriptions +- Push notifications +- Cross-Module Intelligence +- Gamification badges +- Social sharing + +--- + +## Estimated Hours to MVP 1.0 + +| Category | Hours | +|----------|-------| +| Fix critical issues | 8h | +| Life Coach completion | 12h | +| Mind module basic | 18h | +| Polish & testing | 10h | +| **TOTAL** | **~48h** | + +--- + +## Recent Changes + +### 2025-12-02 +- Reorganizacja dokumentacji do BMAD framework +- **Audit kodu vs dokumentacji** - znaczΔ…ce rozbieΕΌnoΕ›ci +- Utworzono MVP-AUDIT-REPORT.md +- Zaktualizowano project-status.md z rzeczywistym stanem + +--- + +## Files Structure (Verified) + +``` +lib/ +β”œβ”€β”€ core/ # Infrastructure (~85% done) +β”‚ β”œβ”€β”€ auth/ βœ… Working +β”‚ β”œβ”€β”€ database/ βœ… Tables defined +β”‚ β”œβ”€β”€ sync/ ⚠️ Queue only, no logic +β”‚ β”œβ”€β”€ ai/ ⚠️ Interface defined +β”‚ └── router/ βœ… Working +β”‚ +β”œβ”€β”€ features/ +β”‚ β”œβ”€β”€ fitness/ βœ… ~90% - Best module +β”‚ β”œβ”€β”€ life_coach/ ⚠️ ~55% - Mock repos issue +β”‚ β”œβ”€β”€ mind_emotion/ ❌ ~10% - UI scaffold only +β”‚ β”œβ”€β”€ exercise/ ❌ ~20% - No persistence +β”‚ β”œβ”€β”€ settings/ ⚠️ ~25% - Basic only +β”‚ └── onboarding/ ❌ ~5% - Placeholder +``` + +--- + +## Links + +- [MVP-AUDIT-REPORT.md](./MVP-AUDIT-REPORT.md) - SzczegΓ³Ε‚owy audit +- [MVP-TODO.md](./MVP-TODO.md) - Master TODO list +- [epic-*.md](./epics/) - Stories per epic + +--- + +*Status zaktualizowany po audycie kodu: 2025-12-02* +*NastΔ™pna weryfikacja: Po implementacji P0 tasks* diff --git a/docs/3-ARCHITECTURE/README.md b/docs/3-ARCHITECTURE/README.md new file mode 100644 index 0000000..941e37a --- /dev/null +++ b/docs/3-ARCHITECTURE/README.md @@ -0,0 +1,46 @@ +# 3-ARCHITECTURE - Technical Design Documents + + + +**Opis:** SzczegΓ³Ε‚owe diagramy, decyzje techniczne per moduΕ‚. + +--- + +## ZawartoΕ›Δ‡ + +### system-design/ - System Design +- Life Coach module design (TBD) +- Fitness module design (TBD) +- Mind module design (TBD) +- Cross-Module Intelligence design (TBD) + +### integration/ - Integration Patterns +- API contracts (TBD) +- Data flow diagrams (TBD) +- Event handling (TBD) + +### deployment/ - Deployment Architecture +- CI/CD pipeline (TBD) +- Environment configuration (TBD) +- Monitoring setup (TBD) + +--- + +## Kiedy czytaΔ‡? + +| Cel | Plik | +|-----|------| +| Module design details | system-design/ | +| API integration | integration/ | +| DevOps/deployment | deployment/ | + +--- + +## PowiΔ…zane Dokumenty + +- [1-BASELINE/architecture/](../1-BASELINE/architecture/) - High-level architecture (overview, database, AI, security) +- [4-DEVELOPMENT/](../4-DEVELOPMENT/) - Developer guides + +--- + +*Detailed technical design per module* diff --git a/docs/4-DEVELOPMENT/README.md b/docs/4-DEVELOPMENT/README.md new file mode 100644 index 0000000..13648cb --- /dev/null +++ b/docs/4-DEVELOPMENT/README.md @@ -0,0 +1,37 @@ +# 4-DEVELOPMENT - Poradniki dla DeveloperΓ³w + + + +**Opis:** Setup, standardy kodu, wzorce, poradniki per moduΕ‚. + +--- + +## ZawartoΕ›Δ‡ + +### setup/ - Environment Setup +- [QUICK-START-5MIN.md](setup/QUICK-START-5MIN.md) - **Szybki start** + +### standards/ - Code Standards +- Code standards (TBD) +- Testing guidelines (TBD) +- Commit conventions (TBD) + +### patterns/ - Design Patterns +- Clean Architecture (TBD) +- State management (TBD) +- AI integration (TBD) + +### modules/ - Per-Module Guides +- Working with Fitness (TBD) +- Working with Life Coach (TBD) +- Working with Mind (TBD) + +--- + +## Kiedy czytaΔ‡? + +| Cel | Plik | +|-----|------| +| Nowy developer | setup/QUICK-START-5MIN.md | +| Coding standards | standards/ | +| Architecture patterns | patterns/ | diff --git a/docs/4-DEVELOPMENT/setup/QUICK-START-5MIN.md b/docs/4-DEVELOPMENT/setup/QUICK-START-5MIN.md new file mode 100644 index 0000000..2f85648 --- /dev/null +++ b/docs/4-DEVELOPMENT/setup/QUICK-START-5MIN.md @@ -0,0 +1,125 @@ +# Quick Start - 5 Minutes Setup + + + +**Cel:** Uruchomienie projektu w 5 minut + +--- + +## Prerequisites + +- Flutter SDK 3.38+ +- Dart 3.10+ +- Git +- VS Code / Android Studio + +--- + +## 1. Clone & Setup (2 min) + +```bash +# Clone repo +git clone https://github.com/CoderMariusz/GymApp.git +cd GymApp + +# Install dependencies +flutter pub get + +# Generate code (Drift, Freezed, Riverpod) +dart run build_runner build --delete-conflicting-outputs +``` + +--- + +## 2. Configuration (1 min) + +StwΓ³rz plik `.env` w root: + +```bash +SUPABASE_URL=your_supabase_url +SUPABASE_ANON_KEY=your_anon_key +``` + +Lub uΕΌyj istniejΔ…cej konfiguracji w `lib/core/config/`. + +--- + +## 3. Run App (2 min) + +```bash +# SprawdΕΊ urzΔ…dzenia +flutter devices + +# Uruchom na emulatorze/symulatorze +flutter run + +# Z hot reload +flutter run --hot +``` + +--- + +## Verification + +Po uruchomieniu powinieneΕ› zobaczyΔ‡: +- Ekran logowania/rejestracji +- MoΕΌliwoΕ›Δ‡ nawigacji po moduΕ‚ach + +--- + +## Common Issues + +| Problem | RozwiΔ…zanie | +|---------|-------------| +| `build_runner` fails | `flutter clean && flutter pub get` | +| Supabase connection | SprawdΕΊ `.env` credentials | +| iOS simulator | `flutter run -d ios` | +| Android emulator | `flutter run -d android` | + +--- + +## Next Steps + +1. **Zrozumienie architektury:** `docs/1-BASELINE/architecture/ARCH-overview.md` +2. **Standardy kodu:** `docs/4-DEVELOPMENT/standards/` +3. **Aktualne zadania:** `docs/2-MANAGEMENT/project-status.md` + +--- + +## Project Structure + +``` +lib/ +β”œβ”€β”€ core/ # Shared utilities (auth, db, sync) +β”œβ”€β”€ features/ # Feature modules +β”‚ β”œβ”€β”€ life_coach/ +β”‚ β”œβ”€β”€ fitness/ +β”‚ β”œβ”€β”€ mind_emotion/ +β”‚ └── ... +└── generated/ # Generated code +``` + +--- + +## Useful Commands + +```bash +# Run tests +flutter test + +# Build APK +flutter build apk + +# Build iOS +flutter build ios + +# Analyze code +flutter analyze + +# Format code +dart format lib/ +``` + +--- + +*Setup time: ~5 minutes | Full docs: docs/* diff --git a/docs/5-ARCHIVE/README.md b/docs/5-ARCHIVE/README.md new file mode 100644 index 0000000..0209bb9 --- /dev/null +++ b/docs/5-ARCHIVE/README.md @@ -0,0 +1,47 @@ +# 5-ARCHIVE - Archived Documentation + + + +**Opis:** Stara dokumentacja, sprint artifacts, pliki historyczne. Zachowane dla referencji. + +--- + +## ZawartoΕ›Δ‡ + +### deprecated/ - Deprecated Documents +Stara dokumentacja, ktΓ³ra zostaΕ‚a zastΔ…piona przez nowΔ… strukturΔ™ BMAD: +- Old PRD files +- Old architecture files +- Old epic files +- Sprint artifacts + +### historical/ - Historical Documents +Dokumenty historyczne, brainstorming sessions, research: +- 2025-11-15 Fitness research +- 2025-01-16 Planning sessions +- Original brainstorming documents + +--- + +## Uwaga + +Pliki w tym folderze sΔ… zachowane dla referencji historycznej. + +**NIE uΕΌywaj** tych plikΓ³w jako ΕΊrΓ³dΕ‚a prawdy - aktualna dokumentacja znajduje siΔ™ w: +- `1-BASELINE/` - Wymagania i architektura +- `2-MANAGEMENT/` - Epics i backlog +- `4-DEVELOPMENT/` - Poradniki deweloperskie + +--- + +## Kiedy szukaΔ‡ tutaj? + +| Pytanie | Lokalizacja | +|---------|-------------| +| Stare decyzje projektowe | deprecated/ | +| Historia brainstormingu | historical/ | +| Poprzednie sprinty | deprecated/sprint-artifacts/ | + +--- + +*Archived for reference only - Do not use as source of truth* diff --git a/docs/AUDIT_SUMMARY_QUICK_REFERENCE.md b/docs/5-ARCHIVE/deprecated/AUDIT_SUMMARY_QUICK_REFERENCE.md similarity index 100% rename from docs/AUDIT_SUMMARY_QUICK_REFERENCE.md rename to docs/5-ARCHIVE/deprecated/AUDIT_SUMMARY_QUICK_REFERENCE.md diff --git a/docs/BATCH_FILE_ASSIGNMENTS.txt b/docs/5-ARCHIVE/deprecated/BATCH_FILE_ASSIGNMENTS.txt similarity index 100% rename from docs/BATCH_FILE_ASSIGNMENTS.txt rename to docs/5-ARCHIVE/deprecated/BATCH_FILE_ASSIGNMENTS.txt diff --git a/docs/BATCH_QUICK_START.md b/docs/5-ARCHIVE/deprecated/BATCH_QUICK_START.md similarity index 100% rename from docs/BATCH_QUICK_START.md rename to docs/5-ARCHIVE/deprecated/BATCH_QUICK_START.md diff --git a/docs/BATCH_REPAIR_INSTRUCTIONS.md b/docs/5-ARCHIVE/deprecated/BATCH_REPAIR_INSTRUCTIONS.md similarity index 100% rename from docs/BATCH_REPAIR_INSTRUCTIONS.md rename to docs/5-ARCHIVE/deprecated/BATCH_REPAIR_INSTRUCTIONS.md diff --git a/docs/DEVELOPMENT_GUIDE.md b/docs/5-ARCHIVE/deprecated/DEVELOPMENT_GUIDE.md similarity index 100% rename from docs/DEVELOPMENT_GUIDE.md rename to docs/5-ARCHIVE/deprecated/DEVELOPMENT_GUIDE.md diff --git a/docs/DOCUMENTATION_AUDIT_REPORT.md b/docs/5-ARCHIVE/deprecated/DOCUMENTATION_AUDIT_REPORT.md similarity index 100% rename from docs/DOCUMENTATION_AUDIT_REPORT.md rename to docs/5-ARCHIVE/deprecated/DOCUMENTATION_AUDIT_REPORT.md diff --git a/docs/ERROR_ANALYSIS_REPORT.md b/docs/5-ARCHIVE/deprecated/ERROR_ANALYSIS_REPORT.md similarity index 100% rename from docs/ERROR_ANALYSIS_REPORT.md rename to docs/5-ARCHIVE/deprecated/ERROR_ANALYSIS_REPORT.md diff --git a/docs/FILES_TO_DELETE.md b/docs/5-ARCHIVE/deprecated/FILES_TO_DELETE.md similarity index 100% rename from docs/FILES_TO_DELETE.md rename to docs/5-ARCHIVE/deprecated/FILES_TO_DELETE.md diff --git a/docs/PROJECT-SETUP-GUIDE.md b/docs/5-ARCHIVE/deprecated/PROJECT-SETUP-GUIDE.md similarity index 100% rename from docs/PROJECT-SETUP-GUIDE.md rename to docs/5-ARCHIVE/deprecated/PROJECT-SETUP-GUIDE.md diff --git a/docs/STATUS_UPDATE.md b/docs/5-ARCHIVE/deprecated/STATUS_UPDATE.md similarity index 100% rename from docs/STATUS_UPDATE.md rename to docs/5-ARCHIVE/deprecated/STATUS_UPDATE.md diff --git a/docs/bmm-workflow-status.yaml b/docs/5-ARCHIVE/deprecated/bmm-workflow-status.yaml similarity index 100% rename from docs/bmm-workflow-status.yaml rename to docs/5-ARCHIVE/deprecated/bmm-workflow-status.yaml diff --git a/docs/ecosystem/architecture-validation-report-2025-01-16.md b/docs/5-ARCHIVE/deprecated/ecosystem/architecture-validation-report-2025-01-16.md similarity index 100% rename from docs/ecosystem/architecture-validation-report-2025-01-16.md rename to docs/5-ARCHIVE/deprecated/ecosystem/architecture-validation-report-2025-01-16.md diff --git a/docs/ecosystem/architecture-validation-report.md b/docs/5-ARCHIVE/deprecated/ecosystem/architecture-validation-report.md similarity index 100% rename from docs/ecosystem/architecture-validation-report.md rename to docs/5-ARCHIVE/deprecated/ecosystem/architecture-validation-report.md diff --git a/docs/ecosystem/architecture.md b/docs/5-ARCHIVE/deprecated/ecosystem/architecture.md similarity index 100% rename from docs/ecosystem/architecture.md rename to docs/5-ARCHIVE/deprecated/ecosystem/architecture.md diff --git a/docs/ecosystem/bmm-workflow-status.yaml b/docs/5-ARCHIVE/deprecated/ecosystem/bmm-workflow-status.yaml similarity index 100% rename from docs/ecosystem/bmm-workflow-status.yaml rename to docs/5-ARCHIVE/deprecated/ecosystem/bmm-workflow-status.yaml diff --git a/docs/ecosystem/devops-strategy.md b/docs/5-ARCHIVE/deprecated/ecosystem/devops-strategy.md similarity index 100% rename from docs/ecosystem/devops-strategy.md rename to docs/5-ARCHIVE/deprecated/ecosystem/devops-strategy.md diff --git a/docs/ecosystem/epic-0-setup-infrastructure.md b/docs/5-ARCHIVE/deprecated/ecosystem/epic-0-setup-infrastructure.md similarity index 100% rename from docs/ecosystem/epic-0-setup-infrastructure.md rename to docs/5-ARCHIVE/deprecated/ecosystem/epic-0-setup-infrastructure.md diff --git a/docs/ecosystem/epics.md b/docs/5-ARCHIVE/deprecated/ecosystem/epics.md similarity index 100% rename from docs/ecosystem/epics.md rename to docs/5-ARCHIVE/deprecated/ecosystem/epics.md diff --git a/docs/ecosystem/implementation-readiness-report-2025-01-16.md b/docs/5-ARCHIVE/deprecated/ecosystem/implementation-readiness-report-2025-01-16.md similarity index 100% rename from docs/ecosystem/implementation-readiness-report-2025-01-16.md rename to docs/5-ARCHIVE/deprecated/ecosystem/implementation-readiness-report-2025-01-16.md diff --git a/docs/ecosystem/lifeos-market-analysis-extended.md b/docs/5-ARCHIVE/deprecated/ecosystem/lifeos-market-analysis-extended.md similarity index 100% rename from docs/ecosystem/lifeos-market-analysis-extended.md rename to docs/5-ARCHIVE/deprecated/ecosystem/lifeos-market-analysis-extended.md diff --git a/docs/ecosystem/prd-validation-report-2025-01-16.md b/docs/5-ARCHIVE/deprecated/ecosystem/prd-validation-report-2025-01-16.md similarity index 100% rename from docs/ecosystem/prd-validation-report-2025-01-16.md rename to docs/5-ARCHIVE/deprecated/ecosystem/prd-validation-report-2025-01-16.md diff --git a/docs/ecosystem/prd.md b/docs/5-ARCHIVE/deprecated/ecosystem/prd.md similarity index 100% rename from docs/ecosystem/prd.md rename to docs/5-ARCHIVE/deprecated/ecosystem/prd.md diff --git a/docs/ecosystem/product-brief-LifeOS-2025-01-16.md b/docs/5-ARCHIVE/deprecated/ecosystem/product-brief-LifeOS-2025-01-16.md similarity index 100% rename from docs/ecosystem/product-brief-LifeOS-2025-01-16.md rename to docs/5-ARCHIVE/deprecated/ecosystem/product-brief-LifeOS-2025-01-16.md diff --git a/docs/ecosystem/research-domain-2025-01-16.md b/docs/5-ARCHIVE/deprecated/ecosystem/research-domain-2025-01-16.md similarity index 100% rename from docs/ecosystem/research-domain-2025-01-16.md rename to docs/5-ARCHIVE/deprecated/ecosystem/research-domain-2025-01-16.md diff --git a/docs/ecosystem/research-technical-2025-01-16.md b/docs/5-ARCHIVE/deprecated/ecosystem/research-technical-2025-01-16.md similarity index 100% rename from docs/ecosystem/research-technical-2025-01-16.md rename to docs/5-ARCHIVE/deprecated/ecosystem/research-technical-2025-01-16.md diff --git a/docs/ecosystem/security-architecture.md b/docs/5-ARCHIVE/deprecated/ecosystem/security-architecture.md similarity index 100% rename from docs/ecosystem/security-architecture.md rename to docs/5-ARCHIVE/deprecated/ecosystem/security-architecture.md diff --git a/docs/ecosystem/sprint-0-database-schema-completion.md b/docs/5-ARCHIVE/deprecated/ecosystem/sprint-0-database-schema-completion.md similarity index 100% rename from docs/ecosystem/sprint-0-database-schema-completion.md rename to docs/5-ARCHIVE/deprecated/ecosystem/sprint-0-database-schema-completion.md diff --git a/docs/ecosystem/test-design-system.md b/docs/5-ARCHIVE/deprecated/ecosystem/test-design-system.md similarity index 100% rename from docs/ecosystem/test-design-system.md rename to docs/5-ARCHIVE/deprecated/ecosystem/test-design-system.md diff --git a/docs/ecosystem/testing-strategy.md b/docs/5-ARCHIVE/deprecated/ecosystem/testing-strategy.md similarity index 100% rename from docs/ecosystem/testing-strategy.md rename to docs/5-ARCHIVE/deprecated/ecosystem/testing-strategy.md diff --git a/docs/ecosystem/ux-design-specification.md b/docs/5-ARCHIVE/deprecated/ecosystem/ux-design-specification.md similarity index 100% rename from docs/ecosystem/ux-design-specification.md rename to docs/5-ARCHIVE/deprecated/ecosystem/ux-design-specification.md diff --git a/docs/ecosystem/ux-validation-report-2025-01-16.md b/docs/5-ARCHIVE/deprecated/ecosystem/ux-validation-report-2025-01-16.md similarity index 100% rename from docs/ecosystem/ux-validation-report-2025-01-16.md rename to docs/5-ARCHIVE/deprecated/ecosystem/ux-validation-report-2025-01-16.md diff --git a/docs/ecosystem/validation-report-2025-01-16.md b/docs/5-ARCHIVE/deprecated/ecosystem/validation-report-2025-01-16.md similarity index 100% rename from docs/ecosystem/validation-report-2025-01-16.md rename to docs/5-ARCHIVE/deprecated/ecosystem/validation-report-2025-01-16.md diff --git a/docs/implementation_plans/00-shared-components.md b/docs/5-ARCHIVE/deprecated/implementation_plans/00-shared-components.md similarity index 100% rename from docs/implementation_plans/00-shared-components.md rename to docs/5-ARCHIVE/deprecated/implementation_plans/00-shared-components.md diff --git a/docs/implementation_plans/01-batch-2-ai-features.md b/docs/5-ARCHIVE/deprecated/implementation_plans/01-batch-2-ai-features.md similarity index 100% rename from docs/implementation_plans/01-batch-2-ai-features.md rename to docs/5-ARCHIVE/deprecated/implementation_plans/01-batch-2-ai-features.md diff --git a/docs/implementation_plans/02-batch-4-charts-smart-features.md b/docs/5-ARCHIVE/deprecated/implementation_plans/02-batch-4-charts-smart-features.md similarity index 100% rename from docs/implementation_plans/02-batch-4-charts-smart-features.md rename to docs/5-ARCHIVE/deprecated/implementation_plans/02-batch-4-charts-smart-features.md diff --git a/docs/implementation_plans/BATCH_1_PLAN.md b/docs/5-ARCHIVE/deprecated/implementation_plans/BATCH_1_PLAN.md similarity index 100% rename from docs/implementation_plans/BATCH_1_PLAN.md rename to docs/5-ARCHIVE/deprecated/implementation_plans/BATCH_1_PLAN.md diff --git a/docs/implementation_plans/BATCH_3_PLAN.md b/docs/5-ARCHIVE/deprecated/implementation_plans/BATCH_3_PLAN.md similarity index 100% rename from docs/implementation_plans/BATCH_3_PLAN.md rename to docs/5-ARCHIVE/deprecated/implementation_plans/BATCH_3_PLAN.md diff --git a/docs/implementation_plans/README.md b/docs/5-ARCHIVE/deprecated/implementation_plans/README.md similarity index 100% rename from docs/implementation_plans/README.md rename to docs/5-ARCHIVE/deprecated/implementation_plans/README.md diff --git a/docs/implementation_plans/SHARED_COMPONENTS.md b/docs/5-ARCHIVE/deprecated/implementation_plans/SHARED_COMPONENTS.md similarity index 100% rename from docs/implementation_plans/SHARED_COMPONENTS.md rename to docs/5-ARCHIVE/deprecated/implementation_plans/SHARED_COMPONENTS.md diff --git a/docs/modules/module-fitness/PRD.md b/docs/5-ARCHIVE/deprecated/modules/module-fitness/PRD.md similarity index 100% rename from docs/modules/module-fitness/PRD.md rename to docs/5-ARCHIVE/deprecated/modules/module-fitness/PRD.md diff --git a/docs/modules/module-fitness/README.md b/docs/5-ARCHIVE/deprecated/modules/module-fitness/README.md similarity index 100% rename from docs/modules/module-fitness/README.md rename to docs/5-ARCHIVE/deprecated/modules/module-fitness/README.md diff --git a/docs/modules/module-fitness/architecture-validation-report.md b/docs/5-ARCHIVE/deprecated/modules/module-fitness/architecture-validation-report.md similarity index 100% rename from docs/modules/module-fitness/architecture-validation-report.md rename to docs/5-ARCHIVE/deprecated/modules/module-fitness/architecture-validation-report.md diff --git a/docs/modules/module-fitness/architecture.md b/docs/5-ARCHIVE/deprecated/modules/module-fitness/architecture.md similarity index 100% rename from docs/modules/module-fitness/architecture.md rename to docs/5-ARCHIVE/deprecated/modules/module-fitness/architecture.md diff --git a/docs/modules/module-fitness/competitive-intelligence-condensed.md b/docs/5-ARCHIVE/deprecated/modules/module-fitness/competitive-intelligence-condensed.md similarity index 100% rename from docs/modules/module-fitness/competitive-intelligence-condensed.md rename to docs/5-ARCHIVE/deprecated/modules/module-fitness/competitive-intelligence-condensed.md diff --git a/docs/modules/module-fitness/epics.md b/docs/5-ARCHIVE/deprecated/modules/module-fitness/epics.md similarity index 100% rename from docs/modules/module-fitness/epics.md rename to docs/5-ARCHIVE/deprecated/modules/module-fitness/epics.md diff --git a/docs/modules/module-fitness/product-brief-GymApp-2025-11-15.md b/docs/5-ARCHIVE/deprecated/modules/module-fitness/product-brief-GymApp-2025-11-15.md similarity index 100% rename from docs/modules/module-fitness/product-brief-GymApp-2025-11-15.md rename to docs/5-ARCHIVE/deprecated/modules/module-fitness/product-brief-GymApp-2025-11-15.md diff --git a/docs/modules/module-fitness/sprint-1-backlog.md b/docs/5-ARCHIVE/deprecated/modules/module-fitness/sprint-1-backlog.md similarity index 100% rename from docs/modules/module-fitness/sprint-1-backlog.md rename to docs/5-ARCHIVE/deprecated/modules/module-fitness/sprint-1-backlog.md diff --git a/docs/modules/module-fitness/sprint-1-quick-start.md b/docs/5-ARCHIVE/deprecated/modules/module-fitness/sprint-1-quick-start.md similarity index 100% rename from docs/modules/module-fitness/sprint-1-quick-start.md rename to docs/5-ARCHIVE/deprecated/modules/module-fitness/sprint-1-quick-start.md diff --git a/docs/modules/module-fitness/sprint-2-backlog.md b/docs/5-ARCHIVE/deprecated/modules/module-fitness/sprint-2-backlog.md similarity index 100% rename from docs/modules/module-fitness/sprint-2-backlog.md rename to docs/5-ARCHIVE/deprecated/modules/module-fitness/sprint-2-backlog.md diff --git a/docs/modules/module-fitness/sprint-2-deferred-items.md b/docs/5-ARCHIVE/deprecated/modules/module-fitness/sprint-2-deferred-items.md similarity index 100% rename from docs/modules/module-fitness/sprint-2-deferred-items.md rename to docs/5-ARCHIVE/deprecated/modules/module-fitness/sprint-2-deferred-items.md diff --git a/docs/modules/module-fitness/sprint-3-backlog.md b/docs/5-ARCHIVE/deprecated/modules/module-fitness/sprint-3-backlog.md similarity index 100% rename from docs/modules/module-fitness/sprint-3-backlog.md rename to docs/5-ARCHIVE/deprecated/modules/module-fitness/sprint-3-backlog.md diff --git a/docs/modules/module-fitness/sprint-planning-summary.md b/docs/5-ARCHIVE/deprecated/modules/module-fitness/sprint-planning-summary.md similarity index 100% rename from docs/modules/module-fitness/sprint-planning-summary.md rename to docs/5-ARCHIVE/deprecated/modules/module-fitness/sprint-planning-summary.md diff --git a/docs/modules/module-fitness/sprint-status.yaml b/docs/5-ARCHIVE/deprecated/modules/module-fitness/sprint-status.yaml similarity index 100% rename from docs/modules/module-fitness/sprint-status.yaml rename to docs/5-ARCHIVE/deprecated/modules/module-fitness/sprint-status.yaml diff --git a/docs/modules/module-fitness/test-design.md b/docs/5-ARCHIVE/deprecated/modules/module-fitness/test-design.md similarity index 100% rename from docs/modules/module-fitness/test-design.md rename to docs/5-ARCHIVE/deprecated/modules/module-fitness/test-design.md diff --git a/docs/modules/module-fitness/ux-color-themes.html b/docs/5-ARCHIVE/deprecated/modules/module-fitness/ux-color-themes.html similarity index 100% rename from docs/modules/module-fitness/ux-color-themes.html rename to docs/5-ARCHIVE/deprecated/modules/module-fitness/ux-color-themes.html diff --git a/docs/modules/module-fitness/ux-design-directions.html b/docs/5-ARCHIVE/deprecated/modules/module-fitness/ux-design-directions.html similarity index 100% rename from docs/modules/module-fitness/ux-design-directions.html rename to docs/5-ARCHIVE/deprecated/modules/module-fitness/ux-design-directions.html diff --git a/docs/modules/module-fitness/ux-design-specification.md b/docs/5-ARCHIVE/deprecated/modules/module-fitness/ux-design-specification.md similarity index 100% rename from docs/modules/module-fitness/ux-design-specification.md rename to docs/5-ARCHIVE/deprecated/modules/module-fitness/ux-design-specification.md diff --git a/docs/modules/module-life-coach/README.md b/docs/5-ARCHIVE/deprecated/modules/module-life-coach/README.md similarity index 100% rename from docs/modules/module-life-coach/README.md rename to docs/5-ARCHIVE/deprecated/modules/module-life-coach/README.md diff --git a/docs/modules/module-mind/README.md b/docs/5-ARCHIVE/deprecated/modules/module-mind/README.md similarity index 100% rename from docs/modules/module-mind/README.md rename to docs/5-ARCHIVE/deprecated/modules/module-mind/README.md diff --git a/docs/sprint-artifacts/BATCH_CONTEXT_CREATION_PLAN.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/BATCH_CONTEXT_CREATION_PLAN.md similarity index 100% rename from docs/sprint-artifacts/BATCH_CONTEXT_CREATION_PLAN.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/BATCH_CONTEXT_CREATION_PLAN.md diff --git a/docs/sprint-artifacts/BATCH_PLAN_OPTIMIZED.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/BATCH_PLAN_OPTIMIZED.md similarity index 100% rename from docs/sprint-artifacts/BATCH_PLAN_OPTIMIZED.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/BATCH_PLAN_OPTIMIZED.md diff --git a/docs/sprint-artifacts/CONTEXT_CREATION_WORKFLOW.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/CONTEXT_CREATION_WORKFLOW.md similarity index 100% rename from docs/sprint-artifacts/CONTEXT_CREATION_WORKFLOW.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/CONTEXT_CREATION_WORKFLOW.md diff --git a/docs/sprint-artifacts/OPTIMIZATION_REPORT.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/OPTIMIZATION_REPORT.md similarity index 100% rename from docs/sprint-artifacts/OPTIMIZATION_REPORT.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/OPTIMIZATION_REPORT.md diff --git a/docs/sprint-artifacts/QUICK_CONTEXT_FORMAT.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/QUICK_CONTEXT_FORMAT.md similarity index 100% rename from docs/sprint-artifacts/QUICK_CONTEXT_FORMAT.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/QUICK_CONTEXT_FORMAT.md diff --git a/docs/sprint-artifacts/SHARED_TEMPLATES_LIBRARY.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/SHARED_TEMPLATES_LIBRARY.md similarity index 100% rename from docs/sprint-artifacts/SHARED_TEMPLATES_LIBRARY.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/SHARED_TEMPLATES_LIBRARY.md diff --git a/docs/sprint-artifacts/SPRINT-PLANNING-STATUS-REPORT-2025-11-17.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/SPRINT-PLANNING-STATUS-REPORT-2025-11-17.md similarity index 100% rename from docs/sprint-artifacts/SPRINT-PLANNING-STATUS-REPORT-2025-11-17.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/SPRINT-PLANNING-STATUS-REPORT-2025-11-17.md diff --git a/docs/sprint-artifacts/START_HERE.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/START_HERE.md similarity index 100% rename from docs/sprint-artifacts/START_HERE.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/START_HERE.md diff --git a/docs/sprint-artifacts/STORY_CONTEXT_INVENTORY.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/STORY_CONTEXT_INVENTORY.md similarity index 100% rename from docs/sprint-artifacts/STORY_CONTEXT_INVENTORY.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/STORY_CONTEXT_INVENTORY.md diff --git a/docs/sprint-artifacts/STORY_TEMPLATE_MAPPING.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/STORY_TEMPLATE_MAPPING.md similarity index 100% rename from docs/sprint-artifacts/STORY_TEMPLATE_MAPPING.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/STORY_TEMPLATE_MAPPING.md diff --git a/docs/sprint-artifacts/sprint-1/1-1-user-account-creation.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-1/1-1-user-account-creation.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-1/1-1-user-account-creation.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-1/1-1-user-account-creation.context.xml diff --git a/docs/sprint-artifacts/sprint-1/1-1-user-account-creation.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-1/1-1-user-account-creation.md similarity index 100% rename from docs/sprint-artifacts/sprint-1/1-1-user-account-creation.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-1/1-1-user-account-creation.md diff --git a/docs/sprint-artifacts/sprint-1/1-2-user-login-session-management.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-1/1-2-user-login-session-management.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-1/1-2-user-login-session-management.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-1/1-2-user-login-session-management.context.xml diff --git a/docs/sprint-artifacts/sprint-1/1-2-user-login-session-management.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-1/1-2-user-login-session-management.md similarity index 100% rename from docs/sprint-artifacts/sprint-1/1-2-user-login-session-management.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-1/1-2-user-login-session-management.md diff --git a/docs/sprint-artifacts/sprint-1/1-3-password-reset-flow.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-1/1-3-password-reset-flow.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-1/1-3-password-reset-flow.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-1/1-3-password-reset-flow.context.xml diff --git a/docs/sprint-artifacts/sprint-1/1-3-password-reset-flow.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-1/1-3-password-reset-flow.md similarity index 100% rename from docs/sprint-artifacts/sprint-1/1-3-password-reset-flow.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-1/1-3-password-reset-flow.md diff --git a/docs/sprint-artifacts/sprint-1/1-4-user-profile-management.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-1/1-4-user-profile-management.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-1/1-4-user-profile-management.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-1/1-4-user-profile-management.context.xml diff --git a/docs/sprint-artifacts/sprint-1/1-4-user-profile-management.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-1/1-4-user-profile-management.md similarity index 100% rename from docs/sprint-artifacts/sprint-1/1-4-user-profile-management.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-1/1-4-user-profile-management.md diff --git a/docs/sprint-artifacts/sprint-1/1-5-data-sync-across-devices.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-1/1-5-data-sync-across-devices.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-1/1-5-data-sync-across-devices.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-1/1-5-data-sync-across-devices.context.xml diff --git a/docs/sprint-artifacts/sprint-1/1-5-data-sync-across-devices.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-1/1-5-data-sync-across-devices.md similarity index 100% rename from docs/sprint-artifacts/sprint-1/1-5-data-sync-across-devices.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-1/1-5-data-sync-across-devices.md diff --git a/docs/sprint-artifacts/sprint-1/1-6-gdpr-compliance-data-export-deletion.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-1/1-6-gdpr-compliance-data-export-deletion.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-1/1-6-gdpr-compliance-data-export-deletion.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-1/1-6-gdpr-compliance-data-export-deletion.context.xml diff --git a/docs/sprint-artifacts/sprint-1/1-6-gdpr-compliance-data-export-deletion.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-1/1-6-gdpr-compliance-data-export-deletion.md similarity index 100% rename from docs/sprint-artifacts/sprint-1/1-6-gdpr-compliance-data-export-deletion.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-1/1-6-gdpr-compliance-data-export-deletion.md diff --git a/docs/sprint-artifacts/sprint-1/SPRINT-SUMMARY.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-1/SPRINT-SUMMARY.md similarity index 100% rename from docs/sprint-artifacts/sprint-1/SPRINT-SUMMARY.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-1/SPRINT-SUMMARY.md diff --git a/docs/sprint-artifacts/sprint-1/VALIDATION-REPORT-2025-11-17.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-1/VALIDATION-REPORT-2025-11-17.md similarity index 100% rename from docs/sprint-artifacts/sprint-1/VALIDATION-REPORT-2025-11-17.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-1/VALIDATION-REPORT-2025-11-17.md diff --git a/docs/sprint-artifacts/sprint-2/2-1-morning-check-in-flow.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/2-1-morning-check-in-flow.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-2/2-1-morning-check-in-flow.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/2-1-morning-check-in-flow.context.xml diff --git a/docs/sprint-artifacts/sprint-2/2-1-morning-check-in-flow.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/2-1-morning-check-in-flow.md similarity index 100% rename from docs/sprint-artifacts/sprint-2/2-1-morning-check-in-flow.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/2-1-morning-check-in-flow.md diff --git a/docs/sprint-artifacts/sprint-2/2-10-weekly-summary-report-life-coach.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/2-10-weekly-summary-report-life-coach.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-2/2-10-weekly-summary-report-life-coach.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/2-10-weekly-summary-report-life-coach.context.xml diff --git a/docs/sprint-artifacts/sprint-2/2-10-weekly-summary-report-life-coach.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/2-10-weekly-summary-report-life-coach.md similarity index 100% rename from docs/sprint-artifacts/sprint-2/2-10-weekly-summary-report-life-coach.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/2-10-weekly-summary-report-life-coach.md diff --git a/docs/sprint-artifacts/sprint-2/2-2-ai-daily-plan-generation.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/2-2-ai-daily-plan-generation.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-2/2-2-ai-daily-plan-generation.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/2-2-ai-daily-plan-generation.context.xml diff --git a/docs/sprint-artifacts/sprint-2/2-2-ai-daily-plan-generation.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/2-2-ai-daily-plan-generation.md similarity index 100% rename from docs/sprint-artifacts/sprint-2/2-2-ai-daily-plan-generation.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/2-2-ai-daily-plan-generation.md diff --git a/docs/sprint-artifacts/sprint-2/2-3-goal-creation-tracking.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/2-3-goal-creation-tracking.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-2/2-3-goal-creation-tracking.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/2-3-goal-creation-tracking.context.xml diff --git a/docs/sprint-artifacts/sprint-2/2-3-goal-creation-tracking.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/2-3-goal-creation-tracking.md similarity index 100% rename from docs/sprint-artifacts/sprint-2/2-3-goal-creation-tracking.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/2-3-goal-creation-tracking.md diff --git a/docs/sprint-artifacts/sprint-2/2-4-ai-conversational-coaching.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/2-4-ai-conversational-coaching.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-2/2-4-ai-conversational-coaching.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/2-4-ai-conversational-coaching.context.xml diff --git a/docs/sprint-artifacts/sprint-2/2-4-ai-conversational-coaching.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/2-4-ai-conversational-coaching.md similarity index 100% rename from docs/sprint-artifacts/sprint-2/2-4-ai-conversational-coaching.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/2-4-ai-conversational-coaching.md diff --git a/docs/sprint-artifacts/sprint-2/2-5-evening-reflection-flow.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/2-5-evening-reflection-flow.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-2/2-5-evening-reflection-flow.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/2-5-evening-reflection-flow.context.xml diff --git a/docs/sprint-artifacts/sprint-2/2-5-evening-reflection-flow.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/2-5-evening-reflection-flow.md similarity index 100% rename from docs/sprint-artifacts/sprint-2/2-5-evening-reflection-flow.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/2-5-evening-reflection-flow.md diff --git a/docs/sprint-artifacts/sprint-2/2-6-streak-tracking-check-ins.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/2-6-streak-tracking-check-ins.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-2/2-6-streak-tracking-check-ins.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/2-6-streak-tracking-check-ins.context.xml diff --git a/docs/sprint-artifacts/sprint-2/2-6-streak-tracking-check-ins.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/2-6-streak-tracking-check-ins.md similarity index 100% rename from docs/sprint-artifacts/sprint-2/2-6-streak-tracking-check-ins.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/2-6-streak-tracking-check-ins.md diff --git a/docs/sprint-artifacts/sprint-2/2-7-progress-dashboard-life-coach.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/2-7-progress-dashboard-life-coach.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-2/2-7-progress-dashboard-life-coach.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/2-7-progress-dashboard-life-coach.context.xml diff --git a/docs/sprint-artifacts/sprint-2/2-7-progress-dashboard-life-coach.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/2-7-progress-dashboard-life-coach.md similarity index 100% rename from docs/sprint-artifacts/sprint-2/2-7-progress-dashboard-life-coach.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/2-7-progress-dashboard-life-coach.md diff --git a/docs/sprint-artifacts/sprint-2/2-8-daily-plan-manual-adjustment.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/2-8-daily-plan-manual-adjustment.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-2/2-8-daily-plan-manual-adjustment.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/2-8-daily-plan-manual-adjustment.context.xml diff --git a/docs/sprint-artifacts/sprint-2/2-8-daily-plan-manual-adjustment.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/2-8-daily-plan-manual-adjustment.md similarity index 100% rename from docs/sprint-artifacts/sprint-2/2-8-daily-plan-manual-adjustment.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/2-8-daily-plan-manual-adjustment.md diff --git a/docs/sprint-artifacts/sprint-2/2-9-goal-suggestions-ai.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/2-9-goal-suggestions-ai.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-2/2-9-goal-suggestions-ai.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/2-9-goal-suggestions-ai.context.xml diff --git a/docs/sprint-artifacts/sprint-2/2-9-goal-suggestions-ai.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/2-9-goal-suggestions-ai.md similarity index 100% rename from docs/sprint-artifacts/sprint-2/2-9-goal-suggestions-ai.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/2-9-goal-suggestions-ai.md diff --git a/docs/sprint-artifacts/sprint-2/SPRINT-SUMMARY.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/SPRINT-SUMMARY.md similarity index 100% rename from docs/sprint-artifacts/sprint-2/SPRINT-SUMMARY.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-2/SPRINT-SUMMARY.md diff --git a/docs/sprint-artifacts/sprint-3/3-1-smart-pattern-memory-pre-fill-last-workout.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/3-1-smart-pattern-memory-pre-fill-last-workout.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-3/3-1-smart-pattern-memory-pre-fill-last-workout.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/3-1-smart-pattern-memory-pre-fill-last-workout.context.xml diff --git a/docs/sprint-artifacts/sprint-3/3-1-smart-pattern-memory-pre-fill-last-workout.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/3-1-smart-pattern-memory-pre-fill-last-workout.md similarity index 100% rename from docs/sprint-artifacts/sprint-3/3-1-smart-pattern-memory-pre-fill-last-workout.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/3-1-smart-pattern-memory-pre-fill-last-workout.md diff --git a/docs/sprint-artifacts/sprint-3/3-10-cross-module-receive-stress-data-from-mind.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/3-10-cross-module-receive-stress-data-from-mind.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-3/3-10-cross-module-receive-stress-data-from-mind.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/3-10-cross-module-receive-stress-data-from-mind.context.xml diff --git a/docs/sprint-artifacts/sprint-3/3-10-cross-module-receive-stress-data-from-mind.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/3-10-cross-module-receive-stress-data-from-mind.md similarity index 100% rename from docs/sprint-artifacts/sprint-3/3-10-cross-module-receive-stress-data-from-mind.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/3-10-cross-module-receive-stress-data-from-mind.md diff --git a/docs/sprint-artifacts/sprint-3/3-2-exercise-library-500-exercises.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/3-2-exercise-library-500-exercises.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-3/3-2-exercise-library-500-exercises.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/3-2-exercise-library-500-exercises.context.xml diff --git a/docs/sprint-artifacts/sprint-3/3-2-exercise-library-500-exercises.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/3-2-exercise-library-500-exercises.md similarity index 100% rename from docs/sprint-artifacts/sprint-3/3-2-exercise-library-500-exercises.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/3-2-exercise-library-500-exercises.md diff --git a/docs/sprint-artifacts/sprint-3/3-3-workout-logging-with-rest-timer.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/3-3-workout-logging-with-rest-timer.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-3/3-3-workout-logging-with-rest-timer.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/3-3-workout-logging-with-rest-timer.context.xml diff --git a/docs/sprint-artifacts/sprint-3/3-3-workout-logging-with-rest-timer.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/3-3-workout-logging-with-rest-timer.md similarity index 100% rename from docs/sprint-artifacts/sprint-3/3-3-workout-logging-with-rest-timer.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/3-3-workout-logging-with-rest-timer.md diff --git a/docs/sprint-artifacts/sprint-3/3-4-workout-history-detail-view.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/3-4-workout-history-detail-view.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-3/3-4-workout-history-detail-view.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/3-4-workout-history-detail-view.context.xml diff --git a/docs/sprint-artifacts/sprint-3/3-4-workout-history-detail-view.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/3-4-workout-history-detail-view.md similarity index 100% rename from docs/sprint-artifacts/sprint-3/3-4-workout-history-detail-view.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/3-4-workout-history-detail-view.md diff --git a/docs/sprint-artifacts/sprint-3/3-5-progress-charts-strength-volume-prs.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/3-5-progress-charts-strength-volume-prs.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-3/3-5-progress-charts-strength-volume-prs.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/3-5-progress-charts-strength-volume-prs.context.xml diff --git a/docs/sprint-artifacts/sprint-3/3-5-progress-charts-strength-volume-prs.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/3-5-progress-charts-strength-volume-prs.md similarity index 100% rename from docs/sprint-artifacts/sprint-3/3-5-progress-charts-strength-volume-prs.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/3-5-progress-charts-strength-volume-prs.md diff --git a/docs/sprint-artifacts/sprint-3/3-6-body-measurements-tracking.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/3-6-body-measurements-tracking.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-3/3-6-body-measurements-tracking.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/3-6-body-measurements-tracking.context.xml diff --git a/docs/sprint-artifacts/sprint-3/3-6-body-measurements-tracking.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/3-6-body-measurements-tracking.md similarity index 100% rename from docs/sprint-artifacts/sprint-3/3-6-body-measurements-tracking.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/3-6-body-measurements-tracking.md diff --git a/docs/sprint-artifacts/sprint-3/3-7-workout-templates-pre-built-custom.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/3-7-workout-templates-pre-built-custom.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-3/3-7-workout-templates-pre-built-custom.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/3-7-workout-templates-pre-built-custom.context.xml diff --git a/docs/sprint-artifacts/sprint-3/3-7-workout-templates-pre-built-custom.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/3-7-workout-templates-pre-built-custom.md similarity index 100% rename from docs/sprint-artifacts/sprint-3/3-7-workout-templates-pre-built-custom.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/3-7-workout-templates-pre-built-custom.md diff --git a/docs/sprint-artifacts/sprint-3/3-8-quick-log-rapid-workout-entry.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/3-8-quick-log-rapid-workout-entry.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-3/3-8-quick-log-rapid-workout-entry.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/3-8-quick-log-rapid-workout-entry.context.xml diff --git a/docs/sprint-artifacts/sprint-3/3-8-quick-log-rapid-workout-entry.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/3-8-quick-log-rapid-workout-entry.md similarity index 100% rename from docs/sprint-artifacts/sprint-3/3-8-quick-log-rapid-workout-entry.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/3-8-quick-log-rapid-workout-entry.md diff --git a/docs/sprint-artifacts/sprint-3/3-9-exercise-instructions-form-tips.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/3-9-exercise-instructions-form-tips.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-3/3-9-exercise-instructions-form-tips.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/3-9-exercise-instructions-form-tips.context.xml diff --git a/docs/sprint-artifacts/sprint-3/3-9-exercise-instructions-form-tips.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/3-9-exercise-instructions-form-tips.md similarity index 100% rename from docs/sprint-artifacts/sprint-3/3-9-exercise-instructions-form-tips.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/3-9-exercise-instructions-form-tips.md diff --git a/docs/sprint-artifacts/sprint-3/SPRINT-SUMMARY.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/SPRINT-SUMMARY.md similarity index 100% rename from docs/sprint-artifacts/sprint-3/SPRINT-SUMMARY.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-3/SPRINT-SUMMARY.md diff --git a/docs/sprint-artifacts/sprint-4/4-1-guided-meditation-library-20-30-mvp.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-1-guided-meditation-library-20-30-mvp.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-4/4-1-guided-meditation-library-20-30-mvp.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-1-guided-meditation-library-20-30-mvp.context.xml diff --git a/docs/sprint-artifacts/sprint-4/4-1-guided-meditation-library-20-30-mvp.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-1-guided-meditation-library-20-30-mvp.md similarity index 100% rename from docs/sprint-artifacts/sprint-4/4-1-guided-meditation-library-20-30-mvp.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-1-guided-meditation-library-20-30-mvp.md diff --git a/docs/sprint-artifacts/sprint-4/4-10-meditation-recommendations-ai.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-10-meditation-recommendations-ai.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-4/4-10-meditation-recommendations-ai.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-10-meditation-recommendations-ai.context.xml diff --git a/docs/sprint-artifacts/sprint-4/4-10-meditation-recommendations-ai.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-10-meditation-recommendations-ai.md similarity index 100% rename from docs/sprint-artifacts/sprint-4/4-10-meditation-recommendations-ai.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-10-meditation-recommendations-ai.md diff --git a/docs/sprint-artifacts/sprint-4/4-11-mood-workout-correlation-insights.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-11-mood-workout-correlation-insights.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-4/4-11-mood-workout-correlation-insights.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-11-mood-workout-correlation-insights.context.xml diff --git a/docs/sprint-artifacts/sprint-4/4-11-mood-workout-correlation-insights.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-11-mood-workout-correlation-insights.md similarity index 100% rename from docs/sprint-artifacts/sprint-4/4-11-mood-workout-correlation-insights.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-11-mood-workout-correlation-insights.md diff --git a/docs/sprint-artifacts/sprint-4/4-12-cross-module-share-mood-stress-with-life-coach-fitness.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-12-cross-module-share-mood-stress-with-life-coach-fitness.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-4/4-12-cross-module-share-mood-stress-with-life-coach-fitness.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-12-cross-module-share-mood-stress-with-life-coach-fitness.context.xml diff --git a/docs/sprint-artifacts/sprint-4/4-12-cross-module-share-mood-stress-with-life-coach-fitness.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-12-cross-module-share-mood-stress-with-life-coach-fitness.md similarity index 100% rename from docs/sprint-artifacts/sprint-4/4-12-cross-module-share-mood-stress-with-life-coach-fitness.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-12-cross-module-share-mood-stress-with-life-coach-fitness.md diff --git a/docs/sprint-artifacts/sprint-4/4-13-meditation-download-ui.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-13-meditation-download-ui.md similarity index 100% rename from docs/sprint-artifacts/sprint-4/4-13-meditation-download-ui.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-13-meditation-download-ui.md diff --git a/docs/sprint-artifacts/sprint-4/4-14-meditation-completion-tracking-integration.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-14-meditation-completion-tracking-integration.md similarity index 100% rename from docs/sprint-artifacts/sprint-4/4-14-meditation-completion-tracking-integration.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-14-meditation-completion-tracking-integration.md diff --git a/docs/sprint-artifacts/sprint-4/4-15-code-generation-and-build-setup.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-15-code-generation-and-build-setup.md similarity index 100% rename from docs/sprint-artifacts/sprint-4/4-15-code-generation-and-build-setup.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-15-code-generation-and-build-setup.md diff --git a/docs/sprint-artifacts/sprint-4/4-2-meditation-player-with-breathing-animation.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-2-meditation-player-with-breathing-animation.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-4/4-2-meditation-player-with-breathing-animation.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-2-meditation-player-with-breathing-animation.context.xml diff --git a/docs/sprint-artifacts/sprint-4/4-2-meditation-player-with-breathing-animation.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-2-meditation-player-with-breathing-animation.md similarity index 100% rename from docs/sprint-artifacts/sprint-4/4-2-meditation-player-with-breathing-animation.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-2-meditation-player-with-breathing-animation.md diff --git a/docs/sprint-artifacts/sprint-4/4-3-mood-stress-tracking-always-free.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-3-mood-stress-tracking-always-free.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-4/4-3-mood-stress-tracking-always-free.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-3-mood-stress-tracking-always-free.context.xml diff --git a/docs/sprint-artifacts/sprint-4/4-3-mood-stress-tracking-always-free.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-3-mood-stress-tracking-always-free.md similarity index 100% rename from docs/sprint-artifacts/sprint-4/4-3-mood-stress-tracking-always-free.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-3-mood-stress-tracking-always-free.md diff --git a/docs/sprint-artifacts/sprint-4/4-4-cbt-chat-with-ai-1-day-free-unlimited-premium.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-4-cbt-chat-with-ai-1-day-free-unlimited-premium.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-4/4-4-cbt-chat-with-ai-1-day-free-unlimited-premium.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-4-cbt-chat-with-ai-1-day-free-unlimited-premium.context.xml diff --git a/docs/sprint-artifacts/sprint-4/4-4-cbt-chat-with-ai-1-day-free-unlimited-premium.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-4-cbt-chat-with-ai-1-day-free-unlimited-premium.md similarity index 100% rename from docs/sprint-artifacts/sprint-4/4-4-cbt-chat-with-ai-1-day-free-unlimited-premium.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-4-cbt-chat-with-ai-1-day-free-unlimited-premium.md diff --git a/docs/sprint-artifacts/sprint-4/4-5-private-journaling-e2e-encrypted.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-5-private-journaling-e2e-encrypted.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-4/4-5-private-journaling-e2e-encrypted.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-5-private-journaling-e2e-encrypted.context.xml diff --git a/docs/sprint-artifacts/sprint-4/4-5-private-journaling-e2e-encrypted.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-5-private-journaling-e2e-encrypted.md similarity index 100% rename from docs/sprint-artifacts/sprint-4/4-5-private-journaling-e2e-encrypted.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-5-private-journaling-e2e-encrypted.md diff --git a/docs/sprint-artifacts/sprint-4/4-6-mental-health-screening-gad-7-phq-9.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-6-mental-health-screening-gad-7-phq-9.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-4/4-6-mental-health-screening-gad-7-phq-9.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-6-mental-health-screening-gad-7-phq-9.context.xml diff --git a/docs/sprint-artifacts/sprint-4/4-6-mental-health-screening-gad-7-phq-9.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-6-mental-health-screening-gad-7-phq-9.md similarity index 100% rename from docs/sprint-artifacts/sprint-4/4-6-mental-health-screening-gad-7-phq-9.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-6-mental-health-screening-gad-7-phq-9.md diff --git a/docs/sprint-artifacts/sprint-4/4-7-breathing-exercises-5-techniques.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-7-breathing-exercises-5-techniques.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-4/4-7-breathing-exercises-5-techniques.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-7-breathing-exercises-5-techniques.context.xml diff --git a/docs/sprint-artifacts/sprint-4/4-7-breathing-exercises-5-techniques.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-7-breathing-exercises-5-techniques.md similarity index 100% rename from docs/sprint-artifacts/sprint-4/4-7-breathing-exercises-5-techniques.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-7-breathing-exercises-5-techniques.md diff --git a/docs/sprint-artifacts/sprint-4/4-8-sleep-meditations-ambient-sounds.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-8-sleep-meditations-ambient-sounds.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-4/4-8-sleep-meditations-ambient-sounds.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-8-sleep-meditations-ambient-sounds.context.xml diff --git a/docs/sprint-artifacts/sprint-4/4-8-sleep-meditations-ambient-sounds.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-8-sleep-meditations-ambient-sounds.md similarity index 100% rename from docs/sprint-artifacts/sprint-4/4-8-sleep-meditations-ambient-sounds.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-8-sleep-meditations-ambient-sounds.md diff --git a/docs/sprint-artifacts/sprint-4/4-9-gratitude-exercises-3-good-things.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-9-gratitude-exercises-3-good-things.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-4/4-9-gratitude-exercises-3-good-things.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-9-gratitude-exercises-3-good-things.context.xml diff --git a/docs/sprint-artifacts/sprint-4/4-9-gratitude-exercises-3-good-things.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-9-gratitude-exercises-3-good-things.md similarity index 100% rename from docs/sprint-artifacts/sprint-4/4-9-gratitude-exercises-3-good-things.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/4-9-gratitude-exercises-3-good-things.md diff --git a/docs/sprint-artifacts/sprint-4/SPRINT-SUMMARY.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/SPRINT-SUMMARY.md similarity index 100% rename from docs/sprint-artifacts/sprint-4/SPRINT-SUMMARY.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-4/SPRINT-SUMMARY.md diff --git a/docs/sprint-artifacts/sprint-5/5-1-insight-engine-detect-patterns-generate-insights.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-5/5-1-insight-engine-detect-patterns-generate-insights.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-5/5-1-insight-engine-detect-patterns-generate-insights.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-5/5-1-insight-engine-detect-patterns-generate-insights.context.xml diff --git a/docs/sprint-artifacts/sprint-5/5-1-insight-engine-detect-patterns-generate-insights.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-5/5-1-insight-engine-detect-patterns-generate-insights.md similarity index 100% rename from docs/sprint-artifacts/sprint-5/5-1-insight-engine-detect-patterns-generate-insights.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-5/5-1-insight-engine-detect-patterns-generate-insights.md diff --git a/docs/sprint-artifacts/sprint-5/5-2-insight-card-ui-swipeable-actionable.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-5/5-2-insight-card-ui-swipeable-actionable.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-5/5-2-insight-card-ui-swipeable-actionable.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-5/5-2-insight-card-ui-swipeable-actionable.context.xml diff --git a/docs/sprint-artifacts/sprint-5/5-2-insight-card-ui-swipeable-actionable.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-5/5-2-insight-card-ui-swipeable-actionable.md similarity index 100% rename from docs/sprint-artifacts/sprint-5/5-2-insight-card-ui-swipeable-actionable.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-5/5-2-insight-card-ui-swipeable-actionable.md diff --git a/docs/sprint-artifacts/sprint-5/5-3-high-stress-heavy-workout-suggest-light-session.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-5/5-3-high-stress-heavy-workout-suggest-light-session.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-5/5-3-high-stress-heavy-workout-suggest-light-session.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-5/5-3-high-stress-heavy-workout-suggest-light-session.context.xml diff --git a/docs/sprint-artifacts/sprint-5/5-3-high-stress-heavy-workout-suggest-light-session.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-5/5-3-high-stress-heavy-workout-suggest-light-session.md similarity index 100% rename from docs/sprint-artifacts/sprint-5/5-3-high-stress-heavy-workout-suggest-light-session.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-5/5-3-high-stress-heavy-workout-suggest-light-session.md diff --git a/docs/sprint-artifacts/sprint-5/5-4-poor-sleep-morning-workout-suggest-afternoon.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-5/5-4-poor-sleep-morning-workout-suggest-afternoon.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-5/5-4-poor-sleep-morning-workout-suggest-afternoon.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-5/5-4-poor-sleep-morning-workout-suggest-afternoon.context.xml diff --git a/docs/sprint-artifacts/sprint-5/5-4-poor-sleep-morning-workout-suggest-afternoon.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-5/5-4-poor-sleep-morning-workout-suggest-afternoon.md similarity index 100% rename from docs/sprint-artifacts/sprint-5/5-4-poor-sleep-morning-workout-suggest-afternoon.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-5/5-4-poor-sleep-morning-workout-suggest-afternoon.md diff --git a/docs/sprint-artifacts/sprint-5/5-5-sleep-quality-workout-performance-correlation.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-5/5-5-sleep-quality-workout-performance-correlation.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-5/5-5-sleep-quality-workout-performance-correlation.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-5/5-5-sleep-quality-workout-performance-correlation.context.xml diff --git a/docs/sprint-artifacts/sprint-5/5-5-sleep-quality-workout-performance-correlation.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-5/5-5-sleep-quality-workout-performance-correlation.md similarity index 100% rename from docs/sprint-artifacts/sprint-5/5-5-sleep-quality-workout-performance-correlation.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-5/5-5-sleep-quality-workout-performance-correlation.md diff --git a/docs/sprint-artifacts/sprint-5/SPRINT-SUMMARY.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-5/SPRINT-SUMMARY.md similarity index 100% rename from docs/sprint-artifacts/sprint-5/SPRINT-SUMMARY.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-5/SPRINT-SUMMARY.md diff --git a/docs/sprint-artifacts/sprint-6/6-1-streak-tracking-system-workouts-meditations-check-ins.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-6/6-1-streak-tracking-system-workouts-meditations-check-ins.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-6/6-1-streak-tracking-system-workouts-meditations-check-ins.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-6/6-1-streak-tracking-system-workouts-meditations-check-ins.context.xml diff --git a/docs/sprint-artifacts/sprint-6/6-1-streak-tracking-system-workouts-meditations-check-ins.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-6/6-1-streak-tracking-system-workouts-meditations-check-ins.md similarity index 100% rename from docs/sprint-artifacts/sprint-6/6-1-streak-tracking-system-workouts-meditations-check-ins.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-6/6-1-streak-tracking-system-workouts-meditations-check-ins.md diff --git a/docs/sprint-artifacts/sprint-6/6-2-milestone-badges-bronze-silver-gold.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-6/6-2-milestone-badges-bronze-silver-gold.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-6/6-2-milestone-badges-bronze-silver-gold.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-6/6-2-milestone-badges-bronze-silver-gold.context.xml diff --git a/docs/sprint-artifacts/sprint-6/6-2-milestone-badges-bronze-silver-gold.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-6/6-2-milestone-badges-bronze-silver-gold.md similarity index 100% rename from docs/sprint-artifacts/sprint-6/6-2-milestone-badges-bronze-silver-gold.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-6/6-2-milestone-badges-bronze-silver-gold.md diff --git a/docs/sprint-artifacts/sprint-6/6-3-streak-break-alerts-push-notification.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-6/6-3-streak-break-alerts-push-notification.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-6/6-3-streak-break-alerts-push-notification.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-6/6-3-streak-break-alerts-push-notification.context.xml diff --git a/docs/sprint-artifacts/sprint-6/6-3-streak-break-alerts-push-notification.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-6/6-3-streak-break-alerts-push-notification.md similarity index 100% rename from docs/sprint-artifacts/sprint-6/6-3-streak-break-alerts-push-notification.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-6/6-3-streak-break-alerts-push-notification.md diff --git a/docs/sprint-artifacts/sprint-6/6-4-celebration-animations-confetti-badge-pop.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-6/6-4-celebration-animations-confetti-badge-pop.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-6/6-4-celebration-animations-confetti-badge-pop.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-6/6-4-celebration-animations-confetti-badge-pop.context.xml diff --git a/docs/sprint-artifacts/sprint-6/6-4-celebration-animations-confetti-badge-pop.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-6/6-4-celebration-animations-confetti-badge-pop.md similarity index 100% rename from docs/sprint-artifacts/sprint-6/6-4-celebration-animations-confetti-badge-pop.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-6/6-4-celebration-animations-confetti-badge-pop.md diff --git a/docs/sprint-artifacts/sprint-6/6-5-shareable-milestone-cards-social-sharing.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-6/6-5-shareable-milestone-cards-social-sharing.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-6/6-5-shareable-milestone-cards-social-sharing.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-6/6-5-shareable-milestone-cards-social-sharing.context.xml diff --git a/docs/sprint-artifacts/sprint-6/6-5-shareable-milestone-cards-social-sharing.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-6/6-5-shareable-milestone-cards-social-sharing.md similarity index 100% rename from docs/sprint-artifacts/sprint-6/6-5-shareable-milestone-cards-social-sharing.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-6/6-5-shareable-milestone-cards-social-sharing.md diff --git a/docs/sprint-artifacts/sprint-6/6-6-weekly-summary-report-all-modules.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-6/6-6-weekly-summary-report-all-modules.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-6/6-6-weekly-summary-report-all-modules.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-6/6-6-weekly-summary-report-all-modules.context.xml diff --git a/docs/sprint-artifacts/sprint-6/6-6-weekly-summary-report-all-modules.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-6/6-6-weekly-summary-report-all-modules.md similarity index 100% rename from docs/sprint-artifacts/sprint-6/6-6-weekly-summary-report-all-modules.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-6/6-6-weekly-summary-report-all-modules.md diff --git a/docs/sprint-artifacts/sprint-6/SPRINT-SUMMARY.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-6/SPRINT-SUMMARY.md similarity index 100% rename from docs/sprint-artifacts/sprint-6/SPRINT-SUMMARY.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-6/SPRINT-SUMMARY.md diff --git a/docs/sprint-artifacts/sprint-7/7-1-onboarding-flow-choose-your-journey.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-7/7-1-onboarding-flow-choose-your-journey.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-7/7-1-onboarding-flow-choose-your-journey.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-7/7-1-onboarding-flow-choose-your-journey.context.xml diff --git a/docs/sprint-artifacts/sprint-7/7-1-onboarding-flow-choose-your-journey.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-7/7-1-onboarding-flow-choose-your-journey.md similarity index 100% rename from docs/sprint-artifacts/sprint-7/7-1-onboarding-flow-choose-your-journey.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-7/7-1-onboarding-flow-choose-your-journey.md diff --git a/docs/sprint-artifacts/sprint-7/7-2-onboarding-set-initial-goals-choose-ai-personality.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-7/7-2-onboarding-set-initial-goals-choose-ai-personality.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-7/7-2-onboarding-set-initial-goals-choose-ai-personality.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-7/7-2-onboarding-set-initial-goals-choose-ai-personality.context.xml diff --git a/docs/sprint-artifacts/sprint-7/7-2-onboarding-set-initial-goals-choose-ai-personality.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-7/7-2-onboarding-set-initial-goals-choose-ai-personality.md similarity index 100% rename from docs/sprint-artifacts/sprint-7/7-2-onboarding-set-initial-goals-choose-ai-personality.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-7/7-2-onboarding-set-initial-goals-choose-ai-personality.md diff --git a/docs/sprint-artifacts/sprint-7/7-3-onboarding-permissions-interactive-tutorial.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-7/7-3-onboarding-permissions-interactive-tutorial.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-7/7-3-onboarding-permissions-interactive-tutorial.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-7/7-3-onboarding-permissions-interactive-tutorial.context.xml diff --git a/docs/sprint-artifacts/sprint-7/7-3-onboarding-permissions-interactive-tutorial.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-7/7-3-onboarding-permissions-interactive-tutorial.md similarity index 100% rename from docs/sprint-artifacts/sprint-7/7-3-onboarding-permissions-interactive-tutorial.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-7/7-3-onboarding-permissions-interactive-tutorial.md diff --git a/docs/sprint-artifacts/sprint-7/7-4-free-tier-life-coach-basic.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-7/7-4-free-tier-life-coach-basic.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-7/7-4-free-tier-life-coach-basic.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-7/7-4-free-tier-life-coach-basic.context.xml diff --git a/docs/sprint-artifacts/sprint-7/7-4-free-tier-life-coach-basic.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-7/7-4-free-tier-life-coach-basic.md similarity index 100% rename from docs/sprint-artifacts/sprint-7/7-4-free-tier-life-coach-basic.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-7/7-4-free-tier-life-coach-basic.md diff --git a/docs/sprint-artifacts/sprint-7/7-5-14-day-trial-all-premium-features.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-7/7-5-14-day-trial-all-premium-features.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-7/7-5-14-day-trial-all-premium-features.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-7/7-5-14-day-trial-all-premium-features.context.xml diff --git a/docs/sprint-artifacts/sprint-7/7-5-14-day-trial-all-premium-features.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-7/7-5-14-day-trial-all-premium-features.md similarity index 100% rename from docs/sprint-artifacts/sprint-7/7-5-14-day-trial-all-premium-features.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-7/7-5-14-day-trial-all-premium-features.md diff --git a/docs/sprint-artifacts/sprint-7/7-6-subscription-management-in-app-purchase.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-7/7-6-subscription-management-in-app-purchase.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-7/7-6-subscription-management-in-app-purchase.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-7/7-6-subscription-management-in-app-purchase.context.xml diff --git a/docs/sprint-artifacts/sprint-7/7-6-subscription-management-in-app-purchase.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-7/7-6-subscription-management-in-app-purchase.md similarity index 100% rename from docs/sprint-artifacts/sprint-7/7-6-subscription-management-in-app-purchase.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-7/7-6-subscription-management-in-app-purchase.md diff --git a/docs/sprint-artifacts/sprint-7/7-7-cancel-subscription-graceful-degradation.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-7/7-7-cancel-subscription-graceful-degradation.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-7/7-7-cancel-subscription-graceful-degradation.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-7/7-7-cancel-subscription-graceful-degradation.context.xml diff --git a/docs/sprint-artifacts/sprint-7/7-7-cancel-subscription-graceful-degradation.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-7/7-7-cancel-subscription-graceful-degradation.md similarity index 100% rename from docs/sprint-artifacts/sprint-7/7-7-cancel-subscription-graceful-degradation.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-7/7-7-cancel-subscription-graceful-degradation.md diff --git a/docs/sprint-artifacts/sprint-7/SPRINT-SUMMARY.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-7/SPRINT-SUMMARY.md similarity index 100% rename from docs/sprint-artifacts/sprint-7/SPRINT-SUMMARY.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-7/SPRINT-SUMMARY.md diff --git a/docs/sprint-artifacts/sprint-8/8-1-push-notification-infrastructure.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-8/8-1-push-notification-infrastructure.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-8/8-1-push-notification-infrastructure.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-8/8-1-push-notification-infrastructure.context.xml diff --git a/docs/sprint-artifacts/sprint-8/8-1-push-notification-infrastructure.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-8/8-1-push-notification-infrastructure.md similarity index 100% rename from docs/sprint-artifacts/sprint-8/8-1-push-notification-infrastructure.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-8/8-1-push-notification-infrastructure.md diff --git a/docs/sprint-artifacts/sprint-8/8-2-daily-reminders-morning-check-in-workout-meditation.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-8/8-2-daily-reminders-morning-check-in-workout-meditation.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-8/8-2-daily-reminders-morning-check-in-workout-meditation.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-8/8-2-daily-reminders-morning-check-in-workout-meditation.context.xml diff --git a/docs/sprint-artifacts/sprint-8/8-2-daily-reminders-morning-check-in-workout-meditation.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-8/8-2-daily-reminders-morning-check-in-workout-meditation.md similarity index 100% rename from docs/sprint-artifacts/sprint-8/8-2-daily-reminders-morning-check-in-workout-meditation.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-8/8-2-daily-reminders-morning-check-in-workout-meditation.md diff --git a/docs/sprint-artifacts/sprint-8/8-3-streak-alerts-about-to-break-freeze-milestone.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-8/8-3-streak-alerts-about-to-break-freeze-milestone.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-8/8-3-streak-alerts-about-to-break-freeze-milestone.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-8/8-3-streak-alerts-about-to-break-freeze-milestone.context.xml diff --git a/docs/sprint-artifacts/sprint-8/8-3-streak-alerts-about-to-break-freeze-milestone.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-8/8-3-streak-alerts-about-to-break-freeze-milestone.md similarity index 100% rename from docs/sprint-artifacts/sprint-8/8-3-streak-alerts-about-to-break-freeze-milestone.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-8/8-3-streak-alerts-about-to-break-freeze-milestone.md diff --git a/docs/sprint-artifacts/sprint-8/8-4-cross-module-insight-notifications.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-8/8-4-cross-module-insight-notifications.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-8/8-4-cross-module-insight-notifications.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-8/8-4-cross-module-insight-notifications.context.xml diff --git a/docs/sprint-artifacts/sprint-8/8-4-cross-module-insight-notifications.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-8/8-4-cross-module-insight-notifications.md similarity index 100% rename from docs/sprint-artifacts/sprint-8/8-4-cross-module-insight-notifications.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-8/8-4-cross-module-insight-notifications.md diff --git a/docs/sprint-artifacts/sprint-8/8-5-weekly-summary-notification-quiet-hours.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-8/8-5-weekly-summary-notification-quiet-hours.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-8/8-5-weekly-summary-notification-quiet-hours.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-8/8-5-weekly-summary-notification-quiet-hours.context.xml diff --git a/docs/sprint-artifacts/sprint-8/8-5-weekly-summary-notification-quiet-hours.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-8/8-5-weekly-summary-notification-quiet-hours.md similarity index 100% rename from docs/sprint-artifacts/sprint-8/8-5-weekly-summary-notification-quiet-hours.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-8/8-5-weekly-summary-notification-quiet-hours.md diff --git a/docs/sprint-artifacts/sprint-8/SPRINT-SUMMARY.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-8/SPRINT-SUMMARY.md similarity index 100% rename from docs/sprint-artifacts/sprint-8/SPRINT-SUMMARY.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-8/SPRINT-SUMMARY.md diff --git a/docs/sprint-artifacts/sprint-9/9-1-personal-settings.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-9/9-1-personal-settings.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-9/9-1-personal-settings.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-9/9-1-personal-settings.context.xml diff --git a/docs/sprint-artifacts/sprint-9/9-1-personal-settings.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-9/9-1-personal-settings.md similarity index 100% rename from docs/sprint-artifacts/sprint-9/9-1-personal-settings.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-9/9-1-personal-settings.md diff --git a/docs/sprint-artifacts/sprint-9/9-2-notification-preferences.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-9/9-2-notification-preferences.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-9/9-2-notification-preferences.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-9/9-2-notification-preferences.context.xml diff --git a/docs/sprint-artifacts/sprint-9/9-2-notification-preferences.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-9/9-2-notification-preferences.md similarity index 100% rename from docs/sprint-artifacts/sprint-9/9-2-notification-preferences.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-9/9-2-notification-preferences.md diff --git a/docs/sprint-artifacts/sprint-9/9-3-unit-preferences.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-9/9-3-unit-preferences.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-9/9-3-unit-preferences.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-9/9-3-unit-preferences.context.xml diff --git a/docs/sprint-artifacts/sprint-9/9-3-unit-preferences.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-9/9-3-unit-preferences.md similarity index 100% rename from docs/sprint-artifacts/sprint-9/9-3-unit-preferences.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-9/9-3-unit-preferences.md diff --git a/docs/sprint-artifacts/sprint-9/9-4-subscription-billing-management.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-9/9-4-subscription-billing-management.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-9/9-4-subscription-billing-management.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-9/9-4-subscription-billing-management.context.xml diff --git a/docs/sprint-artifacts/sprint-9/9-4-subscription-billing-management.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-9/9-4-subscription-billing-management.md similarity index 100% rename from docs/sprint-artifacts/sprint-9/9-4-subscription-billing-management.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-9/9-4-subscription-billing-management.md diff --git a/docs/sprint-artifacts/sprint-9/9-5-data-privacy-cross-module-settings.context.xml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-9/9-5-data-privacy-cross-module-settings.context.xml similarity index 100% rename from docs/sprint-artifacts/sprint-9/9-5-data-privacy-cross-module-settings.context.xml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-9/9-5-data-privacy-cross-module-settings.context.xml diff --git a/docs/sprint-artifacts/sprint-9/9-5-data-privacy-cross-module-settings.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-9/9-5-data-privacy-cross-module-settings.md similarity index 100% rename from docs/sprint-artifacts/sprint-9/9-5-data-privacy-cross-module-settings.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-9/9-5-data-privacy-cross-module-settings.md diff --git a/docs/sprint-artifacts/sprint-9/SPRINT-SUMMARY.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-9/SPRINT-SUMMARY.md similarity index 100% rename from docs/sprint-artifacts/sprint-9/SPRINT-SUMMARY.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-9/SPRINT-SUMMARY.md diff --git a/docs/sprint-artifacts/sprint-status.yaml b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-status.yaml similarity index 100% rename from docs/sprint-artifacts/sprint-status.yaml rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-status.yaml diff --git a/docs/sprint-artifacts/sprint-status.yaml.backup b/docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-status.yaml.backup similarity index 100% rename from docs/sprint-artifacts/sprint-status.yaml.backup rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/sprint-status.yaml.backup diff --git a/docs/sprint-artifacts/story-2-2-detailed-context.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/story-2-2-detailed-context.md similarity index 100% rename from docs/sprint-artifacts/story-2-2-detailed-context.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/story-2-2-detailed-context.md diff --git a/docs/sprint-artifacts/story-3-1-detailed-context.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/story-3-1-detailed-context.md similarity index 100% rename from docs/sprint-artifacts/story-3-1-detailed-context.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/story-3-1-detailed-context.md diff --git a/docs/sprint-artifacts/story-4-5-detailed-context.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/story-4-5-detailed-context.md similarity index 100% rename from docs/sprint-artifacts/story-4-5-detailed-context.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/story-4-5-detailed-context.md diff --git a/docs/sprint-artifacts/story-5-1-detailed-context.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/story-5-1-detailed-context.md similarity index 100% rename from docs/sprint-artifacts/story-5-1-detailed-context.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/story-5-1-detailed-context.md diff --git a/docs/sprint-artifacts/story-7-6-detailed-context.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/story-7-6-detailed-context.md similarity index 100% rename from docs/sprint-artifacts/story-7-6-detailed-context.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/story-7-6-detailed-context.md diff --git a/docs/sprint-artifacts/tech-spec-epic-1.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/tech-spec-epic-1.md similarity index 100% rename from docs/sprint-artifacts/tech-spec-epic-1.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/tech-spec-epic-1.md diff --git a/docs/sprint-artifacts/tech-spec-epic-2.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/tech-spec-epic-2.md similarity index 100% rename from docs/sprint-artifacts/tech-spec-epic-2.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/tech-spec-epic-2.md diff --git a/docs/sprint-artifacts/tech-spec-epic-3.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/tech-spec-epic-3.md similarity index 100% rename from docs/sprint-artifacts/tech-spec-epic-3.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/tech-spec-epic-3.md diff --git a/docs/sprint-artifacts/tech-spec-epic-4.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/tech-spec-epic-4.md similarity index 100% rename from docs/sprint-artifacts/tech-spec-epic-4.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/tech-spec-epic-4.md diff --git a/docs/sprint-artifacts/tech-spec-epic-5.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/tech-spec-epic-5.md similarity index 100% rename from docs/sprint-artifacts/tech-spec-epic-5.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/tech-spec-epic-5.md diff --git a/docs/sprint-artifacts/tech-spec-epic-6.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/tech-spec-epic-6.md similarity index 100% rename from docs/sprint-artifacts/tech-spec-epic-6.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/tech-spec-epic-6.md diff --git a/docs/sprint-artifacts/tech-spec-epic-7.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/tech-spec-epic-7.md similarity index 100% rename from docs/sprint-artifacts/tech-spec-epic-7.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/tech-spec-epic-7.md diff --git a/docs/sprint-artifacts/tech-spec-epic-8.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/tech-spec-epic-8.md similarity index 100% rename from docs/sprint-artifacts/tech-spec-epic-8.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/tech-spec-epic-8.md diff --git a/docs/sprint-artifacts/tech-spec-epic-9.md b/docs/5-ARCHIVE/deprecated/sprint-artifacts/tech-spec-epic-9.md similarity index 100% rename from docs/sprint-artifacts/tech-spec-epic-9.md rename to docs/5-ARCHIVE/deprecated/sprint-artifacts/tech-spec-epic-9.md diff --git a/docs/archive/historical/2025-01-16-planning/bmm-brainstorming-session-2025-01-16.md b/docs/5-ARCHIVE/historical/2025-01-16-planning/bmm-brainstorming-session-2025-01-16.md similarity index 100% rename from docs/archive/historical/2025-01-16-planning/bmm-brainstorming-session-2025-01-16.md rename to docs/5-ARCHIVE/historical/2025-01-16-planning/bmm-brainstorming-session-2025-01-16.md diff --git a/docs/archive/historical/2025-01-16-planning/brainstorming-answers.md b/docs/5-ARCHIVE/historical/2025-01-16-planning/brainstorming-answers.md similarity index 100% rename from docs/archive/historical/2025-01-16-planning/brainstorming-answers.md rename to docs/5-ARCHIVE/historical/2025-01-16-planning/brainstorming-answers.md diff --git a/docs/archive/historical/2025-11-15-fitness-research/bmm-brainstorming-session-2025-11-15.md b/docs/5-ARCHIVE/historical/2025-11-15-fitness-research/bmm-brainstorming-session-2025-11-15.md similarity index 100% rename from docs/archive/historical/2025-11-15-fitness-research/bmm-brainstorming-session-2025-11-15.md rename to docs/5-ARCHIVE/historical/2025-11-15-fitness-research/bmm-brainstorming-session-2025-11-15.md diff --git a/docs/archive/historical/2025-11-15-fitness-research/deep-research-prompts.md b/docs/5-ARCHIVE/historical/2025-11-15-fitness-research/deep-research-prompts.md similarity index 100% rename from docs/archive/historical/2025-11-15-fitness-research/deep-research-prompts.md rename to docs/5-ARCHIVE/historical/2025-11-15-fitness-research/deep-research-prompts.md diff --git a/docs/archive/historical/2025-11-15-fitness-research/market-research-condensed.md b/docs/5-ARCHIVE/historical/2025-11-15-fitness-research/market-research-condensed.md similarity index 100% rename from docs/archive/historical/2025-11-15-fitness-research/market-research-condensed.md rename to docs/5-ARCHIVE/historical/2025-11-15-fitness-research/market-research-condensed.md diff --git a/docs/archive/historical/2025-11-15-fitness-research/technical-research-condensed.md b/docs/5-ARCHIVE/historical/2025-11-15-fitness-research/technical-research-condensed.md similarity index 100% rename from docs/archive/historical/2025-11-15-fitness-research/technical-research-condensed.md rename to docs/5-ARCHIVE/historical/2025-11-15-fitness-research/technical-research-condensed.md diff --git a/docs/archive/historical/2025-11-15-fitness-research/user-research-condensed.md b/docs/5-ARCHIVE/historical/2025-11-15-fitness-research/user-research-condensed.md similarity index 100% rename from docs/archive/historical/2025-11-15-fitness-research/user-research-condensed.md rename to docs/5-ARCHIVE/historical/2025-11-15-fitness-research/user-research-condensed.md diff --git a/docs/BMAD-STRUCTURE.md b/docs/BMAD-STRUCTURE.md new file mode 100644 index 0000000..4dd4e6f --- /dev/null +++ b/docs/BMAD-STRUCTURE.md @@ -0,0 +1,193 @@ +# BMAD Framework - Struktura Dokumentacji + + + +**Wersja:** 2.0 +**Data:** 2025-12-02 + +--- + +## Czym jest BMAD? + +**BMAD** (Baseline-Management-Architecture-Development) to framework organizacji dokumentacji projektowej optymalizowany dla: +- **AI Agents** - szybkie znajdowanie informacji przez indeksy +- **DeveloperΓ³w** - jasna hierarchia i nawigacja +- **SkalowalnoΕ›ci** - Ε‚atwe dodawanie nowych dokumentΓ³w + +--- + +## Zasady Struktury + +### 1. Numerowane Foldery (Hierarchia) +``` +1-BASELINE/ β†’ Fundamenty (czytaj najpierw) +2-MANAGEMENT/ β†’ ZarzΔ…dzanie (status, epiki) +3-ARCHITECTURE/ β†’ Techniczne szczegΓ³Ε‚y +4-DEVELOPMENT/ β†’ Poradniki implementacji +5-ARCHIVE/ β†’ Historia (nie czytaj bez potrzeby) +``` + +### 2. Maksymalny Rozmiar Pliku +- **Idealny:** 600-800 linii +- **Maksymalny:** 1200 linii +- **Dlaczego:** AI context limits, czytelnoΕ›Δ‡ + +### 3. Indeksy AI +KaΕΌdy plik zawiera na gΓ³rze: +```markdown + +``` + +**UΕΌycie:** Wyszukaj `AI-INDEX: keyword` zamiast czytaΔ‡ caΕ‚e pliki. + +### 4. Cross-References +Linkuj do powiΔ…zanych dokumentΓ³w: +```markdown +**Zobacz teΕΌ:** +- [Architektura](../1-BASELINE/architecture/ARCH-overview.md) +- [Epic 3](../2-MANAGEMENT/epics/epic-3-fitness.md) +``` + +--- + +## Struktura KatalogΓ³w + +### 1-BASELINE/ (Dokumentacja Fundamentalna) + +| Folder | ZawartoΕ›Δ‡ | Kiedy czytaΔ‡ | +|--------|-----------|--------------| +| `product/` | PRD, wymagania funkcjonalne | Zrozumienie co budujemy | +| `architecture/` | Decyzje arch., tech stack | Zrozumienie jak budujemy | +| `design-system/` | UI/UX, komponenty | Implementacja UI | + +**Pliki:** +- `PRD-overview.md` - PrzeglΔ…d produktu, success metrics +- `PRD-fitness-requirements.md` - Wymagania Fitness module +- `PRD-life-coach-requirements.md` - Wymagania Life Coach +- `PRD-mind-requirements.md` - Wymagania Mind module +- `ARCH-overview.md` - PrzeglΔ…d architektury +- `ARCH-database-schema.md` - Schemat bazy danych +- `ARCH-ai-infrastructure.md` - AI/LLM infrastructure +- `ARCH-security.md` - Security, GDPR + +### 2-MANAGEMENT/ (ZarzΔ…dzanie Projektem) + +| Folder | ZawartoΕ›Δ‡ | Kiedy czytaΔ‡ | +|--------|-----------|--------------| +| `epics/` | User stories per epic | Planowanie implementacji | +| `backlog/` | Sprint summaries | Status sprintΓ³w | +| `reports/` | Audyty, compliance | PrzeglΔ…dy jakoΕ›ci | + +**Pliki:** +- `project-status.md` - Aktualny status projektu +- `epic-1-core-platform.md` - Stories dla Core Platform +- `epic-2-life-coach.md` - Stories dla Life Coach +- `epic-3-fitness.md` - Stories dla Fitness +- `epic-4-mind.md` - Stories dla Mind & Emotion +- `epic-5-cross-module.md` - Cross-Module Intelligence +- `sprint-1-summary.md` ... `sprint-9-summary.md` + +### 3-ARCHITECTURE/ (SzczegΓ³Ε‚y Techniczne) + +| Folder | ZawartoΕ›Δ‡ | Kiedy czytaΔ‡ | +|--------|-----------|--------------| +| `system-design/` | Design per moduΕ‚ | Przed implementacjΔ… moduΕ‚u | +| `deployment/` | CI/CD, Firebase | DevOps, deploy | +| `integration/` | API, third-party | Integracje | + +**Pliki:** +- `core-platform.md` - Auth, DB, offline-first +- `fitness-module.md` - Fitness technical design +- `life-coach-module.md` - Life Coach technical design +- `deployment-strategy.md` - Deploy, environments +- `api-contracts.md` - API specifications + +### 4-DEVELOPMENT/ (Poradniki) + +| Folder | ZawartoΕ›Δ‡ | Kiedy czytaΔ‡ | +|--------|-----------|--------------| +| `setup/` | Quick start, environment | Nowy dev, setup | +| `standards/` | Code style, testing | Coding standards | +| `patterns/` | Design patterns | Best practices | +| `modules/` | Per-module guides | Working on specific module | + +**Pliki:** +- `QUICK-START-5MIN.md` - Szybki start +- `environment-setup.md` - PeΕ‚ny setup +- `code-standards.md` - Standardy kodu +- `testing-guidelines.md` - Jak testowaΔ‡ +- `clean-architecture.md` - Clean Architecture patterns + +### 5-ARCHIVE/ (Historia) + +| Folder | ZawartoΕ›Δ‡ | Kiedy czytaΔ‡ | +|--------|-----------|--------------| +| `historical/` | Stare sesje planowania | Reference only | +| `deprecated/` | ZastΔ…pione pliki | Nie czytaΔ‡ | + +--- + +## Konwencje Nazewnictwa + +### Pliki +``` +PRD-[temat].md # Product requirements +ARCH-[temat].md # Architecture documents +epic-[N]-[nazwa].md # Epic documents +sprint-[N]-summary.md # Sprint summaries +[temat]-guide.md # Guides/tutorials +``` + +### Sekcje w Plikach +```markdown +# GΕ‚Γ³wny TytuΕ‚ + + +## Spis TreΕ›ci (dla plikΓ³w >500 linii) + +## 1. Executive Summary +## 2. SzczegΓ³Ε‚y +## 3. PrzykΕ‚ady +## 4. Zobacz teΕΌ +``` + +--- + +## Jak UΕΌywaΔ‡ (dla AI) + +### Znajdowanie Informacji +``` +1. SprawdΕΊ 00-START-HERE.md dla kontekstu +2. Wyszukaj "AI-INDEX: [keyword]" w docs/ +3. Przeczytaj tylko potrzebne sekcje +4. UΕΌyj cross-references dla gΕ‚Δ™bszego kontekstu +``` + +### Aktualizowanie Dokumentacji +``` +1. ZnajdΕΊ odpowiedni plik wg hierarchii BMAD +2. Zachowaj format i konwencje +3. Dodaj/zaktualizuj AI-INDEX jeΕ›li trzeba +4. Linkuj do powiΔ…zanych dokumentΓ³w +``` + +--- + +## Migracja ze Starej Struktury + +### Co Przeniesiono +| Stary plik | Nowa lokalizacja | +|------------|------------------| +| `ecosystem/prd.md` | `1-BASELINE/product/PRD-*.md` | +| `ecosystem/architecture.md` | `1-BASELINE/architecture/ARCH-*.md` | +| `modules/module-fitness/epics.md` | `2-MANAGEMENT/epics/epic-*.md` | +| `ecosystem/epics.md` | `2-MANAGEMENT/epics/epic-*.md` | +| `sprint-artifacts/` | `2-MANAGEMENT/backlog/` + `5-ARCHIVE/` | + +### Co Zarchiwizowano +- Stare sesje brainstormingu β†’ `5-ARCHIVE/historical/` +- Deprecated pliki β†’ `5-ARCHIVE/deprecated/` + +--- + +*BMAD Framework v2.0 - Optimized for AI + Human collaboration*