Skip to content

feat: watchlist-based daily briefing on session start (closes #140)#149

Merged
luceinaltis merged 1 commit into
mainfrom
feat/140-watchlist-briefing
Apr 8, 2026
Merged

feat: watchlist-based daily briefing on session start (closes #140)#149
luceinaltis merged 1 commit into
mainfrom
feat/140-watchlist-briefing

Conversation

@luceinaltis
Copy link
Copy Markdown
Owner

Summary

  • Adds generate_briefing() to qracer/conversation/quickpath.py — composes a one-time session-start summary of watchlist prices, alerts triggered since the previous session, and pending scheduled tasks.
  • Detects the previous session via the newest JSONL mtime in the sessions dir, excluding the current session's path so it works correctly even after the current session has started writing.
  • Wires the briefing into _repl_loop() in qracer/cli.py, printed once before the banner; wrapped in try/except so failures never block the REPL.
  • Returns None (and prints nothing) on first-ever runs or when there is nothing to report.

Closes #140

Implementation notes

  • Watchlist prices use data_registry.async_get_with_fallback(PriceProvider, "get_price", ...); individual ticker failures are skipped silently.
  • Alert filtering parses triggered_at ISO timestamps, treats naive datetimes as UTC, and only includes alerts with triggered_at > last_session.
  • Pending task list is truncated to the first 5 with an ... and N more footer.
  • Briefing helpers (_find_last_session, _briefing_price_lines, _briefing_alert_lines, _briefing_task_lines) are private to keep generate_briefing() readable.

Files changed

File Action
qracer/conversation/quickpath.py Added generate_briefing() and helpers
qracer/cli.py Extended _repl_loop() signature; call briefing before banner
tests/conversation/test_quickpath.py Added TestGenerateBriefing (8 cases)

Test plan

  • uv run pytest tests/conversation/test_quickpath.py → 16 passed (8 new briefing tests + 8 pre-existing)
  • uv run pytest tests/conversation/ tests/test_cli.py → 136 passed, 2 skipped
  • uv run pytest tests/test_alerts.py tests/test_tasks.py tests/test_watchlist.py tests/test_alert_monitor.py tests/test_task_executor.py tests/data/ → 143 passed
  • uv run ruff check qracer/ tests/ → clean
  • uv run ruff format --check → clean
  • uv run pyright qracer/conversation/quickpath.py qracer/cli.py tests/conversation/test_quickpath.py → 0 errors

How to test manually

  1. Start a REPL session and exit immediately: qracer replexit. This creates a session log under ~/.qracer/sessions/.
  2. Add at least one watchlist ticker (watch AAPL) or schedule a task so the briefing has content to show.
  3. Start a new REPL session: qracer repl. The "Session Briefing" block should print before the banner, listing watchlist prices and any alerts/tasks since the previous run. On first-ever runs (no prior session log) the briefing is silently skipped.

https://claude.ai/code/session_01TDznA5KxCsxF5oeaBy3JH6

Add `generate_briefing()` to surface a one-time summary at REPL startup
of activity since the previous session: current watchlist prices, alerts
that triggered while away, and pending scheduled tasks. Detects the prior
session via the most recent JSONL log mtime in the sessions directory,
excluding the current session.

The REPL loop calls the briefing once before printing the banner. The
briefing is silently skipped on first-ever runs (no previous session) or
when there is nothing noteworthy to report, and any failures are logged
at debug level so they never block the REPL.

https://claude.ai/code/session_01TDznA5KxCsxF5oeaBy3JH6
@luceinaltis luceinaltis force-pushed the feat/140-watchlist-briefing branch from 3cbd860 to 943fc12 Compare April 8, 2026 14:44
@luceinaltis luceinaltis merged commit b216bb9 into main Apr 8, 2026
3 checks passed
@luceinaltis luceinaltis deleted the feat/140-watchlist-briefing branch April 8, 2026 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: watchlist-based daily briefing on session start

2 participants