feat: 23:00 daily news recap; prompts drop futures

Summarizer still runs the 15-min analyst, plus a 24h breaking-news recap
at 23:00 America/New_York. HUD pins kind=daily_recap. Prompts ignore
futures/market tape.
This commit is contained in:
Sirius DevOps 2026-08-28 22:53:31 -04:00
commit 49ee5fe7a3
16 changed files with 431 additions and 75 deletions

View file

@ -16,7 +16,7 @@ urls.txt (RSS + homepages)
news-scraper (Scrapy, continuous) ──► articles table (osint-db)
│ │
│ ▼
news-summarizer (Nous Portal, every 15m) ──► article_summaries + news_items
news-summarizer (Nous Portal, every 15m + 23:00 recap) ──► article_summaries + news_items
│
▼
GET /api/news · /api/news/summaries · /api/news/ticker · /api/news/map
@ -45,11 +45,13 @@ feeds (`GET /api/news` exact key set is unchanged on purpose).
the `PostgresPipeline` writes to `articles` with URL-based dedup
(`ON CONFLICT (url) DO NOTHING`).
2. **Summarizer** — `news/summerizer/run_news_summarizer.py` runs
`summarizer.py` every `NEWS_SUMMARIZE_INTERVAL_S` (default 900). It reads
articles from the last `SUMMARY_WINDOW_MINUTES` (default 15), map-reduces
them through Nous Portal (`SUMMARY_MODEL` / Settings, default
`Hermes-4.3-36B`), writes the English brief to `article_summaries` (column
`model` is the LLM id), and flagged ticker/map rows to `news_items`.
`summarizer.py` every `NEWS_SUMMARIZE_INTERVAL_S` (default 900) over the
last `SUMMARY_WINDOW_MINUTES` (default 15), and again at 23:00
`America/New_York` (`TZ`) over the last 24 hours as a daily recap
(`kind=daily_recap`). Both map-reduce through Nous Portal (`SUMMARY_MODEL`
/ Settings, default `Hermes-4.3-36B`), write the English brief to
`article_summaries` (column `model` is the LLM id; `kind` is
`interval` or `daily_recap`), and flagged ticker/map rows to `news_items`.
Loops are serial (two crawls/summaries never overlap). Interval idempotency:
if `article_summaries` already has a row in the last interval, the summarizer
@ -116,12 +118,15 @@ Key set **unchanged** (no `lat`/`lon` on articles; geo lives on `/api/news/map`)
"id": 1,
"summary_text": "English markdown brief…",
"batch_timestamp": "2026-08-24T18:10:00Z",
"model": "Hermes-4.3-36B"
"model": "Hermes-4.3-36B",
"kind": "daily_recap"
}
]
```
`model` is additive. Empty DB → `[]` (no crash).
`model` and `kind` are additive (`interval` | `daily_recap` | `null` for old rows).
`?kind=daily_recap` pins the nightly 24h recap. Empty DB → `[]` (no crash).
Malformed `kind` → `422`.
### GET /api/news/ticker — flagged HUD headlines
@ -237,10 +242,13 @@ lands in `article_summaries.summary_text`.
| `SUMMARY_WINDOW_MINUTES` | `15` | How far back the summarizer looks for new articles. |
| `NEWS_SCRAPE_INTERVAL_S` | `10` | Pause after each crawl before the next (scraper is otherwise continuous). |
| `NEWS_SUMMARIZE_INTERVAL_S` | `900` | Seconds between analyst runs (default 15 min). |
| `TZ` | `America/New_York` | Timezone for the 23:00 daily recap. |
| `NEWS_RECAP_HOUR` | `23` | Local hour of the daily 24h recap. |
| `NEWS_RECAP_MINUTE` | `0` | Local minute of the daily recap. |
| `NEWS_SCRAPE_RUN_ON_START` | `1` | Run one scrape immediately on container start. |
| `NEWS_SUMMARIZE_RUN_ON_START` | `1` | Run one summarize immediately on container start. |
| `NEWS_SUMMARIZE_FORCE` | `0` | `1` ignores the interval idempotency skip (double-pins on recreate). |
| `INCLUDE_FUTURES` | `0` | Legacy futures-prices coupling. OFF for OSINT; set `1` + install `yfinance` to enable. |
| `NEWS_SUMMARIZE_FORCE` | `0` | `1` ignores the interval/recap idempotency skip (double-pins on recreate). |
| `INCLUDE_FUTURES` | `0` | Legacy. Ignored — prompts never inject futures/market tape. |
| `NEWS_LOG_LEVEL` | `INFO` | Scrapy log level. |
| `OSINT_USER_AGENT` | `osint-dashboard-news-summarizer` | Sent on every outbound Nous call. |
| `TELEGRAM_TOKEN` / `TELEGRAM_CHAT_ID` | *(blank)* | Reserved for the (out-of-scope) Telegram delivery bot. |
@ -254,11 +262,10 @@ No Hermes-4 reasoning system prompt. Reduce uses `json_mode=True`.
## Prompts
Both prompts are env-overridable — the default `MAP_PROMPT` is OSINT-neutral
(facts, locations, entities, category, OSINT signal per article; English) and
the default `SUMMARY_PROMPT` demands the reduce JSON above (with a
"no qualifying events" escape hatch). Upstream's futures/markets prompt
language is gated behind `INCLUDE_FUTURES=1`.
Both prompts are env-overridable. Defaults focus on **breaking important news**
and explicitly ignore futures, commodity tape, and routine market moves.
`RECAP_PROMPT` (23:00, 24h window) is the daily recap; `SUMMARY_PROMPT` is the
15-min analyst. `INCLUDE_FUTURES` is ignored.
## Tests