Run Coach 🏃
A science-based running coach that works through Telegram. Logs your training, sends visual training plans as HD photo albums, syncs Garmin data, and coaches you with data-driven feedback.
Works for any runner — whether you're jogging 3x a week for fitness or training for your first marathon.
What it does
- - Training log — Record every run: distance, pace, heart rate, feel score
- Visual plans — Training plans rendered as HD images sent to your Telegram Photos tab
- Trend tracking — Pace, heart rate, mileage trends over weeks and months
- Garmin sync — Pull data automatically from Garmin Connect (optional)
- Injury monitoring — Tracks knee, plantar fascia, IT band signals
- 4-week reviews — Automatic progress analysis every 4 weeks
- Race prep — Structured build-up for 5K, 10K, half marathon, or full marathon
Setup
1. Required environment variables
Set these in your OpenClaw config or .env:
CODEBLOCK0
To get your TELEGRAM_CHAT_ID: send /start to your bot — it will show Your Telegram user id: XXXXXXXXXX.
2. Fill in your profile
Edit MEMORY.md with your personal data: age, running history, injuries, goal race.
3. Optional: Garmin integration
⚠️ Known limitation: Garmin periodically changes their login flow. The garminconnect library may stop working after a Garmin-side update until the library maintainers patch it. Check garminconnect releases if sync suddenly fails. The rest of the bot works fine without Garmin — you can always log runs manually.
⚖️ Legal note: garminconnect uses Garmin's unofficial API (no official API exists). This may technically conflict with Garmin's Terms of Service. It accesses only your own data and Garmin has not acted against individual users, but use at your own discretion.
Set these additional env vars for automatic Garmin Connect sync:
CODEBLOCK1
Then install the Python library:
CODEBLOCK2
4. Optional: Visual training plans (self-hosted)
The image pipeline (visual training plans sent as Telegram photos) requires additional system dependencies. Install these in your container/environment:
CODEBLOCK3
Without these, the coaching features still work — plans will be sent as text instead of images.
How to use
Log a run (text)
CODEBLOCK4
Log a run (screenshot — no Garmin needed)
Take a screenshot of your watch, running app (Strava, Nike Run Club, Apple Watch, etc.), or any device that shows your run data, and send it directly to the bot. The bot's built-in vision capability (LLM multimodal input) extracts the numbers — no OCR code is included in this skill.
CODEBLOCK5
Works with any device — the LLM reads the image natively, no integration required.
Request a visual training plan
Send me this week's training plan as an image
The bot calls
training/text-to-image.sh and sends the plan as a Telegram photo album — appears in your Photos tab, full quality.
Get a weekly summary
CODEBLOCK7
Sync Garmin data (optional)
CODEBLOCK8
Image pipeline
Training plans are rendered using Playwright + chrome-headless-shell and sent via Telegram sendMediaGroup (photo album). This means:
- - ✅ Appears in Telegram Photos tab
- ✅ No compression on text
- ✅ CJK (Chinese/Japanese/Korean) and emoji supported
- ✅ Weekly plans sent as 2-photo album: run days + cross-training days
Note: The image pipeline requires Telegram. If you use a different channel (Discord, WhatsApp), the coaching features still work — only the visual plan sending is Telegram-specific.
Training methodology
Based on three evidence-based frameworks:
| Framework | Application |
|---|
| Daniels VDOT | Pace zones derived from test results, not guesses |
| MAF heart rate |
Easy runs at truly easy effort — conversational pace |
|
FIRST structure | Quality sessions: Interval + Tempo + Long run |
|
80/20 polarized | 80% easy volume, 20% quality — prevents overtraining |
Safety rule: pain >4/10 means stop. Always.
Files included
CODEBLOCK9
Agent instructions
When the user asks to send content as an image, use exec to run:
CODEBLOCK10
Do NOT use canvas, browser, or Playwright directly. Only these two scripts.
If a script errors, report the exact error to the user — do not silently switch to text.
For all numeric calculations (pace conversions, HR zones, VDOT), use exec:
node -e "console.log(42.195 / (3*60+55))"
Never calculate in your head.
跑步教练 🏃
一款基于科学的跑步教练,通过Telegram运行。记录你的训练,以高清相册形式发送可视化训练计划,同步Garmin数据,并通过数据驱动的反馈进行指导。
适用于任何跑者——无论你是每周慢跑3次保持健康,还是为首次马拉松进行训练。
功能
- - 训练日志 — 记录每次跑步:距离、配速、心率、感受评分
- 可视化计划 — 以高清图片形式呈现的训练计划,发送至你的Telegram照片选项卡
- 趋势追踪 — 追踪数周至数月的配速、心率、跑量趋势
- Garmin同步 — 自动从Garmin Connect拉取数据(可选)
- 伤病监测 — 追踪膝盖、足底筋膜、髂胫束信号
- 四周回顾 — 每四周自动进行进度分析
- 赛事准备 — 为5公里、10公里、半程马拉松或全程马拉松提供结构化备战方案
设置
1. 必需的环境变量
在OpenClaw配置或.env文件中设置以下变量:
TELEGRAMBOTTOKEN=从BotFather获取的机器人令牌
TELEGRAMCHATID=你的Telegram用户ID
获取TELEGRAMCHATID的方法:向你的机器人发送/start——它会显示Your Telegram user id: XXXXXXXXXX。
2. 填写个人资料
编辑MEMORY.md,填入你的个人数据:年龄、跑步经历、伤病情况、目标赛事。
3. 可选:Garmin集成
⚠️ 已知限制: Garmin会定期更改其登录流程。garminconnect库可能在Garmin端更新后停止工作,直到库维护者进行修补。如果同步突然失败,请查看garminconnect发布页面。机器人的其余功能无需Garmin即可正常运行——你始终可以手动记录跑步。
⚖️ 法律说明: garminconnect使用Garmin的非官方API(不存在官方API)。这在技术上可能违反Garmin的服务条款。它仅访问你自己的数据,且Garmin尚未对个人用户采取行动,但请自行斟酌使用。
为自动同步Garmin Connect,设置以下额外环境变量:
GARMIN_EMAIL=你的Garmin邮箱
GARMIN_PASSWORD=你的Garmin密码
然后安装Python库:
bash
pip install garminconnect
4. 可选:可视化训练计划(自托管)
图片处理流程(以Telegram照片形式发送的可视化训练计划)需要额外的系统依赖。在你的容器/环境中安装以下内容:
bash
中日韩字体 + 表情符号
apt-get install -y fonts-noto-cjk fonts-noto-color-emoji
fc-cache -f
Playwright Chromium (chrome-headless-shell)
npx playwright install chromium
没有这些依赖,教练功能仍然可用——计划将以文本而非图片形式发送。
使用方法
记录跑步(文本)
我今天跑了8公里,配速5:30/公里,平均心率135,感觉不错
记录跑步(截图——无需Garmin)
截取你的手表、跑步应用(Strava、Nike Run Club、Apple Watch等)或任何显示跑步数据的设备的截图,直接发送给机器人。机器人内置的视觉能力(LLM多模态输入)会提取数据——本技能不包含OCR代码。
[发送手表/应用摘要截图]
请记录这次跑步并给我反馈
适用于任何设备——LLM原生读取图片,无需集成。
请求可视化训练计划
以图片形式发送本周的训练计划
机器人调用training/text-to-image.sh,以Telegram相册形式发送计划——出现在你的照片选项卡中,全质量。
获取周总结
总结我本周的训练情况
同步Garmin数据(可选)
同步我的Garmin数据并给我今天跑步的反馈
图片处理流程
训练计划使用Playwright + chrome-headless-shell渲染,通过Telegram的sendMediaGroup(相册)发送。这意味着:
- - ✅ 出现在Telegram照片选项卡中
- ✅ 文本无压缩
- ✅ 支持中日韩文字和表情符号
- ✅ 每周计划以双图相册形式发送:跑步日 + 交叉训练日
注意: 图片处理流程需要Telegram。如果你使用其他渠道(Discord、WhatsApp),教练功能仍然可用——仅可视化计划发送是Telegram特有的。
训练方法论
基于三个循证框架:
| 框架 | 应用 |
|---|
| 丹尼尔斯VDOT | 基于测试结果而非猜测的配速区间 |
| MAF心率 |
以真正轻松的努力进行轻松跑——可交谈的配速 |
|
FIRST结构 | 高质量训练:间歇跑 + 节奏跑 + 长距离跑 |
|
80/20极化训练 | 80%轻松跑量,20%高质量训练——防止过度训练 |
安全规则:疼痛程度>4/10即停止。始终如此。
包含的文件
run-coach/
├── SKILL.md # 本文件——清单与说明
├── MEMORY.md # 用户资料模板(填入你的数据)
├── training/
│ ├── send-plan.sh # HTML → 截图 → Telegram相册
│ ├── text-to-image.sh # 文本 → HTML → 截图 → Telegram相册
│ ├── screenshot.mjs # Playwright截图引擎
│ └── send-album.mjs # Telegram sendPhoto(单张)或sendMediaGroup(多张)
└── garmin/ # 可选Garmin集成
├── garmin-sync.py
└── garmin-query.py
代理指令
当用户要求以图片形式发送内容时,使用exec运行:
bash
选项A:将文本转换为图片
bash training/text-to-image.sh 标题 包含\n换行的内容
选项B:以双图相册形式发送每周计划(跑步日 + 交叉训练日)
bash training/send-plan.sh 第X周计划 training/week-XX-run.html training/week-XX-cross.html
选项C:单个HTML(今日计划、总结——不适用于每周计划)
bash training/send-plan.sh 标题 training/week-XX.html
不要直接使用canvas、浏览器或Playwright。仅使用这两个脚本。
如果脚本出错,向用户报告确切错误——不要静默切换为文本。
对于所有数值计算(配速转换、心率区间、VDOT),使用exec:
bash
node -e console.log(42.195 / (3*60+55))
切勿心算。