Jev decide y el modelo escribe: el juicio entra en el trabajo del Coach, y juzga la selección
Publish Docker images / build (., ./web/Dockerfile, web) (push) Canceled after 0s
Publish Docker images / build (./api, ./api/Dockerfile, api) (push) Canceled after 0s

Recordado como "para mejorar las decisiones en la selección de entrenamiento debe usar Jev y ChatGPT
combinado". La combinación estaba a medias por dos razones, y las dos se cierran acá.

**El juicio no estaba cuando se escribía el plan.** Viajaba al payload sólo si alguien lo había pedido
en Salud hacía menos de seis horas; en la práctica, muchas veces no estaba. Ahora un trabajo del Coach
—crear o revisar— **pide su propio juicio** cuando no hay uno fresco (`insightForCoach` en
`api/insights.js`), con el mismo cupo que gasta el botón de Salud, así que lo automático no puede
costar más que lo manual. Un debrief queda afuera: un veredicto de disposición no habla de una sesión.
Y si el proveedor falla, si la instancia no tiene clave o si el cupo se agotó, el trabajo sigue
exactamente como antes — el juicio es contexto, nunca una dependencia, y hay tests para los tres casos.

**Las preguntas no cubrían la selección.** Jev juzgaba disposición, descarga, limitante y métrica a
vigilar; nada sobre *qué cambiar*. Ahora, además de `volume` (hacia dónde va la carga de la semana,
cuando hay historia suficiente para tener opinión), recibe **una pregunta por ejercicio estancado**:
`keep`, `reduce`, `swap` o `drop`, con la clave del id de la biblioteca y el nombre en la rúbrica —
así la respuesta es algo con lo que el plan se puede editar y el modelo lee palabras, no una clave.
Los ids de ejercicios pasan a viajar en el estado, y sólo ellos: un id de biblioteca es una fila de un
dataset público, no un identificador de persona, y el test de privacidad lo dice ahora en esos
términos.

Hay una sola forma de producir un juicio: `runInsight` en `api/insights.js`, que usan la ruta de Salud
y el trabajo del Coach. Antes esa lógica vivía dentro de la ruta, con sus helpers duplicados en
`server.js`; ahora la ruta es una envoltura fina y no hay dos maneras de pedir, cobrar o guardar.

En el prompt del escritor quedó dicho con precisión qué es un `swap`: **una propuesta a considerar**,
no una decisión a aplicar. Si la evidencia que el propio modelo ve dice que el ejercicio está bien,
puede decir por qué y dejarlo; el cambio que envíe tiene que cumplir el esquema y nombrar un id real.

Tests: seis del runner y de la regla de cuándo preguntar (contra un gateway de mentira, sin levantar
servidor), más los de las preguntas nuevas. API 276 en verde, frontend 1705.
This commit is contained in:
dsantillan committed 2026-09-23 19:11:39 -04:00
1 parent 9a339db85e
commit f80ade25f6
9 files changed
+416 -90

No files matched your search

+31
View File
@@ -56,6 +56,37 @@ The health week is deliberately *not* the health file: averages of a metric per
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.
## Jev decides, the model writes
Two models with two jobs, and the split is deliberate: **the text model writes the plan** (it is the
only one that writes at all), and **Jev judges** — TypeSafe's System One model, served through OpenCode
Zen, which answers typed questions with calibrated probabilities instead of prose (see §3b of
`docs/HEALTH.md` for the whole of that feature).
They are combined in the one place it matters: **when a Coach job is about to write a plan or review
one, and there is no fresh judgment for this profile, the job asks Jev for one itself.** Waiting for
somebody to open Salud and tap *Ask* is how the two halves never meet; a create or a review is exactly
the moment a decision is needed. A debrief is excluded — a readiness verdict is not about one session.
A provider that fails, or an instance with no key, or a spent budget leaves the job running exactly as
it did before this existed: the judgment is context, never a dependency.
What Jev is asked, in one request (see `buildQuestions` in `api/jev.js`):
| Question | Type | What the writer does with it |
| --- | --- | --- |
| `readiness` | score, 5 levels | how hard today can be |
| `deload` | yes/no | whether the week should ease off, with its probability |
| `volume` | score, 5 levels | which way the week's load should move |
| `limiter` | choice over the body parts trained | what is least recovered |
| `attention` | choice over the health metrics present | which number is worth watching |
| `exercise_<library id>` | choice: keep / reduce / swap / drop | one per exercise that has **stopped progressing** — the half of selection that numbers alone cannot decide |
The answers ride into the payload as `secondOpinion`, with the probability attached to each, and the
prompt tells the writer to read them as **evidence with a confidence**, never as an instruction: a
`deload` at 0.55 is a hint and one at 0.95 is close to a fact, and a `swap` answer is a proposal the
writer can disagree with — the change it sends still has to satisfy the schema and name a real
`library` id. That is `prompts/common.md`, which is where the wording lives.
## Turning it on
Nothing here is an environment variable or a restart — the whole point of the admin card is that