@isparling/engram-coach 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +85 -18
  2. package/SETUP.md +559 -0
  3. package/SKILL_PACK.md +75 -0
  4. package/analyses/catalog.md +257 -0
  5. package/analysis-tools/hrv-trend.ts +592 -0
  6. package/analysis-tools/migrate-structured-capture.ts +234 -0
  7. package/analysis-tools/race-context.ts +96 -0
  8. package/analysis-tools/stream-analyze.ts +1008 -0
  9. package/analysis-tools/tsb-predict.ts +117 -0
  10. package/capture-handler.ts +301 -0
  11. package/config.json.example +21 -0
  12. package/engram-coach-ambient-capture.ts +336 -0
  13. package/engram-coach-capture-types.ts +185 -0
  14. package/engram-coach-config.ts +268 -0
  15. package/engram-coach-domain.ts +7 -2
  16. package/engram-coach-keys.ts +189 -0
  17. package/engram-coach-materialization.ts +638 -0
  18. package/engram-coach-migration.ts +1078 -0
  19. package/engram-coach-pack.ts +17 -12
  20. package/engram-coach-presentation.ts +10 -1
  21. package/engram-coach-reconciliation.ts +305 -2
  22. package/engram-coach-structured-capture.ts +622 -0
  23. package/package.json +39 -6
  24. package/personas/aggressive-monitoring.md +121 -0
  25. package/personas/aggressive.json +85 -0
  26. package/personas/conservative-monitoring.md +133 -0
  27. package/personas/conservative.json +93 -0
  28. package/personas/polarized-monitoring.md +112 -0
  29. package/personas/polarized.json +72 -0
  30. package/personas/volume-monitoring.md +85 -0
  31. package/personas/volume.json +108 -0
  32. package/shared/retrieval.md +71 -0
  33. package/shared/setup.md +207 -0
  34. package/skills/.gitkeep +0 -0
  35. package/skills/adapt-plan/SKILL.md +263 -0
  36. package/skills/block-review/SKILL.md +275 -0
  37. package/skills/consult/SKILL.md +176 -0
  38. package/skills/intake/SKILL.md +315 -0
  39. package/skills/lactate-analyze/SKILL.md +230 -0
  40. package/skills/lessons-rollup/SKILL.md +196 -0
  41. package/skills/monitoring-rollup/SKILL.md +208 -0
  42. package/skills/race-analysis/SKILL.md +219 -0
  43. package/skills/season-retrospective/SKILL.md +200 -0
  44. package/skills/set-goal/SKILL.md +297 -0
  45. package/templates/base.md +55 -0
  46. package/templates/build-1.md +57 -0
  47. package/templates/build-2.md +62 -0
  48. package/templates/race-report.md +51 -0
  49. package/templates/race-specificity.md +62 -0
  50. package/templates/season-review.md +40 -0
  51. package/engram-coach-extractor.ts +0 -295
