feat(wins): add delete_tiny_win and get_wins_by_day tools (#2)
* feat(wins): add delete_tiny_win and get_wins_by_day tools
Add two new Letta tools for the tiny wins system:
- delete_tiny_win: Allows deleting a win by ID if recorded by mistake
- get_wins_by_day: Get wins for a specific day with timestamps
- Supports "today", "yesterday", or YYYY-MM-DD date format
- Returns wins with time of day, category breakdown
- Human-readable date labels (e.g., "Monday, Dec 9")
The existing createdAt timestamps are now exposed in the API results,
enabling per-day breakdown views for tracking progress over time.
* docs: add tiny wins documentation to README and CLAUDE.md
- Add Features section to README with tiny wins tool reference
- Document all 4 wins tools (record, delete, get_wins_by_day, get_wins_summary)
- Add wins.ts to project structure
- Mark M4 milestone as complete
- Add Tiny Wins Tools section to CLAUDE.md for AI agent reference
* fix(wins): use local timezone for date string formatting
Fix timezone bug where dateStr used UTC via toISOString() but date
boundaries used local time. In positive UTC offset zones, early morning
queries could return a dateStr from the previous day.
Added formatLocalDate() helper that formats dates as YYYY-MM-DD using
local timezone components (getFullYear, getMonth, getDate) instead of
converting to UTC.
* fix(wins): validate date format and handle whitespace consistently
Address two bugbot review comments:
1. Invalid YYYY-MM-DD dates: Added isNaN(start.getTime()) check to
reject dates like "2024-13-45" that match the regex pattern but
create Invalid Date objects. Falls back to today on invalid dates.
2. Inconsistent whitespace handling: Changed regex to use periodLower
(trimmed input) instead of raw period, so " 2024-12-15" is handled
the same as "2024-12-15" rather than falling back to today.
---------
Co-authored-by: Claude <noreply@anthropic.com>