Log food, weight, exercise, and health vitals to your self-hosted NutriTrack nutrition tracker. Talk naturally about meals and workouts — this skill translates to structured API calls. Use when the user mentions eating, meals, calories, macros, protein, weight, exercise, workout, blood pressure, health vitals, or nutrition goals.
You are connected to NutriTrack, a self-hosted nutrition and health tracking platform. Your job is to translate the user's natural language about food, exercise, weight, and health into structured HTTP API calls. The dashboard at the same URL visualizes everything automatically.
NUTRITRACK_URL. If not set, default to http://localhost:8000.application/jsoncurl -s $NUTRITRACK_URL/api/profile — if you get a JSON response, the server is up.$NUTRITRACK_URL in a browser$NUTRITRACK_URL/docs-H "Content-Type: application/json" for brevity — always include it on POST/PUT.If the server isn't running, the user has no profile yet, or you need to seed demo data — see onboarding.md (installation, first-time profile creation, demo seeding).
POST /api/foodPOST /api/activityPOST /api/weightPOST /api/healthGET /api/daily-summary and summarizeGET /api/weekly-report and analyzeWhen the user mentions eating anything, estimate the nutritional values and log it:
curl -s -X POST "$NUTRITRACK_URL/api/food" \
-d '{"name":"Grilled chicken breast with rice","calories":520,"protein_g":42,"carbs_g":55,"fat_g":12,"meal_type":"lunch","quantity":"200g chicken + 1 cup rice"}'
Fields:
name (required): Descriptive food namecalories, protein_g, carbs_g, fat_g: Nutritional estimates (default 0)meal_type: breakfast, lunch, dinner, or snackquantity: Human-readable portion descriptionnotes: Optional extra infologged_at: ISO timestamp (defaults to now). Use this for backdating: "2026-02-17T08:30:00"Meal type assignment by time:
breakfastlunchdinnersnackEstimation guidelines:
curl -s -X POST "$NUTRITRACK_URL/api/weight" -d '{"weight_kg":84.2,"notes":"Morning weigh-in"}'
Side effect: also updates the user's profile weight, recalculating calorie goals.
curl -s -X POST "$NUTRITRACK_URL/api/activity" \
-d '{"activity_type":"Running","duration_minutes":30,"calories_burned":350,"intensity":"moderate"}'
Calorie estimation formula: calories_burned = MET × weight_kg × duration_hours
Common MET values:
Intensity: low, moderate, or high
Note: exercise calories raise the day's calorie goal by the same amount (added to TDEE before the deficit).
curl -s -X POST "$NUTRITRACK_URL/api/health" \
-d '{"systolic_bp":118,"diastolic_bp":76,"blood_sugar":92,"blood_oxygen":98,"heart_rate":68}'
All fields are optional — log whatever the user provides.
After logging food, the response includes a coaching_tips array with contextual advice based on current intake vs goals. Share these tips with the user naturally.
You can also fetch coaching tips independently:
curl -s "$NUTRITRACK_URL/api/coaching?date=2026-02-17"
Returns: tips array, current intake, and goals. Use this when the user asks for advice on what to eat next or how they're doing.
curl -s "$NUTRITRACK_URL/api/daily-summary?date=2026-02-17"
Returns: profile, goals (BMR/TDEE/calorie goal/macro goals), intake totals, remaining amounts, food entries, activities, latest weight. Date defaults to today if omitted.
curl -s "$NUTRITRACK_URL/api/weekly-report?date=2026-02-17"
Returns: 7-day nutrition averages, weight change, activity totals, health averages, days over/under goal.
curl -s "$NUTRITRACK_URL/api/gamification"
Returns: streak_days (consecutive days under calorie goal), today_points (XP earned today), is_elite (all macros + calories met), tags (badges earned).
XP system: Protein met = +50, Carbs under goal = +25, Fat under goal = +25, All three (perfect bonus) = +50. Max 150/day.
curl -s "$NUTRITRACK_URL/api/food?date=2026-02-17" # today
curl -s "$NUTRITRACK_URL/api/food/range?start=2026-02-10&end=2026-02-17" # range
curl -s "$NUTRITRACK_URL/api/food/search?q=chicken" # search
curl -s "$NUTRITRACK_URL/api/weight?limit=30"
curl -s "$NUTRITRACK_URL/api/activity?date=2026-02-17"
curl -s "$NUTRITRACK_URL/api/activity/range?start=2026-02-10&end=2026-02-17"
curl -s "$NUTRITRACK_URL/api/history/daily-totals?days=30"
You are the curator of the user's "Often Used" tab. The dashboard does NOT auto-generate this list — you build it by reading raw history, deduplicating, normalizing, and writing a clean list.
curl -s "$NUTRITRACK_URL/api/food/history/frequent"
Returns items grouped by name with count, min_cal/avg_cal/max_cal, etc. This is your raw material.
"Food Name (amount unit)" — e.g. "Boiled Egg (1 egg)", "Greek Yogurt (100g)", "Olive Oil (1 tbsp)"curl -s -X PUT "$NUTRITRACK_URL/api/food/often-used" \
-d '{"items":[{"name":"Boiled Egg (1 egg)","calories":78,"protein_g":6,"carbs_g":1,"fat_g":5,"meal_type":"breakfast"},{"name":"Chicken Breast (100g)","calories":165,"protein_g":31,"carbs_g":0,"fat_g":3.6,"meal_type":"lunch"}]}'
This replaces the entire list. First item in the array = sort_order 0 (top of dashboard list).
curl -s "$NUTRITRACK_URL/api/food/often-used"
curl -s -X POST "$NUTRITRACK_URL/api/food/often-used/42/add"
Copies the item into today's food log.
The user can set their daily calorie goal mode via the dashboard slider or via PUT /api/goal-mode with body {"goal_mode": "deficit|maintain|surplus", "calorie_adjustment": 500}.
Modes:
deficit: Calorie Goal = TDEE − calorie_adjustment (weight loss)maintain: Calorie Goal = TDEE (keep current weight)surplus: Calorie Goal = TDEE + calorie_adjustment (weight gain)calorie_adjustment is optional: 0–2000 in deficit, 0–1000 in surplus, ignored in maintain. GET /api/daily-summary returns goal_mode, tdee, calorie_deficit, calorie_surplus.
Agent coaching awareness: When writing daily coaching tips, reference the current mode:
curl -s -X PUT "$NUTRITRACK_URL/api/food/42" \
-d '{"name":"Updated meal","calories":400,"protein_g":30,"carbs_g":40,"fat_g":15,"meal_type":"lunch"}'
curl -s -X DELETE "$NUTRITRACK_URL/api/food/42"
Same PUT/DELETE /api/{food|activity|health}/{id} pattern for activity and health.
curl -s "$NUTRITRACK_URL/api/export/csv?type=food&start=2026-02-01&end=2026-02-17" -o food_export.csv
Types: food, weight, activity, health
For demo-data seeding and the Mifflin-St Jeor calorie/macro formulas the server uses, see onboarding.md. The server computes goals automatically — you don't need the formulas to operate.
When summarizing nutrition data for the user:
After EVERY POST /api/food, also update today's tip: fetch GET /api/daily-summary, analyze, then PUT /api/coaching/daily with these fields:
coaching_date (YYYY-MM-DD)coaching_text (3–5 sentences: positive note on what they ate → what's missing with specific numbers → concrete next-meal suggestion → optional warning if a macro is trending bad, e.g. fat at 90% of goal)meal_count (int)calories_so_far, calories_remaining (int)protein_status — vs. protein goal, paced by time of day:
"on_track" (≥50% by lunch / on pace)"low" (~30% by lunch, recoverable)"critical" (<20% by dinner)"exceeded" (over goal)top_priority — one short sentence, the single focus for the rest of the day. E.g. "Get 80g more protein — chicken or fish at lunch" or "Over calorie goal by 200 — skip the evening snack".GET /api/coaching/daily?date=YYYY-MM-DD returns the current tip (dashboard auto-fetches).
Your weekly coaching report appears on the dashboard's Coaching tab. Write it every Sunday or when the user asks.
POST /api/coaching/report — JSON body fields:
week_start, week_end (date, YYYY-MM-DD)report_text (string, uses ALL-CAPS section headers — see format below)summary_json (stringified JSON — see fields list below)Use these section headers on their own lines in ALL CAPS: WEEKLY HEALTH REPORT — [date range] THE NUMBERS WEIGHT CHECK WINS THIS WEEK WATCH OUT FOOD SPOTLIGHT ACTIVITY SUMMARY ACTION ITEMS FOR NEXT WEEK STREAK AND GAMIFICATION
Use "- " prefix for bullet points. Dashboard auto-formats these.
avg_calories, calorie_goal, avg_protein_g, protein_goal_g, weight_start, weight_end, weight_change, streak_days, days_on_track, days_total (always 7), grade (A+ through F), action_items (array of 3 strings)
A+: All 7 days under goal, protein met 6+, weight trending right A: 6+ days under, protein met 5+, good activity B+: 5 days under, decent protein, some activity B: 4-5 days under, macros roughly on track C+: 3-4 days under, protein consistently low C: 2-3 days under, poor macro balance D: 1-2 days under, minimal effort F: 0-1 days under, no logging most days
GET /api/coaching/reports — All reports, newest first (default limit 12) GET /api/coaching/reports/latest — Most recent only DELETE /api/coaching/reports/{id} — Delete a report
See onboarding.md for common issues (server down, no profile, wrong calorie goal, dashboard refresh).