App Icon Montis.icu

Montis.icu Unified Prefetch Architecture β€” v5.1 Design

The Montis.icu Coach App operates on a authority-driven architecture separating measurement, interpretation, prescription, and interface.

Data integrity originates from Intervals.icu, computation executes in Railway (python), and conversational rendering never alters canonical truth.

🧠 Strategy β€’ 🟒 Technical β€’ 🟠 Coaching β€’ πŸ”΅ Future

The system is intentionally divided into independent architectural layers, each with a single responsibility and defined authority.

This separation enforces:

Conversational AI is a rendering layer β€” never a computational authority.

🧠 System Strategy & Architectural Philosophy

The Montis.icu Coach App is engineered around strict authority separation. No layer may override or recompute another layer’s outputs.


πŸ”’ Core Architectural Contract

Coaching logic never mutates canonical metrics.
Tier-1 and Tier-2 outputs are immutable and remain the single source of performance truth.

This prevents metric drift, silent recomputation, probabilistic coaching artifacts, and black-box behavior.


🧱 Responsibility Separation Model

Measurement    β†’ Technical Pipeline (Tier-0 / Tier-1 / Tier-2)
Interpretation β†’ Coaching Pipeline (Tier-3 Intelligence)
Prescription   β†’ Adaptive Decision Engine (Deterministic Rules)
Interface      β†’ LLM Rendering Layer (Read-Only)

No single layer owns more than one responsibility. This structure enables auditability, stateless execution, and predictable system evolution.


🎯 Strategic Positioning

Unlike heuristic AI dashboards or machine-learning coaching engines, this system does not invent, infer, or probabilistically manipulate performance metrics.

The result is a deterministic performance intelligence platform β€” not a black-box AI coach.

βš™οΈ Current Operational Pipeline (Production)

Status: Live β€’ Used in production β€’ Backward compatible

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚        ChatGPT / CLI App     β”‚
β”‚  (Tool invocation layer)     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
              β”‚  HTTPS tool call
              β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚          Cloudflare Worker (Edge)            β”‚
β”‚  β€’ Auth + routing proxy                      β”‚
β”‚  β€’ Handles start/end normalization           β”‚
β”‚  β€’ Prefetches Intervals data β†’ JSON context  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
              β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚         Railway Backend (FastAPI)            β”‚
β”‚  β€’ Tier-0: Prefetch normalization            β”‚
β”‚     - DataFrame coercion + baseline columns  β”‚
β”‚     - Empty-source detection + AuditHalt     β”‚
β”‚  β€’ Tier-1: Activity & wellness validation    β”‚
β”‚     - moving_time filtering, zero-checks     β”‚
β”‚  β€’ Tier-2: Aggregation + enforcement         β”‚
β”‚     - Totals reconciliation, variance checks β”‚
β”‚  β€’ Tier-3: Forecast, PI and ESPE             β”‚
β”‚     - Advanced Coaching                      β”‚
β”‚  β€’ Outputs URF v5.1 Semantic JSON            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
              β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚     Intervals.icu API        β”‚
β”‚   (authoritative source)     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ”„ Cloudflare handles authentication, routing, and optional synthetic testing.
πŸš‰ Railway performs full computation, validation, and serialization.

🧩 Current Architecture Guarantees

Area Implementation Guarantee
Prefetch Flow Cloudflare normalizes date params and injects optional test payloads Safe staging tests without real data
Execution Model Python execution on Railway (FastAPI + Pandas) Deterministic, audited output
Tier-0 Validation Baseline column checks (`moving_time`, `distance`, etc.) No schema drift or missing fields
Tier-1 Audit Filters invalid / null activities, computes daily summaries Enforced numeric consistency
Tier-2 Metrics & Enforcement Derived Metrics, Lock totals, enforce logical consistency No variance bleed between scopes
Tier-3 Coaching Forecast, Performance Intelligence and ESPE Integrated performance modelling
Serialization Single-pass semantic JSON (no float loss) Stable numeric precision
Observability Structured logs at all Tier boundaries Traceable audit chain (light→full→wellness)
Schema Version URF v5.1 unified contracts Cross-version compatibility with GPT tool API

🧠 Future Technical Pipeline

