Calorie Counter
Simple, reliable calorie and protein tracking with SQLite database.
Features
- - Manual Entry: Add food with calories and protein
- Protein Tracking: Monitor daily protein intake
- Daily Goals: Set custom calorie targets
- Weight Tracking: Log weight in pounds
- Instant Feedback: See totals immediately after adding food
- History: View past days and trends
Usage
Adding Food
python scripts/calorie_tracker.py add "chicken breast" 165 31
python scripts/calorie_tracker.py add "banana" 100 1
Shows immediate feedback with today's totals and remaining calories.
Viewing Today's Summary
python scripts/calorie_tracker.py summary
Shows:
- - All entries for today
- Total calories and protein consumed
- Daily goal and remaining calories
- Progress percentage
Setting Goals
python scripts/calorie_tracker.py goal 2000
Sets the daily calorie goal (persists).
Weight Tracking
python scripts/calorie_tracker.py weight 175
python scripts/calorie_tracker.py weight-history
Weight is in pounds (decimals allowed: 175.5).
Viewing History
CODEBLOCK4
Deleting Entries
CODEBLOCK5
Database
SQLite database: INLINECODE0
Tables
entries - Food log
- - id (INTEGER) - Auto-increment
- date (TEXT) - YYYY-MM-DD
- foodname (TEXT)
- calories (INTEGER)
- protein (INTEGER)
- createdat (TIMESTAMP) - Automatic
daily_goal - Single calorie target
- - id (INTEGER) - Always 1
- calorie_goal (INTEGER)
weight_log - Weight tracking
- - id (INTEGER) - Auto-increment
- date (TEXT) - YYYY-MM-DD
- weightlbs (REAL) - Pounds with decimals
- createdat (TIMESTAMP) - Automatic
Agent Instructions
Important: The skill is located at workspace/calorie-counter/ in your agent's workspace. All commands should use this path prefix.
When user mentions food:
- 1. Extract food name, calories, and protein (estimate if not provided)
- Run: INLINECODE2
- The command outputs immediate totals (no need to run summary separately)
Example:
- - User: "I had a chicken breast for lunch, about 165 calories"
- Estimate protein (chicken is ~30g per 165 cal)
- Run: INLINECODE3
When user wants remaining calories:
- 1. Run: INLINECODE4
When user sets a goal:
- 1. Run: INLINECODE5
When user logs weight:
- 1. Convert to pounds if needed (1 kg ≈ 2.205 lbs)
- Run: INLINECODE6
When user wants to delete entry:
- 1. Run:
python3 workspace/calorie-counter/scripts/calorie_tracker.py list to show IDs - Run: INLINECODE8
Protein Estimation Guide
If user doesn't specify protein, estimate based on food type:
- - Lean meats (chicken, turkey): ~0.30g per calorie
- Fish: ~0.25g per calorie
- Red meat: ~0.20g per calorie
- Eggs: ~0.12g per calorie (1 egg = 70 cal, 6g protein)
- Greek yogurt: ~0.10g per calorie
- Nuts: ~0.04g per calorie
- Bread/pasta: ~0.03g per calorie
- Fruits: ~0.01g per calorie or less
- Vegetables: ~0.02-0.04g per calorie
When uncertain, estimate conservatively or ask the user.
Notes
- - Calories and protein are integers (no decimals)
- Weight is in pounds (decimals allowed)
- Database created automatically on first use
- All times in local timezone
- Dates in YYYY-MM-DD format
- Time shown in lists is from created_at timestamp (HH:MM format)
Example Session
CODEBLOCK6
卡路里计数器
使用SQLite数据库进行简单、可靠的卡路里和蛋白质追踪。
功能特点
- - 手动录入:添加食物及其卡路里和蛋白质含量
- 蛋白质追踪:监控每日蛋白质摄入量
- 每日目标:设定自定义卡路里目标
- 体重追踪:以磅为单位记录体重
- 即时反馈:添加食物后立即查看总计数据
- 历史记录:查看过去的天数和趋势
使用方法
添加食物
bash
python scripts/calorie_tracker.py add 鸡胸肉 165 31
python scripts/calorie_tracker.py add 香蕉 100 1
立即显示今日总计和剩余卡路里的反馈信息。
查看今日摘要
bash
python scripts/calorie_tracker.py summary
显示:
- - 今日所有记录
- 消耗的总卡路里和蛋白质
- 每日目标和剩余卡路里
- 进度百分比
设定目标
bash
python scripts/calorie_tracker.py goal 2000
设定每日卡路里目标(持久保存)。
体重追踪
bash
python scripts/calorie_tracker.py weight 175
python scripts/calorie_tracker.py weight-history
体重以磅为单位(支持小数:175.5)。
查看历史记录
bash
最近7天
python scripts/calorie_tracker.py history
最近30天
python scripts/calorie_tracker.py history 30
删除记录
bash
列出记录以获取ID
python scripts/calorie_tracker.py list
按ID删除
python scripts/calorie_tracker.py delete 42
数据库
SQLite数据库:calorie_data.db
数据表
entries - 食物记录
- - id (INTEGER) - 自动递增
- date (TEXT) - YYYY-MM-DD格式
- foodname (TEXT)
- calories (INTEGER)
- protein (INTEGER)
- createdat (TIMESTAMP) - 自动生成
daily_goal - 单一日卡路里目标
- - id (INTEGER) - 始终为1
- calorie_goal (INTEGER)
weight_log - 体重追踪
- - id (INTEGER) - 自动递增
- date (TEXT) - YYYY-MM-DD格式
- weightlbs (REAL) - 磅数,支持小数
- createdat (TIMESTAMP) - 自动生成
代理指令
重要提示: 该技能位于代理工作区的 workspace/calorie-counter/ 目录下。所有命令应使用此路径前缀。
当用户提到食物时:
- 1. 提取食物名称、卡路里和蛋白质(如未提供则估算)
- 运行:python3 workspace/calorie-counter/scripts/calorie_tracker.py add 食物名称 卡路里 蛋白质
- 命令会直接输出即时总计(无需单独运行摘要命令)
示例:
- - 用户:我午餐吃了鸡胸肉,大约165卡路里
- 估算蛋白质(鸡肉每165卡约含30克蛋白质)
- 运行:python3 workspace/calorie-counter/scripts/calorie_tracker.py add 鸡胸肉 165 30
当用户查询剩余卡路里时:
- 1. 运行:python3 workspace/calorie-counter/scripts/calorie_tracker.py summary
当用户设定目标时:
- 1. 运行:python3 workspace/calorie-counter/scripts/calorie_tracker.py goal 卡路里值
当用户记录体重时:
- 1. 如有需要,转换为磅(1公斤 ≈ 2.205磅)
- 运行:python3 workspace/calorie-counter/scripts/calorie_tracker.py weight 磅数
当用户需要删除记录时:
- 1. 运行:python3 workspace/calorie-counter/scripts/calorietracker.py list 显示ID
- 运行:python3 workspace/calorie-counter/scripts/calorietracker.py delete ID
蛋白质估算指南
如果用户未指定蛋白质含量,根据食物类型进行估算:
- - 瘦肉(鸡肉、火鸡):每卡路里约0.30克
- 鱼类:每卡路里约0.25克
- 红肉:每卡路里约0.20克
- 鸡蛋:每卡路里约0.12克(1个鸡蛋=70卡,6克蛋白质)
- 希腊酸奶:每卡路里约0.10克
- 坚果:每卡路里约0.04克
- 面包/意面:每卡路里约0.03克
- 水果:每卡路里约0.01克或更少
- 蔬菜:每卡路里约0.02-0.04克
不确定时,保守估算或询问用户。
备注
- - 卡路里和蛋白质为整数(不支持小数)
- 体重以磅为单位(支持小数)
- 数据库在首次使用时自动创建
- 所有时间均为本地时区
- 日期格式为YYYY-MM-DD
- 列表中显示的时间来自created_at时间戳(HH:MM格式)
示例会话
bash
设定目标
$ python scripts/calorie_tracker.py goal 2000
✓ 已设定每日目标:2000卡
添加早餐
$ python scripts/calorie_tracker.py add 燕麦粥 150 5
✓ 已添加:燕麦粥(150卡,5克蛋白质)
记录ID:1
今日:150 / 2000卡(剩余:1850)| 今日蛋白质:5克 | 记录数:1
添加午餐
$ python scripts/calorie_tracker.py add 烤鸡沙拉 350 45
✓ 已添加:烤鸡沙拉(350卡,45克蛋白质)
记录ID:2
今日:500 / 2000卡(剩余:1500)| 今日蛋白质:50克 | 记录数:2
查看摘要
$ python scripts/calorie_tracker.py summary
============================================================
每日摘要 - 2026-02-05
============================================================
记录数:2
总消耗:500卡 | 50克蛋白质
每日目标:2000卡
剩余:1500卡
已完成目标的25.0%
============================================================
记录体重
$ python scripts/calorie_tracker.py weight 175.5
✓ 已记录体重:175.5磅