RUNSTR Analytics Skill
Advanced fitness analytics and coaching insights for RUNSTR data. Provides trend analysis, performance tracking, habit correlation, and personalized training recommendations.
Setup
Required: RUNSTR_NSEC environment variable
This skill requires your Nostr private key (nsec1...) to decrypt RUNSTR backup data.
Option 1 - For OpenClaw/chat usage:
Tell your bot: "Here's my RUNSTR nsec: nsec1..."
Option 2 - For CLI/cron automation:
CODEBLOCK0
⚠️ Security note: The nsec is passed securely via stdin (not CLI arguments) to prevent exposure in process lists. Cache files use restrictive permissions (0700/0600).
Features
- - Advanced Trend Analysis: Pace trends by activity type, seasonal comparisons, training load tracking
- Performance Insights: Personal records, weekly challenges, streak tracking
- Correlation Analysis: Mood vs training, habits vs performance, sleep vs recovery
- Training Recommendations: AI-driven tips for improvement, goal-based planning
- Training Plan Integration: Sync with external training plans, track adherence
Quick Start
Extended version (recommended - with local cache):
CODEBLOCK1
Lightweight version (basic analysis):
CODEBLOCK2
Full version (requires pandas, numpy, scipy):
CODEBLOCK3
Commands
| Flag | Description |
|---|
| INLINECODE0 | Your Nostr private key (nsec1...) |
| INLINECODE1 |
Analysis period (default: 30) |
|
--insights | Generate improvement tips |
|
--coaching-report | Full coaching analysis |
|
--training-plan | Path to training plan markdown file |
|
--trends | Show trend visualizations |
|
--correlations | Analyze habit/mood correlations |
|
--pb | Show personal records |
|
--challenges | Generate weekly challenges |
Data Sources
- 1. Nostr Encrypted Backup (Kind 30078): Primary workout, habit, journal data
- Local Cache: SQLite database for fast re-analysis
- Training Plans: Markdown files with structured training schedules
Extended Features (analyze_extended.py)
Local Cache
- - SQLite database stores workouts locally
- Fast subsequent analyses (no Nostr query needed)
- Automatic PR tracking across sessions
- Cache location: INLINECODE9
Week-to-Week Comparison
CODEBLOCK4
Personal Records
- - Automatically detects PRs for: 1K, 5K, 10K, Half Marathon
- Stores historical PRs in cache
- Shows date and pace for each PR
Visual Charts
- - ASCII bar charts for weekly stats
- Sparkline trend indicators (📈 📉 ➡️)
- Easy visual comparison between weeks
Automated Daily Updates
CODEBLOCK5
The automation will:
- - Check if cache is older than 12 hours
- Fetch fresh data from Nostr if needed
- Generate new report with charts
- Save to INLINECODE10
Usage Examples
CODEBLOCK6
Analytics Engine
Trend Calculations
- - Rolling averages (7-day, 30-day)
- Week-over-week comparisons
- Pace progression by distance bracket
- Training load (acute vs chronic)
Correlation Analysis
- - Pearson correlation for numeric relationships
- Mood distribution by activity type
- Habit impact on performance metrics
Recommendation Engine
- - Rule-based coaching tips
- Goal gap analysis
- Recovery recommendations
Output Formats
- - Terminal tables (default)
- JSON export (
--format json) - Markdown reports (
--format md)
Security Considerations
Private Key Handling
- - RUNSTR_NSEC is your Nostr private key — treat it like a password. Never share it.
- This skill passes the key via stdin (not command-line arguments) to prevent exposure in process lists (
ps) - For added security on multi-user systems, ensure your system is not configured to log environment variables
Local Data Protection
- - Decrypted workout/journal data is cached locally in INLINECODE14
- Cache directory and database files are created with restrictive permissions (0700/0600) — only your user can access them
- Ensure your disk is encrypted (full-disk encryption) for maximum protection
Recommended Installation
- - Install on a personal machine with restricted access (single user, disk encryption enabled)
- Consider pinning the
nak binary to a specific release rather than using INLINECODE16 - Review the cron setup before enabling automatic daily updates
Privacy
- - NSEC is never stored or logged in skill output
- All processing happens locally on your machine
- Nostr queries use encrypted connections (WSS/WebSocket Secure)
- No data is sent to external analytics services
RUNSTR 分析技能
针对RUNSTR数据的高级健身分析与教练洞察。提供趋势分析、表现追踪、习惯关联以及个性化训练建议。
设置
必需:RUNSTR_NSEC 环境变量
此技能需要您的Nostr私钥(nsec1...)来解密RUNSTR备份数据。
选项1 - 用于OpenClaw/聊天使用:
告诉您的机器人:这是我的RUNSTR nsec:nsec1...
选项2 - 用于CLI/cron自动化:
bash
export RUNSTR_NSEC=nsec1...
⚠️ 安全提示: nsec通过标准输入(而非CLI参数)安全传递,以防止在进程列表中暴露。缓存文件使用限制性权限(0700/0600)。
功能特性
- - 高级趋势分析:按活动类型分析配速趋势、季节性对比、训练负荷追踪
- 表现洞察:个人纪录、每周挑战、连续打卡追踪
- 关联分析:情绪与训练关联、习惯与表现关联、睡眠与恢复关联
- 训练建议:基于AI的改进建议、目标导向的计划制定
- 训练计划集成:与外部训练计划同步,追踪执行情况
快速开始
扩展版本(推荐 - 使用本地缓存):
bash
首次运行 - 从Nostr获取并本地缓存
python3 scripts/analyze_extended.py --nsec
--days 60 --insights --force-refresh
后续运行 - 使用缓存数据(无需nsec!)
python3 scripts/analyze_extended.py --days 60 --insights
轻量版本(基础分析):
bash
python3 scripts/analyze_light.py --nsec --days 30 --insights
完整版本(需要pandas、numpy、scipy):
bash
首先安装依赖:pip3 install pandas numpy scipy
python3 scripts/analyze.py --nsec --days 60 --coaching-report
命令参数
| 标志 | 描述 |
|---|
| --nsec | 您的Nostr私钥(nsec1...) |
| --days |
分析周期(默认:30) |
| --insights | 生成改进建议 |
| --coaching-report | 完整教练分析 |
| --training-plan | 训练计划Markdown文件路径 |
| --trends | 显示趋势可视化 |
| --correlations | 分析习惯/情绪关联 |
| --pb | 显示个人纪录 |
| --challenges | 生成每周挑战 |
数据来源
- 1. Nostr加密备份(Kind 30078):主要训练、习惯、日志数据
- 本地缓存:用于快速重新分析的SQLite数据库
- 训练计划:包含结构化训练安排的Markdown文件
扩展功能(analyze_extended.py)
本地缓存
- - SQLite数据库本地存储训练数据
- 后续分析快速(无需Nostr查询)
- 跨会话自动追踪个人纪录
- 缓存位置:~/.cache/runstr-analytics/
周与周对比
bash
显示最近4周及趋势
python3 scripts/analyze_extended.py --insights
个人纪录
- - 自动检测以下距离的个人纪录:1公里、5公里、10公里、半程马拉松
- 在缓存中存储历史个人纪录
- 显示每个个人纪录的日期和配速
可视化图表
- - 每周统计数据的ASCII柱状图
- 迷你趋势指示器(📈 📉 ➡️)
- 周与周之间的直观视觉对比
自动每日更新
bash
设置每日定时任务(07:00运行)
./setup_cron.sh
查看最新自动报告
./view_report.sh
检查更新日志
tail -f ~/.cache/runstr-analytics/daily_update.log
自动化功能将:
- - 检查缓存是否超过12小时
- 如有需要从Nostr获取新数据
- 生成包含图表的新报告
- 保存至~/.cache/runstr-analytics/latest_report.txt
使用示例
bash
首次设置 - 获取并缓存
python3 scripts/analyze_extended.py --nsec nsec1... --force-refresh
每日检查 - 使用缓存
python3 scripts/analyze_extended.py --insights
分析最近90天
python3 scripts/analyze_extended.py --days 90 --insights
强制从Nostr重新获取(新备份后)
python3 scripts/analyze_extended.py --nsec nsec1... --force-refresh
设置自动每日更新
./setup_cron.sh
查看今日自动报告
./view_report.sh
分析引擎
趋势计算
- - 滚动平均值(7天、30天)
- 周与周对比
- 按距离区间划分的配速进展
- 训练负荷(急性vs慢性)
关联分析
- - 数值关系的皮尔逊相关系数
- 按活动类型划分的情绪分布
- 习惯对表现指标的影响
建议引擎
输出格式
- - 终端表格(默认)
- JSON导出(--format json)
- Markdown报告(--format md)
安全考虑
私钥处理
- - RUNSTR_NSEC是您的Nostr私钥 — 请像密码一样对待。切勿分享。
- 此技能通过标准输入(而非命令行参数)传递密钥,以防止在进程列表(ps)中暴露
- 在多用户系统上增加安全性,请确保您的系统未配置为记录环境变量
本地数据保护
- - 解密后的训练/日志数据本地缓存于~/.cache/runstr-analytics/runstr_cache.db
- 缓存目录和数据库文件以限制性权限(0700/0600)创建 — 仅您的用户可访问
- 为确保最大程度保护,请确保磁盘已加密(全盘加密)
推荐安装
- - 安装在具有受限访问权限的个人机器上(单用户、启用磁盘加密)
- 考虑将nak二进制文件固定到特定版本,而非使用@latest
- 在启用自动每日更新前,请先审查cron设置
隐私保护
- - NSEC永远不会存储在技能输出中或被记录
- 所有处理均在您的本地机器上完成
- Nostr查询使用加密连接(WSS/WebSocket Secure)
- 不会向外部分析服务发送任何数据