DEV Community

TiltedLunar123
TiltedLunar123

Posted on

Your Gmail cleanup tool found nothing because your mailbox is the wrong shape

Most inbox cleanup tools ship with the same three searches: promotions, big attachments, anything older than a year. Run one against a mailbox holding 60,000 messages and you can still get a report that says 142 promotional emails and four large attachments. Nothing is broken. The tool asked three questions your mailbox does not answer.

I ran into this building a Gmail cleanup extension, and it took me an embarrassingly long time to see it as a design problem instead of a bug.

Category searches get written before anyone sees your mail

category:promotions, larger:10M, older_than:1y. Those are guesses about what clutter looks like, made by someone who has never seen your inbox. They are good guesses for one kind of mailbox: shopper, newsletter reader, ten years of Black Friday mail.

Plenty of mailboxes are not that. A working mailbox is often tens of thousands of small, ordinary, individually reasonable messages from a few dozen automated senders. Build notifications. Ticket updates. Bank alerts. Delivery notices. School portals. None of it is promotional, none of it is large, and a lot of it arrived last month, so it fails all three searches at once.

category:promotions has a second problem stacked on top. The Promotions tab is a classifier's opinion, not a property of the message. Gmail decides. Anything it decides wrong is invisible to a rule built on that category, and you never notice the miss, because a miss looks exactly like a clean mailbox.

Enumerate senders instead

The question that works on every mailbox shape is not "what category is this" but "who keeps sending me things".

Sender lists survive the shape problem because they assume nothing. A mailbox of 40,000 build notifications and a mailbox of 40,000 retail promos both reduce to a short list of names, and the list is shorter than people expect. Most mailboxes are dominated by a few dozen senders. You can hold that list in your head. You cannot hold 40,000 messages in your head, which is most of why the pile feels unmanageable.

Doing it by hand in Gmail:

  1. Sample. Open a few searches that cut across your mail in different directions rather than by category: older_than:2y, is:unread, after:2026/01/01. Read the sender column, not the subjects.
  2. Count each name that keeps coming up: from:notifications@example.com. Gmail gives you the real total for that search.
  3. Sort your list by that number and work top down.

Step 2 is the one that matters and the one tools get wrong. A page of Gmail results is 50 rows. If something counts what it can see on the page, it is reporting a page, not a mailbox. The number has to come from Gmail's own answer to the from: search.

The trap on the way out

Once you have a ranked list you will want to act on it, and this is where a count quietly stops meaning what you think it means.

Say a row says 4,812 from one sender. You have also, sensibly, told your tool never to touch anything starred, or anything with "invoice" in it. So the run deletes 4,390 and you spend ten minutes wondering where the other 422 went.

Nothing went wrong. The count and the button were measured through different filters. If a row shows you a number, that number has to be measured through the same filters the button applies, or it is describing a mailbox you are not about to modify. The same rule holds by hand: put your exclusions in the search you count with, not only in the delete you run afterwards. from:x -is:starred -invoice is the honest count.

Two things worth keeping

Deleting is not the end of it. A sender that filled your mailbox once will do it again, so whatever you decide about a sender wants to keep applying rather than being a one-off sweep.

And check in:spam from: separately when you audit a sender. Mail that Gmail routed to Spam does not appear in an ordinary from: search at all, so a sender can look like they stopped when they only moved. Be careful what you delete in there, too. Spam has no 30 day Trash window.

I built the sampling and the per-sender counting into the extension because doing it by hand across a few dozen senders is tedious and easy to get wrong. The census and the counts are free and read only. Clearing the senders you tick is the paid part, and it only ever touches senders you ticked yourself. Full disclosure, it is mine: https://chromewebstore.google.com/detail/bmcfpljakkpcbinhgiahncpcbhmihgpc

The by-hand version above works fine without any of that, and it is the part worth taking away either way.

Top comments (0)