CLAUDE.md: - Version updated to v9e+ (Phase 0a Goal System Complete) - Added Phase 0a feature section with full details - Updated 'Letzte Updates' with Phase 0a completion - Links to new documentation files docs/issues/issue-50-phase-0a-goal-system.md (NEW): - Complete Phase 0a implementation documentation - Technical details: Migration 022, goals.py, GoalsPage - 4 commits documented (337667fto5be52bc) - Lessons learned section - Basis for Phase 0b documented - Testing checklist + acceptance criteria docs/NEXT_STEPS_2026-03-26.md (NEW): - Comprehensive planning document - Option A: Issue #49 - Prompt Page Assignment (6-8h) - Option B: Phase 0b - Goal-Aware Placeholders (16-20h) - Option C: Issue #47 - Value Table Refinement (4-6h) - Recommendation: Szenario 1 (Quick Wins first) - Detailed technical breakdown for both options - Timeline estimates (4h/day vs 8h/day) - 120+ placeholder categorization for Phase 0b All documentation reflects current state post Phase 0a. Next decision: Choose between Issue #49 or Phase 0b. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
461 lines
13 KiB
Markdown
461 lines
13 KiB
Markdown
# Nächste Schritte nach Phase 0a
|
|
|
|
**Stand:** 26. März 2026, nach Completion von Phase 0a (Goal System)
|
|
**Aktueller Branch:** `develop`
|
|
**Deployed:** `dev.mitai.jinkendo.de`
|
|
|
|
---
|
|
|
|
## Aktueller Stand ✅
|
|
|
|
### Abgeschlossen
|
|
- ✅ **Phase 0a:** Minimal Goal System (Strategic + Tactical)
|
|
- Migration 022, goals.py Router, GoalsPage UI
|
|
- Navigation von Dashboard + Analysis
|
|
- Mobile-friendly Design
|
|
- **Basis vorhanden für 120+ goal-aware Platzhalter**
|
|
|
|
### Offene Gitea Issues
|
|
- 🔲 **#49:** Prompt-Zuordnung zu Verlaufsseiten (6-8h)
|
|
- 🔲 **#47:** Wertetabelle Optimierung (4-6h)
|
|
- 🔲 **#46:** KI Prompt-Ersteller (später)
|
|
- 🔲 **#45:** KI Prompt-Optimierer (später)
|
|
- 🔲 **#43, #42:** Enhanced Debug UI (später)
|
|
|
|
---
|
|
|
|
## Option A: Issue #49 - Prompt Page Assignment ⚡
|
|
|
|
**Aufwand:** 6-8 Stunden
|
|
**Priorität:** Medium
|
|
**Typ:** UX Enhancement
|
|
**Labels:** feature, ux, enhancement
|
|
|
|
### Beschreibung
|
|
KI-Prompts flexibel auf verschiedenen Verlaufsseiten verfügbar machen. Jeder Prompt kann auf mehreren Seiten gleichzeitig angeboten werden (Mehrfachauswahl).
|
|
|
|
### Problem
|
|
**Aktuell:**
|
|
- Prompts nur über zentrale Analyse-Seite verfügbar
|
|
- Kein kontextbezogener Zugriff auf relevante Analysen
|
|
- User muss immer zur Analyse-Seite navigieren
|
|
|
|
**Beispiel-Szenario:**
|
|
```
|
|
User ist auf: Gewicht → Verlauf
|
|
Will: Gewichtstrend analysieren
|
|
Muss: Zur Analyse-Seite → Prompt auswählen → Zurück
|
|
```
|
|
|
|
**Wünschenswert:**
|
|
```
|
|
User ist auf: Gewicht → Verlauf
|
|
Sieht: "🤖 KI-Analyse" Widget mit relevanten Prompts
|
|
Kann: Direkt "Gewichtstrend-Analyse" starten
|
|
```
|
|
|
|
### Technische Umsetzung
|
|
|
|
**Backend (2h):**
|
|
```sql
|
|
-- Migration 023
|
|
ALTER TABLE ai_prompts ADD COLUMN available_on JSONB DEFAULT '["analysis"]';
|
|
|
|
-- Beispiel:
|
|
{
|
|
"slug": "weight_trend",
|
|
"available_on": ["analysis", "weight_history"]
|
|
}
|
|
```
|
|
|
|
**API:**
|
|
```python
|
|
# Neuer Endpoint
|
|
GET /api/prompts/for-page/{page_slug}
|
|
→ Returns: List[Prompt] where available_on contains page_slug
|
|
|
|
# CRUD erweitern
|
|
PUT /api/prompts/unified/{id}
|
|
→ Body: {..., "available_on": ["analysis", "weight_history"]}
|
|
```
|
|
|
|
**Frontend (4h):**
|
|
```javascript
|
|
// Wiederverwendbare Komponente
|
|
<PagePrompts pageSlug="weight_history" />
|
|
|
|
// UnifiedPromptModal erweitern
|
|
const PAGE_OPTIONS = [
|
|
{ value: 'analysis', label: '📊 Analyse (Hauptseite)', default: true },
|
|
{ value: 'weight_history', label: '⚖️ Gewicht → Verlauf' },
|
|
{ value: 'nutrition_history', label: '🍎 Ernährung → Verlauf' },
|
|
// ... 9 Optionen total
|
|
]
|
|
|
|
// Multi-select checkboxes in Prompt-Editor
|
|
```
|
|
|
|
**Integration in Verlaufsseiten (2h):**
|
|
- WeightPage, NutritionPage, ActivityPage erweitern
|
|
- Widget unterhalb Charts einfügen
|
|
- Modal für Inline-Analyse
|
|
|
|
### Vorteile
|
|
- ✅ Schneller Nutzen (UX-Verbesserung sofort sichtbar)
|
|
- ✅ Nutzt bestehendes Unified Prompt System (Issue #28)
|
|
- ✅ Relativ einfache Implementierung
|
|
- ✅ Bereitet vor für Phase 0b (neue Platzhalter dann sofort auf allen Seiten nutzbar)
|
|
|
|
### Nachteile
|
|
- ⚠️ Verzögert strategische Tiefe (goal-aware Analysen)
|
|
- ⚠️ Erst sinnvoll wenn mehr Prompts existieren
|
|
|
|
**Dokumentation:** Siehe `docs/issues/issue-51-prompt-page-assignment.md`
|
|
|
|
---
|
|
|
|
## Option B: Phase 0b - Goal-Aware Placeholders 🎯
|
|
|
|
**Aufwand:** 16-20 Stunden
|
|
**Priorität:** High (strategisch kritisch)
|
|
**Typ:** Core Feature
|
|
**Labels:** feature, ai, goal-system
|
|
|
|
### Beschreibung
|
|
Implementierung von 120+ neuen KI-Platzhaltern die `goal_mode` berücksichtigen. Verwandelt System von "Datensammler" zu "intelligentem Coach".
|
|
|
|
### Problem
|
|
**Aktuell:**
|
|
- Ziele existieren, aber KI-Analysen ignorieren sie
|
|
- Gleiche Daten werden für alle goal_modes gleich interpretiert
|
|
- Keine goal-spezifischen Score-Berechnungen
|
|
|
|
**Beispiel:**
|
|
```python
|
|
# Gleiche Messung: -5kg FM, -2kg LBM
|
|
# Aktuell: Generischer Score (z.B. 50/100)
|
|
|
|
# Mit Phase 0b:
|
|
goal_mode = "weight_loss" → 78/100 (FM↓ gut!)
|
|
goal_mode = "strength" → 32/100 (LBM↓ Katastrophe!)
|
|
goal_mode = "recomposition" → 65/100 (beides relevant)
|
|
```
|
|
|
|
### Technische Umsetzung
|
|
|
|
**1. Placeholder Functions (8-10h):**
|
|
|
|
**Kategorie: KÖRPER (18 neue):**
|
|
```python
|
|
def weight_7d_rolling_median(profile_id, goal_mode):
|
|
"""Rolling median statt avg für Stabilität"""
|
|
|
|
def weight_28d_trend_slope(profile_id, goal_mode):
|
|
"""Linear regression slope - kg/Woche"""
|
|
|
|
def fm_28d_delta(profile_id, goal_mode):
|
|
"""Fettmasse-Veränderung 28 Tage"""
|
|
|
|
def lbm_28d_delta(profile_id, goal_mode):
|
|
"""Magermasse-Veränderung 28 Tage"""
|
|
|
|
def recomposition_score(profile_id, goal_mode):
|
|
"""FM↓ + LBM↑ Balance-Score"""
|
|
# Nur relevant wenn goal_mode = "recomposition"
|
|
|
|
def waist_to_hip_ratio(profile_id):
|
|
"""WHR - Bauchfettverteilung"""
|
|
|
|
def waist_to_height_ratio(profile_id):
|
|
"""WHtR - Gesundheitsrisiko"""
|
|
```
|
|
|
|
**Kategorie: ERNÄHRUNG (15 neue):**
|
|
```python
|
|
def protein_g_per_kg(profile_id, goal_mode):
|
|
"""Protein pro kg Körpergewicht"""
|
|
# Target abhängig von goal_mode:
|
|
# strength: 2.0-2.2g/kg
|
|
# weight_loss: 1.8-2.0g/kg
|
|
# endurance: 1.4-1.6g/kg
|
|
|
|
def protein_g_per_kg_lbm(profile_id):
|
|
"""Protein pro kg Magermasse (präziser)"""
|
|
|
|
def nutrition_adherence_score(profile_id, goal_mode):
|
|
"""Wie gut hält User seine Makro-Ziele ein?"""
|
|
# Ziele abhängig von goal_mode
|
|
|
|
def energy_availability_status(profile_id):
|
|
"""kcal - activity_kcal - BMR = verfügbare Energie"""
|
|
# RED-S Warnung wenn < 30 kcal/kg LBM
|
|
```
|
|
|
|
**Kategorie: AKTIVITÄT (25 neue):**
|
|
```python
|
|
def activity_quality_avg_28d(profile_id):
|
|
"""Durchschnittliche Trainingsqualität"""
|
|
|
|
def activity_strain_28d(profile_id):
|
|
"""Kumulierte Belastung (Monotonie-Detektion)"""
|
|
|
|
def activity_monotony_28d(profile_id):
|
|
"""Variation im Training (Plateaus erkennen)"""
|
|
|
|
def ability_balance_score(profile_id, goal_mode):
|
|
"""Balance zwischen Fähigkeiten (Strength/Cardio/Mobility)"""
|
|
# Gewichtung abhängig von goal_mode
|
|
```
|
|
|
|
**Kategorie: RECOVERY (12 neue):**
|
|
```python
|
|
def recovery_score(profile_id):
|
|
"""
|
|
Kombiniert: RHR + HRV + Sleep Quality + Rest Days
|
|
Score: 0-100
|
|
"""
|
|
|
|
def sleep_regularity_index(profile_id):
|
|
"""Wie regelmäßig sind Schlafzeiten? (0-100)"""
|
|
|
|
def sleep_debt_hours(profile_id):
|
|
"""Kumulierte Schlafdifferenz zu Ziel"""
|
|
```
|
|
|
|
**Kategorie: KORRELATIONEN (8 neue):**
|
|
```python
|
|
def corr_energy_weight_lag(profile_id):
|
|
"""
|
|
Korrelation Kaloriendefizit → Gewicht
|
|
Mit Lag-Analysis (verzögerte Effekte)
|
|
Confidence-Score basierend auf Datenmenge
|
|
"""
|
|
|
|
def plateau_detected(profile_id):
|
|
"""
|
|
Boolean: Gewicht stagniert trotz Defizit?
|
|
Trigger für Interventionen
|
|
"""
|
|
```
|
|
|
|
**Kategorie: META (6 neue):**
|
|
```python
|
|
def goal_mode(profile_id):
|
|
"""Aktueller goal_mode (für Prompts verfügbar)"""
|
|
|
|
def data_quality_score(profile_id):
|
|
"""Wie vollständig/konsistent sind Daten? (0-100)"""
|
|
|
|
def profile_age_years(profile_id):
|
|
"""Alter für altersabhängige Normen"""
|
|
```
|
|
|
|
**2. Score-Gewichtung (4-6h):**
|
|
|
|
```python
|
|
# backend/score_calculator.py (NEU)
|
|
|
|
SCORE_WEIGHTS = {
|
|
"weight_loss": {
|
|
"body_progress": 0.30, # FM↓ wichtig
|
|
"nutrition": 0.25, # Defizit wichtig
|
|
"training_quality": 0.15, # Moderat wichtig
|
|
"recovery": 0.15, # Moderat wichtig
|
|
"adherence": 0.15 # Konsistenz wichtig
|
|
},
|
|
"strength": {
|
|
"body_progress": 0.35, # LBM↑ KRITISCH
|
|
"nutrition": 0.30, # Surplus + Protein
|
|
"training_quality": 0.25, # Progressive Overload
|
|
"recovery": 0.10 # Weniger wichtig
|
|
},
|
|
"endurance": {
|
|
"training_quality": 0.40, # VO2Max, Pace wichtig
|
|
"recovery": 0.25, # Übertraining vermeiden
|
|
"body_progress": 0.15, # Gewicht sekundär
|
|
"nutrition": 0.20 # Energie-Verfügbarkeit
|
|
},
|
|
# ... recomposition, health
|
|
}
|
|
|
|
def calculate_overall_score(profile_id, goal_mode):
|
|
"""Berechnet Gesamt-Score basierend auf goal_mode Gewichtung"""
|
|
weights = SCORE_WEIGHTS[goal_mode]
|
|
|
|
scores = {
|
|
"body_progress": calculate_body_progress_score(profile_id, goal_mode),
|
|
"nutrition": calculate_nutrition_score(profile_id, goal_mode),
|
|
"training_quality": calculate_training_score(profile_id, goal_mode),
|
|
"recovery": calculate_recovery_score(profile_id),
|
|
"adherence": calculate_adherence_score(profile_id, goal_mode)
|
|
}
|
|
|
|
overall = sum(scores[key] * weights[key] for key in weights)
|
|
return {
|
|
"overall": round(overall, 1),
|
|
"breakdown": scores,
|
|
"weights": weights
|
|
}
|
|
```
|
|
|
|
**3. Baseline-Berechnungen (2-3h):**
|
|
|
|
```python
|
|
def calculate_baselines(profile_id):
|
|
"""
|
|
Berechnet persönliche Referenzwerte:
|
|
- 7d baseline (kurzfristig)
|
|
- 28d baseline (mittelfristig)
|
|
- 90d baseline (langfristig)
|
|
|
|
Für: Gewicht, RHR, HRV, Kalorien, Protein, etc.
|
|
"""
|
|
|
|
def detect_anomalies(profile_id, metric, value):
|
|
"""
|
|
Ist Wert außerhalb von ±2 SD vom Baseline?
|
|
→ Warnung für User
|
|
"""
|
|
```
|
|
|
|
**4. Integration in Prompts (1-2h):**
|
|
|
|
```python
|
|
# Beispiel Prompt-Template:
|
|
"""
|
|
Du bist ein KI-Coach für {{goal_mode}} Training.
|
|
|
|
Aktueller Status:
|
|
- Gewichtstrend: {{weight_28d_trend_slope}} kg/Woche
|
|
- Fettmasse Δ28d: {{fm_28d_delta}} kg
|
|
- Magermasse Δ28d: {{lbm_28d_delta}} kg
|
|
- Rekompositions-Score: {{recomposition_score}}/100
|
|
|
|
Ernährung:
|
|
- Protein/kg: {{protein_g_per_kg}} g/kg (Ziel: {{protein_target_for_mode}})
|
|
- Adherence: {{nutrition_adherence_score}}/100
|
|
|
|
Training:
|
|
- Qualität (28d): {{activity_quality_avg_28d}}/5.0
|
|
- Monotonie: {{activity_monotony_28d}} (Warnung bei >2.0)
|
|
|
|
Recovery:
|
|
- Recovery Score: {{recovery_score}}/100
|
|
- Schlafschuld: {{sleep_debt_hours}}h
|
|
|
|
Gesamt-Score ({{goal_mode}}-optimiert): {{overall_score}}/100
|
|
|
|
Analyse den Fortschritt aus Sicht eines {{goal_mode}} Ziels...
|
|
"""
|
|
```
|
|
|
|
### Vorteile
|
|
- ✅ Größter strategischer Impact (System wird intelligent)
|
|
- ✅ Ziele werden tatsächlich genutzt (nicht nur Display)
|
|
- ✅ Basis für alle zukünftigen Features
|
|
- ✅ Automatische Trainingsphasen-Erkennung möglich
|
|
|
|
### Nachteile
|
|
- ⚠️ Hoher Aufwand (16-20h)
|
|
- ⚠️ Komplexe Logik (viel Testing nötig)
|
|
- ⚠️ Erfordert mehr Daten für sinnvolle Scores
|
|
|
|
---
|
|
|
|
## Option C: Issue #47 - Value Table Refinement 🔬
|
|
|
|
**Aufwand:** 4-6 Stunden
|
|
**Priorität:** Low (Polishing)
|
|
**Typ:** Enhancement
|
|
|
|
### Beschreibung
|
|
Wertetabelle übersichtlicher gestalten - Normal-Modus nur Einzelwerte, Experten-Modus mit Stage-Rohdaten.
|
|
|
|
### Vorteile
|
|
- ✅ Bessere UX für Value Table
|
|
- ✅ Weniger Überforderung im Normal-Modus
|
|
|
|
### Nachteile
|
|
- ⚠️ Kosmetisch, kein funktionaler Impact
|
|
- ⚠️ Besser warten bis Phase 0b (dann 120+ Platzhalter)
|
|
|
|
**Empfehlung:** Später (nach Phase 0b)
|
|
|
|
---
|
|
|
|
## Empfehlung 🎯
|
|
|
|
### Szenario 1: "Quick Wins first"
|
|
```
|
|
1. Issue #49 - Prompt Assignment (6-8h)
|
|
→ Bessere UX sofort
|
|
|
|
2. Phase 0b - Goal-Aware Placeholders (16-20h)
|
|
→ Neue Platzhalter profitieren von Page Assignment
|
|
→ Volle Power mit beiden Features
|
|
|
|
Total: 22-28h
|
|
```
|
|
|
|
### Szenario 2: "Strategic Depth first"
|
|
```
|
|
1. Phase 0b - Goal-Aware Placeholders (16-20h)
|
|
→ System wird intelligent
|
|
|
|
2. Issue #49 - Prompt Assignment (6-8h)
|
|
→ Intelligente Prompts dann auf allen Seiten
|
|
|
|
Total: 22-28h
|
|
```
|
|
|
|
### Persönliche Empfehlung: **Szenario 1**
|
|
|
|
**Begründung:**
|
|
- Issue #49 ist relativ einfach und bringt sofort UX-Nutzen
|
|
- Nutzt bestehendes Unified Prompt System optimal
|
|
- Phase 0b profitiert dann von besserer Navigation
|
|
- User kann neue Platzhalter (Phase 0b) direkt auf relevanten Seiten nutzen
|
|
- Psychologisch: Zwei Erfolgserlebnisse statt einem großen
|
|
|
|
---
|
|
|
|
## Nächste Session: Action Items
|
|
|
|
**Falls Issue #49 gewählt:**
|
|
1. [ ] Migration 023 erstellen (available_on JSONB)
|
|
2. [ ] Backend: `/api/prompts/for-page/{slug}` Endpoint
|
|
3. [ ] Backend: CRUD erweitern (available_on in PUT)
|
|
4. [ ] Frontend: PAGE_OPTIONS in UnifiedPromptModal
|
|
5. [ ] Frontend: PagePrompts Komponente (wiederverwendbar)
|
|
6. [ ] Integration: WeightPage, NutritionPage, ActivityPage
|
|
7. [ ] Testing: Multi-select, Modal-Inline-Analyse
|
|
|
|
**Falls Phase 0b gewählt:**
|
|
1. [ ] Placeholder-Funktionen kategorieweise implementieren (KÖRPER → ERNÄHRUNG → AKTIVITÄT → RECOVERY → KORRELATIONEN → META)
|
|
2. [ ] Score-Gewichtung pro goal_mode definieren
|
|
3. [ ] Backend: score_calculator.py erstellen
|
|
4. [ ] Baseline-Berechnungen implementieren
|
|
5. [ ] Integration in bestehende Prompts
|
|
6. [ ] Testing mit verschiedenen goal_modes
|
|
|
|
---
|
|
|
|
## Metriken & Timeline
|
|
|
|
**Geschätzte Timeline (bei 4h/Tag Entwicklung):**
|
|
|
|
| Szenario | Dauer | Fertig bis |
|
|
|----------|-------|------------|
|
|
| Issue #49 | 1.5-2 Tage | ~28.03.2026 |
|
|
| Phase 0b | 4-5 Tage | ~31.03.2026 |
|
|
| Szenario 1 (Quick Wins first) | 5.5-7 Tage | ~02.04.2026 |
|
|
| Szenario 2 (Strategic first) | 5.5-7 Tage | ~02.04.2026 |
|
|
|
|
**Bei 8h/Tag Entwicklung:** Timeline halbiert sich (~01.04.2026)
|
|
|
|
---
|
|
|
|
**Erstellt:** 26. März 2026
|
|
**Status:** Aktiv - Wartet auf Entscheidung
|
|
**Nächste Aktualisierung:** Nach Completion von gewähltem Path
|