Reads unread inbox mail every hour and applies your own labels to each message using AI.

UsesClaudeGmail

Auto-label new Gmail messages with AI

Every hour, the workflow reads the unread mail sitting in your Gmail inbox and sorts it using labels you describe in plain English, such as one for invoices, one for candidate outreach and one for newsletters. The AI reads each message's sender, subject and preview against your rules and picks exactly one label, which is then applied to the message.

You end up with an inbox where new mail already carries the right label, and labels are created in Gmail the first time they are used. A message that matches none of your rules is left untouched rather than pushed into the nearest category, so the labels you do see stay trustworthy. A message that cannot be processed is noted in the run log and skipped, and the rest of the batch still goes through. Nothing is archived, moved or replied to: labels are added and that is all.

Run every hour.Run every hour.
Set labelRules to blank.Set labelRules to blank.
Set maxEmails to 25.Set maxEmails to 25.
GmailGmailList emails. Save it as inbox.List emails. Save it as inbox.
Set messages to inbox.emails.Set messages to inbox.emails.
For each email in messages:For each email in messages:
If a step below fails, save the error as labelErrorIf a step below fails, save the error as labelError
Try
Set subject to email.subject.Set subject to email.subject.
Set sender to email.from.Set sender to email.from.
Set snippet to email.snippet.Set snippet to email.snippet.
Set prompt to You are labeling one email. Reply with EXACTLY one label name from the rules below, and nothing else. If none of them fit, reply with the single word none.Set prompt to You are labeling one email. Reply with EXACTLY one label name from the rules below, and nothing else. If none of them fit, reply with the single word none. Rules: labelRules From: sender Subject: subject Preview: snippet.
ClaudeClaudeAsk Claude: prompt. Save it as verdict.Ask Claude: prompt. Save it as verdict. Maximum response length: 16
Trim verdict.response_text and save it as label.Trim verdict.response_text and save it as label.
If label isn't empty and label is not “none”If label isn't empty and label is not “none”
Yes
GmailGmailAdd label label to email email.Add label label to email email.
No
No steps
On error
Show in the output: Could not label message email.id as text: labelError as text.Show in the output: Could not label message email.id as text: labelError as text.