TrainingPeaks Evidence Protocol
- Owner: Coach Luca
- Last updated: 2026-04-10
- Purpose: Defines how the evening workflow retrieves. interprets, and classifies TrainingPeaks activity data
- Gate: Evening skill cannot claim activity confirmation until this protocol is validated
Evidence Path Priority
The evening workflow uses TrainingPeaks data to classify session outcomes. The following fallback chain defines the priority order:
MCP Server Usage
The TrainingPeaks MCP server is the preferred evidence source.
Authentication: Browser-based auth via /Users/notgeoff/.openclaw-coachluca/trainingpeaks-mcp/.venv/bin/tp-mcp auth --from-browser auto. If Chrome auth fails, manual cookie auth using the Production_tpAuth cookie from app.trainingpeaks.com.
Expected data: The MCP server should return structured activity data including:
- Activity date and time
- Activity type (ride, run, strength, etc.)
- Duration
- Distance (when applicable)
- Power data summary (IF, NP, TSS, average power)
- Heart rate summary
- Athlete notes or descriptions
Validation check: Before relying on MCP data for evening review, confirm:
- The activity date matches today
- The activity type is consistent with the planned session
- The data is not a duplicate or stale cached result
Legacy Script Usage
If the MCP server is unavailable or returns no data:
scripts/tp_check.js — Launches headless Chrome, navigates to Sidney's TrainingPeaks calendar, and returns basic page content. Useful for verifying whether data is visible but not structured.
scripts/tp_last_activity.js — Connects to a running Chrome instance with the TP calendar open. Scrapes for activity-like text on the calendar page. Returns candidate activity entries with text snippets.
Limitations:
- Output is unstructured text scraped from the UI
- May not return precise metrics (TSS, IF, etc.)
- Requires Chrome to be running with TP logged in (for
tp_last_activity.js) - May fail silently if the page layout changes
Session-Outcome Certainty States
The evening workflow must classify today's session using exactly one of these states:
Evidence-to-State Mapping
TP MCP returns structured activity data
- Compare activity type to planned session type
- Compare duration to planned duration (± 15% is "minor" deviation; > 15% is "significant")
- Compare effort metrics (power, HR) to planned effort target if available
- If all match reasonably:
Confirmed completed - If minor deviations:
Confirmed modified — minor - If major deviations:
Confirmed modified — significant
TP MCP returns no activity for today
- If athlete has reported the session in messages: use athlete report to classify
- If no athlete report:
Unconfirmed(notConfirmed not completed— the data may simply be delayed) - Exception: if the athlete explicitly said they skipped:
Confirmed not completed
Legacy scripts return data
- Same mapping logic as MCP, but with lower confidence due to unstructured output
- If the scraped text clearly shows a matching activity: classify normally
- If the scraped text is ambiguous:
Unconfirmed
No automated data available
- Check for athlete messages reporting the session
- If athlete explicitly reports: use their report to classify
- If no athlete report:
Unconfirmed
Handling Partial, Stale, or Missing Data
Critical Rules
- Missing TP evidence = Unconfirmed. Never assume a session was completed because it was planned.
- Do not retry or wait for TP data. The evening pass runs at 20:00. Whatever data is available at that time is what gets used.
- Do not infer effort quality from data alone without context. A shorter ride might be appropriate (Amber day) or might not.
- Always record the evidence source in the evening note's internal section: "Source: TP MCP", "Source: legacy script", "Source: athlete message", or "Source: none".
- TP auth may expire. If the MCP server fails with an authentication error, note this as an infrastructure issue for operator attention. Do not attempt to re-authenticate automatically during the evening pass.
- The plan is not evidence. The rolling 7-day file says what should have happened. TP data and athlete reports say what did happen. These are different things.