PGIS Manus Skill

February 25, 2026 ยท View on GitHub

Performance Glycemic Intelligence System - An integrated decision-support framework for optimizing endurance training while managing Type 2 diabetes.

๐Ÿ“ฃ Announcement

Read the full story behind PGIS: From Patient Data to Open Source: Why I Built the Performance Glycemic Intelligence System (PGIS)

This post explores the intersection of medicine, technology, and personal health, and explains why PGIS was released as an open-source project for physicians who code and individuals managing Type 2 diabetes.

โš ๏ธ IMPORTANT: Privacy & Data Safety

This repository contains TEMPLATE files only. Before using this system:

  1. DO NOT commit personal health data to any public repository
  2. Customize the template files with your own baselines (see Setup section)
  3. Keep your personalized versions private - add them to .gitignore
  4. Never share screenshots containing your CGM data, names, or identifiable information

Overview

PGIS combines multiple data streams to make intelligent training decisions:

  • Metabolic data: CGM readings, fasting glucose, glucose trends
  • Cardiac data: Heart rate, HRV, resting heart rate
  • Recovery data: Sleep duration/quality, Body Battery, DOMS
  • Training load: Recent workout history, strength sessions

The system uses a traffic light model (GREEN/YELLOW/RED) to gate daily training decisions, preventing overtraining, hypoglycemia, and injury while optimizing metabolic adaptation.

Features

  • Daily Readiness Assessments: Morning reports with training recommendations
  • Training Prescriptions: HR-based workout plans with fueling strategies
  • Post-Workout Analysis: Performance reviews with optimization recommendations
  • Audio Summaries: Podcast-style briefings using OpenAI TTS
  • Visual Reports: Clinical performance audit presentations and infographics

Prerequisites

  • Python 3.8+
  • OpenAI API key (for audio generation)
  • Continuous Glucose Monitor (CGM) - e.g., Dexcom
  • Fitness tracker with HRV/HR/sleep tracking - e.g., Garmin

Installation

1. Clone the Repository

git clone https://github.com/YOUR_USERNAME/pgis-manus-skill.git
cd pgis-manus-skill

2. Install Dependencies

pip install openai

3. Set Up OpenAI API Key

# Linux/Mac
export OPENAI_API_KEY='your-api-key-here'

# Windows PowerShell
$env:OPENAI_API_KEY='your-api-key-here'

For persistent setup, add to your shell profile or environment variables.

Configuration

1. Create Your Personal Profile

CRITICAL: Do not edit the template files directly. Create your own private copy:

# Create a private profile (add to .gitignore)
cp references/user_profile.md references/my_profile.md

Edit references/my_profile.md with your personal information:

  • Age, sex, dietary preferences
  • HRV baseline (track for 2 weeks to establish)
  • Resting HR baseline (your typical morning RHR)
  • Primary aerobic HR zone (calculate using MAF formula: 180 - age)
  • Sleep requirements
  • Training goals

2. Customize Python Scripts

Update the baseline values in scripts/readiness_calculator.py:

from readiness_calculator import Baselines, ReadinessCalculator

# Create custom baselines
my_baselines = Baselines(
    hrv_baseline=YOUR_HRV,      # Your typical HRV
    rhr_baseline=YOUR_RHR,      # Your typical RHR
)

calculator = ReadinessCalculator(baselines=my_baselines)

3. Set Up Output Directory

mkdir -p pgis_reports
# This directory is already in .gitignore

Usage

Daily Readiness Assessment

from scripts.readiness_calculator import ReadinessCalculator, Metrics, Baselines

# Initialize with your baselines
my_baselines = Baselines(hrv_baseline=YOUR_HRV, rhr_baseline=YOUR_RHR)
calculator = ReadinessCalculator(baselines=my_baselines)

# Input today's metrics
metrics = Metrics(
    hrv=29.0,
    rhr=59.0,
    sleep_hours=7.5,
    fasting_glucose=93.0,
    doms=2,
    body_battery=77,
    cgm_trend="โ†’",
    illness_signs=False,
    recent_strength=False,
    training_load_48h="low"
)

# Calculate readiness
status, red_flags, yellow_flags = calculator.calculate(metrics)

# Generate report
report = calculator.format_report(metrics)
print(report)

