# Offline Newsletter Builder (Archaeology/History) Local-first toolchain to turn your article links (or pasted texts) into a Friday Ghost draft with consistent summaries, plus a SQLite database for memory and related-article suggestions. ## Highlights - Paste URLs into `inbox.txt` → run importer → get `.md` stubs **and** a growing SQLite DB. - One command to build the weekly newsletter (HTML) and optionally create a **Ghost draft**. - Consistent tone via `templates/prompt.txt` (+ your `templates/style_bank.md` samples). - "Memory" via `data/newsletter.db` (sources, summaries, embeddings, FTS), used to auto-suggest **related** items. ## Quick start ```bash python -m venv .venv && source .venv/bin/activate pip install -r requirements.txt # Configure secrets cp .env.example .env # Edit .env to set your keys (or point to local OpenWebUI/Ollama) # Create DB schema python scripts/db_cli.py init # Ingest URLs (from inbox.txt) python scripts/ingest_list.py --list inbox.txt --fetch --stubs --date 2025-09-19 --sleep 0.5 # Build newsletter from stubs (HTML + optional Ghost draft) python build.py entries/2025-09-19 --out dist/2025-09-19.html --publish # (Optional) Build directly from DB (Top-N sources) python scripts/build_from_db.py --limit 10 --out dist/2025-09-19.html --publish ``` ## Sample Run (Pretend Output) ```bash $ make init Initialized schema in data/newsletter.db $ make stubs DATE=2025-09-19 Stub: entries/2025-09-19/bbc-welsh-rainforests.md Stub: entries/2025-09-19/nature-bone-discovery.md Ingested: 2 URLs into data/newsletter.db $ make build DATE=2025-09-19 [build] Using LLM provider=openwebui model=qwen2.5-7b-instruct [build] Generating summary for: Velšské deštné pralesy ... [build] -> Summary written back to DB (id=5, embedding stored) [build] Generating summary for: Kosterní nález u Nisy ... [build] -> Summary written back to DB (id=6, embedding stored) Saved: dist/2025-09-19.html $ make draft DATE=2025-09-19 Draft: https://your-ghost-site.ghost.io/p/objevy-tydne-2025-09-19-draft ``` You can open the generated HTML under `dist/2025-09-19.html` in your browser to review before publishing.