Skill: shiv19/clawd-coach (version 1.0.0)

--- name: coach description: Create personalized triathlon, marathon, and ultra-endurance training plans. Use when athletes ask for training plans, workout schedules, race preparation, or coaching advice. Can sync with Strava to analyze training history, or work from manually provided fitness data. Generates periodized plans with sport-specific workouts, zones, and race-day strategies. --- # Claude Coach: Endurance Training Plan Skill You are an expert endurance coach specializing in triathlon, marathon, and ultra-endurance events. Your role is to create personalized, progressive training plans that rival those from professional coaches on TrainingPeaks or similar platforms. ## Initial Setup (First-Time Users) Before creating a training plan, you need to understand the athlete's current fitness. There are two ways to gather this information: ### Step 1: Check for Existing Strava Data First, check if the user has already synced their Strava data: ```bash ls ~/.claude-coach/coach.db ``` If the database exists, skip to "Database Access" to query their training history. ### Step 2: Ask How They Want to Provide Data If no database exists, use **AskUserQuestion** to let the athlete choose: ``` questions: - question: "How would you like to provide your training data?" header: "Data Source" options: - label: "Connect to Strava (Recommended)" description: "Copy tokens from strava.com/settings/api - I'll analyze your training history" - label: "Enter manually" description: "Tell me about your fitness - no Strava account needed" ``` --- ## Option A: Strava Integration If they choose Strava, first check if database already exists: ```bash ls ~/.claude-coach/coach.db ``` **If the database exists:** Skip to "Database Access" to query their training history. **If no database exists:** Guide the user through Strava authorization. ### Step 1: Get Strava API Credentials Use **AskUserQuestion** to get credentials: ``` questions: - question: "Go to strava.com/settings/api - what is your Client ID?" header: "Client ID" options: - label: "I have my Client ID" description: "Enter the numeric Client ID via 'Other'" - label: "I need to create an app first" description: "Click 'Create an app', set callback domain to 'localhost'" ``` Then ask for the secret: ``` questions: - question: "Now enter your Client Secret from the same page" header: "Client Secret" options: - label: "I have my Client Secret" description: "Enter the secret via 'Other'" ``` ### Step 2: Generate Authorization URL Run the auth command to generate the OAuth URL: ```bash npx claude-coach auth --client-id=CLIENT_ID --client-[REDACTED_SECRET] ``` This outputs an authorization URL. **Show this URL to the user** and tell them: 1. Open the URL in a browser 2. Click "Authorize" on Strava 3. You'll be redirected to a page that won't load (that's expected!) 4. Copy the **entire URL** from the browser's address bar and paste it back here ### Step 3: Get the Redirect URL Use **AskUserQuestion** to get the URL: ``` questions: - question: "Paste the entire URL from your browser's address bar" header: "Redirect URL" options: - label: "I have the URL" description: "Paste the full URL (starts with http://localhost...) via 'Other'" ``` ### Step 4: Exchange Code and Sync Run these commands to complete authentication and sync (the CLI extracts the code from the URL automatically): ```bash npx claude-coach auth --code="FULL_REDIRECT_URL" npx claude-coach sync --days=730 ``` This will: 1. Exchange the code for access tokens 2. Fetch 2 years of activity history 3. Store everything in `~/.claude-coach/coach.db` ### SQLite Requirements The sync command stores data in a SQLite database. The tool automatically uses the best available option: 1. **Node.js 22.5+**: Uses the built-in `node:sqlite` module (no extra installation needed) 2. **Older Node versions**: Falls back to the `sqlite3` CLI tool ### Refreshing Data To get latest activities before creating a new plan: ```bash npx claude-coach sync ``` This uses cached tokens and only fetches new activities. --- ## Option B: Manual Data Entry If they choose manual entry, gather the following through conversation. Ask naturally, not as a rigid form. ### Required Information **1. Current Training (last 4-8 weeks)** - Weekly hours by sport: "How many hours per week do you typically train? Break it down by swim/bike/run." - Longest recent sessions: "What's your longest ride and run in the past month?" - Consistency: "How many weeks have you been training consistently?" **2. Performance Benchmarks (whatever they know)** - Bike: FTP in watts, or "how long can you hold X watts?" - Run: Threshold pace, or recent race times (5K, 10K, half marathon) - Swim: CSS pace per 100m, or recent time trial result - Heart rate: Max HR and/or lactate threshold HR if known **3. Training Background** - Years in the sport - Previous races: events completed with approximate times - Recent breaks: any time off in the past 6 months? **4. Constraints** - Injuries or health considerations - Schedule limitations (travel, work, family) - Equipment: pool access, smart trainer, etc. ### Creating a Manual Assessment When working from manual data, create an assessment object with the same structure as you would from Strava data: ```json { "assessment": { "foundation": { "raceHistory": ["Based on athlete's stated history"], "peakTrainingLoad": "Estimated from reported weekly hours", "foundationLevel": "beginner|intermediate|advanced", "yearsInSport": 3 }, "currentForm": { "weeklyVolume": { "total": 8, "swim": 1.5, "bike": 4, "run": 2.5 }, "longestSessions": { "swim": 2500, "bike": 60, "run": 15 }, "consistency": "weeks of consistent training" }, "strengths": [{ "sport": "bike", "evidence": "Athlete's self-assessment or race history" }], "limiters": [{ "sport": "swim", "evidence": "Lowest volume or newest to sport" }], "constraints": ["Work travel", "Pool only on weekdays"] } } ``` **Important:** When working from manual data: - Be conservative with volume prescriptions until you understand their true capacity - Ask clarifying questions if something seems inconsistent - Default to slightly easier if uncertain - it's better to underestimate than overtrain - Note in the plan that zones are estimated and should be validated with field tests --- ## Database Access The athlete's training data is stored in SQLite at `~/.claude-coach/coach.db`. Query it using the built-in query command: ```bash npx claude-coach query "YOUR_QUERY" --json ``` This works on any Node.js version (uses built-in SQLite on Node 22.5+, falls back to CLI otherwise). **Key Tables:** - **activities**: All workouts (`id`, `name`, `sport_type`, `start_date`, `moving_time`, `distance`, `average_heartrate`, `suffer_score`, etc.) - **athlete**: Profile (`weight`, `ftp`, `max_heartrate`) - **goals**: Target events (`event_name`, `event_date`, `event_type`, `notes`) --- ## Reference Files Read these files as needed during plan creation: | File | When to Read | Contents | | ------------------------------------ | --------------------------- | -------------------------------------------- | | `skill/reference/queries.md` | First step of assessment | SQL queries for athlete analysis | | `skill/reference/assessment.md` | After running queries | How to interpret data, validate with athlete | | `skill/reference/zones.md` | Before prescribing workouts | Training zones, field testing protocols | | `skill/reference/load-management.md` | When setting volume targets | TSS, CTL/ATL/TSB, weekly load targets | | `skill/reference/periodization.md` | When structuring phases | Macrocycles, recovery, progressive overload | | `skill/reference/workouts.md` | When writing weekly plans | Sport-specific workout library | | `skill/reference/race-day.md` | Final section of plan | Pacing strategy, nutrition | --- ## Workflow Overview ### Phase 0: Setup 1. Ask how athlete wants to provide data (Strava or manual) 2. **If Strava:** Check for existing database, gather credentials if needed, run sync 3. **If Manual:** Gather fitness information through conversation ### Phase 1: Data Gathering **If using Strava:** 1. Read `skill/reference/queries.md` and run the assessment queries 2. Read `skill/reference/assessment.md` to interpret the results **If using manual data:** 1. Ask the questions outlined in "Option B: Manual Data Entry" above 2. Build the assessment object from their responses 3. Read `skill/reference/assessment.md` for context on interpreting fitness levels ### Phase 2: Athlete Validation 3. Present your assessment to the athlete 4. Ask validation questions (injuries, constraints, goals) 5. Adjust based on their feedback ### Phase 3: Zone & Load Setup 6. Read `skill/reference/zones.md` to establish training zones 7. Read `skill/reference/load-management.md` for TSS/CTL targets ### Phase 4: Plan Design 8. Read `skill/reference/periodization.md` for phase structure 9. Read `skill/reference/workouts.md` to build weekly sessions 10. Calculate weeks until event, design phases ### Phase 5: Plan Delivery 11. Read `skill/reference/race-day.md` for race execution section 12. Write the plan as JSON, then render to HTML (see output format below) --- ## Plan Output Format **IMPORTANT: Output the training plan as structured JSON, then render to HTML.** ### Step 1: Write JSON Plan Create a JSON file: `{event-name}-{date}.json` Example: `ironman-703-oceanside-2026-03-29.json` The JSON must follow the TrainingPlan schema. **Inferring Unit Preferences:** Determine the athlete's preferred units from their Strava data and event location: | Indicator | Likely Preference | | -------------------------------------------------- | -------------------------------------------- | | US-based events (Ironman Arizona, Boston Marathon) | Imperial: miles for bike/run, yards for swim | | European/Australian events | Metric: km for bike/run, meters for swim | | Strava activities show distances in miles | Imperial | | Strava activities show distances in km | Metric | | Pool workouts in 25yd/50yd pools | Yards for swim | | Pool workouts in 25m/50m pools | Meters for swim | When in doubt, ask the athlete during validation. Use round distances that make sense in the chosen unit system: - Metric: 5km, 10km, 20km, 40km, 80km (not 8.05km) - Imperial: 3mi, 6mi, 12mi, 25mi, 50mi (not 4.97mi) - Meters: 100m, 200m, 400m, 1000m, 1500m - Yards: 100yd, 200yd, 500yd, 1000yd, 1650yd **Week Scheduling:** Weeks must start on Monday or Sunday. Work backwards from race day to determine `planStartDate`. Here's the structure: ```json { "version": "1.0", "meta": { "id": "unique-plan-id", "athlete": "Athlete Name", "event": "Ironman 70.3 Oceanside", "eventDate": "2026-03-29", "planStartDate": "2025-11-03", "planEndDate": "2026-03-29", "createdAt": "2025-01-01T00:00:00Z", "updatedAt": "2025-01-01T00:00:00Z", "totalWeeks": 21, "generatedBy": "Claude Coach" }, "preferences": { "swim": "meters", "bike": "kilometers", "run": "kilometers", "firstDayOfWeek": "monday" }, "assessment": { "foundation": { "raceHistory": ["Ironman 2024", "3x 70.3"], "peakTrainingLoad": 14, "foundationLevel": "advanced", "yearsInSport": 5 }, "currentForm": { "weeklyVolume": { "total": 8, "swim": 1.5, "bike": 4, "run": 2.5 }, "longestSessions": { "swim": 3000, "bike": 80, "run": 18 }, "consistency": 5 }, "strengths": [{ "sport": "bike", "evidence": "Highest relative suffer score" }], "limiters": [{ "sport": "swim", "evidence": "Lowest weekly volume" }], "constraints": ["Work travel 2x/month", "Pool access only weekdays"] }, "zones": { "run": { "hr": { "lthr": 165, "zones": [ { "zone": 1, "name": "Recovery", "percentLow": 0, "percentHigh": 81, "hrLow": 0, "hrHigh": 134 }, { "zone": 2, "name": "Aerobic", "percentLow": 81, "percentHigh": 89, "hrLow": 134, "hrHigh": 147 } ] } }, "bike": { "power": { "ftp": 250, "zones": [ { "zone": 1, "name": "Active Recovery", "percentLow": 0, "percentHigh": 55, "wattsLow": 0, "wattsHigh": 137 } ] } }, "swim": { "css": "1:45/100m", "cssSeconds": 105, "zones": [{ "zone": 1, "name": "Recovery", "paceOffset": 15, "pace": "2:00/100m" }] } }, "phases": [ { "name": "Base", "startWeek": 1, "endWeek": 6, "focus": "Aerobic foundation", "weeklyHoursRange": { "low": 8, "high": 10 }, "keyWorkouts": ["Long ride", "Long run"], "physiologicalGoals": ["Improve fat oxidation", "Build aerobic base"] } ], "weeks": [ { "weekNumber": 1, "startDate": "2025-11-03", "endDate": "2025-11-09", "phase": "Base", "focus": "Establish routine", "targetHours": 8, "isRecoveryWeek": false, "days": [ { "date": "2025-11-03", "dayOfWeek": "Monday", "workouts": [ { "id": "w1-mon-rest", "sport": "rest", "type": "rest", "name": "Rest Day", "description": "Full recovery", "completed": false } ] }, { "date": "2025-11-04", "dayOfWeek": "Tuesday", "workouts": [ { "id": "w1-tue-swim", "sport": "swim", "type": "technique", "name": "Technique + Aerobic", "description": "Focus on catch mechanics with aerobic base", "durationMinutes": 45, "distanceMeters": 2000, "primaryZone": "Zone 2", "humanReadable": "Warm-up: 300m easy\nMain: 6x100m drill/swim, 800m pull\nCool-down: 200m easy", "completed": false } ] } ], "summary": { "totalHours": 8, "bySport": { "swim": { "sessions": 2, "hours": 1.5, "km": 5 }, "bike": { "sessions": 2, "hours": 4, "km": 100 }, "run": { "sessions": 3, "hours": 2.5, "km": 25 } } } } ], "raceStrategy": { "event": { "name": "Ironman 70.3 Oceanside", "date": "2026-03-29", "type": "70.3", "distances": { "swim": 1900, "bike": 90, "run": 21.1 } }, "pacing": { "swim": { "target": "1:50/100m", "notes": "Start conservative" }, "bike": { "targetPower": "180-190W", "targetHR": "<145", "notes": "Negative split" }, "run": { "targetPace": "5:15-5:30/km", "targetHR": "<155", "notes": "Walk aid stations" } }, "nutrition": { "preRace": "3 hours before: 100g carbs, low fiber", "during": { "carbsPerHour": 80, "fluidPerHour": "750ml", "products": ["Maurten 320", "Maurten Gel 100"] }, "notes": "Test this in training" }, "taper": { "startDate": "2026-03-15", "volumeReduction": 50, "notes": "Maintain intensity, reduce volume" } } } ``` ### Step 2: Render to HTML After writing the JSON file, render it to an interactive HTML viewer: ```bash npx claude-coach render plan.json --output plan.html ``` This creates a beautiful, interactive training plan with: - Calendar view with color-coded workouts by sport - Click workouts to see full details - Mark workouts as complete (saved to localStorage) - Week summaries with hours by sport - Dark mode, mobile responsive ### Step 3: Tell the User After both files are created, tell the user: 1. The JSON file path (for data) 2. The HTML file path (for viewing) 3. Suggest opening the HTML file in a browser --- ## Key Coaching Principles 1. **Consistency over heroics**: Regular moderate training beats occasional big efforts 2. **Easy days easy, hard days hard**: Don't let quality sessions become junk miles 3. **Respect recovery**: Fitness is built during rest, not during workouts 4. **Progress the limiter**: Allocate more time to weaknesses while maintaining strengths 5. **Specificity increases over time**: Early training is general; late training mimics race demands 6. **Taper adequately**: Most athletes under-taper; trust the fitness you've built 7. **Practice nutrition**: Long sessions should include race-day fueling practice 8. **Include strength training**: 1-2 sessions/week for injury prevention and power (see workouts.md) 9. **Use doubles strategically**: AM/PM splits allow more volume without longer sessions (e.g., AM swim + PM run) 10. **Never schedule same sport back-to-back**: Avoid swim Mon + swim Tue, or run Thu + run Fri—spread each sport across the week --- ## Critical Reminders - **Never skip athlete validation** - Present your assessment and get confirmation before writing the plan - **Distinguish foundation from form** - An Ironman finisher who took 3 months off is NOT the same as a beginner - **Zones must be established** before prescribing specific workouts - **Output JSON, then render HTML** - Write the plan as `.json`, then use `npx claude-coach render` to create the HTML viewer - **Explain the "why"** - Athletes trust and follow plans they understand - **Be conservative with manual data** - When working without Strava, err on the side of caution with volume and intensity - **Recommend field tests** - For manual data athletes, include zone validation workouts in the first 1-2 weeks

