Back to Garden
Agents Built Feb 11, 2026 Complexity: Medium5 Min Read

How I Saved My Gmail (And My Wallet) with a Simple 5-Minute Hack

Last week, I got the notification we all dread: "Your Google storage is 90% full. You will soon stop receiving emails."

I looked through my inbox and realized the problem: 80% was just noise. Newsletter subscriptions I don't read, social media pings from years ago, and endless "New Product" alerts. I was literally paying Google every month for the "privilege" of storing digital junk.

Instead of upgrading my storage plan (again), I built a small, smart automated janitor to do the dirty work for me. Here is how it works and how you can use it too.

Note for Workspace Users: Google Workspace Premium now includes "Gemini Studio" which can create similar agentic workflows natively. This script is a free, code-based "hack" specifically designed for personal Gmail accounts (@gmail.com) where those premium features aren't available without a subscription.

The Logic Flow

graph TD
  A[Open Inbox] --> B{Scan Headers}
  B -->|Unsubscribe Header?| C[Move to Junk]
  B -->|Human Thread?| D[Protect/Keep]
  B -->|Official Domain?| D
  C --> E[Final Status Report]
  D --> E

Fig 1. The decision engine of the Smart Janitor

The Solution: Local Intelligence, Zero Tokens

I wanted something personal, powerful, and free. I built a Python-based **Smart Janitor** that runs entirely on your local machine. It doesn't send your data to an external AI model; instead, it uses "Smart Heuristics" to judge your emails like a human would.

Why This Wins

  • Header DNA: Identifies newsletters via List-Unsubscribe markers.
  • Human Protection: Automatically detects active conversation threads.
  • The "Official" Shield: Whitelists trusted domains (.gov, .edu) and keywords (Banks, Invoices).
  • Zero Token Cost: No API costs. Just local Python logic.

Get the Source Code

Clean your inbox across multiple accounts in under 5 minutes.

View on GitHub

Explore other notes