← 返回
数据分析

Runstr analytics

Advanced RUNSTR fitness analytics with trend analysis, performance insights, training recommendations, and correlation tracking. Analyzes workout history, ha...
RUNSTR高级健身分析,支持趋势分析、表现洞察、训练建议及相关性追踪,深度解析运动历史数据
katla50
数据分析 clawhub v1.0.1 2 版本 100000 Key: 无需
★ 0
Stars
📥 573
下载
💾 10
安装
2
版本
#latest

概述

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:

export RUNSTR_NSEC="nsec1..."

⚠️ 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):

# First run - fetch from Nostr and cache locally
python3 scripts/analyze_extended.py --nsec <NSEC> --days 60 --insights --force-refresh

# Subsequent runs - use cached data (no nsec needed!)
python3 scripts/analyze_extended.py --days 60 --insights

Lightweight version (basic analysis):

python3 scripts/analyze_light.py --nsec <NSEC> --days 30 --insights

Full version (requires pandas, numpy, scipy):

# Install dependencies first: pip3 install pandas numpy scipy
python3 scripts/analyze.py --nsec <NSEC> --days 60 --coaching-report

Commands

FlagDescription
-------------------
--nsecYour Nostr private key (nsec1...)
--daysAnalysis period (default: 30)
--insightsGenerate improvement tips
--coaching-reportFull coaching analysis
--training-planPath to training plan markdown file
--trendsShow trend visualizations
--correlationsAnalyze habit/mood correlations
--pbShow personal records
--challengesGenerate weekly challenges

Data Sources

  1. Nostr Encrypted Backup (Kind 30078): Primary workout, habit, journal data
  2. Local Cache: SQLite database for fast re-analysis
  3. 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: ~/.cache/runstr-analytics/

Week-to-Week Comparison

# Shows last 4 weeks with trends
python3 scripts/analyze_extended.py --insights

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

# Set up daily cron job (runs at 07:00)
./setup_cron.sh

# View latest automated report
./view_report.sh

# Check update logs
tail -f ~/.cache/runstr-analytics/daily_update.log

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 ~/.cache/runstr-analytics/latest_report.txt

Usage Examples

# First time setup - fetch and cache
python3 scripts/analyze_extended.py --nsec nsec1... --force-refresh

# Daily check - uses cache
python3 scripts/analyze_extended.py --insights

# Analyze last 90 days
python3 scripts/analyze_extended.py --days 90 --insights

# Force re-fetch from Nostr (after new backup)
python3 scripts/analyze_extended.py --nsec nsec1... --force-refresh

# Set up automatic daily updates
./setup_cron.sh

# View today's automated report
./view_report.sh

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 ~/.cache/runstr-analytics/runstr_cache.db
  • 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 @latest
  • 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

版本历史

共 2 个版本

  • v1.0.1 当前
    2026-03-19 13:42 安全 安全
  • v1.0.0
    2026-03-14 04:41

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

data-analysis

A股量化 AkShare

mbpz
A股量化数据分析工具,基于AkShare库获取A股行情、财务数据、板块信息等。用于回答关于A股股票查询、行情数据、财务分析、选股等问题。
★ 165 📥 59,957
data-analysis

Data Analysis

ivangdavila
{"answer":"数据分析与可视化。查询数据库、生成报告、自动化电子表格,将原始数据转化为清晰可行的见解。适用于:(1) 您……"}
★ 198 📥 65,081
data-analysis

Stock Analysis

udiedrichsen
{"answer":"基于雅虎财经数据,分析股票与加密货币。支持投资组合管理、自选股预警、股息分析、8维评分、热门趋势扫描及传闻/早期信号探测。适用于股票分析、持仓追踪、财报异动、加密监控、热门股追踪或提前发掘非主流传闻。"}
★ 270 📥 56,950