# Generator v4 Scoring Algorithm

## Data Source (EXCLUSIVE — NO FALLBACK)
- **ONLY SOURCE**: `~/.hermes/profiles/nutrition-coach/real_recipes.jsonl` (25k+ Chefkoch recipes, JSONL, one recipe per line)
- **NEVER use**: `recipes.json` (old dummy data), live web scraping, or external recipe APIs
- **Minimum rating filter**: 4.3 stars (raises quality, reduces noise)
- **Excluded categories**: Backen, Kuchen, Dessert (penalty −20)

## Scoring Dimensions

| Factor | Weight | Logic |
|---|---|---|
| Base rating | ×2 | Higher-rated recipes start with advantage |
| Weather heat ≥30°C | +6 / −4 | Cold/salad boosted; hot cooking penalized |
| Weather heat ≥25°C | +4 / −3 | Same direction, lesser magnitude |
| Cold ≤15°C | +4 | Soups/stews/curry boosted |
| Perishables (fish, herbs) | +4 early / −5 late | Fresh items forced to Mon–Tue |
| Asian boost | +3 | curry, wok, thai, vietnam, ramen tags |
| Low-carb / protein | +2 | Dominik weight-goal diet |
| Carb boost | +1.5 | Pasta, rice, potato — Sarah preference |
| Cleo-friendly | +1.5 | pasta, nudeln, gnocchi, schnell, einfach tags |
| Meal-Prep days (Di/Do) | +6 | oven, stew, curry, gratin, lasagne boosted |
| Meal-Prep: fast ≤40min | +2 | Quick prep bonus on Di/Do |
| Meal-Prep: fry penalty | −10 | Frittiertes / Schnitzel / Tempura bad for meal-prep |
| Thursday travel | +10 | ≤30min recipes if special events contain "reise" |
| Friday events (picknick) | +15 | salad, wrap, cold, fingerfood boosted |
| Monday events (grill) | +15 / +20 | grill tags / barbecue category boosted |
| Diversity: new category | +2 | Unseen category gets bonus |
| Diversity: name overlap | −8 | Similar names penalized to avoid repetition |
| Craving match | +5 | If keyword in name or tags |

## Cleo Logic
- **Joins family meal** if recipe tags contain: pasta, nudeln, gnocchi, kartoffel, reis
- **Gets extra dish** otherwise: "Nudeln mit Butter & Käse (frisch)"
- Hard rule: NO leftovers for Cleo, ever

## Output
- Compact Telegram summary: 7 lines (one per day) + list count
- Full details written to `~/Documents/Essensplanung/KW<NN>_plan.md`
- Shopping list to `~/Documents/Essensplanung/KW<NN>_einkaufsliste.md`
