Context / Focus for Today
Massive codebase health day: deep refactoring across the entire stack to extract modules, eliminate dead code, and deduplicate logic. Over 6,600 lines deleted. On top of that, two significant features shipped — the AI Coach got native tool calling via AI SDK v2, and the kanban board got color-coded labels. Proactive recovery coaching landed with a new adapt_plan tool.
Things I Got Done Today
AI Coach: AI SDK v2 Migration (PR #316)
The AI Coach is now powered by AI SDK v2 with native tool calling — replacing the legacy parsing-based approach entirely.
- New coach route built on AI SDK v2 with native tool calling support
- Replaces hand-rolled parsing with structured tool invocations
- Modern streaming and tool execution pipeline
- Legacy coach routes and parsers deleted — -4,691 lines in a single commit
- The new approach eliminates an entire class of fragile string manipulation
Adapt Plan Tool & Proactive Recovery Coaching (PR #313)
- New
adapt_plantool enables the AI Coach to proactively suggest plan adjustments - Coach can now detect overtraining signals and recommend recovery modifications
- Integration tests for the adapt_plan handler
- Closes the loop on "training that adapts" — the coach doesn't just advise, it executes
Kanban Board: Color-Coded Labels (PR #315)
- Color-coded labels and tagging system for the kanban planning board
- Visual categorization of tasks by type, priority, or custom tags
- Quality-of-life feature for managing the growing feature set
AI Coach Reliability Fixes
- Reduce false positives in intent detection and surface parsing failures to users
- Fix stale saved paces being used when goal race pace is faster — workout targets now reflect current fitness
- Deduplicate intent detection logic between coach routes into a single source of truth
- Fix onboarding survey re-appearing for existing users
Codebase Refactoring Blitz (22 commits, ~6,600+ lines removed)
The single largest cleanup day in the project's history. Systematic decomposition of monolithic files into focused modules and hooks.
TCA & Coach Route Extraction:
- Extract large inline blocks from Training Calendar App and coach route (-1,971 lines)
- Extract
handleSendworkout processing, shared context building, and utility functions intolib/aimodules - Deduplicate coach route context builders into
lib/ai/context
Training Calendar App Hook Extraction:
- Extract into 5 custom hooks:
useWorkoutCrud,useGarminHandlers,useMetrics,useEvents,useWorkoutDeletion - Replace fetch boilerplate with
useFetchDatahook - Consolidate modal state
Factory Pattern & Deduplication:
- Consolidate grouped health processors and raw table upsert processors with factory pattern
- Deduplicate
safeUUIDacross codebase - Extract VDOT calculations to
lib/training
Dead Code Removal Sweep:
- Remove dead FIT exporter, auto-sync route, obsolete fixtures
- Remove dead FIT export routes and unused validation pipeline
- Delete 6 dead files, remove unused exports across 8 modules
- Remove 8 dead components/hooks, 2 unused deps, stale docs
- Remove standalone test scripts, dead brick templates, stale docs
- Remove unused imports and dead constants
Commits Today
- 37 commits — highest daily count on record
- 3 PRs merged: #316 (AI SDK v2), #315 (kanban labels), #313 (adapt_plan)
- Features: AI SDK v2 native tool calling, adapt_plan recovery coaching, kanban color labels
- Refactor: 22 commits extracting modules, hooks, and factory patterns
- Fixes: AI Coach false positives, stale paces, onboarding bug, intent detection dedup
- Tests: adapt_plan integration tests
Notes / Observations
- The AI SDK v2 migration is architecturally significant. Moving from hand-rolled parsing to native tool calling eliminates an entire class of fragile string manipulation. The -4,691 line deletion proves the new approach is a clean replacement, not an additive layer.
- The Training Calendar App went from a god-object to a composition of purpose-built hooks. Each piece is now independently testable.
- Factory patterns for health and upsert processors show the codebase is maturing — repeated patterns are being abstracted instead of copy-pasted.
- The
adapt_plantool with proactive recovery coaching is a meaningful product differentiator. Most training apps are reactive; this one can now proactively suggest plan adjustments based on fatigue signals. - The combination of deep refactoring + feature shipping + dead code removal shows a codebase being simultaneously built and cleaned.
Momentum Score: 10 / 10
Extraordinary day. Three features shipped (AI SDK v2 coach, adapt_plan recovery coaching, kanban labels) while executing the most aggressive refactoring session in the project's history. Over 6,600 lines of dead code removed, the Training Calendar App decomposed into focused hooks, and legacy parsing replaced by native tool calling. 37 commits — the project is simultaneously getting more capable and more maintainable.