path: reference/periodization.md
content: # Periodization & Progressive Overload

## Macrocycle Structure

Divide the training period into phases:

### 1. Base Phase (40-50% of available time)

- Build aerobic capacity
- Increase volume gradually (max 10% per week)
- Mostly Zone 2 (conversational pace)
- Focus on technique, especially in swimming

### 2. Build Phase (30-40% of available time)

- Introduce intensity (tempo, threshold work)
- Sport-specific workouts
- Race-simulation sessions (brick workouts for tri)
- Peak volume weeks occur here

### 3. Peak/Race-Specific Phase (10-15% of available time)

- Reduce volume, maintain intensity
- Race-pace work
- Course-specific preparation (hills, open water)

### 4. Taper (1-3 weeks depending on event)

- Significant volume reduction (40-60%)
- Maintain some intensity
- Focus on rest, nutrition, mental prep

---

## Microcycle Structure (Weekly)

### Principles (more important than specific days)

1. **Separate hard days** - 48hr between quality sessions in the same sport
2. **No same sport back-to-back** - Spread swim/bike/run across the week (no swim Mon + swim Tue)
3. **Respect long session recovery** - Easy day after long rides/runs
4. **Consistent weekly structure** - Same sports on same days each week helps athletes plan
5. **Include doubles strategically** - AM/PM splits for time efficiency or brick practice

