Home / use case

Morning Digest: a local Gemma 3 agent that summarizes overnight Telegram group chats

At a glance
Hardware
CPU-only inference on the author's machine
Models & engines
Ollama 0.40.6 serving Gemma 3 (default gemma3, the 4B model; gemma3:1b as a faster option)
Key gotcha
CPU inference with the 4B model is slow (about 5 minutes), so run it before you need the digest.

What they built

Waleed Shamhan used to start each morning scrolling through hundreds of unread messages from a study group, a project team and friends, trying to find the lecture that moved or the deadline that got confirmed. Morning Digest does that scrolling for him.

It takes a Telegram Desktop export or a plain-text chat log, looks at the last 12 hours of messages, and writes a short Arabic digest: a headline of at most two lines, key topics as bullets, and any decisions or action items. Everything runs on his own machine with Gemma 3 through Ollama, with no cloud, API key or subscription.

He explains that local, open-weight inference matters where he lives: internet cuts are common and he has no international payment card for API credits, so a hosted model would be a luxury he cannot pay for.

Setup

  • Ollama 0.40.6 serving Gemma 3 (default gemma3, the 4B model; gemma3:1b as a faster option)
  • One Python file, digest.py, with a single dependency (requests)
  • A Telegram Desktop export (result.json) or a plain .txt chat log
  • CPU-only inference on the author's machine

How it works

  1. The parser flattens Telegram's formatting entities, drops service events such as joins and pins and empty media messages, and keeps a flat list of timestamp, chat, sender and text.
  2. The time window (default 12 hours, set with --hours) is anchored at the latest message in the export, since exports are made in the morning.
  3. Messages are split into chunks, each chunk is summarized, and then the chunk summaries are summarized into the final digest so a busy night does not overflow a small model's context.
  4. Ollama is the default provider and the model is chosen with the OLLAMA_MODEL environment variable; an OpenAI provider exists as an option but is not needed.

Results & numbers

  • On a synthetic sample of 30 fictional messages (24 in the 12-hour window), the 4B model's unedited digest picked up the moved database lecture, the Thursday submission date and who owed whom notes.
  • On the author's CPU the 4B model took about 5 minutes end to end; gemma3:1b finished in under 2 minutes with a shorter, rougher digest.
  • He estimates catching up went from roughly 15 minutes of scrolling to about 30 seconds of reading.
  • Five parser tests pass without a model, and a stopped Ollama server produces a friendly error instead of a stack trace.

Gotchas

  • CPU inference with the 4B model is slow (about 5 minutes), so run it before you need the digest.
  • The 1B model is faster but its digest is rougher.
  • The demo uses fictional sample chats; the results shown are from that sample, not a large real-world test.
“A chat export is one of the most personal files on your computer.”— Waleed Shamhan

Do it yourself

  1. Install Ollama and run ollama pull gemma3 (or gemma3:1b on slower machines).
  2. Clone github.com/waleedshamhan2050-sys/morning-digest and install requests.
  3. Export a chat from Telegram Desktop as JSON (result.json).
  4. Run python3 digest.py path/to/result.json, optionally with --hours N to change the window.
  5. Try it first on the bundled sample/result.json to see the output format.
ollama pull gemma3
python3 digest.py sample/result.json
Source: Waleed Shamhan (DEV Community) · Published 2026-10-20 · Added 2026-10-25. This write-up summarizes the original source; see it for full details.

Similar setups

Local AI: a one-click Windows app that picks a model for your PC and sets up Ollama for friends

Tired of setting up local LLMs for friends, a developer built a free MIT-licensed Windows app that detects your GPU and RAM, installs Ollama without admin rights, pulls a fitting model and opens a private chat.

Oleg Che (DEV Community) · 2026-11-04

rip: a local Gemma 2 2B writes epitaphs and revival ideas for your abandoned side projects

A Hacktoberfest CLI scans your folders for dormant projects and has Gemma 2 2B on Ollama write a witty obituary and a suggestion to revive each one, sending only metadata, never code.

razorbill (DEV Community) · 2026-11-03

PatchPal TinyAgent: a coding agent on a 4B model and a 6GB laptop GPU

WiseProbe adapted its PatchPal coding agent to run Gemma 4 E4B or Qwen3.5 4B through Ollama on a 6GB RTX A1000, using handoff-note compaction and capped file reads to work inside a 16K or 32K window.

WiseProbe Blog · 2026-11-25

Link Séance: a local Gemma 3 writes grounded epitaphs for the dead links in your bookmarks

Abdul AmberNeel built a command-line tool that checks every link in a bookmarks file, finds the last living Wayback Machine snapshot of dead ones, and has a local Gemma 3 write a two-sentence epitaph only from what the archive kept.

Abdul AmberNeel (DEV Community) · 2026-10-31