- Python 86%
- Jinja-like 9%
- CSS 5%
newsbrief #
Local-LLM RSS digest. Pulls unread entries from a Miniflux instance, runs them through a triage → embed → cluster → synthesize pipeline on local models (Gemma 4 E4B for triage, Gemma 4 26B-A4B MOE for synthesis, Snowflake Arctic Embed L v2.0 for clustering), and produces a structured newsbrief — grouped stories with one-paragraph summaries — instead of a chronological firehose.
The pipeline owns its inference server: it spawns llama.cpp's
llama-server (Vulkan) on a dedicated port, swaps models between stages, and
tears everything down when the run finishes. No daemons to pre-start, no
ollama. One model on the iGPU at a time, sized so each stage fits comfortably.
Comes with both a CLI and a small local web app (FastAPI + HTMX + SSE) for on-demand generation with live progress.
Status: working end-to-end. See AGENTS.md for design notes and FUTURE.md
for deliberately-open doors.
Prereqs #
- llama.cpp Vulkan binaries at
~/.local/llamacpp/llama-b9542/(override withLLAMACPP_DIR). No build needed — precompiled release. - GGUFs in
~/projects/local-llm/ggufs/(override withNEWSBRIEF_GGUF_DIR):gemma-4-E4B_q4_0-it.gguf(5.15 GB, symlink into ollama's blob store works)gemma-4-26B_q4_0-it.gguf(14.4 GB, same)snowflake-arctic-embed-l-v2.0-q8_0.gguf(635 MB, fromCasual-Autopsy/snowflake-arctic-embed-l-v2.0-ggufon HF — note: ollama's arctic blob is NOT loadable by upstream llama.cpp, its tokenizer metadata uses a stale GGUF encoding)
- Miniflux URL + token from
~/projects/miniflux-mcp/constants.py(gitignored) orMINIFLUX_URL/MINIFLUX_TOKENenv vars.
See ~/projects/local-llm/ for the llama.cpp/GGUF setup story.
Quickstart #
uv sync
# CLI:
uv run python -m newsbrief run --hours 48
# Web app at http://127.0.0.1:8001:
uv run python -m newsbrief serve
That's it — servers are managed automatically.
CLI #
uv run python -m newsbrief run [options]
--hours INT window to fetch (default 48)
--threshold FLOAT cluster distance threshold (default 0.40)
--max-sections INT cap on synthesized sections (default 20)
--max-concurrency INT hard cap on parallel LLM requests (default 4)
--triage-profile NAME e4b (default) or 26b
--synth-profile NAME 26b (default) or e4b
--skip-triage bypass the per-entry triage pass
--resume PATH reuse intermediates from runs/<stamp>
--print echo digest markdown to stdout
uv run python -m newsbrief fetch --hours 48
uv run python -m newsbrief serve --host 127.0.0.1 --port 8001
Pipeline #
- fetch — Miniflux REST, cached per
cache/entries-<window>-<date>.json - triage — E4B (
-np 4, 64K ctx), per-entry{keep, type, novelty}, batched + parallel - embed — arctic-embed-l-v2.0 via llama-server
--embeddings, batched - cluster — agglomerative on cosine distance
- rank — multi-clusters first, then singletons by novelty/type; overflow → "Also seen" tail
- synthesize — 26B-A4B MOE (
-np 2, 16K ctx) per cluster (parallel),{headline, paragraph, dropped} - render — markdown, persisted to SQLite (web) or
runs/<stamp>/digest.md(CLI)
Each stage that needs a model asks the ModelHost for its profile; the host
swaps the server only when the model actually changes. Model load costs on a
780M iGPU: E4B ~4s, 26B ~35s, embed ~2s.
Every intermediate is dumped to runs/<stamp>/ for inspection and resume,
including per-profile llama-server-*.log.
Configuration (env) #
| var | default | meaning |
|---|---|---|
LLAMACPP_DIR |
~/.local/llamacpp/llama-b9542 |
llama.cpp binaries |
NEWSBRIEF_GGUF_DIR |
~/projects/local-llm/ggufs |
model files |
NEWSBRIEF_LLAMA_PORT |
8090 |
managed server port |
NEWSBRIEF_TRIAGE_PROFILE |
e4b |
triage model profile |
NEWSBRIEF_SYNTH_PROFILE |
26b |
synthesis model profile |
NEWSBRIEF_EXTERNAL |
unset | 1 = don't manage servers; use LLAMA_BASE + EMBED_BASE |
MINIFLUX_URL / MINIFLUX_TOKEN |
constants.py | Miniflux access |
Layout #
src/newsbrief/
config.py miniflux, paths, server/profile knobs
server.py ModelHost: spawn/swap/teardown llama-server per stage
fetch.py miniflux client + caching
triage.py per-entry classification (E4B, parallel)
embed.py arctic-embed via llama-server
cluster.py cosine + agglomerative
rank.py cluster → synth-queue + overflow tail
synthesize.py per-cluster summary (26B MOE)
render.py markdown
pipeline.py orchestration, RunResult, on_event callback
llm.py pooled HTTP client, chat/embed helpers, concurrency
cli.py / __main__.py
prompts/ jinja templates (triage, synthesize)
web/
app.py FastAPI factory + routes
db.py sqlite3
jobs.py single-worker JobRunner with per-job event queues
templates/ base / index / digest / entry
static/ style.css
cache/ raw miniflux fetches (gitignored)
runs/ per-run intermediates + outputs (gitignored)
newsbrief.sqlite3 web app digest history (gitignored)