### Sample Week Templates

**Template A: Traditional (Mon rest)**
| Day | Session 1 | Session 2 |
|-----|-----------|-----------|
| Mon | Rest | - |
| Tue | Swim (quality) | - |
| Wed | Bike (easy) | Strength |
| Thu | Run (quality) | - |
| Fri | Swim (easy) | - |
| Sat | Bike (long) | Run (brick, easy) |
| Sun | Run (long) | - |

**Template B: Weekend Warrior (busy weekdays)**
| Day | Session 1 | Session 2 |
|-----|-----------|-----------|
| Mon | Rest | - |
| Tue | Swim (AM, 45min) | Run (PM, easy) |
| Wed | Bike (trainer, 60min) | - |
| Thu | Swim (AM, 45min) | Strength (PM) |
| Fri | Rest | - |
| Sat | Bike (long, outdoor) | - |
| Sun | Run (long) | Swim (easy, PM) |

**Template C: 70.3 Build Phase**
| Day | Session 1 | Session 2 |
|-----|-----------|-----------|
| Mon | Easy swim or rest | - |
| Tue | Bike (sweet spot) | - |
| Wed | Run (tempo) | Strength |
| Thu | Swim (threshold) | - |
| Fri | Rest or easy spin | - |
| Sat | Bike (long) | Run (brick) |
| Sun | Run (long) | - |

### Avoid These Patterns

- ❌ Same sport on consecutive days (swim Mon + swim Tue, run Thu + run Fri)
- ❌ Quality run day after long ride (insufficient recovery)
- ❌ Two threshold sessions in same sport within 48hr
- ❌ Long sessions back-to-back without one being easy

---

## Progressive Overload

**The 10% Rule**: Increase weekly volume by no more than 10% per week—**for athletes building new fitness**.

### Adjust Progression Based on Athletic Foundation

| Foundation Level             | Progression Rate        | Rationale                            |
| ---------------------------- | ----------------------- | ------------------------------------ |
| True beginner                | 5-10% per week          | Everything is new; high injury risk  |
| Some experience (1-2 years)  | 10% per week            | Standard progression                 |
| Strong foundation, returning | 10-15% per week         | Body remembers; rebuilding is faster |
| Recent high fitness          | Maintain or small build | Already fit; focus on specificity    |

**Example**: An Ironman finisher who took 3 months off can progress faster than a beginner. Their muscles, tendons, and cardiovascular system have adapted before. Where a beginner might take 20 weeks to reach 10-hour training weeks, someone rebuilding might get there in 10-12 weeks.

**However**: Always validate with the athlete. Time off due to injury requires more caution than time off due to life circumstances.

### 3:1 or 4:1 Loading

- 3 weeks building load, 1 week recovery (reduce volume 30-40%)
- Or 2 weeks building, 1 week recovery for older/injury-prone athletes
- Athletes rebuilding can often handle 3:1; beginners may need 2:1

### Long Session Progression

For a target marathon (42km), build the long run over 12-16 weeks:

```
Week 1:  16km
Week 2:  18km
Week 3:  20km
Week 4:  14km (recovery)
Week 5:  20km
Week 6:  22km
Week 7:  24km
Week 8:  16km (recovery)
...continue to 32-35km peak
```

Never increase the long session by more than 2-3km (running) or 15-20km (cycling) per week.

---

## Event-Specific Training Requirements

### Full Ironman (140.6)

**Minimum training time**: 12-15 hours/week at peak
**Minimum build time**: 24-30 weeks from solid base

**Weekly structure at peak**:

- Swim: 3x per week, 8-12km total
- Bike: 3x per week, 250-350km total, one ride of 150-180km
- Run: 3-4x per week, 50-70km total, one run of 28-32km

**Key workouts**:

- 5-6 hour bike followed by 30-60min run (brick)
- Long swim of 3500-4000m continuous
- Back-to-back long sessions on weekends

### 70.3 / Half Ironman

**Minimum training time**: 8-12 hours/week at peak
**Minimum build time**: 16-20 weeks from solid base

**Weekly structure at peak**:

- Swim: 2-3x per week, 6-8km total
- Bike: 2-3x per week, 150-200km total, one ride of 80-100km
- Run: 3x per week, 35-50km total, one run of 18-22km

### Marathon

**Minimum training time**: 6-10 hours/week at peak
**Minimum build time**: 16-20 weeks

**Weekly structure at peak**:

- 5-6 running days
- 60-90km per week for experienced runners
- One long run (28-35km)
- One quality session (tempo or intervals)
- One medium-long run (18-22km)
- Remaining runs easy

---

## Physiological Adaptations: The "Why"

### Why Easy Training Works (Zone 2)

| Adaptation                      | Timeline   | Mechanism                                    |
| ------------------------------- | ---------- | -------------------------------------------- |
| Increased mitochondrial density | 4-8 weeks  | More cellular powerhouses for aerobic energy |
| Capillarization                 | 6-12 weeks | More blood vessels deliver oxygen to muscles |
| Improved fat oxidation          | 4-6 weeks  | Shifts fuel use from glycogen to fat         |
| Increased stroke volume         | 8-12 weeks | Heart pumps more blood per beat              |
| Type I fiber development        | Ongoing    | Slow-twitch fibers become more efficient     |

Zone 2 is the foundation—never sacrifice it for more intensity.

### Why Threshold Training Works (Zone 4)

| Adaptation                | Timeline  | Mechanism                                           |
| ------------------------- | --------- | --------------------------------------------------- |
| Lactate clearance         | 2-4 weeks | Muscles better at processing lactate                |
| Raised lactate threshold  | 4-8 weeks | Sustain higher intensity before lactate accumulates |
| Improved muscle buffering | 3-6 weeks | Tolerate higher lactate levels                      |
| Mental toughness          | Immediate | Learn to sustain "comfortably hard"                 |

### Why VO2max Intervals Work (Zone 5b)

| Adaptation                | Timeline   | Mechanism                          |
| ------------------------- | ---------- | ---------------------------------- |
| Increased VO2max          | 4-8 weeks  | Maximum oxygen uptake improves     |
| Cardiac output            | 6-12 weeks | Heart pumps more blood per minute  |
| Neuromuscular recruitment | 2-4 weeks  | Better coordination at high speeds |

Use sparingly—1x/week max, requires 48-72hr recovery.

### Adaptation Timelines Summary

| System                       | Time to See Changes | Time to Optimize |
| ---------------------------- | ------------------- | ---------------- |
| Neuromuscular (coordination) | 1-2 weeks           | 4-6 weeks        |
| Lactate clearance            | 2-4 weeks           | 6-8 weeks        |
| Aerobic enzymes              | 3-4 weeks           | 8-12 weeks       |
| Mitochondrial density        | 4-6 weeks           | 12-16 weeks      |
| Capillarization              | 6-8 weeks           | 16-24 weeks      |
| Cardiac adaptations          | 8-12 weeks          | 24+ weeks        |
| Bone/tendon strength         | 12-24 weeks         | 1-2 years        |

**Implication**: Base phases should be longer than athletes want. Intensity phases should be shorter. The deepest adaptations take months—there are no shortcuts.


path: reference/workouts.md
content: # Sport-Specific Workout Library

## Swimming

### Workout Types

| Session Type      | Structure                          | Zone | When to Use              |
| ----------------- | ---------------------------------- | ---- | ------------------------ |
| Technique         | 6-8 x 50m drill/swim, 15s rest     | 1-2  | Every session warm-up    |
| Aerobic Endurance | 3-5 x 400m @ CSS+10s, 20s rest     | 2    | Base phase, 1-2x/week    |
| Threshold         | 8-12 x 100m @ CSS, 10-15s rest     | 4    | Build phase, 1x/week     |
| VO2max            | 6-8 x 100m @ CSS-5s, 20-30s rest   | 5    | Peak phase, 1x/week      |
| Race-Specific     | 1-2 x race distance @ goal pace    | 3-4  | Every 2-3 weeks in build |
| Open Water        | Continuous swim, sighting practice | 2-3  | Monthly if racing OW     |

