← ClaudeAtlas

endurance-coach-architecture-contractlisted

The load-bearing architecture and invariants of the Endurance Coach app — load this when you need to understand how data flows, what must never break, or where something is assembled/enforced before you design or change a feature. Triggers: "how does data flow", "where is X assembled", "what are the invariants", "what must not break", "is this safe to change", "why is this null / a '—' field", designing or reviewing a feature that touches state assembly, sources (AI Endurance / Garmin), the write path, persistence, the dashboard HTML, the LLM coach layer, or the profile; onboarding to the codebase; wanting the contract behind `assemble.ts`, `Provenanced<T>`, `WriteGate`, `escapeHtml`, `StateStore`, the propose→confirm write gate, degrade-don't-crash, deterministic-vs-LLM split, or "no live numbers in the profile". Keywords: AthleteState, assembleState, Provenanced, WriteGate, allowWrite, escapeHtml, StateStore, atomic + locked write, prompt cache no-op, claude-opus-4-8. NOT for live triage of a broken symptom
maxeskell/personal-training-app · ★ 0 · AI & Automation · score 70
Install: claude install-skill maxeskell/personal-training-app
# Endurance Coach — architecture contract **Use this when** you are designing or reviewing a change that touches the daily state, the data sources, the write path, persistence, the dashboard HTML, or the LLM coach layer, and you need to know *what the system guarantees and where those guarantees are enforced* so your change preserves them. **Don't use this when** — a live thing is broken and you need to triage it (use `endurance-coach-debugging-playbook`); you need the env-var catalog or a flag's meaning (use `endurance-coach-config-and-flags`); you need the meaning/maths of a metric or the statistics internals (use `endurance-domain-reference`, `endurance-coach-proof-and-analysis-toolkit`); or you're asking whether a change may be committed/shipped (use `endurance-coach-change-control`, then `endurance-coach-run-and-operate`). Jargon defined once, here: - **AIE** = AI Endurance, the external coaching platform reached over **MCP** (Model Context Protocol, a tool-call protocol) with **OAuth**. It owns the training-load science (FTP, CSS, thresholds, predictions, recovery). We *consume* it; we never re-derive it. - **AthleteState** = the one assembled daily object every downstream layer reads. - **Provenanced<T>** = a value wrapped with where it came from: `{ value: T | null, source, note? }`. - **Write gate** = the propose→confirm two-step that is the only path to mutating the AIE plan. --- ## The one-paragraph model Local-first, single-athlete. Each day `assembleSta