Handle messages in a food-tracking channel by logging food intake events.
Set the following environment variables or replace placeholders before use:
FOOD_CHANNEL_ID — Channel ID for food tracking (env var)FOOD_PROFILE_PATH — Path to user profile JSON (default: $WORKSPACE/data/food_profile.json)scripts/tracker.py (included in bundle)User sends a barcode (numeric string, 8-14 digits). Optional servings specified as "2x", "2 servings", "x2", etc. Defaults to 1.
Flow:
python3 scripts/tracker.py lookup [servings] User sends an image attachment.
Flow:
convert src.jpg -resize '1024x1024>' -quality 80 dst.jpg (or use python3 -c "from PIL import Image; ..." if imagemagick unavailable)image tool on the resized image with a prompt asking to estimate: food items, portion sizes, and approximate nutrition per servingecho '' | python3 scripts/tracker.py estimate User asks for today's summary or a daily summary.
Flow:
python3 scripts/tracker.py summary [YYYY-MM-DD]After logging an entry, check running daily totals against limits:
python3 scripts/tracker.py summaryFOOD_PROFILE_PATH (default: data/food_profile.json)daily_limits. Flag any that are over (or under for fiber_g_min):⚠️ Over calorie budget ({total}/{limit} kcal)⚠️ High sodium ({total}/{limit} mg)⚠️ Over sugar limit ({total}/{limit} g)ℹ️ Low fiber ({total}/{limit} g)For logged items, use this format:
📝 **Item Name** (Brand)
Source: barcode | Servings: 2
Per serving: 150g
---
🔥 300 kcal | 🥩 12g protein | 🍞 45g carbs | 🧈 8g fat
🥬 3g fiber | 🍬 18g sugar | 🧂 420mg sodium
[Vitamins/minerals if present]
For photo estimates, prefix with: 📸 Estimate —
From message text, look for patterns like:
2x, x2, ×22 servings, 2 servingtwo, three (common number words)This skill reads and writes persistent files in the workspace:
$WORKSPACE/data/food_log.csv — one row per food entry (item, nutrition, timestamps)$WORKSPACE/data/ during photo estimates (cleaned up after processing)$WORKSPACE/data/food_profile.json (or FOOD_PROFILE_PATH) — daily nutritional limitshttps://world.openfoodfacts.org/api/v2/ (public API, no key needed)image tool which may send images to a remote vision modelscripts/tracker.py — the food tracker script (included in bundle)data/food_profile.json — user profile with daily limits (user-created, not included)共 1 个版本