# Meal-history logger (used by the daily job) After composing the two meals (lunch + dinner) and BEFORE sending the email, the daily job must record them into `meal-history.json` (same skill dir) so the user can later say "remove 's from inventory" and have precise items deducted. ## Entry shape ```json { "date": "2026-08-27", "weekday": "Thursday", "meal": "lunch" | "dinner", "name": "Human-readable meal name", "items": [ { "name": "Name as in inventory.json", "qty": 1, "unit": "count" }, ... ], "kcal": 720, "protein_g": 64 } ``` ## Rules - UPSERT: if an entry with the same `date`+`meal` already exists, replace it (don't duplicate on re-runs). - PRUNE: drop any entry whose `date` is more than 7 days before today (keep a true rolling 7-day window). - Log ONLY substantive food items actually used in that meal — enough to decrement inventory accurately. Do NOT log pure condiments (olive oil, salt, pepper, spices, garlic, soy sauce, miso, honey, etc.) and do NOT log the optional "third hit" snack. - Item `name` values should match `inventory.json` names closely (case-insensitive match on removal) so removal works: e.g. "Chicken breast", "Eggs", "Tinned tuna in veg oil", "Dried red lentils", "Sweet potatoes", "Aubergine", "Red cabbage", "Green pesto", "Leeks", "Orange bell pepper", "Cooked beetroot", "Microwave rice", "Cheese", etc. - Use units consistent with inventory.json (count / g / can / portion / pieces / jar). For a half-item use 0.5 (e.g. half a sweet potato = qty 0.5 unit "count"). - Bump the top-level file with no extra schema — keep the `entries` array only. - This does NOT modify inventory.json (that only happens on explicit user removal). ## Example Composed lunch "Chicken & Pesto Roast Veg Bowl" using chicken breast (1), sweet potato (½), aubergine (½), red cabbage (150 g), green pesto (1 tbsp ≈ 0.1 jar) → record those five items under meal "lunch" for today's date/weekday.