Workout Log
Parses strength training sessions from natural or structured input and inserts them into the sport schema of life_db.
Connection
Credentials are in ~/.openclaw/services/life-db/.env.
Workflow
1. Parse the user's message
Extract from free text or structured input:
| Field | Type | Notes |
|---|
| INLINECODE3 | YYYY-MM-DD | Default: today |
| INLINECODE4 |
int | Total session duration |
|
feeling | 1–10 integer | Overall session feeling |
|
notes | string | Optional — program name, injuries, etc. |
|
exercises[] | array | One object per exercise |
Each exercise:
| Field | Type | Notes |
|---|
| INLINECODE8 | string | Normalize consistently (e.g. "Bench Press", "Squat", "Romanian Deadlift") |
| INLINECODE9 |
int | Number of working sets |
|
reps | int | Reps per set (use average if varied) |
|
weight_kg | float | Working weight —
null for bodyweight exercises |
|
rpe | float | Rate of perceived exertion (1–10), optional |
|
rest_sec | int | Rest between sets in seconds, optional |
|
order_in_session | int | Order as mentioned |
|
notes | string | Optional — tempo, drop sets, supersets, etc. |
2. Confirm with the user
Show a summary before inserting:
CODEBLOCK0
3. Insert
Only after confirmation, use the exec tool:
CODEBLOCK1
Replace <json> with the minified JSON payload (no newlines, properly shell-escaped).
4. Confirm result
On OK — respond with exactly this format, nothing more:
CODEBLOCK2
INLINECODE20 rules — 1 line, max 60 chars, no emoji:
- - feeling ≥ 8 → short hype line
- feeling 5–7 → encouragement
- feeling ≤ 4 → grind acknowledgement
On ERROR — report the error as-is, do not retry without user input.
Examples
| User says | Parsed session |
|---|
| "Gym 1h feeling 8. Bench 4x10 80kg, Squat 4x8 100kg, Curl 3x12 15kg" | 3 exercises, 60 min, feeling 8/10 |
| "45 min chest/shoulders. Bench press 5x5 90kg RPE 9, overhead press 4x8 40kg, lateral raises 3x15 10kg" |
3 exercises, 45 min, feeling asked |
| "Quick session 30min: pull-ups 4x8 bodyweight, rows 4x10 60kg" | 2 exercises, 30 min, feeling asked |
训练日志
从自然语言或结构化输入中解析力量训练内容,并将其插入到 life_db 数据库的 sport 模式中。
连接
凭据存储在 ~/.openclaw/services/life-db/.env 文件中。
工作流程
1. 解析用户消息
从自由文本或结构化输入中提取:
| 字段 | 类型 | 说明 |
|---|
| sessiondate | YYYY-MM-DD | 默认值:今天 |
| durationmin |
int | 训练总时长 |
| feeling | 1–10 整数 | 整体训练感受 |
| notes | string | 可选 — 训练计划名称、伤病情况等 |
| exercises[] | array | 每个动作一个对象 |
每个动作:
| 字段 | 类型 | 说明 |
|---|
| exercise_name | string | 统一规范化命名(例如:卧推、深蹲、罗马尼亚硬拉) |
| sets |
int | 正式组数 |
| reps | int | 每组次数(如有变化取平均值) |
| weight_kg | float | 训练重量 — 自重训练填 null |
| rpe | float | 主观疲劳度(1–10),可选 |
| rest_sec | int | 组间休息时间(秒),可选 |
| order
insession | int | 按提及顺序排列 |
| notes | string | 可选 — 节奏、递减组、超级组等 |
2. 与用户确认
插入前显示摘要:
📅 {DD/MM/YYYY} · 力量训练 · {duration} 分钟 · 感受 {feeling}/10
• {动作1} — {sets}×{reps} @ {weight} kg
• {动作2} — {sets}×{reps} 自重
• …
是否保存?(是 / 否)
3. 插入
仅在确认后,使用 exec 工具:
json
{
tool: exec,
command: bash -c set -a; source ~/.openclaw/services/life-db/.env; uv run --project ~/.openclaw {baseDir}/scripts/insert_workout.py
}
将 替换为压缩后的 JSON 数据(无换行,正确进行 shell 转义)。
4. 确认结果
成功时 — 严格按照以下格式回复,不多不少:
✅ 力量训练 · {duration} 分钟 · 感受 {feeling}/10 · #{session_id}
{评论}
{评论} 规则 — 1 行,最多 60 字符,无表情符号:
- - 感受 ≥ 8 → 简短激励语
- 感受 5–7 → 鼓励语
- 感受 ≤ 4 → 坚持肯定语
失败时 — 直接报告错误,未经用户输入不得重试。
示例
| 用户输入 | 解析结果 |
|---|
| 健身房1小时感受8。卧推4x10 80kg,深蹲4x8 100kg,弯举3x12 15kg | 3个动作,60分钟,感受8/10 |
| 45分钟胸/肩。卧推5x5 90kg RPE 9,过头推举4x8 40kg,侧平举3x15 10kg |
3个动作,45分钟,需要询问感受 |
| 快速训练30分钟:引体向上4x8自重,划船4x10 60kg | 2个动作,30分钟,需要询问感受 |