@@ -0,0 +1,257 @@
1
+ # Analysis Catalog
2
+
3
+ Reference for all available stream analyses. Personas select from this catalog by key. The adapt-plan skill uses MCP tool mappings and data requirements from this file to execute analyses during Orient phase.
4
+
5
+ ---
6
+
7
+ ## How to Read This Catalog
8
+
9
+ Each analysis defines:
10
+
11
+ | Field | Purpose |
12
+ |-------|---------|
13
+ | **Key** | Stable identifier used in persona `analyses` config |
14
+ | **Description** | What the analysis measures and why a coach would use it |
15
+ | **MCP Tools** | Which Intervals.icu MCP tool calls are required |
16
+ | **Required Data** | Stream types, minimum session duration, sport applicability |
17
+ | **Output** | What the analysis produces (metric type, unit) |
18
+ | **Typical Thresholds** | Default threshold ranges — personas override these |
19
+
20
+ ---
21
+
22
+ ## `aerobic_decoupling`
23
+
24
+ **Description:** Compares efficiency factor (power:HR or pace:HR ratio) in the first half of a steady-state effort versus the second half. A positive decoupling percentage means HR is drifting upward relative to output — the aerobic system is struggling to sustain the effort. Measured over the main body of the session (excluding warmup/cooldown).
25
+
26
+ **Data Source:**
27
+ - `stream-analyze` CLI tool (`--analyses decoupling`) — retrieves watts and heartrate streams via Intervals.icu REST API, computes decoupling in-process, returns compact JSON. Raw streams never enter LLM context.
28
+
29
+ **Required Data:**
30
+ - Power and heartrate streams available on the activity
31
+ - Session duration > 45 minutes (shorter sessions produce unreliable decoupling)
32
+ - Steady-state or sub-threshold effort (interval sessions are not candidates)
33
+
34
+ **Output:**
35
+ - Decoupling % (float): `((EF_first_half - EF_second_half) / EF_first_half) * 100`
36
+ - Positive = HR drifting up relative to output (worse)
37
+ - Negative = HR stable or improving (better)
38
+
39
+ **Typical Thresholds:**
40
+ - < 3%: normal, aerobic system sustaining
41
+ - 3-5%: mild drift, watch trend across sessions
42
+ - 5-8%: meaningful drift, volume ceiling approaching
43
+ - \> 8%: significant aerobic strain, session duration exceeding capacity
44
+
45
+ **Sport Applicability:** Cycling (power:HR), running (pace:HR), any sport with continuous output + HR
46
+
47
+ ---
48
+
49
+ ## `hr_recovery_curve`
50
+
51
+ **Description:** Measures how quickly heart rate drops after the end of hard efforts within a session. Calculated as bpm drop in the first 60 seconds and 120 seconds after each identifiable interval ends. Faster recovery indicates better cardiac fitness and freshness; declining recovery rate across intervals within a session indicates within-session fatigue accumulation.
52
+
53
+ **Data Source:**
54
+ - `stream-analyze` CLI tool (`--analyses hr_recovery`) — retrieves heartrate stream and interval boundaries via Intervals.icu REST API, computes recovery drops in-process, returns compact JSON.
55
+
56
+ **Required Data:**
57
+ - Heartrate stream
58
+ - Identifiable intervals (structured workout, not steady-state)
59
+ - At least 2 intervals to compare early vs late recovery
60
+
61
+ **Output:**
62
+ - HR recovery rate per interval: bpm drop in first 60s, bpm drop in first 120s
63
+ - Recovery trend: comparison of first interval recovery vs last interval recovery
64
+
65
+ **Typical Thresholds:**
66
+ - 60s recovery > 25 bpm: good cardiac fitness
67
+ - 60s recovery 15-25 bpm: moderate
68
+ - 60s recovery < 15 bpm: poor recovery, fatigue present
69
+ - Decline of > 5 bpm/min from first to last interval: within-session fatigue accumulation
70
+
71
+ **Sport Applicability:** Any sport with discrete high-intensity efforts and recovery periods
72
+
73
+ ---
74
+
75
+ ## `power_curve_trend`
76
+
77
+ **Description:** Compares the athlete's recent best power (or pace) at key durations against their 28-day and 90-day historical bests. Reveals whether peak capacity is improving, maintaining, or declining at specific physiological durations — sprint (5s), anaerobic (1min), VO2max (5min), threshold (20min), endurance (60min).
78
+
79
+ **MCP Tools:**
80
+ - `get_athlete_power_curves` — retrieve power curves for specified date ranges
81
+
82
+ **Required Data:**
83
+ - Power data across multiple activities in the comparison windows
84
+ - At least 3-4 activities per window for reliable curves
85
+
86
+ **Output:**
87
+ - % change at each configured duration vs 28-day and 90-day bests
88
+ - Positive = improving, negative = declining
89
+
90
+ **Typical Thresholds:**
91
+ - \> +3%: improving
92
+ - -2% to +3%: maintaining
93
+ - < -3%: declining
94
+
95
+ **Configurable Parameters:**
96
+ - `durations`: array of seconds (e.g., `[5, 60, 300, 1200, 3600]`)
97
+ - Personas select which durations matter for their coaching model
98
+
99
+ **Sport Applicability:** Cycling (power), running (pace curves if available)
100
+
101
+ ---
102
+
103
+ ## `hr_at_power_trend`
104
+
105
+ **Description:** Tracks heart rate at a reference steady-state power output across sessions over a configurable time window. Declining HR at the same power indicates improving aerobic efficiency — the core validation metric for volume-based training. Rising HR at the same power indicates aerobic efficiency is declining despite training.
106
+
107
+ **MCP Tools:**
108
+ - `get_athlete_power_hr_curve` — retrieve power vs HR relationship over date range
109
+ - Fallback: `get_activity_streams` across recent activities at similar intensity
110
+
111
+ **Required Data:**
112
+ - Power + HR data from multiple sessions at similar sub-threshold intensity
113
+ - At least 3-4 comparable sessions within the reference window
114
+
115
+ **Output:**
116
+ - HR at reference power: current vs window average
117
+ - Trend direction: improving (HR down), stable, worsening (HR up)
118
+ - Magnitude: bpm change over the window
119
+
120
+ **Typical Thresholds:**
121
+ - HR declining ≥ 2 bpm: improving efficiency
122
+ - HR stable (± 1 bpm): neutral
123
+ - HR rising ≥ 2 bpm: declining efficiency
124
+
125
+ **Configurable Parameters:**
126
+ - `reference_window_days`: lookback window (default 28)
127
+
128
+ **Sport Applicability:** Cycling (power:HR), running with power meter
129
+
130
+ ---
131
+
132
+ ## `interval_execution_quality`
133
+
134
+ **Description:** Assesses how well the athlete executed prescribed intervals. Measures power fade across repeated efforts, compliance with target power ranges, and variability within intervals. Fade across intervals indicates accumulating fatigue; poor target compliance indicates prescription misalignment or pacing issues.
135
+
136
+ **Data Source:**
137
+ - Fade and target compliance: `get_activity_intervals` MCP tool (compact structured endpoint, no raw streams needed)
138
+ - Power CV per interval: `stream-analyze` CLI tool (`--analyses interval_cv`) — retrieves power stream via Intervals.icu REST API, computes CV in-process
139
+
140
+ **Required Data:**
141
+ - Structured workout with identifiable intervals
142
+ - Power stream (or pace for running)
143
+ - Prescription targets (from the active prescription YAML)
144
+
145
+ **Output:**
146
+ - Fade %: power difference between first and last interval (negative = fade)
147
+ - Target compliance %: how closely average interval power matched prescription
148
+ - Power CV per interval: variability index (lower = smoother execution)
149
+
150
+ **Typical Thresholds:**
151
+ - Fade < 3%: excellent execution
152
+ - Fade 3-8%: normal fatigue progression
153
+ - Fade 8-15%: significant fatigue, prescription may be too aggressive
154
+ - Fade > 15%: session exceeded capacity
155
+ - Target compliance > 95%: excellent
156
+ - Target compliance 85-95%: acceptable
157
+ - Target compliance < 85%: significant miss
158
+
159
+ **Sport Applicability:** Any sport with structured interval prescriptions
160
+
161
+ ---
162
+
163
+ ## `time_in_zones`
164
+
165
+ **Description:** Distribution of time spent across heart rate and/or power training zones for a completed activity. Primary use is validating intensity distribution — especially critical for the polarized training model where grey-zone (Zone 2-3) accumulation is a training quality failure.
166
+
167
+ **MCP Tools:**
168
+ - `get_activity_time_at_hr` — retrieve HR zone distribution
169
+ - Activity power data for power zone distribution
170
+
171
+ **Required Data:**
172
+ - HR stream and/or power stream
173
+ - Zone boundaries configured in Intervals.icu athlete settings
174
+
175
+ **Output:**
176
+ - % time per zone (Z1 through Z5+)
177
+ - Grey-zone percentage (Z2+Z3 combined)
178
+ - Distribution shape classification (polarized, pyramidal, threshold-heavy)
179
+
180
+ **Typical Thresholds:**
181
+ - Polarized target: Z1 ≥ 75%, Z4+ present, Z2-3 < 5%
182
+ - Grey-zone warning: Z2-3 > 10% on an intended easy or hard day
183
+ - Zone compliance: intended zone matches actual primary zone
184
+
185
+ **Sport Applicability:** All endurance sports with HR and/or power
186
+
187
+ ---
188
+
189
+ ## `resting_hr_trend`
190
+
191
+ **Description:** Multi-day resting heart rate trend from wellness data. A rising RHR baseline across days indicates cardiac fatigue accumulation — the sympathetic nervous system is running at elevated baseline. More reliable over multi-day windows than single morning readings.
192
+
193
+ **MCP Tools:**
194
+ - `get_wellness` — retrieve wellness entries for a date range
195
+
196
+ **Required Data:**
197
+ - Wellness data with resting HR entries across the configured window
198
+ - At least 5 data points within the window for reliable trend
199
+
200
+ **Output:**
201
+ - RHR trend direction: rising, stable, declining
202
+ - Magnitude: bpm change over the window
203
+ - Consecutive days above personal baseline
204
+
205
+ **Typical Thresholds:**
206
+ - Rising 3+ bpm over window: amber, cardiac fatigue accumulating
207
+ - Rising 5+ bpm over window: red, sustained sympathetic elevation
208
+ - Stable (± 1 bpm): normal
209
+ - Declining: recovery progressing
210
+
211
+ **Configurable Parameters:**
212
+ - `window_days`: lookback window (7 or 14 days)
213
+
214
+ **Sport Applicability:** All — sport-independent wellness metric
215
+
216
+ ---
217
+
218
+ ## `hrv_trend`
219
+
220
+ **Description:** Multi-week HRV trend analysis with personal baseline computation. Pulls 60+ days of wellness history and classifies today's reading against a dual-window rolling baseline (14-day short, 60-day long) using z-score position, percentile rank, linear regression slope, and historical-analog lookup (prior readings at or near today's level and how quickly they rebounded). Designed to replace absolute-value thresholds with athlete-calibrated readiness signals.
221
+
222
+ **Data Source:**
223
+ - `hrv-trend` CLI tool (`npx tsx analysis-tools/hrv-trend.ts --config ...`) — fetches wellness history via Intervals.icu REST API, computes all statistics in-process, returns compact JSON. No raw wellness data enters LLM context.
224
+
225
+ **Required Data:**
226
+ - Wellness data with `hrv_rmssd` (or `hrv_sdnn`) entries
227
+ - Minimum 14 days for short baseline; 60 days for full classification (fewer returns `insufficient_data`)
228
+
229
+ **Output:**
230
+ - `current`: today's HRV reading
231
+ - `baselines`: `{short_mean, short_sd, long_mean, long_sd}` — dual-window rolling statistics
232
+ - `position`: `{z_short, z_long, percentile_long}` — statistical position of today's reading
233
+ - `trend`: `{slope_per_day, direction, consecutive_days_below_long_mean}` — 7-day regression slope and direction
234
+ - `analogs`: `{matches, match_count, median_rebound_days, any_sustained_suppression}` — prior readings at or near today's level and their rebound patterns
235
+ - `classification`: `{label, reasoning}` — one of `green | green-watch | amber | amber-red | red | insufficient_data`
236
+
237
+ **Classification Bands (default thresholds):**
238
+
239
+ | Label | z_long condition |
240
+ |-------|-----------------|
241
+ | `green` | ≥ -0.5 |
242
+ | `green-watch` | -1.0 to -0.5 |
243
+ | `amber` | -1.5 to -1.0 (no severe trend/suppression) |
244
+ | `amber-red` | -1.5 to -1.0 (consec≥3 AND sustained) or -2.0 to -1.5 (no sustained) |
245
+ | `red` | -2.0 to -1.5 (consec≥3 OR sustained) or < -2.0 (hard floor) |
246
+ | `insufficient_data` | fewer than long_window_days of history |
247
+
248
+ **Configurable Parameters (persona JSON `analyses.hrv_trend`):**
249
+ - `metric`: `hrv_rmssd` (default) or `hrv_sdnn`
250
+ - `short_window_days`: short baseline window (default 14)
251
+ - `long_window_days`: long baseline and analog search window (default 60)
252
+ - `trend_window_days`: regression window (default 7)
253
+ - `analog_tolerance`: HRV units for analog matching (default 2)
254
+ - `analog_dedup_days`: cluster window for deduplication (default 3)
255
+ - `thresholds`: persona-specific z-score band edges `{green, green_watch, amber, red}`
256
+
257
+ **Sport Applicability:** All — sport-independent wellness metric