diet

A command for recording meals from food photos and estimating their nutritional content. It can keep meal history and show nutrition totals for periods such as today, a week, or a month.

In plain words
What is it for?
Use it to add meals with photos, review past entries, check daily or weekly nutrition status, and create nutrition summaries.
Why use it?
It removes the need to type every food item and nutrient manually. Keeping records over time makes it easier to review eating patterns and reported nutrient intake.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/huifer/wellally-health/diet
Clone the repo
git clone --depth 1 https://github.com/huifer/WellAlly-health

Made for: Claude Code.

Per session 10 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 4,448 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00010 $0.04448
Opus 5 $0.00005 $0.02224
Sonnet 5 $0.00002 $0.00890
Haiku 4.5 $0.00001 $0.00445

Measured yesterday against content hash 512464c26b26, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

diet scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/diet.md · 528 lines

How it starts

The opening of the file, as written. The whole thing — 528 lines — stays where its author put it; the contents beside it link to each section on GitHub.

饮食营养记录

通过拍照或上传图片记录每日饮食,自动分析营养成分并追踪营养摄入情况。

操作类型

1. 添加饮食记录 - add

通过食物照片自动识别并记录营养成分。

参数说明:

  • image: 食物照片路径(必填),支持拖拽图片或指定路径
  • meal_time: 用餐时间(可选),格式:
    • HH:mm - 今天的具体时间(如:12:30)
    • YYYY-MM-DD HH:mm - 完整日期时间(如:2025-12-30 18:00)
    • 默认:当前时间

示例:

/diet add food.jpg
/diet add breakfast.png 08:00
/diet add lunch.jpg 2025-12-30 12:30

使用流程:

  1. 用户拍摄或选择食物照片
  2. AI 识别食物种类和份量
  3. 自动分析营养成分
  4. 保存记录并显示确认信息

2. 查看历史记录 - history

查看所有饮食记录。

示例:

/diet history
/diet history today
/diet history 2025-12-30

3. 营养统计 - status

查看营养摄入统计和分析。

示例:

/diet status
/diet status today
/diet status week

4. 营养汇总 - summary

查看特定时间段的营养汇总。

示例:

/diet summary today
/diet summary week
/diet summary month

执行步骤

添加记录 (add)

1. 读取和分析图片

支持的图片格式:

  • JPG/JPEG
  • PNG
  • WebP

图片分析内容:

  • 食物种类识别(主食、蔬菜、肉类、水果等)
  • 食物份量估算(通过视觉参考)
  • 烹饪方式判断(煎、炒、蒸、煮等)
  • 餐具识别(盘子大小、碗等参考)
2. 营养成分分析

必记录的营养成分:

  • 热量 (kcal)
  • 蛋白质 (g)
  • 脂肪 (g)
  • 碳水化合物 (g)

微量营养素:

  • 维生素A (μg)
  • 维生素B1 (mg)
  • 维生素B2 (mg)
  • 维生素B3 (mg)
  • 维生素B6 (mg)
  • 维生素B12 (μg)
  • 维生素C (mg)
  • 维生素D (μg)
  • 维生素E (mg)
  • 维生素K (μg)
  • 叶酸 (μg)

矿物质:

  • (mg)
  • (mg)
  • (mg)
  • (mg)
  • (mg)
  • (mg)
  • (mg)

其他:

  • 膳食纤维 (g)
  • 胆固醇 (mg)
  • 水分 (g)
3. 餐次分类

根据用餐时间自动分类:

  • 早餐: 05:00 - 09:59
  • 午餐: 10:00 - 14:59
  • 下午茶: 15:00 - 16:59
  • 晚餐: 17:00 - 21:59
  • 夜宵: 22:00 - 04:59
4. 保存记录

文件路径格式: data/diet-records/YYYY-MM/YYYY-MM-DD_HHMM.json

JSON 数据结构:

{
  "id": "20251231123456789",
  "record_date": "2025-12-31",
  "meal_time": "12:30",
  "meal_type": "午餐",
  "image_path": "food.jpg",

  "foods": [
    {
      "name": "米饭",
      "portion": "1碗(约150g)",
      "weight_estimate": 150,
      "cooking_method": "蒸",
      "confidence": 0.95
    },
    {
      "name": "清炒时蔬",
      "portion": "1份(约200g)",
      "weight_estimate": 200,
      "cooking_method": "炒",
      "confidence": 0.88
    }
  ],

  "nutrition": {
    "calories": {
      "value": 485,
      "unit": "kcal",
      "breakdown": {
        "carbohydrate": 60,
        "protein": 15,
        "fat": 18,
        "fiber": 6
      }
    },
    "macronutrients": {
      "protein": { "value": 15.2, "unit": "g" },
      "fat": { "value": 18.5, "unit": "g" },
      "carbohydrate": { "value": 60.3, "unit": "g" },
      "fiber": { "value": 6.2, "unit": "g" }
    },
    "vitamins": {
      "vitamin_a": { "value": 245, "unit": "μg" },
      "vitamin_b1": { "value": 0.18, "unit": "mg" },
      "vitamin_b2": { "value": 0.12, "unit": "mg" },
      "vitamin_b3": { "value": 2.5, "unit": "mg" },
      "vitamin_b6": { "value": 0.25, "unit": "mg" },
      "vitamin_b12": { "value": 0.5, "unit": "μg" },
      "vitamin_c": { "value": 35, "unit": "mg" },
      "vitamin_d": { "value": 0.5, "unit": "μg" },
      "vitamin_e": { "value": 2.1, "unit": "mg" },
      "vitamin_k": { "value": 45, "unit": "μg" },
      "folate": { "value": 28, "unit": "μg" }
    },
    "minerals": {
      "calcium": { "value": 45, "unit": "mg" },
      "iron": { "value": 2.8, "unit": "mg" },
      "zinc": { "value": 1.5, "unit": "mg" },
      "potassium": { "value": 320, "unit": "mg" },
      "sodium": { "value": 450, "unit": "mg" },
      "magnesium": { "value": 38, "unit": "mg" },
      "phosphorus": { "value": 120, "unit": "mg" }
    },
    "other": {
      "cholesterol": { "value": 35, "unit": "mg" },
      "water": { "value": 285, "unit": "g" }
    }
  },

  "health_score": {
    "overall": 7.5,
    "balance": 8.0,
    "variety": 7.0,
    "nutrition_density": 7.5
  },

  "suggestions": [
    "蔬菜摄入量良好,建议继续保持",
    "蛋白质摄入适中,可适当增加优质蛋白比例",
    "注意控制钠盐摄入"
  ],

  "metadata": {
    "created_at": "2025-12-31T12:34:56.789Z",
    "last_updated": "2025-12-31T12:34:56.789Z",
    "ai_confidence": 0.88
  }
}

Read the full file on GitHub · 528 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 528 lines · 10 tokens per session scan A 512464c26b26

Subscribe to this mod's changes

diet is a command published in the GitHub repository huifer/WellAlly-health (935 stars, last pushed 1mo ago), licensed MIT. It adds 10 tokens to every session and 4,448 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.