Add on-demand meal-log health/calorie analyzer + git-sync README trap pitfall
- scripts/analyze_history.py: read-only per-meal/per-day kcal+protein+micronutrient review of meal-history.json, unit-aware via references/nutrition-db.json (g_per_unit conversion so veg logged in g vs count both resolve correctly) - references/nutrition-db.json: estimate per-item nutrition DB (ESTIMATE-grade; condiments/oil not logged => ~+80-120 kcal/meal real) - SKILL.md: 'Health / calorie review (on-demand)' section; 'Git-sync README trap' pitfall (live README may be a stub while repo README is the real doc -- safe-sync procedure); scripts + references pointers
This commit is contained in:
33
SKILL.md
33
SKILL.md
@ -309,6 +309,20 @@ If the user lists ingredients in chat, add them to the inventory and optionally
|
||||
give an immediate 2-meal suggestion. If they ask "what should I eat today?", read
|
||||
the inventory and suggest now (and offer to email it).
|
||||
|
||||
### Health / calorie review of the meal log (on-demand, one-off)
|
||||
If the user asks to "analyse the last meals file" / "show calories for each meal" /
|
||||
"how healthy is the plan", run `scripts/analyze_history.py` (optionally
|
||||
`--days N` to limit the window). It reads `meal-history.json`, looks each item up in
|
||||
`references/nutrition-db.json` (unit-aware: converts logged qty/unit to grams, then
|
||||
scales), and prints per-meal kcal + protein, per-day totals, and a window average with a
|
||||
rough micronutrient read (fibre, sat fat, vit C/A, calcium) vs RDA-ish targets. The DB is
|
||||
ESTIMATE-grade — condiments/oils/cooking fat are NOT logged so real meals run ~80-120 kcal
|
||||
higher per cooked meal. Present the output plainly; lead with the headline (protein on
|
||||
target? sat fat high? veg variety good?) and note it is NOT medical advice. Do NOT modify
|
||||
any file — this is a read-only review. If you instead hand-roll nutrition math inline, you
|
||||
will likely mis-handle units (a veg logged in 'g' vs 'count'): use the script + DB, not ad
|
||||
hoc arithmetic.
|
||||
|
||||
### Import a weekly shop into inventory (exclusions supported)
|
||||
The weekly job does **NOT** auto-add the shop to inventory — `last-shop.json` is
|
||||
only a record of what the Monday email proposed. To bring it in, the user says
|
||||
@ -364,6 +378,18 @@ Note: this is entirely on-demand — the weekly job itself never writes inventor
|
||||
start flagging legitimate balanced plates — keep the >=85% dominance condition. `--all` is an
|
||||
audit of history, not a send gate; historical over-cap rows (old halloumi quantities) are
|
||||
already-sent and only fixed on explicit request.
|
||||
- **Git-sync trap: the LIVE skill README may be a stub, the REPO README may be the real doc —
|
||||
do NOT let `cp` clobber the better one.** When syncing the live skill dir into the repo
|
||||
(`/home/jp/IdeaProjects/meal-suggestion`) before a commit, the two README.md files can
|
||||
diverge: the live skill's README was found to have been reduced to a 49-line stub while the
|
||||
committed repo README was a fuller 324-line version. Blind `cp live/README.md repo/README.md`
|
||||
would silently destroy the richer doc. SAFE SYNC PROCEDURE: (1) `git show HEAD:README.md | wc -l`
|
||||
and compare to the live README's line count; (2) if the committed version is longer, RESTORE it
|
||||
with `git checkout HEAD -- README.md` and patch only the few figures that changed (e.g. protein
|
||||
target), rather than overwriting with the stub; (3) copy SKILL.md / references/* / scripts/* from
|
||||
live (those are the authoritative, richer copies); (4) never stage `.idea/` or `.agentbridge/`
|
||||
— add them to `.gitignore`. Same caution applies to any tracked file that the live dir might
|
||||
carry a degraded copy of.
|
||||
|
||||
## Automation
|
||||
Two cron jobs (created via the `cronjob` tool), both loading this skill:
|
||||
@ -390,6 +416,10 @@ Delivery is `local` because the email itself is the deliverable; check
|
||||
sending a regenerated day. Pass `--all` to audit the full 7-day window (this WILL flag
|
||||
ALREADY-SENT historical rows like old 100–200 g halloumi — audit only, NOT a send gate;
|
||||
only fix history on explicit user request). Exits non-zero on violation.
|
||||
- `scripts/analyze_history.py` — read-only health/calorie review of `meal-history.json`
|
||||
(per-meal kcal+protein, per-day totals, window averages vs RDA-ish targets). Looks items up
|
||||
in `references/nutrition-db.json` (unit-aware). Use for the "analyse the meals / show calories"
|
||||
on-demand request. Does NOT modify files.
|
||||
|
||||
## References
|
||||
- `references/protein-sources.md` — allowed proteins + example pairings.
|
||||
@ -400,3 +430,6 @@ Delivery is `local` because the email itself is the deliverable; check
|
||||
- `references/food-health.md` — research-grounded food & health knowledge base
|
||||
(healing nutrition, wound-healing micronutrients, men's health at 46, easy & tasty
|
||||
budget meals, flavour-without-cost). Read this when generating meals.
|
||||
- `references/nutrition-db.json` — estimate per-item nutrition (kcal/protein/fibre/satfat/
|
||||
vitC/vitA/calcium) with canonical unit + g_per_unit, consumed by `scripts/analyze_history.py`.
|
||||
ESTIMATE-grade; update values if better figures become available.
|
||||
|
||||
Reference in New Issue
Block a user