foodlens

AI-powered meal photo recognition and nutrition tracking. Use when a user sends a food/meal photo with keywords like breakfast, lunch, dinner, snack, or "what did I eat". Triggers on meal photos for calorie/macro analysis, daily nutrition summaries, weekly diet trends, and health scoring. Supports user corrections, duplicate detection, and customizable nutrition goals.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "foodlens" with this command: npx skills add yxjsxy/foodlens

FoodLens — AI Meal Photo & Nutrition Tracker

Trigger Conditions

User sends a meal/food photo with context such as:

  • breakfast / lunch / dinner / snack / supper / 早饭 / 午饭 / 晚饭 / 加餐 / 零食

Configuration

Set these paths for your deployment (defaults shown):

FOODLENS_DIR=~/.openclaw/workspace/skills/foodlens
FOODLENS_DATA=$FOODLENS_DIR/data          # daily JSON logs: YYYY-MM-DD.json
FOODLENS_VENV=$FOODLENS_DIR/venv

Nutrition goals are user-configurable. Defaults (edit foodlens_config.json):

  • Calories: 2000 kcal/day
  • Protein: 80g | Carbs: 250g | Fat: 65g

Core Flow

Step 1 — Analyze Photo (Primary)

Save the inbound photo to a temp path, then run:

cd $FOODLENS_DIR && source venv/bin/activate
python3 analyze_photo.py /path/to/photo.jpg "lunch"

This script:

  1. Calls GPT-4o Vision (fallback: Gemini) to identify foods and estimate portion sizes using container/utensil references
  2. Cross-validates against nutrition_db (778 foods + 197 aliases); if deviation > 30%, trusts the database
  3. Appends the meal to data/YYYY-MM-DD.json
  4. Outputs a formatted nutrition report

Forward the script output directly to the user.


Step 2 — Fallback (API unavailable)

If analyze_photo.py fails, use the image tool:

image(
  image="/path/to/photo.jpg",
  prompt="You are a professional nutritionist. Identify all foods in this meal
  photo. Observe container size and utensils to estimate actual grams per item.
  Reference: standard takeout box 500–800 ml, bowl of rice ~150–200 g,
  stir-fried noodles ~400–500 g. List each food: name, estimated grams,
  kcal per 100 g, protein/carb/fat per 100 g."
)

Then write results via Python:

cd $FOODLENS_DIR && source venv/bin/activate && python3 - <<'EOF'
import json, uuid, sys
sys.path.insert(0, '.')
from foodlens import (ensure_item_nutrition, calc_total,
                      health_score_and_comment, load_day, save_day,
                      today_str, recalc_day_totals)
from datetime import datetime

date_str = today_str()
day = load_day(date_str)

# Replace with image tool results
items = [
    ensure_item_nutrition({'name': 'food name', 'grams': 300, 'source': 'image_tool'}),
]

meal_total = calc_total(items)
score, comment = health_score_and_comment(meal_total, len(items))
meal = {
    'meal_id': f'meal_{uuid.uuid4().hex[:10]}',
    'timestamp': datetime.now().isoformat(),
    'label': 'lunch',
    'items': items,
    'meal_total': meal_total,
    'health_score': score,
    'comment': comment,
}
day['meals'].append(meal)
recalc_day_totals(day)
save_day(date_str, day)
print(json.dumps({'meal': meal, 'daily_total': day['daily_total']}, ensure_ascii=False, indent=2))
EOF

Step 3 — Format Reply

🍽️ [Lunch] Nutrition Analysis

🔍 Identified foods:
  • Stir-fried noodles ~400g (720 kcal)
  • Shrimp ~30g (27 kcal)
  • Chicken slices ~60g (90 kcal)

📊 Meal total:
  • Calories: 837 kcal
  • Protein: 38g | Carbs: 102g | Fat: 29g

⭐ Health score: 7/10
  Comment: ...

📈 Daily total (meal N):
  • Calories: X / [goal] kcal (X%)
  • Protein: X / [goal]g (X%)

Step 4 — User Corrections

If user says "that's not X it's Y" or "only about Xg":

  1. Re-query nutrition_db for the corrected food
  2. Update the JSON entry
  3. Reply with corrected nutrition totals

Step 5 — Duplicate Detection

If the same photo is sent again, alert the user it was already logged and ask whether to record again.


Summaries

Daily summary:

cd $FOODLENS_DIR && source venv/bin/activate
python3 analyze_photo.py --summary today

Weekly trend (last 7 days):

cd $FOODLENS_DIR && source venv/bin/activate
python3 analyze_photo.py --weekly-summary yesterday 7

Data Layout

PathDescription
data/YYYY-MM-DD.jsonDaily meal logs
nutrition_db.py778 foods + 197 aliases
analyze_photo.pyMain entry point
foodlens_config.jsonUser nutrition goals
venv/Python virtual environment

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

Multi Edge-TTS CN

Edge-TTS 在线语音合成 skill。基于微软 Edge TTS 引擎,生成速度快(1-2秒),支持多种音色和输出格式。同时支持飞书(OGG/Opus)和企业微信(AMR)。默认音色 xiaoxiao_lively。需联网。

Registry SourceRecently Updated
General

vedic-destiny

吠陀命盘分析中文入口。用于完整命盘研判、命主盘 Rashi chart 与九分盘 Navamsha chart 联读、既往事件回看、出生时间稳定度判断、事业主题、婚姻主题、时空盘专题,以及基于 Jagannatha Hora PDF、星盘截图或文本命盘数据的系统拆盘。当用户提到完整星盘、事业方向、婚姻问题、关系窗...

Registry SourceRecently Updated
General

One Person Company OS

Build a visual operating cockpit for an AI-native one-person company across promise, buyer, product, delivery, cash, learning, and assets. / 为 AI 一人公司建立可视化经营...

Registry SourceRecently Updated
General

健康追踪

健康追踪技能 - 追踪饮水、睡眠、步数等健康数据,JSON存储。

Registry SourceRecently Updated