Commit Graph

1 Commits

Author SHA1 Message Date
Claude
ce6077be0c feat(briefing): morning briefing + approval queue
Implements the Morning Briefing and Approval Queue feature — the first step
from tool to companion.  Timmy now shows up before the owner asks.

New modules
-----------
• src/timmy/approvals.py  — ApprovalItem dataclass, GOLDEN_TIMMY governance
  constant, full SQLite CRUD (create / list / approve / reject / expire).
  Items auto-expire after 7 days if not actioned.
• src/timmy/briefing.py   — BriefingEngine that queries swarm activity and
  chat history, calls Timmy's Agno agent for a prose summary, and caches
  the result in SQLite (~/.timmy/briefings.db).  get_or_generate() skips
  regeneration if a fresh briefing (< 30 min) already exists.

New routes (src/dashboard/routes/briefing.py)
----------------------------------------------
  GET  /briefing                        — full briefing page
  GET  /briefing/approvals              — HTMX partial: pending approval cards
  POST /briefing/approvals/{id}/approve — approve via HTMX (no page reload)
  POST /briefing/approvals/{id}/reject  — reject via HTMX (no page reload)

New templates
-------------
• briefing.html           — clean, mobile-first prose layout (max 680px)
• partials/approval_cards.html         — list of approval cards
• partials/approval_card_single.html   — single approval card with
                                          Approve/Reject HTMX buttons

App wiring (src/dashboard/app.py)
----------------------------------
• Added asynccontextmanager lifespan with _briefing_scheduler background task.
  Generates a briefing at startup and every 6 hours; skips if fresh.

Push notification hook (src/notifications/push.py)
---------------------------------------------------
• notify_briefing_ready(briefing) — logs + triggers local notifier.
  Placeholder for APNs/Pushover wiring later.

Navigation
----------
• Added BRIEFING link to the header nav in base.html.

Tests
-----
• tests/test_approvals.py  — 17 tests: GOLDEN_TIMMY, CRUD, expiry, ordering
• tests/test_briefing.py   — 22 tests: dataclass, freshness, cache round-trip,
                              generate/get_or_generate, push notification hook

354 tests, 354 passing.

https://claude.ai/code/session_01D7p5w91KX3grBeioGiiGy8
2026-02-22 14:04:20 +00:00