### Sample Sessions (2500m total)

**Aerobic Endurance:**

```
Warm-up: 300m easy, 4x50m drill (catch-up, fingertip drag)
Main: 5 x 400m @ CSS+8sec/100m, 20s rest
Cool-down: 200m easy pull
```

**Threshold Development:**

```
Warm-up: 400m easy, 4x50m build
Pre-main: 4 x 100m descend 1-4
Main: 3 x (4 x 100m @ CSS, 10s rest), 60s between sets
Cool-down: 200m easy
```

**VO2max (advanced):**

```
Warm-up: 300m, 6x50m drill/swim
Main: 8 x 100m @ CSS-5sec, 30s rest
       4 x 50m FAST, 30s rest
Cool-down: 300m easy
```

### Common Limiters & Solutions

| Limiter            | Indicators                       | Prescription                         |
| ------------------ | -------------------------------- | ------------------------------------ |
| Technique          | High stroke count, early fatigue | 30% of swim volume as drills         |
| Aerobic base       | Can't sustain pace beyond 400m   | More Zone 2 continuous swimming      |
| Threshold          | Pace drops sharply in sets       | More CSS-pace work with short rest   |
| Open water anxiety | Pool-only history                | Monthly OW sessions, sighting drills |

---

## Cycling

### Workout Types

| Session Type | Structure                                    | Zone/Power   | When to Use                    |
| ------------ | -------------------------------------------- | ------------ | ------------------------------ |
| Endurance    | 2-5hr steady                                 | 56-75% FTP   | Weekly, base phase emphasis    |
| Tempo        | 2-3 x 20min continuous                       | 76-90% FTP   | Base/build, muscular endurance |
| Sweet Spot   | 2-3 x 20-30min                               | 88-93% FTP   | Build phase, 1-2x/week         |
| Threshold    | 3-4 x 10-12min, 5min rest                    | 95-105% FTP  | Build/peak, 1x/week            |
| VO2max       | 5-6 x 4-5min, 4min rest                      | 106-120% FTP | Peak phase, 1x/week            |
| Over-Unders  | 3 x (8min: 2min @95%, 1min @105%), 5min rest | 4-5a         | Threshold extension            |
| Hill Repeats | 4-6 x 5-8min climb, descent recovery         | 100-110% FTP | Climbing races                 |

### Sample Sessions

**Sweet Spot (Build Phase Staple):**

```
Warm-up: 20min Zone 2, include 2x1min high-cadence
Main: 3 x 25min @ 88-92% FTP, 5min easy between
Cool-down: 15min Zone 1
Total: 2hr, ~80 TSS
```

**VO2max Development:**

```
Warm-up: 20min progressive to Zone 3
Main: 5 x 5min @ 110-115% FTP, 5min @ 50% FTP recovery
Cool-down: 15min easy spin
Total: 1:30, ~90 TSS
```

**Over-Under Threshold:**

```
Warm-up: 20min with 3x30s accelerations
Main: 4 x 9min [(2min @ 95% FTP, 1min @ 108% FTP) x3], 5min rest
Cool-down: 15min Zone 1
Total: 1:45, ~85 TSS
```

### Brick Workouts (Triathlon-Specific)

| Race         | Bike Portion                       | Run Portion          | Purpose                    |
| ------------ | ---------------------------------- | -------------------- | -------------------------- |
| Sprint prep  | 45min w/ 10min @ race effort       | 15min @ race pace    | Transition practice        |
| Olympic prep | 90min w/ 30min @ race effort       | 20-30min @ race pace | Pace calibration           |
| 70.3 prep    | 3hr w/ final hour @ race effort    | 30-45min easy        | Fatigue adaptation         |
| Ironman prep | 4-5hr w/ final 90min @ race effort | 45-60min easy        | Pacing, nutrition practice |

---

## Running

### Workout Types

| Session Type     | Structure               | Pace/Zone                           | When to Use               |
| ---------------- | ----------------------- | ----------------------------------- | ------------------------- |
| Recovery         | 30-45min very easy      | Zone 1, E+30s/km                    | After hard days           |
| Aerobic          | 45-75min steady         | Zone 2, E pace                      | 60-70% of run volume      |
| Long Run         | 90min-3hr               | Zone 2, start easy, finish moderate | Weekly, primary endurance |
| Tempo            | 20-40min continuous     | Zone 4, T pace                      | Build phase, 1x/week      |
| Cruise Intervals | 4-6 x 1mi, 60-90s jog   | T pace                              | Threshold development     |
| VO2max Intervals | 5-6 x 1000m, 400m jog   | I pace                              | Peak phase, 1x/week       |
| Repetitions      | 8-12 x 400m, 400m jog   | R pace                              | Speed, late build/peak    |
| Progression      | Last 25% at faster pace | E → M → T                           | Race simulation           |
| Fartlek          | Unstructured speed play | Varies                              | Mental break, adaptable   |

### Sample Sessions

**Threshold Cruise Intervals:**

```
Warm-up: 15min easy, 4x100m strides
Main: 5 x 1600m @ T pace (LTHR 100%), 90s jog recovery
Cool-down: 10min easy
Total: 75min, moderate-high stress
```

**VO2max Development:**

```
Warm-up: 15min easy, 6x100m strides
Main: 5 x 1000m @ I pace (LTHR 103-106%), 400m jog recovery
Cool-down: 15min easy
Total: 60min, high stress
```

**Marathon-Specific Long Run:**

```
Warm-up: 2km very easy
Main: 24km total
      - First 16km @ E pace (Zone 2)
      - Final 8km @ M pace (Zone 3)
Cool-down: 1km walk/easy jog
Nutrition: Practice race-day fueling every 30-45min
```

**Progression Run (Advanced):**

```
16km total:
- 0-6km: Easy (Zone 2)
- 6-10km: Steady (Zone 2-3)
- 10-14km: Tempo (Zone 4)
- 14-16km: Threshold (Zone 5a)
Great for teaching pace discipline and finishing strong
```

### Long Run Targets by Event

| Event         | Peak Long Run    | Frequency       | Notes                            |
| ------------- | ---------------- | --------------- | -------------------------------- |
| 5K            | 10-12km          | Weekly          | Some quality in long runs OK     |
| 10K           | 14-16km          | Weekly          | Include some tempo               |
| Half Marathon | 18-22km          | Weekly          | 1-2 runs at goal pace            |
| Marathon      | 32-35km          | Every 2-3 weeks | Don't exceed 3.5hr               |
| Ultra (50K)   | 35-45km or 4-5hr | Every 2-3 weeks | Time-based, practice nutrition   |
| Ultra (100K+) | 50-60km or 5-6hr | Monthly         | Back-to-back long runs work well |

---

## Strength Training

Strength work is essential for injury prevention, power development, and late-race durability. Include 1-2 sessions per week.

### Workout Types

| Session Type | Structure                          | When to Use            |
| ------------ | ---------------------------------- | ---------------------- |
| Foundation   | 2-3 sets x 12-15 reps, bodyweight  | Base phase, beginners  |
| Strength     | 3-4 sets x 6-8 reps, moderate load | Build phase, 1-2x/week |
| Power        | 3-4 sets x 4-6 reps, explosive     | Peak phase, 1x/week    |
| Maintenance  | 2 sets x 8-10 reps, light          | Race week, taper       |

### Core Exercises (Every Session)

```
Plank: 3 x 45-60s
Side plank: 2 x 30s each side
Dead bug: 2 x 12 each side
Bird dog: 2 x 10 each side
```

### Triathlete-Specific Exercises

| Focus        | Exercises                                    | Why                               |
| ------------ | -------------------------------------------- | --------------------------------- |
| Swim power   | Lat pulldown, pull-ups, band pull-aparts     | Catch strength, stroke power      |
| Bike power   | Squats, leg press, step-ups, single-leg work | Pedaling force, hill climbing     |
| Run strength | Lunges, Romanian deadlifts, calf raises      | Push-off power, injury prevention |
| Stability    | Single-leg squats, BOSU work, hip circles    | Balance, proprioception           |

### Sample Session (45min)

```
Warm-up: 5min light cardio, dynamic stretches
Circuit 1 (3 rounds):
  - Goblet squats x 10
  - Push-ups x 12
  - Single-leg Romanian deadlift x 8 each
Circuit 2 (3 rounds):
  - Lat pulldown x 10
  - Step-ups x 10 each leg
  - Plank x 45s
Cool-down: 5min stretching
```

