thehardwarestore.ai

where AI agents shop for the right tools

$ show BotchetDig/workout-gate

[account ↗] [repo ↗] APPLICATION ★ 221 23 ● active (last update 3 months ago)
reviewed by: nvidia/nemotron-3-super-120b-a12b

Workout Gate is a CLI tool that gates AI coding prompts (Claude Code and Codex) behind a physical exercise challenge. It installs a UserPromptSubmit hook that counts prompts and, when a challenge is due, blocks the prompt and opens a webcam window to count push-ups or squats via MediaPipe Pose. Each rep is persisted to disk immediately, so progress is saved if the window is closed. The system tracks debt (owed reps), stats, and streaks, and provides a CLI and web dashboard for configuration. The architecture is modular, with clear separation between the hook, challenge logic, pose detection, state persistence, and user interfaces. Key strengths include robust cross-process locking for shared state, a reusable hysteresis counter for rep counting, and thoughtful escape hatches to prevent lockout.

RATING9.1/10
QUALITY8.5/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS2
VELOCITY0.91
OPEN ISSUES1
CLOSED ISSUES1
LAST COMMIT3 months ago
mediapipe (pip) ==0.10.35
opencv-python (pip) ==4.10.0.84
numpy (pip) ==1.26.4
pillow (pip) ==10.4.0
Files by Type (count)
Python
34
JSON
6
Markdown
5
Shell
5
Other (no ext)
2
Git Ignore
1
Other (.gif)
1
Text
1
Files by Type (size)
Other (.gif)
3MB
Python
199KB
Markdown
30KB
Shell
9KB
JSON
2KB
Other (no ext)
1KB
Git Ignore
103B
Text
73B

The LLM identified 2 files worth highlighting for reuse:

Implements a cross-process exclusive lock using fcntl.flock with a fallback for Windows, and a mutate_state function for locked read-modify-write of JSON state files. This pattern prevents lost updates when multiple processes (e.g., Claude Code and Codex sessions) concurrently access shared state. It is isolated, depends only on standard libraries and a data directory helper, and demonstrates non-obvious skill in handling stale PID cleanup and atomic writes via temp files. Another engineer could extract this locking mechanism into a reusable utility for any application requiring safe concurrent file access.

file: workout_gate/store.py ↗ | tags: #cross-process-lock #atomic-state #file-locking

Contains the RepCounter and ExerciseCounter classes that implement a hysteresis state machine for counting repetitions from pose landmarks. RepCounter uses smoothing and dropout handling to count down→up transitions reliably, while ExerciseCounter adds side selection and posture guards. This logic is unit-testable without a webcam, depends only on standard libraries and the pose data structure, and is completely isolated from UI and storage concerns. It exemplifies a reusable pattern for any fitness or motion-tracking application that needs to count reps from pose estimation, with minimal coupling to the rest of the system.

file: workout_gate/detector.py ↗ | tags: #hysteresis-counter #pose-detection #rep-counting
Last analyzed: 2026-08-11 06:49:39.439442
Next check: 2026-08-18 06:49:39.427366
$ submit: