Files
Excersise-Tracker/docs/SPEC.md
T

29 KiB
Raw Blame History

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

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, time sets, 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, afternoon isometric holds, daily walks and Monday/Friday stretching.
  4. Use rest/countdown and 10-minute EMOM timers during workouts.
  5. Edit routine parameters through the UI; log actual per-set reps, loads and hold/hang times, with a durable dated performance history and progress views.
  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, adequate touch targets and accessible timers.
  • 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; timers and logging
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, hold durations, 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, or full-body stretching on Monday/Friday. Afternoon contains the five isometric holds and daily hanging practice, with day-specific targets.
  • Dog walks are always accessible via a separate compact activity log/control rather than appearing as a third large workout section within either period.
  • 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, isometric holds in the afternoon and dog walks throughout the day.

4.1 Weekly structure

Day Morning Afternoon Additional
Monday Rest from resistance exercise Moderate isometric holds (RPE 5–6) Full-body stretch; three dog walks
Tuesday Pull 1 — Back + Core Easy isometric holds (RPE 3–4) Three dog walks
Wednesday Push 1 — Chest + Serratus Easy isometric holds (RPE 3–4) Three dog walks
Thursday Legs + Posterior Chain + Core Easy isometric holds (RPE 3–4) Three dog walks
Friday Rest from resistance exercise Challenging isometric holds (RPE 6–7) Full-body stretch; three dog walks
Saturday Pull 2 — Biceps + Grip + Abs Easy isometric holds (RPE 3–4) Three dog walks
Sunday Push 2 — Shoulders + Triceps + Core Easy isometric holds (RPE 3–4) Three dog walks

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 × 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, with per-side durations as shown. Start at one round; optionally progress to two rounds if recovery is good. Rest around 30–60 sec between holds.

Exercise Monday (moderate) Tue–Thu (easy) Friday (challenging) Sat–Sun (easy)
Deep squat hold 45 sec 30 sec 60 sec 30 sec
90/90 hip hold 45 sec / side 30 sec / side 60 sec / side 30 sec / side
Bird-dog hold 20 sec / side 15 sec / side 30 sec / side 15 sec / side
Single-leg balance 45 sec / leg 30 sec / leg 60 sec / leg 30 sec / leg
Prone swimmer isometric 20 sec 15 sec 30 sec 15 sec
Target intensity (RPE) 5–6 3–4 6–7 3–4

Bird-dog repetitions were removed from Tuesday because these holds occur daily. Longer holds should not become maximal effort or undermine morning training.

4.8 Daily hanging practice — afternoon

  • Hang from the pull-up bar every day, during the afternoon isometric session.
  • Goal is 120 seconds, but this is a target, not an assumed current ability or default completed duration.
  • Current successful continuous duration, number of attempts, whether hangs are weighted, and whether the two-minute goal is presently cumulative are not specified; do not invent these.
  • 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 Full-body stretching — Monday and Friday

Exercise Prescription
Standing calf stretch 30 sec / leg
Standing quadriceps stretch 30 sec / leg
Kneeling hip-flexor stretch 30 sec / side
Seated hamstring stretch 30 sec / leg
Figure-four glute stretch 30 sec / side
Doorway chest stretch 30 sec
Cross-body shoulder stretch 30 sec / arm
Child's pose with side reach 30 sec / side
Cat-cow 8–10 slow repetitions

Target 15–20 min, gentle stretching, one or two rounds as appropriate. Modify movements causing pain or uncomfortable spinal pressure.

4.10 Daily dog walks

  • Three walks every day, each typically 30–60 min.
  • 6 kg weighted vest currently used during walks.
  • Record actual minutes and optional vest load per walk rather than assuming every walk lasts the same time.
  • Permit a walk to be logged without a vest, particularly when fatigued after Thursday legs or when joints/back need reduced loading.
  • No automatic calorie-burn calculations in v1.

4.11 Global strength-training rules

  • Usually 2 min rest between sets, 2–3 min for demanding compounds, ~3 min between different exercises.
  • EMOM is time-based: each new set starts on a 60-second boundary, for 10 rounds. Count performed reps by round.
  • 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. Walk tracking stays accessible separately.
  2. Allow navigating to any date/day, not just a repeating abstract weekday; records are tied to actual local dates.
  3. Tap an exercise to open details. Start a set, log actual reps, load and/or duration and mark it completed; log individual sets independently and prefill only suggested values from the previous matching session (never mark them completed automatically).
  4. Timer presets based on the exercise; audible alert optional/muted by default, with visible completion feedback.
  5. End the session with a compact summary (completed sets, deviations and free-text notes).
  6. Partial workouts remain saved, and future plan edits do not rewrite previously logged performance.
  7. Log three independent walks (actual duration, optional vest load, completion); support more/fewer walks in future via editor.
  8. Check off isometric and stretch exercises and capture actual duration; log daily hang attempts in seconds and surface personal best and 120-second continuous-hang progress.
  9. Show previous performance and basic progress views without confusing prescribed and achieved values; retain previous records after routine edits.

