tl;dr: Search Gmail for “
is:spam -label:^os” to find messages that you manually marked as spam (as opposed to ones that Gmail automatically marked for you).
Gmail recently had a bug where some emails were accidentally moved to the trash or marked as spam. Google “encouraged” users that might have been affected to check their trash and spam folders for any messages that didn't belong. Since I get a lot of spam (one of the perks of having the same email address since 1996), I didn't relish the thought of going through thousands of messages to see if any of them were mislabeled¹.
I figured that Gmail must keep track of which messages were explicitly marked as spam by the user versus one that it automatically classifies (though I get a lot of spam, almost all of it is caught by Gmail's filters). Gmail (like Google Reader) keeps track of per-message state via internal system labels. For example, others have discovered that Gmail's Smart Labels are represented as
^smartlabel_type labels while Superstars uses names like
^ss_sy. Indeed, if you try to use a caret in a label name, Gmail says that it is not allowed.
It therefore seemed like a reasonable assumption that there was a system label that would tell us how a message came to be marked as spam. The problem was to figure out what it was called.
Thinking back to Reader (where all label operations went through an edit-tag HTTP API call, which listed the labels to added or removed), I figured I would see what the request was when marking a message as spam. Unfortunately, it looked like Gmail's requests were of slightly higher abstraction level, where marking a message as spam would send a request with an act=sp parameter (while marking as read uses act=rd, and so on).
I then figured I should look at HTTP response when loading the spam folder. There appeared to be a bunch of system label names associated with each message. One that I explicitly marked as spam had the labels:
"^a", "^ad_1391126400000", "^all", "^bsm"," ^clu_group", "^clu_unim", "^cob-processed-gmr", "^cob_pevent", "^oc_group", "^os_group", "^s", "^smartlabel_group", "^u"
Meanwhile, another that had been automatically marked as spam used:
"^ad_1391126400000", "^all"," ^bsm", "^clu_notification", "^cob-processed-gmr", "^oc_notification", "^os", "^os_notification", "^s", "^smartlabel_notification", "^u”
^s was present on all of them, and indeed doing a search for
label:^s shows all spam messages (and the UI rewrites the search to
in:spam). Others could also be puzzled out based on name, for example
^u is for unread messages. The more mysterious ones like
^cob_pevent I figured I could ignore².
After looking at a bunch of messages, both automatically and manually marked as spam,
^os stood out. It only seemed to be present on messages that Gmail itself had decided were spam. Doing the search
is:spam -label:^os seemed to show only messages that I had marked as spam. Indeed, each of the messages in the result displayed the header: "Why is this message in Spam? You clicked 'Report spam' for this message." Thus I was able to go through the much shorter list and see if any where mistakenly marked (they weren't).
^ and a simple dictionary attack for two-letter names, here's some others that I've found (those that are marked as “unknown” are ones that match some messages in my account, but with no apparent pattern):
^a: archived conversations
^b: chat transcripts (equivalent to
is:chat, presumably the “b” is for “Buzz”, Google Talk's codename)
^f: sent messages (equivalent to
^g: muted conversations (equivalent to
is:muted, the “g” is most likely for “ignore”)
^i: inbox (equivalent to
^k: trashed messages (equivalent to
in:trash, unclear why “k” is the abbreviation)
^p: messages that were marked as phishing attempts
^r: drafts (equivalent to
^s: spam (equivalent to
^t: starred messages (equivalent to
is:starred, the “t” is most likely for “to do”)
^u: unread messages (equivalent to
^ac: Google Buzz messages (equivalent to
^act: Google Buzz messages (unclear how it's different from
^bc: unknown subset of chat transcripts
^p_cc: another unknown subset of chat transcripts
^op: messages that were automatically marked as phishing attempts
^os: messages that were automatically marked as spam
^vm: Google Voice voicemails (equivalent to
^pop: unknown, seems to match some (very old messages) that I imported via POP
^ss_cp: Superstar stars
_finance: Smart Labels
^io_im: important messages (equivalent to is:important)
^io_lr: unknown, possibly more degrees of importance (“Info Overload” was the project that resulted in the importance filtering)
^clu_unim: unknown, possibly unimportant messages
^hunsub: messages where an unsubscribe link has been detected (when marking one as spam, the “In addition to marking this message as spam, you can unsubscribe...” dialog appears).
^unsubseems to be for messages where there's an unsubscribe link you have to click while
^hunsubis for ones where Gmail offers to unsubscribe on your behalf.
^cff: sender is in a Google+ circle (equivalent to
^p, if I had to guess I would say it's something related to spear phishing)
^p_esnotif: Google+ notifications ("es" presumably being "Emerald Sea", Google+'s code name)