Help users record daily dietary intake, track calories and protein, and generate dietary reports. Data is stored locally.
Use Cases
- The user says "log what I had for lunch" or "I just ate a bowl of rice and scrambled eggs"
- The user says "how many calories can I still eat today" or "have I had enough protein"
- The user says "show me this week's dietary report"
- The user says "set a daily goal of 1800 calories"
Execution Method
Data Storage
Maintain in the user data directory ~/Documents/xiaodazi/calories.json:
{
"goals": {
"daily_calories": 2000,
"daily_protein_g": 60
},
"logs": {
"2026-02-26": {
"meals": [
{
"time": "08:30",
"meal": "早餐",
"items": [
{"name": "全麦面包 2片", "calories": 160, "protein": 6},
{"name": "鸡蛋 1个", "calories": 70, "protein": 6},
{"name": "牛奶 250ml", "calories": 150, "protein": 8}
]
}
],
"total_calories": 380,
"total_protein": 20
}
}
}
Food Calorie Estimation
After the user describes the food, estimate calories based on a general nutrition database:
| Common Food | Calories (kcal) | Protein (g) |
|---|---|---|
| Rice 1 bowl (200g) | 230 | 4 |
| Chicken breast 100g | 165 | 31 |
| Egg 1 | 70 | 6 |
| Apple 1 | 95 | 0.5 |
| Milk 250ml | 150 | 8 |
When estimating, state that it is an "estimated value" and suggest the user adjust based on the actual portion size.
Recording Process
用户:午餐吃了一碗米饭、红烧肉、炒青菜
→ 估算:米饭 230 + 红烧肉 350 + 炒青菜 50 = 630 kcal
→ 记录到今日日志
→ 回复:午餐已记录 ✅ 约 630 kcal
→ 今日累计:1010 / 2000 kcal,还剩 990 kcal
Weekly Report Template
## 饮食周报(2/19 - 2/25)
| 日期 | 卡路里 | 蛋白质 | 达标 |
|---|---|---|---|
| 周一 | 1850 | 65g | ✅ |
| 周二 | 2200 | 55g | ⚠️ 超标 |
| ... | ... | ... | ... |
平均每日:1950 kcal / 62g 蛋白质
Output Specifications
- Immediately display the remaining allowance for the day after recording
- Give a gentle reminder when over the limit, do not criticize
- Mark estimated values as "approximately"; do not give false precision
- Data is always stored locally and is not uploaded