# 03-Aug-2026 — newsletter mode with an AI-drafted overview of what is coming up [ref #347](https://github.com/nbarrett/ngx-ramblers/issues/347)

## [build 807](https://github.com/nbarrett/ngx-ramblers/actions/runs/30819075701) — [commit 2f05702](https://github.com/nbarrett/ngx-ramblers/commit/2f05702e6949bebace97ecbb03413b1566c29bf4)

_____

Groups had no way to send a periodic "what's coming up" newsletter that picks up where the last one left off. The composer could already auto-include events over a date range, but the window was seeded as today to today + 2 weeks every time, nothing remembered when the last newsletter went out, and the intro was a blank box that someone rewrote from scratch on each send.

Newsletter mode, switched on from the Events step when auto-include is active:

- A kind on the stored composition marks it as a newsletter, so the previous one can be found without matching on subject text. Existing compositions default to standard, so nothing already saved is affected and no migration is needed.
- The previous newsletter is looked up across the whole group rather than only the current member's own drafts, since a newsletter belongs to the group.
- The date window is derived from it: today forward by the chosen cadence, except where the previous window has not yet run out, in which case it starts where that one stopped so members are not told the same thing twice.
- Cadence (weekly through quarterly, or custom dates) is inherited from the previous newsletter rather than re-picked each time.
- Events the previous newsletter did not announce are marked as new in the selection list, worked out from the event ids it recorded rather than needing a per-event created date.
- The recipient list defaults to the one the previous newsletter went to, but only when no list has been chosen already.

The intro is drafted by the existing AI capability from the selected events, through a new /api/ai/newsletter-intro endpoint. The system prompt is held server side rather than accepted from the browser, and asks for a high-level summary rather than a re-listing, with nothing invented and no greeting or sign-off since those are separate fragments. What comes back is an editable draft with an undo beside it. The AI writes the intro paragraph and nothing else: events still render through the existing fragment untouched, so no model output can reach a member as event detail.

With AI switched off the endpoint reports 503 and the composer says the intro was left as it was, so a newsletter stays composable by hand.

Window derivation and prompt input building are pure functions with 32 tests between them, covering the first newsletter, a previous window still running, one that has run out, a previous newsletter that recorded no window, custom dates, and the empty-programme case.