# Agents.md ## Current Task Build a simple Telegram time‑tracking bot in Go. ## Context Summary - **User requirements**: only clock‑in / clock‑out, auto‑infer breaks, onsite/remote flag (ask after first clock‑in), i18n (fa/en), SQLite storage, monthly .xlsx export, HTTP proxy support, Docker, CI via Gitea. - **Design decisions**: single user, event pairing logic, minimal SQLite schema, on‑demand Excel download, Docker multi‑stage, CI/CD workflow. - **Implementation plan**: 11 phases (scaffold → Docker → CI), with edge‑case handling (multiple clock‑outs, missed clock‑out, midnight sessions, time‑zone). ## Edge Cases Covered - Multiple clock‑outs → treat middle clock‑out as break start. - No clock‑out → blocked unless clock‑in first. - Midnight or overnight sessions → attributed to originating day. - Unpaired final event → indicates currently clocked‑in. - Remote work flag set after first clock‑in (default onsite). ## Edge Cases Checklist - [ ] Clock‑in/out validation (no duplicate in/out). - [ ] Onsite/remote flag storage. - [ ] i18n message loading (fa/en). - [ ] Excel file saved monthly and on demand. - [ ] Proxy configuration respected for all outbound traffic. ## Next Steps (TODO) 1. Scaffold repo & config loader. 2. Initialize SQLite DB and event models. 3. Implement Telegram bot core with proxy transport. 4. Add clock‑in / clock‑out handlers with validation. 5. Build event pairing & daily/weekly/monthly totals logic. 6. Create monthly .xlsx template and generation. 7. Implement day‑off handling and edit‑event UI. 8. Add Dockerfile, docker‑compose, and Gitea CI workflow. 9. Polish i18n, error handling, and edge‑case tests.