Design Goal Implementation Guarantee
Natural Language Interface LLMs interact exclusively via MCP tools (no UI state, no clicks) Human-like interaction without loss of determinism
Multi-LLM Compatibility MCP-standard tool schemas (OpenAI, Anthropic, Mistral, local models) No vendor lock-in; identical outputs across models
Secure Access Control Cloudflare Workers act as MCP + OAuth gateway Intervals.icu tokens never exposed to LLMs
Edge Policy Enforcement OAuth scopes, rate limits, and request validation at Cloudflare Edge Strong isolation between clients, tools, and athletes
Execution Engine Python services on Railway (FastAPI + Pandas) Deterministic, auditable metric computation
Authoritative Data Source Intervals.icu APIs (activities, intervals, FIT-derived data) Single source of truth for all training data
Semantic Contract URF v5.1 structured semantic JSON LLMs interpret results without recomputation or inference
Context Integrity Explicit context windows (activity, 7d, 90d, rolling) No accidental β€œseasonal” or cross-scope mislabeling
Headless by Design No dependency on web UI or dashboards Future-proof for voice, agents, automation, and APIs
Tool-First Expansion New capabilities exposed as MCP tools Feature growth without breaking existing clients

βš™οΈ Future Operational Pipeline

Status: Planned β€’ Incremental rollout β€’ No breaking changes


🧭 System Diagram

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Human / LLM Agent β”‚
β”‚  (Chat, Voice, AI) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
          β”‚  Natural Language
          β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ MCP Tool Interface (Standard)β”‚
β”‚ β€’ Typed tool contracts       β”‚
β”‚ β€’ No UI state                β”‚
β”‚ β€’ Multi-LLM compatible       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
          β”‚ MCP call
          β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Cloudflare Edge (OAuth + MCP)β”‚
β”‚ β€’ OAuth token handling       β”‚
β”‚ β€’ Scope enforcement          β”‚
β”‚ β€’ Rate limiting              β”‚
β”‚ β€’ Request normalization      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
          β”‚ Authenticated request
          β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Railway Execution Layer      β”‚
β”‚ (FastAPI + Pandas)           β”‚
β”‚ β€’ Tier-0 validation          β”‚
β”‚ β€’ Tier-1 audit               β”‚
β”‚ β€’ Tier-2 enforcement         β”‚
β”‚ β€’ Tier-3 Methodology         β”‚
β”‚ β€’ Deterministic computation  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
          β”‚ Canonical queries
          β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Intervals.icu APIs           β”‚
β”‚ β€’ Activities (7d / 90d)      β”‚
β”‚ β€’ Intervals & FIT-derived    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
          β”‚ Structured data
          β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Semantic JSON (URF v5.1)     β”‚
β”‚ β€’ Explicit context windows   β”‚
β”‚ β€’ Locked totals              β”‚
β”‚ β€’ No recomputation allowed   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
          β”‚ Read-only
          β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ LLM Rendering / Reasoning    β”‚
β”‚ β€’ Descriptive only           β”‚
β”‚ β€’ Coach-like narrative       β”‚
β”‚ β€’ No metric invention        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ”„ Cloudflare handles authentication, routing, and optional synthetic testing.
πŸš‰ Railway performs full computation, validation, and serialization.
πŸ’‘Independence from LLMs via MCP

πŸ”‘ Key Insights


βš™οΈ How It Works (End-to-End)

  1. User or AI issues a natural-language request
    Example: β€œExplain my weekly intensity balance and recovery status.”
  2. Request is converted into an MCP tool call
    • Strongly typed inputs
    • Explicit report scope (weekly / season / activity)
  3. Cloudflare Edge handles trust and policy
    • OAuth token exchange with Intervals.icu
    • Scope validation
    • Rate limiting
    • Parameter normalization
  4. Railway executes the computation
    • Tier-0: schema + column validation
    • Tier-1: numeric consistency and filtering
    • Tier-2: locked totals and scope enforcement
    • No cross-window leakage (e.g. weekly β‰  seasonal)
  5. Canonical semantic JSON is produced
    • URF v5.1 contract
    • Explicit context windows
    • Deterministic numeric precision
    • No derived ambiguity
  6. LLM renders the report
    • Descriptive, coach-like language
    • Anchored strictly to provided semantics
    • No recomputation, guessing, or extrapolation