### Timing Considerations

- **Before endurance**: Light activation only (bands, bodyweight)
- **After easy sessions**: Full strength OK
- **Separate from key workouts**: 6+ hours apart, or different days
- **Taper**: Reduce to maintenance (2 sets, lighter weight)

---

## Multiple Workouts Per Day (Doubles)

Doubling up sessions is common in triathlon. Guidelines:

### When to Use Doubles

| Scenario                | Example                    | Notes                        |
| ----------------------- | -------------------------- | ---------------------------- |
| Brick workouts          | Bike → Run                 | Race simulation, transition  |
| Time-efficient training | AM swim + PM run           | Separate by 6+ hours ideally |
| High-volume phases      | Easy swim AM + bike PM     | Keep one session easy        |
| Strength + cardio       | AM strength + PM easy ride | Strength first when fresh    |

### Rules for Doubles

1. **Never two quality sessions on the same day** - One hard, one easy
2. **Separate key sessions** - 6+ hours between, or easy/hard split
3. **Fuel between sessions** - Carbs and protein within 30min of first session
4. **Sleep matters more** - Skip the double if sleep-deprived
5. **Consider weekly load** - Doubles add stress; reduce elsewhere if needed

### Sample Double Days

**Triathlon Build Phase:**

```
AM: 45min technique swim (easy)
PM: 90min bike with sweet spot intervals (quality)
```

**Weekend Long Day:**

```
AM: 3hr long ride (quality)
PM: 30min easy transition run (easy)
```

**Time-Crunched Weekday:**

```
Lunch: 30min strength (moderate)
PM: 60min easy run (easy)
```

---

## Session Intensity Distribution (Polarized Model)

For endurance events, 80% of volume should be easy (Zone 1-2), 20% hard (Zone 4+). Avoid excessive Zone 3 "gray zone" training.

| Zone         | % of Weekly Volume | Purpose                       |
| ------------ | ------------------ | ----------------------------- |
| 1-2 (Easy)   | 75-80%             | Aerobic development, recovery |
| 3 (Moderate) | 5-10%              | Race-specific only            |
| 4-5 (Hard)   | 15-20%             | Stimulus for adaptation       |


path: reference/queries.md
content: # SQL Queries for Athlete Assessment

Run these queries using the claude-coach CLI:

```bash
npx claude-coach query "YOUR_QUERY" --json
```

This works on any Node.js version (uses built-in SQLite on Node 22.5+, falls back to CLI otherwise).

## Current Form (Last 8 Weeks)

```sql
-- Weekly volume by sport
SELECT
  strftime('%Y-W%W', start_date) AS week,
  sport_type,
  COUNT(*) AS sessions,
  ROUND(SUM(moving_time) / 3600.0, 1) AS hours,
  ROUND(SUM(distance) / 1000.0, 1) AS km
FROM activities
WHERE start_date >= date('now', '-8 weeks')
GROUP BY week, sport_type
ORDER BY week DESC, sport_type;

-- Longest recent sessions by sport
SELECT sport_type,
  ROUND(MAX(moving_time) / 3600.0, 1) AS longest_hours,
  ROUND(MAX(distance) / 1000.0, 1) AS longest_km
FROM activities
WHERE start_date >= date('now', '-12 weeks')
GROUP BY sport_type;

-- Average session duration
SELECT sport_type,
  ROUND(AVG(moving_time) / 60.0, 0) AS avg_minutes,
  ROUND(AVG(distance) / 1000.0, 1) AS avg_km,
  COUNT(*) AS total_sessions
FROM activities
WHERE start_date >= date('now', '-8 weeks')
GROUP BY sport_type;

-- Weekly training load trend
SELECT
  strftime('%Y-W%W', start_date) AS week,
  SUM(suffer_score) AS weekly_load,
  ROUND(SUM(moving_time) / 3600.0, 1) AS total_hours
FROM activities
WHERE start_date >= date('now', '-12 weeks')
GROUP BY week
ORDER BY week;
```

## Athletic Foundation (Lifetime / 2 Years)

```sql
-- Race history (workout_type = 1)
SELECT
  strftime('%Y-%m', start_date) AS month,
  name,
  sport_type,
  ROUND(distance / 1000.0, 1) AS km,
  ROUND(moving_time / 3600.0, 1) AS hours
FROM activities
WHERE workout_type = 1
ORDER BY start_date DESC;

-- Lifetime peaks by sport
SELECT sport_type,
  ROUND(MAX(distance) / 1000.0, 1) AS max_km,
  ROUND(MAX(moving_time) / 3600.0, 1) AS max_hours
FROM activities
GROUP BY sport_type;

-- Peak training weeks ever
SELECT
  strftime('%Y-W%W', start_date) AS week,
  ROUND(SUM(moving_time) / 3600.0, 1) AS total_hours,
  COUNT(*) AS sessions
FROM activities
GROUP BY week
ORDER BY total_hours DESC
LIMIT 5;

-- Training history depth
SELECT sport_type,
  MIN(start_date) AS first_activity,
  MAX(start_date) AS last_activity,
  COUNT(*) AS total_activities,
  ROUND(SUM(distance) / 1000.0, 0) AS lifetime_km
FROM activities
GROUP BY sport_type;
```

## Strength Detection

```sql
-- Efficiency: Low suffer_score per minute = strength
SELECT sport_type,
  ROUND(AVG(distance) / 1000.0, 1) AS avg_km,
  ROUND(AVG(moving_time) / 60.0, 0) AS avg_minutes,
  ROUND(AVG(suffer_score), 0) AS avg_suffer,
  ROUND(AVG(suffer_score * 60.0 / moving_time), 2) AS suffer_per_minute,
  ROUND(AVG(average_heartrate), 0) AS avg_hr
FROM activities
WHERE start_date >= date('now', '-6 months')
  AND moving_time > 1800
GROUP BY sport_type
ORDER BY suffer_per_minute ASC;

-- Long sessions at low HR = aerobic strength
SELECT sport_type,
  COUNT(*) AS easy_long_sessions,
  ROUND(AVG(distance) / 1000.0, 1) AS avg_km,
  ROUND(AVG(moving_time) / 60.0, 0) AS avg_minutes,
  ROUND(AVG(average_heartrate), 0) AS avg_hr
FROM activities
WHERE moving_time > 3600
  AND average_heartrate < 145
  AND start_date >= date('now', '-12 months')
GROUP BY sport_type;

-- Last activity by sport (detect dormant skills)
SELECT sport_type,
  MAX(start_date) AS last_session,
  ROUND(julianday('now') - julianday(MAX(start_date)), 0) AS days_ago,
  COUNT(*) AS total_sessions_last_year
FROM activities
WHERE start_date >= date('now', '-1 year')
GROUP BY sport_type
ORDER BY last_session DESC;

-- Historical peaks (last 2 years)
SELECT sport_type,
  ROUND(MAX(distance) / 1000.0, 1) AS peak_km,
  ROUND(MAX(moving_time) / 3600.0, 1) AS peak_hours,
  MAX(start_date) AS when_achieved
FROM activities
WHERE start_date >= date('now', '-2 years')
GROUP BY sport_type;
```

## Schedule Preferences

```sql
-- Preferred days for long rides (>90 min)
-- Day mapping: 0=Sunday, 1=Monday, ..., 6=Saturday
SELECT
  CASE strftime('%w', start_date)
    WHEN '0' THEN 'Sunday'
    WHEN '1' THEN 'Monday'
    WHEN '2' THEN 'Tuesday'
    WHEN '3' THEN 'Wednesday'
    WHEN '4' THEN 'Thursday'
    WHEN '5' THEN 'Friday'
    WHEN '6' THEN 'Saturday'
  END AS day_name,
  COUNT(*) AS long_rides
FROM activities
WHERE sport_type = 'Ride'
  AND moving_time > 5400
GROUP BY strftime('%w', start_date)
ORDER BY long_rides DESC;

-- Preferred days for long runs (>60 min)
SELECT
  CASE strftime('%w', start_date)
    WHEN '0' THEN 'Sunday'
    WHEN '1' THEN 'Monday'
    WHEN '2' THEN 'Tuesday'
    WHEN '3' THEN 'Wednesday'
    WHEN '4' THEN 'Thursday'
    WHEN '5' THEN 'Friday'
    WHEN '6' THEN 'Saturday'
  END AS day_name,
  COUNT(*) AS long_runs
FROM activities
WHERE sport_type IN ('Run', 'Trail Run')
  AND moving_time > 3600
GROUP BY strftime('%w', start_date)
ORDER BY long_runs DESC;

-- Preferred days for swim sessions
SELECT
  CASE strftime('%w', start_date)
    WHEN '0' THEN 'Sunday'
    WHEN '1' THEN 'Monday'
    WHEN '2' THEN 'Tuesday'
    WHEN '3' THEN 'Wednesday'
    WHEN '4' THEN 'Thursday'
    WHEN '5' THEN 'Friday'
    WHEN '6' THEN 'Saturday'
  END AS day_name,
  COUNT(*) AS swim_sessions
FROM activities
WHERE sport_type = 'Swim'
GROUP BY strftime('%w', start_date)
ORDER BY swim_sessions DESC;
```

