fitness-web/AGENTS.md

51 lines
2.2 KiB
Markdown

# Fitness Web Agent Notes
## Project Overview
Multi-user fitness tracking web app with AI coaching.
Replaces the fitness-agent markdown-based training repo.
## Related Repo
- `~/git/fitness-agent` — Training markdown logs, agent config, historical data, Juggernaut cycles
- This repo (`fitness-web`) is the web app successor. When this is fully operational, the old repo can be archived.
## Architecture
- **FastAPI** — async Python web framework
- **Jinja2 + Pico.css** — server-rendered templates with minimal CSS framework (CDN)
- **SQLite + SQLAlchemy 2.0 async** — database with aiosqlite driver
- **opencode serve** — AI coach service (Big Pickle model, free). Runs as a separate process/container.
## Key Files
- `app/main.py` — App factory, route registration, lifespan
- `app/config.py` — Environment-based configuration
- `app/auth.py` — Password hashing, session management, `get_current_user` dependency
- `app/models/` — SQLAlchemy ORM models
- `app/routers/` — Route handlers (one per feature)
- `scripts/schema.py` — DB initialization
- `scripts/seed.py` — Seed data (exercises, phases)
- `opencode/fitness-trainer.md` — Agent config for AI coach (copied from fitness-agent)
## Commands
```bash
uv sync # Install deps
uv run python scripts/schema.py # Create DB tables
uv run python scripts/seed.py # Seed initial data
uv run uvicorn app.main:app --reload # Dev server on :8000
```
## Key Decisions
- Session-based auth with DB-backed tokens (simple, no OAuth dependencies)
- SQLAlchemy async with aiosqlite (works well with FastAPI async handlers)
- SSE streaming for chat responses
- Pico.css from CDN (no build step)
- Chat messages stored in DB per session for history
- Docker Compose for deployment (opencode serve service commented out until ready)
## Next Steps / TODOs
1. Seed exercises and phases (done via `python scripts/seed.py`)
2. Add exercise progress chart (matplotlib or chart.js)
3. Enable opencode serve integration (uncomment docker-compose service)
4. Migrate existing markdown logs from fitness-agent repo into DB
5. Migrate Juggernaut training xlsx data into DB
6. Add calendar view for training history
7. PWA manifest + service worker for offline-capable mobile use