Generate Audio Summary

from scripts.audio_summary_generator import AudioSummaryGenerator

generator = AudioSummaryGenerator()

audio_path = generator.generate_daily_readiness_audio(
    status="GREEN",
    metrics={
        'hrv': 29.0,
        'rhr': 59,
        'sleep_hours': 7.5,
        'fasting_glucose': 93,
        'cgm_trend': 'stable',
        'body_battery': 77,
        'doms': 2,
        'recent_strength': False
    },
    output_path="pgis_reports/20260225-daily_readiness.mp3"
)

Project Structure

pgis-manus-skill/
โ”œโ”€โ”€ README.md                           # This file
โ”œโ”€โ”€ .gitignore                          # Prevents committing personal data
โ”œโ”€โ”€ SKILL.md                            # Complete skill documentation
โ”œโ”€โ”€ references/
โ”‚   โ”œโ”€โ”€ user_profile.md                 # TEMPLATE - Do not edit directly
โ”‚   โ”œโ”€โ”€ readiness_algorithm.md          # Decision logic
โ”‚   โ””โ”€โ”€ visual_style_guide.md           # Design specifications
โ”œโ”€โ”€ scripts/
โ”‚   โ”œโ”€โ”€ readiness_calculator.py         # Core readiness logic
โ”‚   โ””โ”€โ”€ audio_summary_generator.py      # TTS audio generation
โ”œโ”€โ”€ templates/
โ”‚   โ”œโ”€โ”€ slide_template.md               # Presentation structure
โ”‚   โ””โ”€โ”€ example_infographic.png         # Visual reference
โ””โ”€โ”€ pgis_reports/                       # Your outputs (gitignored)

Readiness Status Guide

๐ŸŸข GREEN (Full Training Clearance)

  • All metrics within 10% of baseline
  • Sleep โ‰ฅ7 hrs, glucose stable
  • Proceed with planned training

๐ŸŸก YELLOW (Modified Training)

  • Metrics 10-15% off baseline
  • Sleep 6-7 hrs
  • Reduce intensity and duration, avoid fasted training

๐Ÿ”ด RED (Rest/Recovery Day)

  • Metrics >15% off baseline
  • Sleep <6 hrs, glucose unstable
  • Complete rest, focus on recovery

Safety Protocols

Fasted Run Requirements

  • Fasting glucose >85 mg/dL
  • CGM trend stable or upward (โ†’ or โ†‘)
  • GREEN readiness status
  • Carry glucose (minimum 30g fast-acting)
  • Check CGM every 10-15 minutes
  • Abort if glucose <70 mg/dL

Post-Strength Hypoglycemia Prevention

After strength sessions:

  • Bedtime fueling: 20-30g complex carbs + 10-15g protein
  • Set CGM low alert to 75 mg/dL
  • Keep fast-acting glucose at bedside
  • Monitor overnight

Privacy Best Practices

  1. Never commit personal health data:

    • Add your custom profile to .gitignore
    • Keep pgis_reports/ directory private
    • Don't share screenshots with identifiable info
  2. Use environment variables for sensitive data:

    • API keys
    • Personal names/identifiers
  3. Fork privately if you want version control:

    • Create a private fork on GitHub
    • Keep your customizations there

Contributing

If you'd like to contribute improvements to the TEMPLATE system (not personal customizations):

  1. Fork the repository
  2. Create a feature branch
  3. Ensure no personal data is included
  4. Submit a pull request

Do not submit:

  • Personal health data
  • Specific baselines or thresholds
  • Screenshots with identifiable information

License

MIT License - See LICENSE file for details

Disclaimer

This system is for informational and educational purposes only. It is not medical advice and should not replace consultation with healthcare professionals. Always consult with your physician before making changes to diabetes management or exercise routines.

Acknowledgments

This system is designed for endurance athletes managing Type 2 diabetes, emphasizing:

  • Durability and longevity over speed
  • Metabolic stability and autonomic balance
  • Data-driven, algorithm-based decisions
  • Long-term health over short-term performance

Support

For issues with the template system (not personal health questions):

  • Open an issue on GitHub
  • Check existing documentation in SKILL.md

Remember: Keep your personal health data private. This is a tool to help you make informed training decisions, not a substitute for medical care.