## HR / Zone Data

```sql
-- Average HR by sport
SELECT
  sport_type,
  ROUND(AVG(average_heartrate), 0) AS avg_hr,
  ROUND(AVG(max_heartrate), 0) AS avg_max_hr,
  COUNT(*) AS sessions
FROM activities
WHERE average_heartrate IS NOT NULL
  AND start_date >= date('now', '-8 weeks')
GROUP BY sport_type;

-- HR distribution for zone estimation
SELECT
  sport_type,
  ROUND(MIN(average_heartrate), 0) AS min_avg_hr,
  ROUND(AVG(average_heartrate), 0) AS mean_avg_hr,
  ROUND(MAX(average_heartrate), 0) AS max_avg_hr,
  ROUND(MAX(max_heartrate), 0) AS highest_max_hr
FROM activities
WHERE average_heartrate IS NOT NULL
  AND start_date >= date('now', '-12 weeks')
GROUP BY sport_type;
```


path: reference/race-day.md
content: # Race Execution & Nutrition Strategy

## Pacing Principles by Event Duration

| Event Duration | Optimal Strategy                                      | Common Mistake            |
| -------------- | ----------------------------------------------------- | ------------------------- |
| < 60 min       | Negative split (second half faster)                   | Starting too fast         |
| 60-90 min      | Even pacing, slight negative                          | Chasing early pace        |
| 2-4 hours      | Even pacing with controlled start                     | Not respecting first hour |
| 4+ hours       | Conservative start, feel-based middle, push final 20% | ANY early intensity debt  |

---

## Triathlon-Specific Pacing

### Swim

- Start conservatively—first 200m sets tone for whole race
- Find feet to draft, but don't sprint to get there
- Save legs by kicking minimally (2-beat kick)
- Target: Slightly slower than pool CSS pace (open water adds 5-10%)

### Bike

- First 30 minutes: 5-10 watts BELOW target (let body warm up)
- Steady power, not steady speed (reduce power on descents, push on climbs)
- Watch Normalized Power, not average power

**Target power for race distance:**
| Race | % of FTP |
|------|----------|
| Sprint | 85-90% |
| Olympic | 80-85% |
| 70.3 | 70-77% |
| Ironman | 65-72% |

### Run off Bike

- First 2km: Accept it will feel terrible
- Build into race pace by 3-4km
- If legs don't come around by 5km, adjust target

---

## Marathon Pacing

| Strategy        | Best For                           | Execution                                        |
| --------------- | ---------------------------------- | ------------------------------------------------ |
| Even splits     | First-timers, conservative goals   | Run every mile at goal pace                      |
| Slight negative | Experienced, controlled starters   | First half at goal+5-10s/km, second half at goal |
| Progressive     | Very experienced, aggressive goals | First 15km easy, 15-30km at goal, 30-42km push   |

**Red flags during marathon:**

- HR 10+ bpm above expected at same pace = slow down NOW
- Quad burn before halfway = too fast early
- GI distress = slow down, focus on hydration

---

## Heart Rate Ceiling for Long Events

| Event        | Max Sustainable HR |
| ------------ | ------------------ |
| Sprint Tri   | 90-95% LTHR        |
| Olympic Tri  | 85-90% LTHR        |
| 70.3         | 80-85% LTHR        |
| Ironman      | 75-82% LTHR        |
| Marathon     | 85-88% LTHR        |
| Ultra (50K+) | 75-80% LTHR        |

_Exceeding these early will result in catastrophic fade later._

---

## Race Nutrition Strategy

### Carbohydrate Intake Guidelines

| Event Duration | Carbs/Hour       | Example                         |
| -------------- | ---------------- | ------------------------------- |
| < 75 min       | 0-30g (optional) | Water or light sports drink     |
| 1-2.5 hours    | 30-60g           | 1 gel + sports drink            |
| 2.5-4 hours    | 60-90g           | 2-3 gels + sports drink         |
| 4+ hours       | 80-120g          | Gels + bars + drink + real food |

**Gut training is essential.** Practice race nutrition in training—start with 30g/hr and build up over 4-6 weeks.

### Hydration Guidelines

| Conditions         | Fluid/Hour | Sodium/Hour |
| ------------------ | ---------- | ----------- |
| Cool (<18°C)       | 400-600ml  | 300-500mg   |
| Moderate (18-25°C) | 600-800ml  | 500-700mg   |
| Hot (>25°C)        | 800-1000ml | 700-1000mg  |

---

## Event-Specific Nutrition Plans

### 70.3 / Half Ironman (4-6 hours)

```
Pre-race: 2-3 hours before: 100-150g carbs (oatmeal, banana, toast)
          30min before: 20-30g (half gel or sports drink)

Swim: Nothing (too short)

Bike (2.5-3hr):
- First 30min: Settle, sip water
- Every 20-30min: 1 gel OR 1/2 bar
- Total: 200-250g carbs, 1.5-2L fluid

Run (1.5-2hr):
- Aid stations: Cola, gel, water at alternating stops
- Total: 60-90g carbs, 0.5-1L fluid
```

### Ironman (9-15 hours)

```
Pre-race: Same as 70.3 but larger breakfast (200g carbs)

Swim: Nothing

Bike (5-7hr):
- Hourly: 80-100g carbs
- Mix: Gels, bars, bananas, sandwiches (variety prevents flavor fatigue)
- Include: Real food after hour 3
- Total: 400-600g carbs, 3-5L fluid

Run (4-7hr):
- Aid stations every 1-2km: Alternate cola/gel with water
- Solid food if stomach tolerates (pretzels, oranges)
- Total: 150-250g carbs, 1.5-3L fluid
```

### Marathon (3-5 hours)

```
Pre-race: 3 hours before: 100-150g carbs
          30min before: Sip sports drink

Race:
- Take gel every 45-60min (start at 45min mark)
- Water at every other aid station
- Total: 90-150g carbs depending on time
```

---

## Caffeine Strategy

| Event Duration | Protocol                                        | Timing                            |
| -------------- | ----------------------------------------------- | --------------------------------- |
| < 2 hours      | 3-6mg/kg 30-60min pre-race                      | Single dose pre-start             |
| 2-5 hours      | 3mg/kg pre-race + 1-2mg/kg during               | Caffeinated gels in back half     |
| 5+ hours       | Low/no caffeine start, save for final 2-3 hours | Caffeinated cola/gels when needed |

**Caution:** Practice caffeine timing in training. Some athletes get GI distress.

---

## Handling Athlete Constraints

When the athlete mentions constraints in their goal notes, adapt accordingly:

- **Travel week**: Reduce volume, provide bodyweight/hotel gym alternatives
- **Injury history**: Avoid aggravating movements, include prehab work
- **Limited pool access**: Substitute open water, dryland swim exercises, or band work
- **Time-crunched**: Prioritize key sessions, use high-intensity low-duration alternatives
- **Family commitments**: Stack long workouts on one weekend day if needed


path: reference/zones.md
content: # Training Zones & Field Testing

Professional coaching requires accurate training zones derived from field tests, not arbitrary percentages of max HR.

## Lactate Threshold Heart Rate (LTHR) Zones

LTHR is the heart rate at lactate threshold—the intensity you could sustain for approximately 60 minutes in a race. It's more accurate than max HR for prescribing training.

### Running LTHR Zones (Friel 7-Zone System)

| Zone | Name          | % of LTHR | Purpose                                | Feel                               |
| ---- | ------------- | --------- | -------------------------------------- | ---------------------------------- |
| 1    | Recovery      | < 81%     | Active recovery, warm-up/cool-down     | Very easy, could talk indefinitely |
| 2    | Aerobic       | 81-89%    | Aerobic base building, fat oxidation   | Easy, full conversations           |
| 3    | Tempo         | 90-93%    | Muscular endurance, aerobic capacity   | Moderate, sentences only           |
| 4    | Sub-threshold | 94-99%    | Lactate tolerance, threshold extension | Hard, few words at a time          |
| 5a   | Threshold     | 100-102%  | Lactate threshold improvement          | Very hard, race effort for 60min   |
| 5b   | VO2max        | 103-106%  | VO2max development                     | Extremely hard, 3-8min max         |
| 5c   | Anaerobic     | > 106%    | Neuromuscular power, speed             | Max effort, < 3min                 |

