Consolidates multiple legacy email accounts (Gmail, Workspace tenants) into one shared Workspace hub inbox. Covers forwarding mechanisms, history migration, spam handling, and verification for each source type.
Ships in gmail-commander. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Self-Evolving Skill: This skill improves through use. If a step is wrong, Google changed behaviour, or a workaround was needed, fix this file immediately. Only record real, reproducible findings, and never add a real address, domain, tenant, rule ID or customer detail: this plugin is public.
The setup: one hub mailbox in a Google Workspace tenant (a shared front-desk inbox) receives everything that used to go to several sources. Each source keeps its own copy. Staff reply from the hub using "send mail as" for each source, so correspondents see no change.
Each source type gets a different mechanism, and each mechanism fails silently in its own way. The rules below were all measured, not taken from documentation.
Before changing anything, read each mailbox's actual settings through the Gmail API. Reading needs only gmail.settings.basic or gmail.readonly, and it can be done for consumer accounts too.
GET users/me/settings/autoForwarding → {"enabled": false} means nothing is forwarded, whatever the docs say
GET users/me/settings/forwardingAddresses → is the hub even listed, and is it "accepted" or "pending"?
GET users/me/settings/filters → filters that archive, delete or forward
Then prove where the hub's mail actually came from, using metadata only (no bodies). The Delivered-To chain tells the three routes apart:
| Route | Delivered-To on the hub's copy | To: header |
|---|---|---|
| History import (Data migration) | hub and source | source |
| Consumer-Gmail auto-forwarding | hub and source | source |
| Admin routing rule "Also deliver to" | hub only | source |
Imported and forwarded copies look alike, so use dates. If the newest source-addressed message in the hub is older than mail the source received since, forwarding is off and only the import ever ran.
Practicalities:
gmail.metadata scope rejects the q= search parameter, so list by label or page through, then filter on internalDate.messages.get in a loop hits the per-user "Total Query Cost" quota (403) within seconds. Sleep about 150–250 ms per call.| Source | Mechanism | Automatable? |
|---|---|---|
Consumer @gmail.com | Gmail → Settings → Forwarding and POP/IMAP → add the hub → a confirmation code arrives in the hub (in its subject) → choose "keep Gmail's copy in the Inbox" | No API. forwardingAddresses.create and updateAutoForwarding need a service account with domain-wide delegation, which only Workspace has. One manual UI pass; a browser profile signed in to both mailboxes can read the code. |
| Mailbox in another Workspace tenant | Admin console → Apps → Gmail → Routing rule: Inbound + Internal-receiving, envelope recipient = the source, Also deliver to the hub | Admin UI. User-level forwarding is often refused by the tenant ("Invalid forwarding address", with no verification flow offered). Prefer the routing rule: it works on Google's servers and survives password changes. |
| Address in the hub's own tenant | An alias on the hub, or a routing rule | Directory API or Admin UI. |
Opening the Admin console triggers a password re-check even in an already signed-in profile. A person, or a vault-backed form filler, has to complete it. Never type a password through an agent's browser tools, because the value would land in the transcript.
Routing rules: every additional recipient added under "Also deliver to" defaults to "Do not deliver spam to this recipient" and "Suppress bounces from this recipient". When the source tenant classes a message as spam, the source still receives it, but no copy goes to the hub and nobody gets a bounce. A new outside sender with an odd subject (exactly what a test email looks like) is often scored "blatant spam", so the very first real test fails while internal tests pass.
Fix: rule → Edit → the additional recipient → Advanced:
X-Gm-Spam: 0/1)Google also says some blatant spam is dropped at delivery whatever the settings (control delivery by content).
Consumer forwarding: Gmail never forwards what the source classed as spam (Gmail Help). Someone still has to check the source's Spam folder now and then.
Hub side: the hub runs its own spam check on every copy. Once the source has already filtered, a second check only adds false positives. Hub filters via API (settings.filters.create, action removeLabelIds: ["SPAM"], which is "Never send to Spam" in the UI):
criteria.query: "deliveredto:<consumer-source>" matches forwarded copies.criteria.to: "<routed-source>" matches routed copies, which carry only the hub in Delivered-To. It misses mail where the source was only Bcc'd.Snapshot the hub's settings into a baseline file and diff them on a schedule. Settings drift is otherwise invisible.
messages.insert (preferred over a delta import)Gaps happen even when everything is "on": the time between the import snapshot and forwarding going live, routed copies that bounced while the hub's domain was down (routing never retries them), and copies dropped as spam before the routing fix. Measure and fill them by Message-ID, not by date or count:
Message-IDs since a cutoff (metadata scope is enough).-in:sent -in:drafts -in:spam -in:trash, matching the import's defaults) and keep the IDs the hub lacks. Exclude your own test sender.format=raw from the source (a read-only grant is enough: gmail.readonly via OAuth for a consumer account, or domain-wide delegation for a Workspace one), and POST upload/gmail/v1/users/me/messages?uploadType=multipart&internalDateSource=dateHeader into the hub, with labelIds: ["INBOX","UNREAD"] and the raw bytes as message/rfc822. The hub only needs gmail.insert.Compared with re-running the Admin import, this needs no new owner consent, works for sources in other tenants too, copies exactly the missing messages, and the content passes only through the script. Tell staff that backfilled mail shows as new in the hub, although it may already have been answered from the source mailbox.
includeSpamTrash=true). Also check the copy's X-Gm-Spam header: a pass with X-Gm-Spam: 0 proves the route but not the spam path.admin.reports.audit.readonly, applications/admin). Routing edits appear as CHANGE_GMAIL_SETTING / UNIFIED_MAIL_ROUTING, carrying the rule's description and ID. The same API is a cheap test of whether an account is an administrator: it returns 200 only for admins.clientHold returns NXDOMAIN, and every copy bounces.Record each source's mechanism, rule ID, the date it went live and the test that proved it, in the project's own private records, never in this public skill. When a status turns out to be only partly true (for example "routed copies arrive", true only for non-spam), correct that record in the same change as the fix.
After this skill completes, check before closing:
X-Gm-Spam: 0 on a path meant to cover spam. Add it to section 5.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/gmail-commander:mailbox-consolidationfrom gmail-commander
npx claudepluginhub terrylica/cc-skills --plugin gmail-commander7 skills in this plugin
/bot-process-controlGmail Commander bot and digest process control - they run unattended in a private Restate deployment, never as workstation launchd jobs. Where they run, how to check them, what not to start locally. TRIGGERS - bot start, bot stop, bot restart, bot status, gmail bot down/email-triageGmail Commander email triage - the three-category Haiku prompt and parser in lib/triage.ts, run on demand by the bot's /digest command. The scheduled digest runs in a private deployment with its own implementation. TRIGGERS - email digest, triage emails, digest categories/gmail-accessAccess Gmail via CLI with 1Password OAuth: read, search and export email, and create drafts. Replies quote the sender verbatim as styled blockquotes and can carry file attachments, built and verified in one command. TRIGGERS - gmail, read email, search inbox, export emails, create draft, compose email, reply to email, draft a reply, quote their words, quoted reply, attach a file to a draft.Other plugins' skills for the same job