Drag-to-reorder writes Routine.order through the document, which used to
read as a content edit: isPristine would fork a starter for a mere reorder,
and reconcile's semantic compare would clobber a reordered seed file back
to bundle order. Both now normalize order (and updatedAt) away — a fixed-
ULID file still never holds user content; ordering is bookkeeping.
SyncEngine gains restoreSeed(id:) — the per-seed analog of the bulk
restore, sharing one restoreSeedIfEligible core — and duplicate(routine:),
which copies any routine (starter or not) to a fresh ULID with fresh
exercise ids, a unique "… Copy" name, and last position in the list.
Claude-Session: https://claude.ai/code/session_01H8VxUX4ckjU3vRF5M4L5FV
Groundwork for the Library tab: RoutineOrdering.changedOrders turns an
.onMove gesture into the minimal set of order writes (normalizing legacy
colliding orders on first drag), RoutineNaming.uniqueName picks the next
free "X Copy" name for duplication, and ExerciseCatalog groups the bundled
exercise library into curated category sections with name/category/target
search. Plus ExerciseDocument.planSummary for read-only document rendering.
All covered by unit tests, including a motion/info name-parity assertion.
Claude-Session: https://claude.ai/code/session_01H8VxUX4ckjU3vRF5M4L5FV
Three solver defects made limbs teleport, twist, or windmill: write-back
angles wrapped at ±180 and lerped the long way around; branch flips landed
on configurations the anatomical write-back cannot represent, silently
pulling pinned extremities off their pins; and the degenerate straight-limb
bend plane fell back to the camera axis instead of the anatomical anterior.
solve_limb now verifies each branch reproduces the solved end before
accepting it, resolve unwraps written-back angles toward the pose they
replace, and the degenerate plane comes from the parent's anterior axis.
render.py --check replays every exercise's full tween loop and fails hard
on six invariants (pin fidelity, continuity, wraps, authored-vs-resolved
drift, ground penetration, resolved ROM); --export refuses to ship a
failing exercise. All 66 motions re-authored or retouched to pass: honest
authored angles where pins used to override them silently, grounded feet
on the seated machines, a vertical bench-press bar path, straight-armed
child's pose, a butterfly stretch seated on the mat, and FK arms where
pins forced impossible reaches. MotionSolver.swift mirrors the solver
changes line for line, held by regenerated fixtures.
Claude-Session: https://claude.ai/code/session_01PKptrgbx74peTwHGRxBojv
Editing a starter-seed routine forks it to a fresh ULID, but only workouts
were durably repointed — schedules kept the dead seed id, and after a
relaunch (empty in-memory redirect map) the Today board and edit form saw
the routine as gone.
- cloneSeedOnEdit now repoints schedules too (routineID + routineName
track the clone; a schedule's name is a live-pointer fallback, unlike a
workout's frozen run-as name)
- A launch-time repair pass (pure ScheduleRepairPlanner + tests) heals
already-broken references by re-attaching a dead-pointer schedule to
the unique live routine matching its remembered name
- ScheduleDocument/Schedule gain optional reminderMinutes (minutes from
midnight; decode-compatible, no schema bump)
- New Workout form gets a Reminder section (toggle + time picker, hidden
for Now; footer warns when notifications are denied)
- ReminderPlanner (pure, tested) derives notification triggers: daily
repeating, per-weekday repeating for fixed days, one-shot for once
- ReminderScheduler resyncs pending requests from the cache on every
change, multiplexed onto onCacheChanged after the watch push; asks
notification permission only once a reminder actually exists
- Due-filter schedules: daily always, fixed days by weekday, one-offs on
their date; rest days get an empty state
- Workouts with no due schedule row (ad hoc or off-day starts) now render
as their own board rows
- The + sheet is now "New Workout" with a "When" picker; "Now" (offered
when adding on today) skips the schedule and starts the workout directly
- Remove the times-per-week scheduling mode everywhere (enum, document,
entity, mappers, planner, seeds, tests)
The UX redesign's first landing (spec in UX-REDESIGN.md): ContentView
becomes a Today / Progress / Settings TabView, "Routine" replaces
"Split" in every user-facing string and view name (code-level types
keep their names), and workout starting moves to shared
WorkoutStarter / StartedWorkoutNavigator plumbing.
- New Progress tab: weekly goal streaks, workout trends, per-exercise
weight progression, achievements, and the full history list
(WorkoutLogsView -> WorkoutHistoryView).
- Goals: stable categories workouts roll up to, managed from Settings.
- New Meditation exercise + starter routine; timed sits record to
Apple Health as Mind & Body sessions.
Claude-Session: https://claude.ai/code/session_012qw2itfzKyEJ1HpsFt8Ex4
A single "Cardio" library entry (running-in-place figure, duration-logged)
plus a matching Cardio starter split tagged .cardio (HealthKit .mixedCardio),
so the Apple Watch records the real aerobic workout while the phone logs the
time — no per-machine cardio entries or schema changes.
Claude-Session: https://claude.ai/code/session_012qw2itfzKyEJ1HpsFt8Ex4
Adds WorkoutActivityType.warmUp (HealthKit .preparationAndRecovery) and
.stretching (.flexibility), and retags the six starter splits that were all
mislabeled as Functional Strength:
- Warm-Up: Upper Body Warm-Up, Lower Body Warm-Up, Morning Wake-Up
- Stretching: Morning Mobility, Full Body Stretch, Evening Stretch
The split editor's activity picker surfaces them automatically (CaseIterable).
Older app versions decode the new raw values as the default type — additive and
not schema-gated, so no quarantine.
Premium/enhanced voices ship with the tier in their name (e.g. "Ava
(Premium)"), so appending "— Premium" produced "Ava (Premium) — Premium"
in the voice picker. Move the label logic to SpeechSettings.displayLabel
and skip the suffix when the name already contains the tier (still
name-only for default voices). Deterministic string helper, unit-tested.
Claude-Session: https://claude.ai/code/session_01BQcEWmAPA78338QuEwRkAh
Speak exercise setup and form cues aloud with AVSpeechSynthesizer:
- Library detail: a speaker toolbar button reads the full reference aloud.
- Active workout: an opt-in "Speak Exercise Cues" setting speaks a brief
cue (Setup/Execution/Cues) when an exercise starts, hands-free.
- Settings › Voice: pick the voice (auto-prefers an installed enhanced/
premium English voice), a premium-download nudge shown only while on a
basic voice, and a Speed/Pitch/Volume sheet with Reset to Defaults.
On-device and offline; ducks other audio rather than stopping it. iPhone
only for now. Shared SpeechSettings is the single source of truth for the
voice/prosody, read fresh per utterance so changes preview live.
Claude-Session: https://claude.ai/code/session_01BQcEWmAPA78338QuEwRkAh
ingestFromWatch arbitrated by whole-document updatedAt, so concurrent edits
to the same workout on both devices (phone edits exercise A while the watch
completes exercise B) lost one side wholesale — the newer snapshot replaced
the other (H1).
Reconcile per log instead. WorkoutMergePlanner (pure, deterministic) unions
logs by id, resolves each by newest per-log updatedAt, and applies
phone-authored deletion tombstones so an absent log is never ambiguous
between "deleted on the phone" and "just added on the watch". Edits to
different exercises now commute — delivery order and offline gaps stop
mattering. A stale/duplicate push merges back to exactly the cached doc, so
ingest re-pushes authoritative state rather than writing.
The per-log updatedAt scaffolding shipped (unused) in schema v4; it's now
stamped by transition(to:) on status flips and a new touch() at the
content-only edit sites (order, notes, machine settings, adjusted entries,
new logs) on both phone and watch. deletedLogIDs is new: additive on the
wire and cache, phone-authored (deleteLog), pruned after a 30-day grace.
Because an older build rewriting a file would strip the tombstones and
resurrect a deleted exercise, WorkoutDocument schema bumps 4->5 (forward
gate quarantines old builds) and the cache bumps 5->6.
recomputeStatusFromLogs takes an injectable now: so the merge recomputes
status/end deterministically. WorkoutMergePlannerTests pins the decision
table (commute, per-log newer-wins, legacy-nil, watch-add, tombstone
honored/resurrect/union/prune, status recompute, no-op re-push);
WorkoutDocumentMapperTests gains the deletedLogIDs round-trip.
Live frames ride sendMessage, which is reachable-only — and phone→watch
reachability drops exactly when the user is swiping on the phone (wrist
down). A frame that failed to send was staged but never retried until a
reachability edge, and a frame lost outright desynced the run until the
next human transition — sometimes forever, since a reconnect could even
re-send the stale staged frame and yank the peer backwards.
Four fixes, symmetric on both bridges and both run screens:
- A send that fails while nominally reachable now retries with a short
backoff (a few times per staged message) instead of being swallowed.
- Receiving a frame that outranks the staged outbound one drops the
staged frame, so a reconnect re-send can't move the run backwards;
a delivery the staged frame outranks is ignored as stale.
- Every staleness comparison now tie-breaks the shared version sequence
on the frame's wall-clock anchor (LiveProgress.isNewer) — after a
lost frame both devices can mint the same version, and the later
human action must win.
- Durable repair: when the absorbed workout doc shows sets completed
beyond anything the open run screen recorded or followed, it jumps
forward to the first unfinished set's work page — a lost frame now
degrades to a briefly-stale page instead of a stuck one.
The orbit was always a real camera orbit — figure and props share one
rigid rotation — but a bar's screen-space angle authored the wrong 3D
rod: the default horizontal encoded a rod along the body axis, so
barbells hovered fixed on screen and vanished at the head-on view
where they should span widest. Line props now take "axis": "z" (both
renderers in lockstep, fixture-pinned): the world left-right direction
projects through the camera pitch like the floor quad — end-on plates
in profile, full span face-on, swinging with the hands in between.
Applied to the ten cross-body bars; vertical handles were already
orbit-invariant.
Goblet Squat's hand pins sat so close to the shoulders that the
two-bone IK was degenerate, flipping between a chicken-wing and an
elbow-behind solve; re-pinned level with the shoulders so the elbows
tuck straight down through the whole rep.
Claude-Session: https://claude.ai/code/session_01HJDQQDA9QdP8zByg43H5v3
The library grows to 64 exercises: arm circles, torso twist, leg
swings, hip and neck mobility, marching, calf raises, and a full
stretching set (forward fold, quad, calf, chest, triceps, hip flexor,
butterfly, cobra, child's pose), each with an authored motion rig and
reference page. Eight new starter splits join the catalog — Upper and
Lower Body Warm-Up, Morning Wake-Up, Morning Mobility, Full Body
Stretch, Evening Stretch, Free Weight Basics, and Full Body Machines —
regenerated deterministically at split schema v3 with fixed ULIDs.
Claude-Session: https://claude.ai/code/session_01HJDQQDA9QdP8zByg43H5v3
Every completed set now writes a SetEntry (reps/weight or seconds),
pre-filled from the plan by transition(to:) so the list checkbox, both
run flows, and One More all capture for free; reset clears, skip keeps
partials. The rest and finish pages show the just-done set as a pill
that opens a stepper sheet for correcting reps and weight (2.5 lb /
1.25 kg steps). The Weight Progression chart plots the top-set actual
weight and workout volume sums recorded sets, both falling back to the
plan for legacy logs via effectiveSetEntries.
Storage side of UX #3 rides along: plan weights are Double now.
Schema bumps: SplitDocument 2→3, WorkoutDocument 3→4 (a fractional
weight fails an older Int decode, and a rewrite would strip the
irreplaceable actuals), SwiftData cache 4→5. A per-log updatedAt is
reserved for the future cross-device log merge.
Claude-Session: https://claude.ai/code/session_01HJDQQDA9QdP8zByg43H5v3
iCloud Drive writes now flow through a persistent WriteBacklog sidecar
(drained with backoff, flushed on backgrounding, wiped with the cache on
account change), so a save can never be lost to a transient coordinator
error. A status banner on the workout list surfaces stuck syncing.
Also: the split picker gains a Recent section with day labels, split
rows fold SplitItem into SplitListView, and list rows dim the multiply
sign in sets-by-reps.
Claude-Session: https://claude.ai/code/session_01HJDQQDA9QdP8zByg43H5v3
Editing a workout's start date now removes the file at its old month
bucket so the record no longer duplicates on the next reconcile. Seed
reconcile re-checks the tombstone veto before overwriting an upgraded
seed. The watch applies authoritative-empty pushes so remote deletes
prune, and a re-saved finished workout keeps its original end time.
Adds unit tests for the mappers, path bucketing, and status machine.
Claude-Session: https://claude.ai/code/session_01HJDQQDA9QdP8zByg43H5v3
Abdominal's pinned hands used elbow -40 as the IK plane hint, drawing
the arms hyperextended (user-reported). Flipping the hint bends the
elbows the natural way while the hands stay on the handles. Same class
of fix for the milder cases: Arm Curl and Shoulder Press elbows and
Calfs knees clamp to -8, Side Plank's raised arm to the -70 ROM cap.
The whole library now passes render.py --strict with zero warnings,
making it a valid verification gate. Fixtures regenerated; 48 tests
green.
Claude-Session: https://claude.ai/code/session_01HJDQQDA9QdP8zByg43H5v3
render.py --export bundles the 25 new motion rigs and info pages;
figure-fixtures.json regenerated for all 47 (the Swift solver reproduces
every new motion, including negative-y pins and the new prop uses). The
fixture count assertion moves to 47, and the no-bundled-motion test now
uses Treadmill - a permanent COVERAGE.md exclusion - since Bench Press
exists. 48 tests green; watch target builds. Coverage handoff complete -
TODO-coverage.md retired.
Claude-Session: https://claude.ai/code/session_01HJDQQDA9QdP8zByg43H5v3
With the equipment layer carrying world-space 3D form, the prop-free
gate comes off: machines now get the same slow orbit as the bodyweight
moves, their seats, cables, bars, and rollers turning with the figure.
Closes out the orbit-for-all-exercises plan.
Claude-Session: https://claude.ai/code/session_01HJDQQDA9QdP8zByg43H5v3
Hollow Body Hold, Leg Raises, and Reverse Crunch hid the far arm
because it was never authored - a leftover from the planar rig. Both
arms are now posed, so the far arm reads as the standard light member
behind the near one, the same visual language every other exercise
uses, and the figures stay truthful from any viewpoint. With no
remaining users, the hide mechanism is deleted from both renderers,
the motion schema, and the docs.
Claude-Session: https://claude.ai/code/session_01HJDQQDA9QdP8zByg43H5v3
Scene shapes, cable anchors, bar angles, pad perpendiculars, and roller
offsets all resolve in the authored view exactly as before, then rotate
about the world-vertical axis through the root anchor - the same
resolve-then-rotate pattern as the figure's pins and the mat - so at the
authored yaw every exercise renders bit-identically to today, and under
an orbiting camera the equipment turns with the figure while staying
welded to its hands and feet. Scene lines gain an optional depth plane
(z) and slab extrusion (depth) so seats, backrests, and platforms keep
form edge-on; the rect shape is retired (re-authored as slab lines).
All 14 machines' props re-authored with depths and verified at eight
orbit angles. The fixture snapshots move into the pipeline as
render.py --fixtures and now cover orbit-presentation samples with
resolved prop primitives for a spread of prop flavors; the in-app
renderer resolves props in MotionSolver (lockstep with resolve_props)
and the view just draws primitives.
Claude-Session: https://claude.ai/code/session_01HJDQQDA9QdP8zByg43H5v3
The default camera pitches down 10 degrees, so the floor reads as a
plane (drawn as a rectangle) and near/far contacts straddle it.
Elevation is pure presentation - IK pins solve in the flat authored
view and the posed body tilts, the same pattern as the orbit, so
authored canvas targets never go out of reach. The leg-extension
roller moves up onto the shin above the ankle and the leg-curl roller
tucks under the heel. Fixtures and reference test values regenerated
for the pitched camera.
Claude-Session: https://claude.ai/code/session_01LEoff8bXGBS83tK1c55Mf7
Shoulder and pelvis widths grow to human-like proportions per profile
(shoulders wider than hips for neutral/male, reversed for female) and
are now drawn — bars across the attach points that read near-full-width
face-on and as a shoulder/hip nub in profile, so limbs visibly hang
from a torso instead of a point. Orbiting no longer re-solves IK pins
in the rotated view (pins are canvas targets in the authored camera):
the pose resolves first and the posed body rotates, which fixes hands
sticking to stale screen points mid-orbit (Cat-Cow, Bird Dog, Plank).
Leg Extension and Leg Curl swap their ankle bars for a machine roller
disc — a new `roller` prop riding the shin's press side. Fixtures
regenerated; both renderers updated in lockstep.
Claude-Session: https://claude.ai/code/session_01LEoff8bXGBS83tK1c55Mf7
Bodyweight motions (no equipment layer, no hide list) now turn the
camera a full revolution every 24 seconds while the motion loops, so
the exercise reads from every side; machine exercises keep their
authored view, since scene equipment is a view-locked billboard and a
hide list describes a single viewpoint.
Claude-Session: https://claude.ai/code/session_01LEoff8bXGBS83tK1c55Mf7
The library's planar world-angle rig becomes a genuine 3D anatomical
model: skeleton.json holds bone-length profiles (real shoulder/pelvis
widths, feet, neutral/female/male) and per-joint ROM; motions pose
joints with anatomical angles (flexion/abduction/rotation from neutral
standing) under a per-exercise orthographic camera, resolved by
kinematics.py (3D FK, analytic two-bone IK with anatomical write-back)
and validated against physiological ranges. All 20 sagittal motions
were migrated by planar decomposition with 0.00 px golden parity against
the old renderer — relabeled to true anatomy, since shading is now
near-dark/far-light by camera depth rather than by limb suffix — and
the face-on machines are re-authored honestly: Abductor/Adductor with
real hip abduction (the foreshortened "frontal" profile is retired) and
Rotary with genuine spine axial rotation. Figures gain articulated
feet; profiles swap without touching a single motion script; --orbit
sweeps the camera 360° while a motion loops.
The in-app SwiftUI renderer (iOS + watch) is ported to the same model
and consumes the exported motions verbatim; figure-fixtures.json pins
its geometry to the Python pipeline within 0.5 px across every
exercise, key frame, tween, and orbit sample. Also makes the watch
bridge logger nonisolated for the newer SDK's stricter isolation
checking.
Claude-Session: https://claude.ai/code/session_01LEoff8bXGBS83tK1c55Mf7
Library detail screens now lead with the user's recorded machine settings
(per-split when they disagree, empty-state card for machine-based entries)
and append the weight progression chart. Starter seeds mark machine
exercises with an empty machineSettings list so the settings UI lights up
before first use. The figure rig gains a frontal body profile for face-on
machines, props that can ride mid joints (knees/elbows), and an
alternating four-frame Bird Dog loop.
Claude-Session: https://claude.ai/code/session_01LEoff8bXGBS83tK1c55Mf7
Seeding now covers existing installs, not just empty containers: after the
same settle delay as auto-seed, connect() branches to reconcileSeeds(),
driven by a pure tested planner — upgrade an older seed revision in place
(safe: clone-on-edit guarantees no user content at seed ULIDs), skip
up-to-date/quarantined files, respect delete-veto stubs, and write missing
seeds unless a same-name legacy split exists. Settings gains Restore
Starter Splits (the one deliberate veto lift, writing current bundle
bytes) and a dev duplicate-cleanup tool backed by a fail-closed scanner.
The HealthKit estimate now follows the clone redirect when resolving a
workout's split.
Claude-Session: https://claude.ai/code/session_01LEoff8bXGBS83tK1c55Mf7
Machine-based exercises now carry ordered name/value comfort settings
(seat height, back-rest position, ...) on both ExerciseDocument and, as a
plan-time snapshot, WorkoutLogDocument — the optional array doubles as the
machine flag. Editable from the exercise editor's new Machine section and
from the workout row's settings sheet, whose mid-workout edits write back
to the originating split (workout saved first, so seed clone-on-edit
repointing can't clobber the log edit).
Schema tightening rides the same rev: splits bump to v2 (weight-reminder
fields and the unused exercise category removed), workouts to v3 (the
derived `completed` flag removed; status is the single source). Starter
seeds regenerated at v2 with unchanged ULIDs; SwiftData cache schema
bumped to rebuild. SCHEMA.md documents the shapes.
Claude-Session: https://claude.ai/code/session_01LEoff8bXGBS83tK1c55Mf7
Fourteen Planet Fitness machine exercises join the rig library, each with
authored motion, info page, and schematic equipment via the new props layer
(scene shapes, cables, bars, pads) rendered in lockstep by render.py and the
in-app figure renderer. Abductor and Adductor are authored face-on with the
real seated machine motion — knees-bent legs swinging apart/together against
knee pads — replacing the earlier middle-split depiction. The watch target
now bundles the figure renderer and motion rigs too.
Claude-Session: https://claude.ai/code/session_01LEoff8bXGBS83tK1c55Mf7
Starter splits ship as byte-canonical SplitDocument JSON with fixed
ULIDs (Workouts/Resources/StarterSplits, regenerated by
Scripts/generate_starter_splits.swift) and auto-seed after connect into
a verifiably empty container, re-checked after a settle delay — wrong
guesses are harmless because identical bytes make same-path conflicts
empty and tombstones reap resurrected seeds. Seeds are immutable:
SyncEngine.save(split:) forks an edited seed to a fresh ULID and
soft-deletes the original, whose stub is exempt from pruning
(IndieSync 0.3.0 prune(exempting:)) and vetoes resurrection forever;
split views resolve by id through a redirect map to follow the swap.
Add Starter Splits in Settings restores deleted seeds by lifting the
veto stub and rewriting the bundle bytes.
Also fixes ingestFromWatch bypassing the tombstone veto (a phone-deleted
workout resurrected when a stale watch resent it) and reaps a live file
immediately when its tombstone arrives.
SplitDetailView also picks up the category-grouped exercise sections
from the exercise-category work.
Exercise Library/ holds per-exercise reference docs (setup, cues,
mistakes, progressions) with SVG visuals and a Python-rendered motion
pipeline; Workouts/ExerciseFigure renders the bundled *.motion.json
rigs as animated stick figures on the exercise screen. Exercises gain
a warm-up/main-circuit category, timed exercises display hold time via
planSummary, and a completed exercise reopens to a check screen instead
of its timers.
No unit test target existed (testTargets: [] in scheme). Adds a
bundle.unit-test target wired into the Workouts scheme, with a smoke test
that round-trips SplitDocument through IndieSync's DocumentCoder — the
same codec DocumentFileStore uses for every iCloud document.