### Cycling LTHR/Power Zones

| Zone | Name          | % of LTHR | % of FTP | Purpose             |
| ---- | ------------- | --------- | -------- | ------------------- |
| 1    | Recovery      | < 81%     | < 55%    | Active recovery     |
| 2    | Aerobic       | 81-89%    | 56-75%   | Endurance base      |
| 3    | Tempo         | 90-93%    | 76-90%   | Muscular endurance  |
| 4    | Sub-threshold | 94-99%    | 91-99%   | Threshold extension |
| 5a   | Threshold     | 100-102%  | 100-105% | FTP improvement     |
| 5b   | VO2max        | 103-106%  | 106-120% | VO2max intervals    |
| 5c   | Anaerobic     | > 106%    | > 120%   | Neuromuscular power |

### Swimming Zones (CSS-based)

| Zone | Name      | Pace Relative to CSS | Purpose               |
| ---- | --------- | -------------------- | --------------------- |
| 1    | Recovery  | CSS + 15-20 sec/100m | Warm-up, cool-down    |
| 2    | Aerobic   | CSS + 8-12 sec/100m  | Aerobic endurance     |
| 3    | Tempo     | CSS + 3-6 sec/100m   | Lactate tolerance     |
| 4    | Threshold | CSS pace             | Threshold development |
| 5    | VO2max    | CSS - 3-5 sec/100m   | VO2max intervals      |

---

## Field Testing Protocols

### Run: 30-Minute Threshold Test

1. Warm up 15 minutes easy (Zone 1-2)
2. Run 30 minutes at the hardest sustainable pace (simulate race effort)
3. Record average HR for the entire 30 minutes = LTHR
4. Cool down 10 minutes easy
5. Average pace = approximate lactate threshold pace

_Note: Some coaches use final 20 minutes of a 30-min test to exclude early pacing errors._

### Bike: 20-Minute FTP Test

1. Warm up 20 minutes including 3x1min high-cadence spin-ups
2. Ride 20 minutes at maximum sustainable power
3. Average power × 0.95 = FTP
4. Average HR = approximate cycling LTHR
5. Cool down 10-15 minutes

_Alternative: 2x8 minute test with 10min recovery; average power × 0.90 = FTP_

### Swim: Critical Swim Speed (CSS) Test

1. Warm up 400m easy with drills
2. Swim 400m time trial (all-out, record time)
3. Rest 10 minutes (active recovery)
4. Swim 200m time trial (all-out, record time)
5. CSS = (400m distance - 200m distance) / (400m time - 200m time)

_Example: 400m in 6:40 (400 sec), 200m in 3:00 (180 sec)_
_CSS = 200m / 220 sec = 0.909 m/sec = 1:50/100m_

### When to Retest

- Every 6-8 weeks during base/build phases
- After recovery weeks (when fresh)
- If perceived effort no longer matches prescribed zones

---

## Running Pace Zones (VDOT / Jack Daniels)

For athletes with known race times:

| Zone | Name       | Description                  | How to Determine                                  |
| ---- | ---------- | ---------------------------- | ------------------------------------------------- |
| E    | Easy       | Daily running, long runs     | 59-74% VO2max; 1:00-1:30/km slower than threshold |
| M    | Marathon   | Marathon race pace           | 75-84% VO2max; sustainable for 2-4 hours          |
| T    | Threshold  | Tempo runs, cruise intervals | 83-88% VO2max; ~60min race pace                   |
| I    | Interval   | VO2max development           | 95-100% VO2max; 3-5min repeats                    |
| R    | Repetition | Speed, neuromuscular         | > 100% VO2max; short reps with full recovery      |

**Pace Estimation from Threshold:**

- Easy pace: Threshold + 50-70 sec/km
- Marathon pace: Threshold + 15-25 sec/km
- Interval pace: Threshold - 15-20 sec/km
- Repetition pace: Threshold - 25-35 sec/km

---

## Power-Based Training (Cycling)

When power data is available, use power zones exclusively—they're more accurate than HR which lags and drifts.

| Workout Type | Zone             | Duration             | Recovery | Weekly Frequency |
| ------------ | ---------------- | -------------------- | -------- | ---------------- |
| Endurance    | 2                | 1-5 hours            | N/A      | 2-4x             |
| Tempo        | 3                | 20-60 min continuous | N/A      | 1-2x             |
| Sweet Spot   | 3-4 (88-93% FTP) | 2x20-30 min          | 5-10 min | 1-2x             |
| Threshold    | 5a               | 2-4 x 8-15 min       | 5-8 min  | 1x               |
| VO2max       | 5b               | 4-6 x 3-5 min        | 3-5 min  | 1x               |
| Anaerobic    | 5c               | 6-10 x 30sec-2min    | 2-4 min  | 0-1x             |


path: reference/assessment.md
content: # Athlete Assessment Guide

## Foundation vs Current Form

These are two different things:

| Dimension               | Timeframe           | What It Tells You                                                 |
| ----------------------- | ------------------- | ----------------------------------------------------------------- |
| **Athletic Foundation** | Lifetime / 2+ years | What the athlete is capable of; training history; race experience |
| **Current Form**        | Last 8-12 weeks     | Where they are RIGHT NOW; starting point for the plan             |

**Why this matters**: An athlete who completed an Ironman last year but has barely trained in 10 weeks is NOT the same as a beginner. They have:

- Muscle memory and movement efficiency
- Mental toughness and race experience
- Knowledge of pacing, nutrition, transitions
- A body that has adapted to high training loads before

Their plan should focus on **rebuilding** (faster progression possible) rather than **building from scratch** (conservative progression required).

## Interpreting Foundation vs Form

| Scenario                       | Foundation  | Current Form | Plan Approach                                      |
| ------------------------------ | ----------- | ------------ | -------------------------------------------------- |
| Ironman finisher, 10 weeks off | Very strong | Low          | Rebuild: faster progression OK, body remembers     |
| First-time triathlete          | None        | Moderate     | Build: conservative progression, everything is new |
| Marathoner doing first tri     | Strong run  | Moderate     | Build swim/bike carefully, leverage run strength   |
| Consistent trainer, no races   | Moderate    | Strong       | Peak: maintain and sharpen, add race specificity   |

## Interpreting Strength Signals

| Signal                              | Interpretation                       |
| ----------------------------------- | ------------------------------------ |
| Long sessions at low HR             | Excellent aerobic base in that sport |
| Low suffer_score per minute         | Sport feels easy to them (strength)  |
| High suffer_score per minute        | Sport is hard for them (limiter)     |
| Historical peaks >> recent activity | Dormant fitness, will return quickly |
| No historical data for a sport      | True beginner, needs careful build   |
| Consistent high volume              | Sport they enjoy and prioritize      |

**Limiter identification**: Compare suffer_per_minute and average HR across sports. The sport with highest relative effort for similar durations is the limiter.

## Example Interpretation

_"The athlete's swim data shows 5000m sessions at avg HR 125 with suffer_score of 45. Their runs show 10km at avg HR 165 with suffer_score of 120. Swimming is clearly a strength (low effort, long duration). Running is a limiter (high effort, shorter duration). Even though they haven't swum in 4 months, that fitness will return quickly with a few weeks of swimming. The plan should prioritize run development while maintaining swim fitness with modest volume."_

## Event Requirements Reference

| Event               | Swim  | Bike  | Run  |
| ------------------- | ----- | ----- | ---- |
| Sprint Tri          | 750m  | 20km  | 5km  |
| Olympic Tri         | 1500m | 40km  | 10km |
| 70.3 / Half Ironman | 1900m | 90km  | 21km |
| Full Ironman        | 3800m | 180km | 42km |
| Marathon            | -     | -     | 42km |
| Ultra (50k)         | -     | -     | 50km |

**Gap analysis**: Compare their longest recent/historical sessions against these requirements.

---

## Validating With The Athlete

**IMPORTANT**: Before creating the training plan, always share your assessment and validate it with the athlete.

### What to Ask

1. **Race history / athletic foundation**: _"I see you completed an Ironman in [year] and have [X] years of triathlon history. Does that match your background?"_

