You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey Duarte. I've been running openGym on my own box and added something I use pretty much every session now. Before I make a PR out of it I wanted to ask if you'd want it upstream at all, and in what shape. It's a decent-sized change, so I'd rather ask first than drop a big diff on you.
The idea
While you're in a workout, tap the little sparkles next to an exercise (also in the ⋯ menu as Ask Coach about this exercise) and tell the Coach what's going on:
shoulder's pinching on the bench
the rack is taken
I've only got 15 minutes
I feel great, give me something extra
It answers, and if there's something worth changing, it proposes the changes as cards you tick: swap the remaining sets to something else, move an exercise later, add one, cut sets/reps/weight/rest (only ever down), skip the rest of it, or add a line to the session note.
Nothing happens until you tick it. Sets you already logged are never touched. Your routine isn't changed by it.
Left to right: the button next to the exercise (Barbell Bench Press), the proposal cards, after applying, the entry in Coach history.
Details that took a few rounds at the gym to get right
Swaps are like-for-like. The suggestions come from a library slice built around the exercise you asked from (same target muscle first, then body part, mixing equipment), so a sore shoulder on barbell bench gets a cable press offered, not a row.
It knows which exercise you mean. Each question is tagged with the exercise you asked it from, so "this is too easy" asked from the next exercise is answered for that one, not the last one you talked about.
Proposals don't go stale. The proposal lives on the server tied to that workout. It goes away when you finish or discard the workout, and another phone can clear it if it's stuck.
Routine changes are separate and limited. After you apply, it can offer the swap/reorder/add as a routine change through the normal Coach change set, so undo works. On purpose, it never offers sets/reps/weight to the routine, same rule as your Update routine item.
"This hurts" can be remembered. It offers to save a one-line limitation to the Coach profile, in your own words.
How it's built
No new deps, and no second engine. Changes go through swapActiveExercise, moveActiveWorkoutUnit and insertionIndexAfterCurrentUnit inside one store update, so if anything went stale the whole batch is dropped.
The manual swap and manual add built an entry the same way in two places, so the first commit folds that into one buildSessionEntry, and the Coach uses it too.
Server-side, it's a fourth job kind next to create/review/debrief. payload.js sends an allowlisted snapshot of the live session, validate.js has the action list and checks every one against the live entry, and schema/prompt/pipeline/jobs/routes get the new kind the same way debrief did. OpenAPI and api.html are updated. Demo and on-device modes work too. Your disclaimer line shows under every proposal.
Tests: unit tests next to the lib code, validator and fixture end-to-end tests on the API, a view test for the button. All 18 locales have the strings. Everything in your CI passes locally: frontend, api, MCP, both locale checks, the fatigue probes, the asset and API-docs checks, both Docker targets.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Hey Duarte. I've been running openGym on my own box and added something I use pretty much every session now. Before I make a PR out of it I wanted to ask if you'd want it upstream at all, and in what shape. It's a decent-sized change, so I'd rather ask first than drop a big diff on you.
The idea
While you're in a workout, tap the little sparkles next to an exercise (also in the ⋯ menu as Ask Coach about this exercise) and tell the Coach what's going on:
It answers, and if there's something worth changing, it proposes the changes as cards you tick: swap the remaining sets to something else, move an exercise later, add one, cut sets/reps/weight/rest (only ever down), skip the rest of it, or add a line to the session note.
Nothing happens until you tick it. Sets you already logged are never touched. Your routine isn't changed by it.
Left to right: the button next to the exercise (Barbell Bench Press), the proposal cards, after applying, the entry in Coach history.
Details that took a few rounds at the gym to get right
Swaps are like-for-like. The suggestions come from a library slice built around the exercise you asked from (same target muscle first, then body part, mixing equipment), so a sore shoulder on barbell bench gets a cable press offered, not a row.
It knows which exercise you mean. Each question is tagged with the exercise you asked it from, so "this is too easy" asked from the next exercise is answered for that one, not the last one you talked about.
Proposals don't go stale. The proposal lives on the server tied to that workout. It goes away when you finish or discard the workout, and another phone can clear it if it's stuck.
Routine changes are separate and limited. After you apply, it can offer the swap/reorder/add as a routine change through the normal Coach change set, so undo works. On purpose, it never offers sets/reps/weight to the routine, same rule as your Update routine item.
"This hurts" can be remembered. It offers to save a one-line limitation to the Coach profile, in your own words.
How it's built
No new deps, and no second engine. Changes go through
swapActiveExercise,moveActiveWorkoutUnitandinsertionIndexAfterCurrentUnitinside one store update, so if anything went stale the whole batch is dropped.The manual swap and manual add built an entry the same way in two places, so the first commit folds that into one
buildSessionEntry, and the Coach uses it too.Server-side, it's a fourth job kind next to create/review/debrief.
payload.jssends an allowlisted snapshot of the live session,validate.jshas the action list and checks every one against the live entry, and schema/prompt/pipeline/jobs/routes get the new kind the same way debrief did. OpenAPI and api.html are updated. Demo and on-device modes work too. Your disclaimer line shows under every proposal.Tests: unit tests next to the lib code, validator and fixture end-to-end tests on the API, a view test for the button. All 18 locales have the strings. Everything in your CI passes locally: frontend, api, MCP, both locale checks, the fatigue probes, the asset and API-docs checks, both Docker targets.
The branch
https://github.com/bbolinger/opengym/tree/mid-workout-coach
Three commits, each standing on its own:
buildSessionEntryrefactor (net fewer lines, no behavior change)If you'd rather not have the sparkles button and keep it only in the ⋯ menu, or want it shaped differently, let me know. What do you think?
All reactions