From 3d4f5d8f103688721c83505f84b9488487fff45c Mon Sep 17 00:00:00 2001 From: Clawd Agent Date: Fri, 6 Mar 2026 12:35:34 +0100 Subject: [PATCH] docs(phase-06): Add intelligent workout adaptation & recovery tracking plan --- .phase-06-plan.md | 91 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 .phase-06-plan.md diff --git a/.phase-06-plan.md b/.phase-06-plan.md new file mode 100644 index 0000000..77ddbe7 --- /dev/null +++ b/.phase-06-plan.md @@ -0,0 +1,91 @@ +# Phase 06 — Intelligent Workout Adaptation & Recovery Tracking + +## 🎯 Goals +Skapa intelligenta träningsprogram som anpassas baserat på muskelgruppernas återhämtning, inte bara vilket pass som kördes senast. + +## 📋 Features + +### 06-01: Workout Swap/Rotation System +- [ ] Add "Swap Workout" button to WorkoutPage +- [ ] Show available workouts for current week +- [ ] Replace current workout while keeping tracking +- [ ] Update UI to show swap history +- [ ] Database: Update workout_logs to track swaps + +### 06-02: Muscle Group Recovery Tracking +- [ ] Model: Define muscle groups per exercise +- [ ] Calculate recovery time from last workout targeting each group +- [ ] Store: muscle_group_recovery table (timestamp, intensity) +- [ ] Display: Recovery status in ExerciseCard (red/yellow/green) +- [ ] Algorithm: Track last 7-14 days of activity per muscle group + +### 06-03: Smart Workout Recommendation Engine +- [ ] Analyze: Which muscle groups were trained this week +- [ ] Identify: Most-recovered groups available to train today +- [ ] Suggest: 2-3 workouts that target recovered muscle groups +- [ ] Avoid: Overtraining same groups (48-72h rest recommendation) +- [ ] Backend: POST /api/recommendations/smart-workout + +### 06-04: Recovery Metrics & Analytics +- [ ] Dashboard card: Recovery status per muscle group +- [ ] Chart: 7-day muscle group activity heatmap +- [ ] Insight: "Chest needs work", "Legs well-recovered" +- [ ] Prediction: Next recommended workout based on recovery + +### 06-05: UI/UX Polish +- [ ] Integrate swap system with recommendation engine +- [ ] Show recovery timeline for each group +- [ ] Mobile-friendly recovery badges +- [ ] One-tap "Use Recommendation" button +- [ ] Visual feedback for muscle group selection + +### 06-06: Testing & Validation +- [ ] E2E tests: Swap workflow +- [ ] E2E tests: Recovery calculation accuracy +- [ ] Performance: Recovery algorithm benchmarks +- [ ] User feedback: Recommendation quality validation + +## 🏗️ Database Changes +```sql +-- Muscle Group Recovery Tracking +CREATE TABLE muscle_group_recovery ( + id SERIAL PRIMARY KEY, + user_id INTEGER REFERENCES users(id), + muscle_group VARCHAR(50), + last_workout_date TIMESTAMP, + intensity FLOAT, -- 0-1 + exercises_count INT, + created_at TIMESTAMP DEFAULT NOW() +); + +-- Workout Swaps +ALTER TABLE workout_logs ADD COLUMN swapped_from_id INT REFERENCES workout_logs(id); +``` + +## 🔑 Key Algorithms + +### Recovery Calculation +``` +recovery_score = 1.0 if last_workout > 72h ago +recovery_score = 0.5 if 48h < last_workout < 72h +recovery_score = 0.2 if 24h < last_workout < 48h +recovery_score = 0.0 if last_workout < 24h +``` + +### Smart Recommendation +1. Get all exercises available +2. Group by muscle group +3. Calculate recovery for each group +4. Sort by recovery score (highest = best to train) +5. Filter: exclude groups with score < 0.3 +6. Return: Top 3 workouts with best muscle group coverage + +## 📦 Implementation Order +1. **06-01** — Basic swap functionality (UI + backend) +2. **06-02** — Recovery tracking (database + calculations) +3. **06-03** — Recommendation engine (backend algorithm) +4. **06-04** — Analytics & visualization (frontend) +5. **06-05** — Polish & integration +6. **06-06** — Testing + +---