Files

380 lines
42 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Workout Tracker — Project Specification
**Status:** Handoff candidate v0.2 — planning baseline; implementation begins only when approved
**Project type:** Personal, offline-first training planner and tracker
**Implementation:** React, Vite, React-Bootstrap, vanilla CSS/SCSS as needed
**Backend:** None in initial version; IndexedDB local persistence behind a storage adapter
**Primary devices:** Debian laptop/desktop browser; responsive mobile browser
**Maintainer workflow:** Codex CLI + `roborto-project-context`, Git, isolated per-task branches/worktrees
## TASK-015 accepted implementation — 2026-11-04
TASK-015 implements metadata-driven equipment/measurement entry and was accepted by Captain on 2026-11-04 after the count-input and completion-checkbox refinements. Its UI brief is `docs/TASK-015_UI.md`. Legacy aggregate EMOM, repetition sets and weight-only sets remain preserved separately; new logging uses detailed versioned records. The app stays timer-free.
- Exercise definitions describe supported equipment and applicable measurements, independent of prescription targets and performed values. Use the complete assignment matrix in `WORKOUT_ROUTINE.md` section 8. No fixed vest weight belongs in definitions. Dumbbells used as push-up handles do not contribute lifted resistance.
- Reusable UI derives controls from repetitions, repetitions per side, duration, duration per side, distance when applicable, EMOM total reps and equipment-specific loads. Bodyweight-only work has no external-weight fields; supported external resistance accepts explicit zero. Dumbbells are entered per dumbbell; bars include the bar's weight.
- Log regular sets with independent load components and partial state. Explicit Save marks fully filled valid rows complete; no completion checkboxes are shown. Normal EMOM entry uses exactly one Weight (kg) input and one Total reps input (TASK-017 / ADR-020). Earlier aggregate/minute records remain separately accessible without conversion. Keep previous-session suggestions distinct from actuals and preserve next-set weight defaults.
- Show compact name/target/equipment/rest information and applicable logging, with expandable available instructions, muscles, technique and local media/placeholders. Reduce repeated visible labels while retaining accessible names; stack at mobile width without horizontal scrolling. Preserve date navigation, Morning/Afternoon switching and the wall clock.
- Afternoon holds may record actual seconds (per side where applicable) without repetitions, weights or prescribed hold times. Daily hang is bodyweight-only with an editable initial two-minute **continuous** target, optional attempts and independent longest/cumulative totals. Do not treat cumulative duration as continuous success.
- Preserve historical records and local edits independently of metadata changes. IndexedDB v3 adds performanceEntries and its matching-session index without rewriting the two older stores. New records use schemaVersion 1; JSON adapter backups use version 2 with a legacy version 1 envelope reader. Test old total-only/component records, existing goal overrides and old/new JSON round trips. TASK-009 still owns backup UI and user-facing import policy; the current adapter supports non-overwriting imports or explicit transactional replacement, with no Settings interface.
- Dog-walk classification is bodyweight-only; restoring walks to the UI/seed/logs is outside this task. No straight-bar exercise is added merely to support the equipment vocabulary.
- Captain resolved the timer question on 2026-11-04: keep the app timer-free. Preserve the local wall clock and prescribed rest/EMOM guidance; no timers or audio are added (ADR-018).
Full acceptance tests, dependencies, ownership boundaries, likely files and implementation gates are recorded under TASK-015. Earlier 6/10 kg prescriptions remain distinguishable from definitions and actuals; their optional future display must never determine equipment controls or prefill performance.
## 1. Purpose and success criteria
Build a small, maintainable, private workout application that replaces the weekly schedule document. It should make it easy to see today's session, understand correct exercise technique, record performance and change the programme without editing React source.
A successful first version enables the user to:
1. See the complete seven-day plan and today's prescribed sessions using a weekday strip and exclusive Morning/Afternoon switch.
2. Open each exercise's instructions, muscles involved, equipment, and image(s), with offline availability.
3. Complete and log morning strength sessions and afternoon isometric holds. Monday and Friday mornings are labeled Full body stretch routine; specific stretches will be provided later.
4. Record one weight and total reps for each EMOM exercise; log reps, per-side values, duration and equipment-specific loads per set as applicable.
5. Edit routine parameters through the UI; retain dated performance history and progress views, including total external-load volume without a time-based rate.
6. Back up and restore their own data without cloud accounts, analytics or external services.
### Out of scope for v1
- Authentication, registration, user profiles for multiple people.
- Flask/API/server database, cloud sync, background jobs, sharing/social features.
- Meal tracking, calorie estimation, automated coaching or training advice.
- Wearables and Apple/Google Health integrations.
- Generated exercise technique images without review, third-party hotlinked images, advertising, analytics or tracking SDKs.
- Automatic progressive-overload recommendations (manual review first).
## 2. Principles and constraints
- **Offline-first:** After the app has been loaded/installed, the UI, descriptions and images should remain usable without network connectivity. For a true PWA/offline reload, use a service worker and cache the app assets; development server operation alone is not an offline guarantee.
- **Private by default:** No account and no network transmission of workout records. No telemetry, ad networks, third-party font CDNs or remote image loading.
- **Editable routine:** Store prescribed programme separately from UI code. Changes made in-app must survive updates; historical sessions must retain what was actually performed even when the plan later changes.
- **No premature backend:** Keep storage behind an adapter to permit optional sync later without redoing the UI.
- **Transparent progress:** Track prescribed versus actual reps, load and duration; avoid made-up estimates.
- **Accessibility:** Keyboard navigation, clear focus states, readable text, screen-reader labels, reduced-motion respect and adequate touch targets.
- **Safety:** Show exercise descriptions as guidance rather than diagnosis. Allow pain/discomfort notes; do not force floor movements that hurt the user's prominent spine. Make vest load explicit per exercise.
- **Scope discipline:** Do not invent pages, new exercises or functionality beyond this spec without an approved decision/task.
## 3. Information architecture
Use **one responsive application** with these surfaces:
| Surface | Primary functions |
|---|---|
| **Today** | Current calendar day selected automatically; seven-day navigation strip; **Morning/Afternoon exclusive toggle**; show only selected period, not both stacked; strength recording |
| **Week** | Seven-day horizontal navigation strip and date navigation; changing weekday preserves selected Morning/Afternoon period |
| **Exercise detail** | Images, setup, step-by-step movement, technique cues, main/secondary muscles, equipment, common mistakes, variations, personal notes |
| **History & Progress** | Browse completed sessions by date; actual sets/reps/weights/times and notes; personal bests and basic trends, including longest continuous hang |
| **Plan editor** | Edit exercises, order, sets, rep ranges, the daily hang goal, weight presets, rest and session assignment |
| **Settings & data** | Export/import backup, unit preferences (kg), storage explanation, offline status |
Navigation should remain simple (top tabs or bottom navigation on mobile). Avoid creating an account or dashboard-heavy UI. **The day/period selector is the primary workout navigation**, not a page showing both periods. Weekday browsing alone must never create or complete a workout record.
### 3.1 Session view behavior (approved)
- Use a seven-day horizontal weekday strip, current calendar day selected initially; the user can navigate other actual dates for past/future weeks.
- Place a **Morning | Afternoon** segmented switch above the weekday strip. Only one period is displayed at a time; changing day preserves the period. Remember the last selected period locally.
- Morning contains the strength workout on five days and the Full body stretch routine heading, without exercise entries, on Monday/Friday. Afternoon contains the five isometric holds and daily hanging practice, with day-specific targets.
- Each exercise presents prescription and recorded progress, with access to an exercise detail panel (local images, form description).
- Viewing a day or changing the Morning/Afternoon toggle does **not** automatically start or mark a session complete.
## 4. Current programme — initial seed data
The following is **initial editable programme data**, not a permanent hardcoded schedule. Day order and exercise order are significant. Unless specified otherwise, exercises are performed in the **morning** and isometric holds in the **afternoon**.
### 4.1 Weekly structure
| Day | Morning | Afternoon |
|---|---|---|
| Monday | Full body stretch routine | Moderate isometric holds (RPE 5–6) |
| Tuesday | Pull 1 — Back + Core | Easy isometric holds (RPE 3–4) |
| Wednesday | Push 1 — Chest + Serratus | Easy isometric holds (RPE 3–4) |
| Thursday | Legs + Posterior Chain + Core | Easy isometric holds (RPE 3–4) |
| Friday | Full body stretch routine | Challenging isometric holds (RPE 6–7) |
| Saturday | Pull 2 — Biceps + Grip + Abs | Easy isometric holds (RPE 3–4) |
| Sunday | Push 2 — Shoulders + Triceps + Core | Easy isometric holds (RPE 3–4) |
No individual stretches or durations are specified for the Monday/Friday routine until the owner provides them.
### 4.2 Tuesday — Pull 1
| Order | Exercise | Prescription | Rest | Notes |
|---|---|---|---|---|
| 1 | Pull-ups | 10-minute EMOM; aim 3–4 reps/min | Until next minute | **6 kg vest.** Start at 4/min and drop to 3 as needed; work toward 4 reps each minute for 10 minutes. Occasionally switch to traditional sets. |
| 2 | EZ-bar bent-over rows | 4 × 8–12 | 2–3 min | Controlled torso position. |
| 3 | Single-arm dumbbell rows | 3–4 × 8–15 per side | 2 min | Alternative to previously easy shrugs. |
| 4 | Suitcase carries | 3 × 30–60 seconds per side | 1–2 min | Walk with weight on one side; avoid leaning. |
### 4.3 Wednesday — Push 1
| Order | Exercise | Prescription | Rest | Notes |
|---|---|---|---|---|
| 1 | Deep weighted push-ups using dumbbells as handles | 4 × 6–12 | 2–3 min | **10 kg vest.** Stable dumbbell handles; controlled depth. |
| 2 | Dumbbell floor flys | 3–4 × 8–15 | 2 min | Heavier standalone flys. **Floor press removed** from previous fly/press combination. Cushion back or modify if pressure on spine is uncomfortable. |
| 3 | Push-up plus | 2–3 × 12–20 | 1–2 min | Initially unweighted; full controlled scapular protraction; placed before final push-up exercise. |
| 4 | Feet-elevated weighted push-ups | 3 × 8–15 | 2–3 min | **10 kg vest.** |
### 4.4 Thursday — Legs
| Order | Exercise | Prescription | Rest | Notes |
|---|---|---|---|---|
| 1 | Bulgarian split squats | 4 × 8–12 per leg | 2–3 min | **10 kg vest + dumbbells.** |
| 2 | Single-leg Romanian deadlifts | 3–4 × 8–12 per leg | 2–3 min | Posterior chain and erector stabilization; use dumbbells as appropriate. |
| 3 | Squats | 4 × 8–12 | 2–3 min | **10 kg vest + dumbbells.** |
| 4 | Single-leg calf raises | 4 × 10–20 per leg | 2 min | Vest load as tolerated. |
| 5 | Front plank | 3 × 30–60 seconds | 1–2 min | Replaces supine weighted crunch because floor pressure on spine is uncomfortable. |
### 4.5 Saturday — Pull 2
| Order | Exercise | Prescription | Rest | Notes |
|---|---|---|---|---|
| 1 | Chin-ups | 10-minute EMOM; aim 3–4 reps/min | Until next minute | **6 kg vest.** Occasionally switch to conventional sets. |
| 2 | Hanging knee raises | 3 × 6–12 | 1–2 min | Controlled pelvic curl; avoid swinging; doubles as grip work. |
| 3 | Finger hangs | 2–3 sets, duration tracked | 1–2 min | Reduced from 4 sets because hanging knee raises add grip volume. |
| 4 | Single-arm preacher curls over a chair | 3–4 × 8–12 per arm | 2 min | |
| 5 | Hammer curls | 3 × 10–15 | 2 min | Replaces wrist curls; **EZ curls removed** to reduce redundant biceps work. |
### 4.6 Sunday — Push 2
| Order | Exercise | Prescription | Rest | Notes |
|---|---|---|---|---|
| 1 | Standing single-arm dumbbell shoulder press | 4 × 8–12 per arm | 2–3 min | |
| 2 | Leaning single-arm lateral raises | 3–4 × 10–15 per arm | 2 min | Full rep + half rep technique. |
| 3 | Bent-over rear-delt flys | 3 × 12–20 | 2 min | |
| 4 | Lying dumbbell triceps extensions | 3–4 × 8–15 | 2 min | Existing bed-supported variation; substitute standing if back/spine is uncomfortable. |
| 5 | Single-arm triceps extensions | **Optional** 2–3 × 10–15 | 2 min | |
| 6 | Side-plank hip raises | 3 × 10–20 per side | 1–2 min | |
### 4.7 Daily isometric routine — afternoon
Each row is **one hold**, without a prescribed time. Start at one round; optionally progress to two rounds if recovery is good. Do not show duration targets. The persistent local time clock remains visible.
| Exercise | Side guidance |
|---|---|
| Deep squat hold | — |
| 90/90 hip hold | Per side |
| Bird-dog hold | Per side |
| Single-leg balance | Per leg |
| Prone swimmer isometric | — |
Target intensity (RPE): Monday **5–6**; Tuesday–Thursday **3–4**; Friday **6–7**; Saturday–Sunday **3–4**. Bird-dog repetitions were removed from Tuesday because these holds occur daily.
### 4.8 Daily hanging practice — afternoon
- Hang from the pull-up bar **every day**, during the afternoon isometric session.
- Goal starts at **120 seconds** and can be changed in the app; it is a target, not an assumed current ability or default completed duration.
- Current successful duration and number of attempts are not specified. The goal is explicitly continuous; daily hangs are bodyweight-only. Never default performed duration to the goal.
- Allow logging multiple attempts separately, in seconds, with **longest continuous hang** and **total cumulative hang time** computed independently. A 120-second cumulative total is not equivalent to one continuous 120-second hang.
- Keep Saturday finger hangs as distinct morning exercises, independent of the daily afternoon hang.
- Watch for accumulated grip, finger, elbow and shoulder fatigue; exercise logging must not force completion.
### 4.9 Global strength-training rules
- Usually **2 min** rest between sets, **2–3 min** for demanding compounds, **~3 min** between different exercises.
- EMOM remains a prescribed ten-minute protocol with a new start each minute. Record one actual weight and one actual total-reps value for the exercise/session.
- Increase load or exercise difficulty after consistently reaching the top of a rep range with clean technique.
- Allow recording actual load, reps and time even when they differ from the plan.
- Morning resistance training takes priority over optional higher-effort afternoon sessions.
## 5. Exercise library and media
Each exercise has a stable `exerciseId` and human-readable name, category, equipment, main/secondary muscles, setup, numbered technique steps, form cues, common mistakes, regressions/progressions, safety notes, and an ordered list of local images (e.g. `start.webp`, `end.webp`).
**Image rules:**
- The app must be usable before illustrations are available; use a clear labeled placeholder.
- Images can be commissioned/created or sourced only with suitable rights; track origin/license in metadata.
- Do not hotlink remotely or bundle copied copyrighted imagery without permission.
- Illustrations should match the *actual variant* (e.g., vested push-ups on stable dumbbell handles, floor flys, hanging knee raises) and be reviewed for technique accuracy.
- Provide descriptive alt text and potentially two stages (start/end) for moving exercises.
- Images are part of app assets and update through normal Git deployments; personal exercise notes are user data.
## 6. Interaction and session flow
1. Default to **Today**, selecting its actual date and the last-used Morning/Afternoon period; show only that period.
2. Allow navigating to any date/day, not just a repeating abstract weekday; records are tied to actual local dates.
3. Expand Exercise details for available notes and honest content/image placeholders. Enter one weight and total reps for EMOM; regular sets retain metadata-selected measurements and load fields. Per-side exercises use one reps or seconds input per set, applying to each side (ADR-021). Adding a set copies loads/count but leaves measurements blank. Save performance marks fully filled valid rows complete; incomplete rows remain saved drafts. Never mark targets or suggestions as performed automatically.
4. End the session with a compact summary (recorded sets, deviations and free-text notes) when session summaries are implemented.
5. Partial records remain saved, and future plan edits do not rewrite previously logged performance.
6. Save isometric duration drafts without requiring completion; completed holds have actual seconds (per side where applicable). Daily hang attempts in seconds produce separate longest-continuous and cumulative totals and continuous-goal status. Long-term personal best history remains TASK-008.
7. Show previous performance and basic progress views without confusing prescribed and achieved values; retain previous records after routine edits.
### Suitcase-carry recording
Suitcase carries retain their prescribed duration per side and accept one actual seconds-per-side input plus dumbbell kilograms per dumbbell and count per set, without requiring repetitions. Existing TASK-014 weight-only rows (`load-sets`) remain separately available; no achieved duration is inferred from them. Timed work contributes no rep-load volume.
### Plank recording
Front planks accept actual seconds and vest kilograms per set without repetitions. Side-plank hip raises accept one reps-per-side input and vest kilograms. Neither has dumbbell/bar fields or assumed load. Different sets may use zero or different loads. Older bodyweight-only or weight-only records stay in their original representation and are never converted automatically.
### Clock and recording behavior
- Show the current local time in the persistent app header across all views. It is a time-of-day display and does not record workout duration.
- Do not show workout, exercise, rest, or EMOM timers or audio cues.
- Keep EMOM duration and rest guidance as prescriptions only. A new EMOM entry has one weight and one total-reps input with no minute table or mode switch; regular entries have applicable measurements, load/count and completion per set. Dumbbell fields mean kilograms per dumbbell. No exercise shows a dumbbell-count input; its defined count supplies new rows and remains stored for load calculations. Existing recorded counts are preserved. Preserve older single-total entries without interpreting them as components.
- Browsing dates does not create workout records. Saving a strength entry writes the selected date and exercise only.
## 7. Local data architecture
Use **IndexedDB** for persistent routines, exercise definitions if editable, logs, notes and settings. Keep bundled seed routine and base exercise descriptions/images in versioned JSON/JS assets. Use `localStorage` only for small UI preferences if desired.
**Implementation approach:** use native IndexedDB behind a tested async storage/repository adapter, or a lightweight dependency such as `idb` if approved during implementation. React components must not call IndexedDB directly. Use indexed, date-scoped queries rather than saving one monolithic app object. Transactions must preserve consistency across session and set writes. Ensure useful error handling for quota failures, blocked upgrades and unavailable/private browser storage.
IndexedDB is **per browser profile and origin**, not a server database; a laptop and phone have separate records. Avoid making persistence depend on running Vite. Serve the built application from a stable origin for reliable data retention; a bundled PWA/service worker can enable offline reloads, subject to browser restrictions.
### Suggested entities
| Entity | Essential fields |
|---|---|
| `ExerciseDefinition` | `id`, `name`, `category`, `version`, `equipment`, `measurement`, optional `dumbbellCount`, `protocols`, support-role notes; future `muscles`, `instructions`, `cues`, `warnings`, `imageAssets` |
| `Routine` | `id`, `name`, `version`, `effectiveDate`, `weeklySchedule` |
| `RoutineExercise` | `exerciseId`, `day`, `sessionType`, `order`, `sets`, `repMin`, `repMax`, `targetDurationSec`, `perSide`, `restSec`, `loadKg`, `optional`, `notes` |
| `RoutineOverride` | `dailyHangGoalSec` stored separately from the bundled seed |
| `LegacyStrengthEntry` | Original aggregate `emom`, repetition `sets` or weight-only `load-sets`, including component or unclassified `externalKg` values |
| `PerformanceEntry` | `schemaVersion`, `date`, `period`, `exerciseId`, `format`, saved `definition`, saved `prescription`, and actual `rows` |
| `LegacyCompletedSet` | `exerciseId`, `sequence`, `reps`, `side`, `notes`, and load components (`vestKg`, `dumbbellKgEach` / `dumbbellKg`, `ezBarTotalKg`, `bodyweightOnly` when relevant); later work may support variable dumbbell counts |
| `HangAttempt` | `date`, `sessionId`, `exerciseId`, `attemptNumber`, `durationSec`, `completedAt`, `notes` (daily hangs distinct from Saturday finger hangs) |
| `BodyWeightLog` | `date`, `weightKg`, `notes` (optional entry) |
| `Settings` | `preferredUnit`, `dataSchemaVersion` |
New detailed entries live in `performanceEntries`, keyed by local date, period and exercise. The compound exercise/period/format index supports compatible previous-session queries. Each record has `schemaVersion: 1`, identity, format, a definition snapshot, a prescription snapshot and rows `{values, load, completed}`. Measurement keys are reps/leftReps/rightReps/seconds/leftSeconds/rightSeconds/metres as applicable; load keys are vestKg/dumbbellKgEach/dumbbellCount/ezBarTotalKg/straightBarTotalKg. Missing draft values are null, never assumed zero. Completion is derived only on explicit successful Save: fully filled valid rows are complete and incomplete rows remain drafts. Only valid completed rows contribute achieved totals. Historical snapshots are independent of current metadata.
The earlier `strengthEntries` store is kept verbatim, including aggregate EMOM, component sets, total-only sets and weight-only rows. It is exposed in an original-record disclosure with the existing explicit editor; new detailed entries do not overwrite or double-count it. There were no shipping backup files before TASK-015: adapter JSON v1 represents the two legacy stores and v2 all three. Import validates the complete file before opening one transaction, rejects unsupported versions/duplicate keys, and rolls back failed imports. Replacement is an explicit adapter option; TASK-009 owns confirmation and UI. The backup includes bundled reference data and saved snapshots; it does not overwrite the running seed or create a routine editor.
### 7.1 Tracking requirements (v1, agreed)
1. Save regular strength sets independently with actual reps and external weight, without external-weight controls for bodyweight-only work. Explicit zero is valid where external resistance is supported. Preserve partial records and separate them from prescription values.
2. For EMOM pull-ups and chin-ups, save one total-reps value and one vest weight. Keep the ten-minute protocol visible without running a timer. The normal EMOM entry has no format switch.
3. For weighted push-ups, track vest load (initial prescription 10 kg); for applicable leg exercises record actual vest and dumbbell load separately. Dumbbell floor flys record kilograms per dumbbell with a fixed count of two, without vest or count fields. No made-up actual weights.
4. For daily hangs, track each timed attempt, longest single attempt, accumulated time across attempts, and progression toward the current editable goal (initially two minutes). Record Saturday finger-hang work separately.
5. For other timed workout activities (planks and carries), log **actual** duration rather than treating the prescribed value as achieved. Incomplete hold drafts may omit times; completion requires actual durations. Record sides independently where relevant.
6. Offer Use previous session for compatible earlier detailed records. Fill only an empty current draft, reset completion, and never save automatically or reinterpret legacy totals.
7. Show dated exercise history, previous vs current performance and straightforward progress charts/personal bests (particularly vest load, reps, hang duration, optional body weight). Do not fabricate missing data or equate different loading modes in comparisons.
8. Never rewrite completed history following routine edits, reseeding, changes to exercise definitions or app upgrades. Future routine edits only change future prescriptions.
9. Export all workouts, hang attempts, plan edits, and optional body-weight records to a **versioned JSON backup**; validate on import and ask before overwriting/merging existing records.
10. Avoid external analytics and automatic calorie estimates; training data remains local and private.
11. For a workout's **total external-load volume** (kg·reps), sum `actual reps × actual external kilograms moved` across completed regular sets and new aggregate EMOM entries; preserved historical minute entries retain their individual calculations. Retain original aggregate calculations separately when displaying legacy history; do not count both representations together. External load includes recorded vest mass, actual dumbbell mass times count, and EZ/straight-bar total as applicable; it excludes body weight. Do not invent missing load components. Show the formula and raw total, and mark partial or incomplete data. Timed holds and hangs do not contribute rep-load volume. Do not calculate volume per minute.
### Data integrity and update rules
- Seed programme on first run only from `docs/WORKOUT_ROUTINE.md`-aligned bundled data; avoid overwriting edits during app upgrades. This document is authoritative for initial prescribed workout data, while subsequent in-app edits become authoritative locally.
- Use migrations on schema changes; retain old backups and test migration from prior versions.
- Workout history must be immutable in substance unless the user explicitly edits or deletes an entry.
- Show export/import controls for versioned JSON backups (with schema validation and import confirmation); consider CSV export for history later. Export must contain enough metadata to reimport into a new browser/profile. Include an explicit backup recommendation because site data can be cleared/evicted.
- Make clear that local data is **device/browser-specific** and can be lost if browser storage is cleared, browser data is evicted, or a profile is removed. Request persistent storage where supported, but **do not promise permanence**. Do not add intrusive backup reminders or subscription-like prompts. Only create user-initiated reminders if requested.
- Multi-device sync is **not available in v1**. Export/import is the manual transfer path; optional API sync is a future decision.
## 8. Visual and UX direction
- Calm, minimal, readable, keyboard-usable layout; neutral/dark styling with clear completion emphasis. Respect light/dark preference if feasible without a large theme system.
- The weekday strip and **Morning/Afternoon toggle** should be immediately visible. Display **only one selected session period** on screen, never both together.
- Exercise cards show: name, prescription, relevant equipment, prescribed rest, only applicable actual logging controls, and an expandable detail view with available notes and missing-content/media placeholders.
- The persistent local time clock remains legible at phone and desktop widths.
- Avoid busy gamification, badges/streaks and unnecessary dashboards.
- Responsive at mobile widths; no horizontal scrolling for primary interaction.
- Keep the content editable and data-centric, rather than a static copy of this document.
## 9. Release scope and development tasks
Use separate Codex tasks and isolated branches/worktrees in the repository context workflow. Suggested grouping:
| Task | Deliverable | Dependencies |
|---|---|---|
| T001 | Repo/bootstrap: Vite + React + React-Bootstrap; project context docs; lint/test scripts; basic responsive shell | None |
| T002 | Exercise definitions and accurate **seed** routine for all seven days; validation tests | T001 |
| T003 | Day navigation and exclusive Morning/Afternoon views; selected period persists | T002 |
| T004 | Exercise-detail screen and local media placeholders; accessibility | T002–T003 |
| T005 | Extend TASK-014 records with hangs, holds, other performance details and history-safe migrations | T014 |
| T006 | Superseded timer task; the local time clock and hang-goal editor remain | T003 |
| T014 | Completed timer-free original-format recording baseline | T002–T003 |
| T015 | Metadata-driven detailed sets/minutes/attempts; compatible storage and JSON adapter | T014 |
| T007 | Routine editor: reorder, adjust prescription, optional exercises, persistence | T005 |
| T008 | History and progress views (hang PB, loads, reps, total external-load volume), responsive/accessibility polish, offline/PWA build, test pass and documentation | T004–T007, T014 |
| T009 (content) | Produce and review licensed/local exercise illustrations for the actual variants | T004; may run separately |
Do not implement all tasks as a single unreviewed change. Define task boundaries, run unit/integration tests and manually review the UI before merge.
## 10. Acceptance tests
- [ ] Today defaults to current local calendar date; seven-day strip works across weeks; exclusive Morning/Afternoon toggle remembers its state and does not show both periods at once.
- [ ] Monday and Friday mornings show “Full body stretch routine” with no invented exercise entries; afternoon holds and hangs remain.
- [ ] The local time clock remains prominent and readable at phone and desktop widths while navigating the app.
- [ ] Tuesday pull-ups and Saturday chin-ups retain the **10 × 60-second EMOM** prescription and 6 kg vest presets, while actual performance uses one total-reps and one weight input.
- [ ] Wednesday flys have **no floor-press drop set**; push-up plus precedes feet-elevated push-ups.
- [ ] Thursday includes single-leg RDLs and front planks, **not weighted floor crunches**.
- [ ] Saturday includes hanging knee raises, 2–3 finger-hang sets, preacher curls and hammer curls; **no EZ curls or wrist curls**.
- [ ] Sunday includes optional single-arm triceps extensions and side-plank hip raises.
- [ ] Afternoon isometric holds show no time targets; day-specific effort guidance remains.
- [ ] Daily afternoon hangs appear all seven days with an initially **2:00 goal** that can be changed and survives reload, but no invented achieved value or vest detail; multiple attempts produce longest-continuous and cumulative totals independently. Saturday finger hangs remain separate.
- [ ] Equipment capabilities contain no fixed weight. Historical 6/10 kg values remain prescription context only and do not determine inputs or prefill actuals.
- [ ] Users can enter vest and dumbbell loads separately, total EZ-bar load, per-side values, recorded reps, hold/carry durations, and optional body-weight entries.
- [ ] EMOM total reps/weight and regular-set measurements/weights survive reload by date, period and exercise; prescribed values are never saved as performed automatically.
- [ ] Exercise-specific load components, hang attempts and untimed hold checkoffs can be extended without replacing existing strength records; old total-only entries remain available.
- [ ] Exercise history and simple progress charts display actual saved values; editing a future prescription leaves existing entries unchanged.
- [ ] Total external-load volume uses recorded reps and actual external weight without a time denominator; the display shows raw totals and flags partial or missing data.
- [ ] No workout, exercise, rest, or EMOM timer or audio control is present; the local time-of-day clock remains visible and updates across views.
- [ ] All exercise details work offline with useful text even if an image is absent.
- [ ] Routine edits persist after refresh/build updates and do not rewrite previous session logs.
- [ ] IndexedDB survives refresh/browser restart, saves partial sessions, and handles blocked/unavailable storage or upgrade errors clearly.
- [ ] Export → clear/test profile → import round-trip restores all records, including independent hang attempts, historical loads and plan edits.
- [ ] All major controls work with keyboard and on phone viewport.
- [ ] No login, API calls, analytics, third-party remote imagery or browser storage sync is required.
## 11. Open questions — not blockers to initial spec
1. **Where to deploy?** Laptop-local only initially, or self-hosted static site on your existing infrastructure? Both can use the same static build.
2. **Images:** Generate/review bespoke instructional illustrations or curate permissively licensed exercise drawings; both need review for exercise accuracy.
3. **Progress history:** Whether workout records should allow arbitrary additional sets and supersets in v1 or in a later version.
4. **Editor scope:** v1 should support modifying seeded routines; fully custom exercise creation may be a follow-up depending on implementation size.
5. **Synchronization:** Defer until a real multi-device need is confirmed; does not justify a backend now.
## 12. Handoff for Codex
1. Create/choose a dedicated repository for the workout app.
2. Run `roborto-project-context` for a **new** repository; follow its existing docs/task/decision conventions and consult `AGENTS.md` and `docs/*` before making changes.
3. Place this spec at `docs/SPEC.md` for application requirements and `docs/WORKOUT_ROUTINE.md` for the **authoritative initial training programme**. Verify both are consistent and promote unresolved choices to decisions only when needed.
4. Break implementation into tasks above or the closest matching project task format.
5. Implement one task per branch/worktree, verify tests/UI behavior, then review and merge.
6. Do not introduce Flask, cloud accounts, synchronization or additional exercises without an explicit decision.
---
*This is a design specification, not medical guidance. Adjust any exercise causing pain and seek clinical assessment for new or progressive spinal prominence, unexplained weight loss or persistent pain.*
### TASK-017 EMOM compatibility contract
New EMOM totals use schemaVersion 1, format `emom-total`, one row of reps/vestKg/completion and saved definition/prescription snapshots. Their `performanceEntries` key adds `:emom-total` to date/period/exercise identity, leaving the original detailed record untouched. IndexedDB stays v3; no records migrate on read. Earlier records are accessible only through an initially collapsed disclosure; it never invents an empty minute record for editing. New suggestions match earlier aggregate-format records only. If aggregate and original representations coexist for one session, use the aggregate as the current representation and never sum them. Blank values persist as incomplete drafts; valid zero remains explicit.
Adapter exports now use JSON envelope v3 and continue importing v1/v2 as well as v3. Older applications cannot read the new aggregate record format; retain the new application for restoring v3 backups. No Settings backup UI is added.
### TASK-017 side-input correction
Every per-side exercise, including Single-arm preacher curls over a chair, uses one Reps (each side) or Seconds (each side) input per set. Entering or clearing the input changes both stored side values together. Equipment inputs and prescription guidance remain unchanged. Existing unequal/partial side values are shown as read-only text with a blank shared replacement input; browsing or untouched Save does not choose a side or rewrite either value. Storage shapes, snapshots and per-side volume semantics remain unchanged.
## TASK-005 dated observations contract — 2026-11-11
This current contract supersedes earlier database/backup version descriptions for the TASK-005 candidate. Existing performance schemaVersion 1 and all original storage semantics remain unchanged.
- Session notes are optional plain text by local date and Morning/Afternoon period. Exercise notes are optional plain text by date/period/exercise ID, independent of aggregate/minute/legacy representation. These are dated observations, not permanent exercise-library instructions, per-set/minute notes or automatic previous-session suggestions. Limit 4000 characters; preserve entered text, treating blank/whitespace-only Save as removal.
- Body weight is an optional finite positive decimal kg measurement once per local date, shared across both periods; blank Save removes it. It does not contribute external-load volume and is never copied from targets or previous sessions.
- Each field has an independent explicit Save. Clear edits only its draft; Save confirms removal. Saving observations never saves/completes sets. Navigation follows existing discard-of-unsaved-draft behavior; late reads/save feedback cannot enter another date/period/exercise editor. Read failures disable overwriting and offer retry; write failures preserve drafts.
- IndexedDB v4 adds `workoutDetails`, preserving all prior stores/records. Keys: `date:period:session-note`, `date:period:exerciseId:exercise-note`, `date:body-weight`. Values have `schemaVersion: 1`, `kind`, `date`, applicable `period`/`exerciseId` and either `text` or `weightKg`. Validate identity, record fields, values and key consistency.
- JSON exports use envelope v4 with `workoutDetails`; imports accept v1/v2/v3/v4. Older envelopes contain no observation store; even an explicit old-format replacement preserves existing observations rather than inferring their deletion. V4 replacement covers all four stores atomically. Validate all records before mutation; duplicate/non-replacing import failures roll back all stores. Older app builds cannot open a v4 database or read v4 backups; retain this app version for restoring new data. No downgrade/rewrite of historical records and no backup UI in this task.
- UI composition and state/accessibility/responsive specification: `TASK-005_UI.md`. Existing programme notes remain distinct from personal observations. History charts remain TASK-008; backup interface remains TASK-009.
## TASK-008 history contract — 2026-11-11
History is now read-only, replacing its placeholder, with From/To date filters (initially all dates), saved-period filter, Refresh/Retry and Clear filters. Dates are newest first; row details mount on disclosure expansion. Show saved names/measurement/equipment and original actual values, completed/draft row counts, notes and daily weight. Counts never assert whole-programme session completion. Weight-only/notes-only dates do not become completed workouts. Body weight follows date range only because it is shared across periods.
A consistent readonly transaction validates keys/records across performanceEntries, strengthEntries and workoutDetails; no writes/migrations or backup changes are added. Current emom-total wins over original minute/set representation for the same date/period/exercise even if it is a draft. Preserve original rows in a separate disclosure excluded from current totals. Legacy records have only date/exercise identity and original recorded totals: period, completion and saved definition are unknown. If any detailed record exists for that date/exercise, keep the legacy data in a separate date-level disclosure and do not count it. Otherwise group it under Earlier records (period not saved), retaining original rep/load calculation; weight-only legacy data has no inferred reps or volume.
Detailed external-load volume sums completed actual reps × external kg from saved vest, dumbbell kg-each × saved count and bar totals. Reps-per-side include both saved side values, with originals shown. Timed/distance work and body weight contribute no rep-load volume; drafts are excluded. Show known completed-row totals with partial/missing-data qualifiers; arithmetic outside supported finite/safe-count ranges is unavailable, not zero. True zero remains valid. Original legacy externalKg is never reinterpreted through current definitions. Do not combine alternate representations.
Progress groups exercise/period/format/saved measurement-equipment-fixed-count signature and actual dumbbell-count modes. Legacy groups stay separate by original format/load-field modes. Offer compatible previous/current values, change, recorded high and metric selection (reps, known volume, highest actual external load, duration/distance, longest/cumulative hang as appropriate). Partial records remain labelled; no adjustment for number of sets or estimate of missing performance. Hanging exercise IDs remain independent. Daily weight has a separate date-only trend with no preferred direction. Local SVG plots have normal-sized HTML date/scale labels and accessible exact recorded-value lists; missing values break lines and one point does not invent a comparison. No new dependencies, editing/deleting history, backup UI, recommendations, calories, streaks or time rates. UI/acceptance brief: TASK-008_UI.md; durable choices: ADR-023.