DEV Community

Cover image for Purge: an open-weight AI that clears my Gmail spam folder while I sleep
Ezichi Jenissi
Ezichi Jenissi

Posted on AI-assisted

Purge: an open-weight AI that clears my Gmail spam folder while I sleep

What I Built

Purge is an open-source tool that cleans your Gmail Spam folder for you.
I was clearing my spam folder three times a day.
This week I gave Purge a brain. Every night it scans your Spam folder. Your rules run first. For everything else, an open-weight AI model reads the sender, subject and a short preview of each message and decides whether it is really junk. Purge only acts when the model is confident, and everything goes to Trash, so it is recoverable for 30 days.

Anyone whose Gmail Spam folder keeps filling up gets to be a little lazier. I'm the first one.

Demo

Live on my Hacktoberfest .tech domain: https://purge-it.tech”

Code

How I Built It

Building: Built Google login, a dashboard, and keyword and sender rules. The AI cleanup, the nightly automation, the activity log, the rules page redesign, the dashboard stats, the legal pages, and the custom domain. [Check this list against your commit history and edit it.]

The open pieces:

  • Model: openai/gpt-oss-20b, an open-weight model, through Groq's OpenAI-compatible API.
  • Classifier: a small Python module that sends the sender, subject and preview to the model and asks for JSON: a label (junk or keep), a confidence, and a short reason. Purge trashes a message only when the label is junk and the confidence is at least 0.8. Any error, bad reply or missing setting means keep.
  • Flow: a GitHub Actions cron calls my FastAPI backend on Render every night. The backend runs the user's rules first, then sends the remaining Spam messages to the model, with a per-run cap to stay inside rate limits. React and Firestore handle the dashboard, rules and logs.
  • Settings: the model's address, name and key are three environment variables, so changing the model or provider takes no code change.

Safety choices: it only touches the Spam folder, it moves messages to Trash instead of deleting them, and the model is told to answer keep when unsure.

Why Does Open Innovation Matte

  • No lock-in. In Groq's playground I could browse several open models (Llama, Qwen, gpt-oss) in one dropdown and pick a small one that fit the job. Because the classifier talks to a standard API, I can change provider or model by editing three settings. A closed model would have tied Purge to one vendor's prices and terms.
  • A path to privacy. The weights are open, so the same code can point at a model running on the user's own machine, for example through Ollama. I haven't tested that yet. My live version uses a hosted API, so message previews do go to Groq, and I say so plainly. For an app that reads your inbox, being able to move that model onto your own hardware matters.
  • Trust. The code and the model are both open to inspect, which is what I'd want before giving any app access to my email.

I don't have a proper accuracy measurement yet, since I've only run it for a few days. In my first tests the model labeled a dating-spam email as junk and a normal university email as keep, which is what I wanted. After the first nightly runs my Spam folder was cleared of 50+ emails. I checked my Trash and found no emails I would have wanted to keep.

I haven't compared it against a bigger closed model, so I can't say how much better one would do. For this job, a small open model was enough.

The Lazy Payoff

For 2 days now I've woke up to a Spam folder with 50+ irrelevant emails already cleared, and I hadn't touched anything,I didnt manually start deleting or selecting which emails to delete which are irrelevant to me

Prize Categories

Best Use of a .tech Domain: Purge is live on https://purge-it.tech, a .tech domain I claimed through Hacktoberfest.

Best Use of GitHub Copilot: The nightly cleanup is automated with a GitHub Actions workflow that triggers the scan.

Best Use of Render: Purge's backend runs on Render. It runs the nightly scan that sends messages to the model (the model itself runs on Groq).

Top comments (0)