2. **Reason for time off**: _"You've had lower training volume recently. Was this due to injury, life circumstances, or something else?"_ (Injury = more conservative; life = faster rebuild OK)

3. **Strengths assessment**: _"Based on your data, swimming appears to be a strength—you've done 5km sessions at low effort. Does that match your perception?"_

4. **Limiter identification**: _"Running shows higher relative effort for shorter distances. Would you say the run is your biggest area for improvement?"_

5. **Dormant fitness**: _"I see you haven't swum in 4 months but had strong swim fitness earlier this year. Do you expect that to come back quickly?"_

6. **Constraints**: _"Any injuries, schedule constraints, upcoming travel, or equipment limitations I should know about?"_

7. **Goals**: _"Do you have a time goal, or is finishing the main focus?"_

8. **Preferences**: _"Are there workouts you love or hate? Sports you'd rather emphasize?"_

9. **Long session scheduling**: _"Which days work best for your long ride and long run? I see from your data you typically do long rides on [day]."_ (Check their historical patterns first—look for rides >2hr and runs >1hr to infer preferred days)

### Inferring Long Session Preferences

Before asking, analyze their Strava data to identify patterns:

```sql
-- Find preferred days for long rides (>90 min)
SELECT
  strftime('%w', start_date) as day_of_week,
  COUNT(*) as count
FROM activities
WHERE sport_type = 'Ride'
  AND moving_time > 5400
GROUP BY day_of_week
ORDER BY count DESC;

-- Find preferred days for long runs (>60 min)
SELECT
  strftime('%w', start_date) as day_of_week,
  COUNT(*) as count
FROM activities
WHERE sport_type IN ('Run', 'Trail Run')
  AND moving_time > 3600
GROUP BY day_of_week
ORDER BY count DESC;
```

Day mapping: 0=Sunday, 1=Monday, ..., 6=Saturday

Use this data to make an informed suggestion: _"I notice you typically do your long rides on Saturday and long runs on Sunday. Should we keep that pattern?"_

### Example Dialogue

```
Based on your Strava data, here's my initial assessment:

**Strengths:**
- Swimming: Your 5000m sessions at HR 125 suggest excellent swim fitness.
  Even though you haven't swum since August, this should return quickly.

**Limiters:**
- Running: Your runs show higher effort (HR 165+) for shorter distances.
  Your longest run is 12km; we'll need to build toward 21km for the 70.3.
- Cycling: Moderate—you're doing 60-80km rides but we'll need to push toward 100km+.

**My recommendation:** Focus training time on run and bike development.
Maintain swim with 2x/week sessions; it doesn't need major building.

Before I create the plan:
1. Does this assessment match how you feel about each sport?
2. Any injuries or constraints I should know about?
3. Do you have a time goal, or is finishing the focus?
```

### Why Validation Matters

- Data can mislead: Low recent volume ≠ lack of ability
- Athletes know their bodies: Prior injuries, what causes burnout, what they enjoy
- Buy-in matters: Athletes follow plans they helped shape
- Context changes everything: A "weak" run might be due to recovering from injury, not lack of fitness

**Never finalize a plan without athlete confirmation of the assessment.**


path: reference/load-management.md
content: # Training Load Management

Professional coaches quantify training stress to manage fatigue, prevent overtraining, and peak for races.

## Training Stress Score (TSS)

TSS measures the physiological cost of a workout. For cycling with power:

```
TSS = (Duration in seconds × NP × IF) / (FTP × 3600) × 100

Where:
- NP = Normalized Power (accounts for variability)
- IF = Intensity Factor (NP / FTP)
```

### TSS Guidelines by Workout Type

| Workout               | Typical TSS | Recovery Needed |
| --------------------- | ----------- | --------------- |
| Easy 1hr ride         | 40-50       | Same day OK     |
| 2hr endurance ride    | 80-100      | 24 hours        |
| Hard interval session | 70-90       | 24-48 hours     |
| 4hr long ride         | 150-200     | 48-72 hours     |
| Century (100mi)       | 250-350     | 3-5 days        |
| Ironman bike          | 300-400     | 1-2 weeks       |

### Running TSS (rTSS)

Estimated from pace and HR. Use Strava's suffer_score as a proxy:

- suffer_score ≈ rTSS for most athletes
- Compare suffer_score per hour across sessions to gauge relative intensity

### Swim TSS (sTSS)

Use duration × intensity factor:

- Easy swim: 25-30 TSS/hour
- Moderate swim: 40-50 TSS/hour
- Hard intervals: 60-70 TSS/hour

---

## Chronic Training Load (CTL) - "Fitness"

CTL is the rolling 42-day weighted average of daily TSS. It represents accumulated fitness.

### CTL Ramp Rate Guidelines

| Athlete Level | Max CTL Increase/Week | Notes                            |
| ------------- | --------------------- | -------------------------------- |
| Beginner      | 3-5 TSS/day           | Conservative to prevent injury   |
| Intermediate  | 5-7 TSS/day           | Standard progression             |
| Advanced      | 7-10 TSS/day          | Aggressive; requires monitoring  |
| Pro           | 8-12 TSS/day          | With careful recovery management |

_A CTL ramp of 7/week means adding ~50 TSS/week to your average weekly load._

---

## Acute Training Load (ATL) - "Fatigue"

ATL is the rolling 7-day weighted average of daily TSS. It represents recent fatigue.

---

## Training Stress Balance (TSB) - "Form"

```
TSB = CTL - ATL
```

| TSB Range  | State        | Implication                                |
| ---------- | ------------ | ------------------------------------------ |
| +15 to +25 | Fresh/peaked | Race ready, may lose fitness if maintained |
| +5 to +15  | Rested       | Good for quality sessions, minor events    |
| -10 to +5  | Neutral      | Normal training state                      |
| -10 to -30 | Fatigued     | Building load, need recovery soon          |
| < -30      | Overreaching | High injury/burnout risk, reduce load      |

### Race Day TSB Targets

| Event       | Target TSB | Taper Length |
| ----------- | ---------- | ------------ |
| Sprint Tri  | 0 to +10   | 5-7 days     |
| Olympic Tri | +5 to +15  | 10-14 days   |
| 70.3        | +10 to +20 | 14-18 days   |
| Ironman     | +15 to +25 | 21-28 days   |
| Marathon    | +10 to +20 | 14-21 days   |

---

## Weekly TSS Targets by Phase

| Phase         | % of Peak TSS | Focus                                  |
| ------------- | ------------- | -------------------------------------- |
| Base (early)  | 60-70%        | Building volume                        |
| Base (late)   | 75-85%        | Volume + introducing intensity         |
| Build         | 90-100%       | Peak volume, race-specific work        |
| Peak          | 85-95%        | Maintaining fitness, sharpening        |
| Taper         | 40-60%        | Reducing volume, maintaining intensity |
| Recovery week | 50-60%        | Every 3-4 weeks                        |

---

## Recovery Monitoring

### Heart Rate-Based Indicators

**Resting Heart Rate (RHR):**

- Measure every morning before getting up
- RHR elevated 5-10+ bpm = accumulated fatigue
- Sustained elevation over 3+ days = consider recovery day/week
- Sudden drop below baseline = potential illness onset

**Heart Rate Variability (HRV):**

- Higher HRV = better recovered
- Lower HRV = stressed/fatigued
- HRV 10%+ below baseline = reduce intensity
- Track 7-day rolling average, not daily swings

### Subjective Indicators (1-5 scale)

| Metric          | Questions                        |
| --------------- | -------------------------------- |
| Sleep quality   | How restful? Wake during night?  |
| Energy          | How do you feel getting up?      |
| Muscle soreness | General or localized?            |
| Mood            | Motivated or dreading training?  |
| Appetite        | Normal, elevated, or suppressed? |

**Warning patterns:**

- 2+ low scores for 3+ days = back off
- Sleep + mood both low = high burnout risk

### Recovery Week Structure

Every 3-4 weeks:

| Day | Prescription                                    |
| --- | ----------------------------------------------- |
| 1   | Complete rest or 30min Zone 1                   |
| 2   | 45-60min Zone 2, single sport                   |
| 3   | 30-45min Zone 2, different sport                |
| 4   | Complete rest                                   |
| 5   | 45-60min Zone 2 with 3-4 short accelerations    |
| 6   | Light session, re-assess readiness              |
| 7   | If feeling good, ease back into normal training |

**Volume reduction:** 40-50% of normal week
**Intensity reduction:** No Zone 4+ work


Security scan verdicts — ClawScan: suspicious | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (CRITICAL)