El Coach ahora sabe para qué cuerpo escribe: tu semana de Salud y tu peso al crear
Publish Docker images / build (., ./web/Dockerfile, web) (push) Canceled after 0s
Publish Docker images / build (./api, ./api/Dockerfile, api) (push) Canceled after 0s

Preguntado como "¿Jev está integrado en el Coach para crear o revisar, según mi peso, mis medidas y
los entrenamientos que ya he hecho?" — y la respuesta honesta tenía dos huecos, que este commit
cierra, y uno que no.

**Lo que ya estaba.** El payload del Coach lleva el cuestionario (objetivo, experiencia, días,
minutos, equipamiento, limitaciones), tu plan, `history.workingWeights` (el mejor peso que ya
manejaste en cada ejercicio, para que las cargas iniciales partan de evidencia), `window` +
`aggregates` en una revisión (las últimas tres sesiones serie por serie, las anteriores resumidas,
estancamientos, adherencia, series por parte del cuerpo), tu peso de las últimas semanas y la segunda
opinión de Jev cuando tiene menos de seis horas.

**Lo que faltaba.**

  · **Una semana de Apple Health no llegaba nunca**: el Coach podía leer tu entrenamiento y no tu
    recuperación. Ahora `health` viaja en el payload — por métrica y por campo, el promedio diario,
    el valor más nuevo y cuántos días tienen datos, con tope de ocho métricas y en el orden del
    catálogo. Promedios y no el archivo, a propósito: "durmiendo 6,2 h contra 7,1 la semana
    anterior" cambia una decisión de volumen, y 288 muestras de pulso sólo gastan tokens. Va en
    crear y en revisar; no en el debrief, porque el promedio de una semana no dice nada de una sesión.
    El resumen vive en `jev.js`, junto al orden de métricas que ya usaba, y `jobs.js` lo lee del
    mismo archivo que el teléfono escribe.
  · **Al crear un plan no le llegaba tu peso.** Revisar y debrief siempre lo llevaron; crear no. Un
    plan nuevo se escribía sin saber si estás en déficit o subiendo. Ahora el payload de crear lleva
    el objetivo y los últimos ocho pesajes.
  · Ambas cosas se documentan al modelo en `prompts/common.md`, con su límite dicho: dos días con
    datos no son una semana, así que no se lee una tendencia de ahí.

**Lo que no existe, y lo digo en vez de dejarlo creer: medidas corporales.** La app guarda peso y
nada más — ni cintura, ni pecho, ni brazo. No hay dónde escribirlas, así que "según mis medidas"
todavía no es algo que esta instancia pueda hacer; lo que el Coach lee es la serie de peso. Está
escrito así en `docs/AI_COACH.md`, con la tabla de qué entra en el payload y de dónde sale cada cosa.

Tests: el resumen (promedios por campo, ventana, orden, métricas fuera de la ventana descartadas,
tope de ocho) y el payload (el resumen reducido y saneado, la clave ausente en vez de un objeto vacío,
y el peso en crear). API 269 en verde, frontend 1705.
This commit is contained in:
dsantillan committed 2026-09-23 19:03:19 -04:00
1 parent f7b884be81
commit 9a339db85e
8 files changed
+195 -4

No files matched your search

+24
View File
@@ -32,6 +32,30 @@ A model on your own LAN is the compatible endpoint with no key: point it at
`http://ollama.lan:11434` and pick a model from the list it serves. That is the whole
configuration.
## What the Coach is given
Everything it reads arrives in one JSON payload, built by `api/coach/core/payload.js` and bounded on
purpose — a plan is written from evidence, and evidence is small.
| In the payload | Where it comes from |
| --- | --- |
| `coachProfile` — goal, experience, days per week, session length, equipment, limitations, likes and dislikes | the intake questionnaire |
| `plan` — routines, weekday schedule, per-exercise prescription | the profile's own document |
| `history.workingWeights` (create) — the best weight actually handled per exercise | every logged session |
| `window` + `aggregates` (review, debrief) — the last three sessions set by set, older ones compacted, plus stalls, adherence and sets per body part | the workout history |
| `bodyweight` — the weigh-ins of the last weeks and the target weight. Now in a **create** payload too, not only review and debrief | the Stats screen's weigh-in log |
| `health` — a week of Apple Health **as averages**: per metric and per field, the daily average, the newest value and how many days had data (see below) | `api/jev.js`'s `healthSummary`, over the file the phone posts |
| `secondOpinion` — a judgment with probabilities, when one was asked for less than six hours ago | the Salud card (Jev via OpenCode Zen) |
| `cohort` (optional) — anonymous medians across profiles that opted in | the community aggregate |
**There are no body measurements.** The app stores a body weight (`bodyweight`) and nothing else —
no waist, no chest, no arm. A plan written "from your measurements" is not something this instance can
do today, because there is nowhere to type them; the weight series is what the Coach reads.
The health week is deliberately *not* the health file: averages of a metric per field, capped at eight
metrics, and never the samples. A week of sleep and resting heart rate is what changes a volume
decision; 288 heart-rate samples are tokens spent to tell the model nothing more.
## Turning it on
Nothing here is an environment variable or a restart — the whole point of the admin card is that