🧠 Why This Matters

This architecture enables natural language coaching at scale without:

The result is a system that is:

Natural language becomes the interface β€” not the source of truth.

πŸ” Architectural Continuity

The future MCP-native architecture does not replace the current system. It formalizes the same guarantees behind a standard tool interface.

🎯 Decision Governance

🧠 Coaching Intelligence Pipeline (Performance Layer)

Status: Evolutionary (v6+) β€’ Deterministic β€’ Rule-based β€’ No metric recomputation

The Coaching Pipeline operates strictly on validated canonical data produced by the Technical Pipeline. It does not compute raw metrics. It transforms trusted semantic inputs into structured performance intelligence and deterministic training decisions.


CANONICAL SEMANTIC DATA (URF v5.1)
                β”‚
                β–Ό
Tier-3A: Stress Intelligence
(WDRM / ISDM / NDLI)
                β”‚
                β–Ό
Tier-3B: Progression Intelligence
ESPE v1 β€” Power Curve Progression
β€’ Duration anchors (5s / 1m / 5m / 20m / 60m)
β€’ Curve rotation detection
β€’ Endurance vs anaerobic shift
                β”‚
                β–Ό
Tier-3C: System Modeling (Future)
ESPE v2 β€” Physiological System Engine
β€’ Glycolytic vs aerobic bias
β€’ Durability gradient
β€’ VOβ‚‚ reserve capacity
β€’ Energy system balance score
                β”‚
                β–Ό
Adaptive Decision Engine (ADE)
                β”‚
                β–Ό
COACHING SEMANTIC LAYER (v6)
                β”‚
                β–Ό
Final Structured Report

πŸ” Stage 1 β€” Stress Intelligence

Evaluates how the athlete is expressing training load under fatigue.

Answers: β€œCan the athlete tolerate additional stress?”


πŸ“ˆ Stage 2 β€” Progression Intelligence (ESPE v1)

Tracks energy system progression using power curves and structural signals.

Answers: β€œIs current training producing adaptation?”

🧬 Stage 2B β€” System Modeling (ESPE v2)

The next evolution of the Energy System Progression Engine extends beyond simple power-duration changes and models the athlete’s physiological system balance.

This stage transforms curve progression into deeper physiological diagnostics describing how the athlete’s energy systems are adapting to training stimulus.


🧭 Stage 3 β€” Adaptive Decision Engine (ADE)

Applies deterministic, rule-based logic to produce structured prescription guidance.

IF:
  Neural density high
  AND Repeatability decreasing
  AND FatigueTrend elevated
THEN:
  Reduce VO2 duration 15%
  Convert tempo β†’ endurance
  Insert OFF day

No GPT improvisation. No hidden logic. Rules are executed inside Railway and serialized into the semantic graph.


🧠 Training State Machine

All prescription logic is governed by a deterministic training state model. The system cannot prescribe progression outside the current state.

Training State Machine:
  Stable β†’ Progress
  Dense β†’ Absorb
  Strain β†’ Consolidate
  Overreached β†’ Recover

The state machine governs intensity permission and load progression. It ensures Tier-2 diagnostics cannot override Tier-3 state.


πŸ“¦ Coaching Semantic Output (v6)

The Coaching Semantic Layer converts structural intelligence into clear, athlete-readable language β€” without removing analytical depth.

adaptive_layer:
  readiness_state
  progression_state
  neural_state
  durability_state
  prescription_adjustment

The system supports:

Complexity is abstracted in Athlete Mode, but fully accessible in Coach Mode.

Any recommendation can be queried for complete technical breakdown β€” including source metrics, thresholds, trend deltas, and deterministic rule logic.

The system hides complexity β€” it never hides transparency.

πŸ“¬ Contact

For integration, customization, or coaching inquiries, connect via GitHub link below or DM via Intervals.icu DM and contribute in Intervals.icu Forum.

github.com/revo2wheels

Built with ❀️ for endurance athletes β€” by Clive King.
Made in the Suisse Alps πŸ‡¨πŸ‡­.
Powered by Intervals.icu, Cloudflare and the Railway Engine.

⬆