Timer behavior

  • Rest countdown: pause/resume/reset, selectable presets including 60, 90, 120 and 180 seconds; custom duration later if useful.
  • EMOM: ten one-minute rounds, clear round number, visible countdown to next boundary, and per-round rep entry. Work/rest timing must use elapsed timestamps rather than incrementing an interval counter (avoid browser-tab drift).
  • Hold timer: countdown from prescribed hold length; optional per-side steps for bilateral holds.
  • Timers should remain accurate after tab/background throttling on return, although browser restrictions may limit background notification/audio. Never promise guaranteed background alarms.
  • One active timer at a time in v1; changing timers requires explicit cancel/replace.

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, equipment, muscles, instructions, cues, warnings, imageAssets, version
Routine id, name, version, effectiveDate, weeklySchedule
RoutineExercise exerciseId, day, sessionType, order, sets, repMin, repMax, targetDurationSec, perSide, restSec, loadKg, optional, notes
WorkoutSession id, date, sessionType, routineVersion, startedAt, endedAt, status, notes, sets
CompletedSet sessionId, exerciseId, sequence, reps, durationSec, side, completedAt, notes, load components (vestKg, dumbbellKgEach / dumbbellKg, ezBarTotalKg, bodyweightOnly when relevant)
HangAttempt date, sessionId, exerciseId, attemptNumber, durationSec, completedAt, notes (daily hangs distinct from Saturday finger hangs)
WalkLog date, walkNumber, durationMin, vestKg, completed, notes
BodyWeightLog date, weightKg, notes (optional entry)
Settings preferredUnit, soundsEnabled, timerPresets, dataSchemaVersion

The implementation may normalize or refine this model. Do not treat the suggested shape as frozen API contracts. Store actual loads, not just vest presets; the 6 kg and 10 kg loads are initial values. For dumbbells distinguish per-dumbbell mass from total load; for the EZ bar record bar plus plates as total load. Where a prescribed exercise involves vest plus dumbbells, store both rather than merging them into an ambiguous number.

7.1 Tracking requirements (v1, agreed)

  1. Save sets independently: achieved reps, any supported time/duration, actual resistance, side and optional notes. Preserve incomplete/partial sessions.
  2. For EMOM pull-ups and chin-ups, log ten distinct minutes, each with actual repetitions and vest load (initial 6 kg); permit zero/missed rounds. Support conventional-set sessions when the user switches training format.
  3. For weighted push-ups, track vest load (initial 10 kg); for applicable leg exercises record 10 kg vest plus any dumbbell load separately. No made-up dumbbell weights.
  4. For daily hangs, track each timed attempt, longest single attempt, accumulated time across attempts, and progression toward a continuous two-minute goal. Record Saturday finger-hang work separately.
  5. For other timed activities (isometrics, planks, carries, walks, stretches), log actual duration rather than treating the prescribed value as achieved. Per-side timing should remain distinguishable where relevant.
  6. Prefill suggested starting weights/reps/durations from the previous matching exercise/session, but require user action before recording completion.
  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, walks, 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.

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. Walk controls are a separate compact accessible element.
  • Exercise cards show: name, prescription, prescribed rest, load/vest preset, completed/remaining sets and an expandable description/image view.
  • Timers must be highly legible and operate with large touch targets.
  • 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; walk controls accessible separately; selected period persists T002
T004 Exercise-detail screen and local media placeholders; accessibility T002–T003
T005 IndexedDB repository, per-set and per-minute EMOM logging, weight components, hangs, walks/holds, history-safe migrations, JSON backup round-trip T002–T003
T006 Rest, hold and EMOM timers, elapsed-time correctness tests T003
T007 Routine editor: reorder, adjust prescription, optional exercises, persistence T005
T008 History and progress views (hang PB, loads, reps), responsive/accessibility polish, offline/PWA build, test pass and documentation T004–T007
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 show full-body stretching in the morning, and holds plus hangs in the afternoon; walks remain accessible independently.
  • Tuesday pull-ups and Saturday chin-ups are 10 × 60-second EMOMs with 6 kg vest presets and reps logged per round.
  • 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.
  • Holds correctly change between Monday, Tue–Thu, Friday and Sat–Sun targets.
  • Daily afternoon hangs appear all seven days with 2:00 goal, but no invented achieved value; multiple attempts produce longest-continuous and cumulative totals independently. Saturday finger hangs remain separate.
  • Monday/Friday full-body stretching lists all nine agreed movements.
  • Three daily walk slots initially show 30–60 min and 6 kg vest, but actual duration/load can be changed.
  • Weight presets on pull-ups/chin-ups (6 kg) and weighted push-ups/vested leg work (10 kg) display correctly; dumbbell loads are not invented.
  • 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.
  • Ten EMOM rounds accept different actual rep counts, including missed rounds; completed sets persist and previous recorded numbers can be offered as suggestions, not already-logged results.
  • Exercise history and simple progress charts display actual saved values; editing a future prescription leaves existing entries unchanged.
  • Timers pause/resume/reset correctly and EMOM remains accurate after background tab throttling.
  • 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, walk entries 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.