writing / post18 nov 2026

Nothing is written without a diff

I let a model draft my training routines in Durandal, but nothing reaches Hevy until a function has checked the draft and I've confirmed a diff, which comes to three write requests and no delete.

this post

published
2026-11-18
reading
08 min
parts
9
the exhibit: ~ / work / durandal

One rule

Durandal, my iPhone training coach, writes nothing to Hevy until I've read a diff and confirmed it. The rule is in the commit that added the planner, on 2 November 2026. I didn't want a model touching what I follow in the gym without me seeing it first.

Hevy is where I log my workouts. A routine in Hevy is a saved session: the exercises, the sets of each, and a target weight and a range of reps for every set. It's what I follow in the gym.

The planner is the part of Durandal that has a model draft those routines, through the Claude API. The diff is a list of what would change, line by line, against what's in Hevy right now. Personal software, again tells you how the app started. This is the road from a draft to a write.

What the model can't touch

The training frame is fixed, and the model doesn't get a vote. A cycle is 7 weeks: six build weeks and a light week 7. The week has five main sessions and one optional: Mon Push, Tue Pull, Wed Legs, Thu Upper, Fri Lower, Sat Active Recovery.

Each exercise of a main session has 2 working sets, and one of the recovery session has 1 or 2. Warm-ups go only on the first compound lift of a session, and on heavy lower-body lifts. A superset, two exercises back to back, is allowed only for a pair of isolation exercises or machine exercises.

The frame lives in two places. One is the skill file, the instructions the model works from. The other is a function in Swift that checks every draft. The skill file asks the model to keep to the frame. The function doesn't ask. It rejects a draft that breaks a rule it knows.

Four kinds of proposal

A proposal is a draft that waits for my answer. Two words first. A check-in is a look at the cycle so far: I ask for one with the button check in on this cycle, or I ask the coach, the chat part of the app, and pass its reply on. The report is a text about the whole cycle, which the model writes from week 7 on.

Four kinds of proposal
KindWhenWhat the model returns
cycle routinesa cycle startsall six sessions
routine changesafter a check-inonly the sessions that change, each in full
light weekweek 7the five main sessions, each working weight about 15% lower
next cycleafter the reportall six sessions; the request is for 2 new exercises at most

"Each in full" has a dull reason: Hevy's update replaces a whole routine. The app can't send one changed set, so a draft that changes one set has to carry the complete routine.

The next cycle leans toward the two muscle groups that the report names as the slowest.

From a draft to a proposal

Before the model writes a word, the app reads Hevy: the exercise templates, the new workouts, and the current routines. It reads the routines back so that an edit I made in Hevy by hand counts. The next draft starts from my edit, and the diff is against it.

How one proposal is madediagram

Every exercise in Hevy has a template id, and a routine names its exercises by id. The app fetches the list of templates at most once a week and hands it to the model.

The draft comes back as one JSON object, and the API makes the model keep to a fixed shape, a schema: a summary, a list of changes, the muscle groups in focus, and the routines. Then the checks run. A draft fails when:

  • a session shows twice, or a new cycle doesn't have all six
  • the light week has the recovery session in it
  • a routine has no exercises
  • an exercise uses a template id that isn't in Hevy's list
  • an exercise of a main session doesn't have exactly 2 working sets, or one of the recovery session doesn't have 1 or 2
  • an exercise has more than 2 warm-up sets
  • a set has no reps and no duration
  • a superset isn't a pair, or a session has more than 3 of them

The names in the proposal come from Hevy's list too, and each routine is named after its session: Mon Push. The model's own titles go in the bin.

A draft that breaks a rule gets one retry. The app sends the list of broken rules back in the same conversation and asks for the whole object again. If the second draft fails too, there's no proposal. The screen shows an error that starts the draft broke the framework twice and names the first three problems.

Some checks only warn. A session with more than 18 working sets, more than 2 new exercises in a new cycle, or any new exercise in the middle of a cycle doesn't fail the draft. Each becomes a line in amber on the proposal, with a ! in front. The comment on that function reads "you decide".

The diff

A proposal is kept in a file on the phone, so it's still there when I close the app. Its panel says waiting for you. The app opens on the today tab, and that tab shows one line that names the proposal, unless an error comes first.

The panel has the model's summary, the warnings, and under why one line for each change with its reason. Then each routine is a block of lines with a mark. Here's one, with invented numbers:

one routine of a proposal (invented numbers)text
mon push                                 16 sets
~ bench press (barbell)
  2 × 8–12 @ 55 → 2 × 8–12 @ 57.5
~ cable fly
  rest 1:30 → 1:00 · superset none → 1
+ triceps pushdown
  2 × 10–15 @ 25 · rest 1:00 · superset 1
− skull crusher
  removed
= 5 unchanged

The app draws the first line in capitals. 2 × 8–12 @ 55 is 2 sets of 8 to 12 reps at 55 kg. superset 1 puts an exercise in the first superset pair of the session. + is an exercise that's new, − is one that goes, and ~ is one that changes, with the old value and the new one. The exercises that don't change are only counted. A routine that's new in Hevy shows every exercise with a +.

Two buttons. write to hevy is the red one. discard asks me to confirm, and the question reads: nothing was written to hevy. you can ask for a new one.

One function writes

Every write to Hevy sits in one function, apply, and it runs only from the red button. It makes its requests in order. For a new cycle it creates a folder, durandal · cycle 2. Then, for each routine of the proposal, it updates the routine when the cycle already has one for that session, and creates it in the folder when not. After each request it saves how far it got.

The save is for a request that dies in the middle. Say the third routine of six fails. The first two are in Hevy and the app knows it. The error says nothing else was changed; confirm again to retry, and the second run doesn't create the folder or the first two routines a second time. It sends those two again as updates.

Three requests, no delete

The code has three write requests, and that's the whole list:

every write to hevytext
POST /v1/routine_folders     a folder for a new cycle
POST /v1/routines            a new routine
PUT  /v1/routines/{id}       replace a routine

There's no fourth. So:

  • It can't write a workout. The app only reads workouts. It has no request that changes what I logged in the gym.
  • It can't delete. There's no DELETE in the code. A new cycle gets a new folder, and the folder of the old cycle stays in Hevy.
  • The coach can't write. Its skill file says it can't change Hevy or the plan, and the app gives it no tool for it. After the coach replies, I can tap apply to routines. That hands the reply to the planner as advice, and what comes back is a proposal like any other, with a diff.
  • It can't write to Apple Health. The app asks for read access only.
  • The model can't edit the plan. The plan is the text the coach follows. I can edit it on the phone. The coach never does.

What the checks miss

A diff only helps if somebody reads it, and that somebody is me. So here's what the checks don't catch.

  • A wrong weight passes. The checks are about structure: ids, counts, pairs. A draft that puts 20 kg too much on a lift is valid JSON with 2 working sets. Only the diff shows it, and only if I read the diff.
  • Not all of the frame is checked. The function doesn't check where the warm-ups are, which exercises make a superset, or how much lighter the light week is. For those, the skill file and the diff are all there is.
  • The folders add up. An app that never deletes leaves one folder in Hevy for each cycle. The app never removes one.

Week 7 hasn't happened yet

Two of the four kinds can't have met a real week 7 yet. The planner is from 2 November. Week 7 of a cycle that started that day begins on 14 December. No test covers the planner, so the light week and the next cycle have to wait for that week.

Am I confident in the planner? It's too early to say. Week 7 will tell me.

Until then they're two doors in the app that nobody has opened.