Files
hermes f7c9b78dc1 Add per-meal calorie cap (1000 kcal) + kcal/protein display
- SKILL.md RATIONAL PORTIONS: add ~1000 kcal/meal cap; trim starch/cheese/halloumi/lentil
  (not protein) if over; use scripts/calc_meal.py to check
- scripts/calc_meal.py: estimate protein/kcal/fibre/satfat for a meal's items, flag
  over_kcal (>1000) + per-item max_per_meal breaches (unit-aware); gates daily sends
- scripts/verify_portions.py: now also flags KCAL CAP violations via calc_meal
- references/calories.md: per-portion kcal/macro estimate table (source of truth)
- references/email-template.md + meal-history.md: show Est. kcal + Protein per card/entry
- daily cron prompt: compute + record kcal/protein_g on each entry, show kcal in email,
  enforce 1000 kcal cap before send (pushed via cronjob update)
2026-08-29 08:17:43 +01:00

1.9 KiB

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

{
  "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.