I built a little Gmail cleaner because my inbox had a bunch of "newsletters I unsubscribed from in my head but never actually did." Headers only, never message bodies, because privacy should still matter, I think. It worked very well and the amount of spam I get dropped dramatically, which was the point.
Everything was built with AI as part of a 12-in-12 challenge I'm doing, where I'm building 12 products in 12 months. https://twelve.zamith.pt/
Quietbox (https://quietbox.zamith.pt/) - Clear spammy emails from your inbox
is:unread -is:starred <-- go through your inbox and star what you want to keep, this filter will help you delete everything else unread. Add something like older_than:1y to also prune your Gmail from time to time.
Did something similar for myself, but CLI-only: https://github.com/facundofarias/gmail-cleaner. Good one!