Gmail Commander Setup
Set up interactive Gmail access on this machine: find the OAuth credentials in 1Password, build the Gmail CLI, and prove it can read the intended mailbox.
Self-Evolving Skill: This skill improves through use. If instructions are wrong, parameters drifted, or a workaround was needed — fix this file immediately, don't defer. Only update for real, reproducible issues.
Scope — what this wizard does NOT do
The interactive Telegram bot and the scheduled digest run unattended in a private Restate deployment on an always-on Mac mini, not on a workstation. This wizard installs no launchd jobs, launcher scripts or daemon env files, and it must not: the laptop jobs were retired on 2026-09-24, and a second bot poller on the same token breaks the deployed one. Provisioning the deployment (bot token, chat ID, Gmail refresh token, model settings) is done through its own repository's runbook. What the deployment needs from this plugin is listed in the plugin CLAUDE.md.
Prerequisites Check
command -v op && echo "OK 1Password CLI" || echo "MISSING: 1Password CLI (macOS: brew install 1password-cli; Linux: 1Password's package repository)"
command -v proto && echo "OK proto" || echo "MISSING: proto (https://moonrepo.dev/docs/proto/install)"
command -v bun && echo "OK bun" || echo "MISSING: proto install bun"
On Linux there is no 1Password desktop app, so op works only with OP_SERVICE_ACCOUNT_TOKEN. Without 1Password at all, skip Phase 1's item discovery and supply the OAuth client through GMAIL_OAUTH_CLIENT_ID + GMAIL_OAUTH_CLIENT_SECRET or GMAIL_OAUTH_CLIENT_FILE, with GMAIL_OP_UUID set to any stable name for the account: env-setup.md § Without 1Password.
Phase 1: Gmail OAuth Setup
Step 1: Check if already configured
echo "GMAIL_OP_UUID: ${GMAIL_OP_UUID:-NOT_SET}"
If already set, use AskUserQuestion to ask if user wants to reconfigure.
Step 2: Discover 1Password items
op item list --vault Employee --format json | jq -r '.[] | select(.title | test("gmail|oauth"; "i")) | "\(.id)\t\(.title)"'
Step 3: Present options
Use AskUserQuestion with discovered items or guide new credential creation.
Step 4: Supply the UUID
Use the item UUID, not its title — the token cache is keyed by UUID. Pass it per command (GMAIL_OP_UUID=<selected-uuid> gmail list -n 1) or export GMAIL_OP_UUID=<selected-uuid> in the current shell. Per-command is safest when different projects use different mailboxes. See env-setup.md.
Phase 2: Build the Gmail CLI
The binary is built from the committed lockfile so every machine resolves the same dependency tree:
cd "$HOME/.claude/plugins/marketplaces/cc-skills/plugins/gmail-commander/scripts/gmail-cli" && bun run build
If --frozen-lockfile fails, package.json and bun.lock disagree. Do not delete the lockfile to get past it; report the mismatch.
Phase 3: Verification
GMAIL_CLI="$HOME/.claude/plugins/marketplaces/cc-skills/plugins/gmail-commander/scripts/gmail-cli/gmail"
"$GMAIL_CLI" list -n 1 2>&1 | head -5
The first run opens a browser for Google OAuth consent. Sign in with the account that the chosen 1Password item belongs to, then confirm with the user that the listed message comes from the intended mailbox.
Success Criteria
GMAIL_OP_UUIDresolves to a 1Password item UUID (in the shell or on the command line), or, without 1Password, names the account whileGMAIL_OAUTH_CLIENT_*supplies the clientscripts/gmail-cli/gmailexists (built withbun run build, which needs no install:@googleapis/gmailis vendored invendor/)gmail list -n 1returns a message from the intended mailbox- No
gmail-commanderbackground job exists locally: on macOSlaunchctl list | grep -F gmail-commanderprints nothing; on Linuxsystemctl --user list-units --all | grep -F gmail-commanderprints nothing
No OAuth Credentials?
Direct user to: gmail-api-setup.md
Post-Execution Reflection
After this skill completes, reflect before closing the task:
- Locate yourself. — Find this SKILL.md's canonical path (Glob for this skill's name) before editing. All corrections target THIS file and its sibling references/ — never other documentation.
- What failed? — Fix the instruction that caused it. If it could recur, add it as an anti-pattern.
- What worked better than expected? — Promote it to recommended practice. Document why.
- What drifted? — Any script, reference, or external dependency that no longer matches reality gets fixed now.
- Log it. — Every change gets an evolution-log entry with trigger, fix, and evidence.
Do NOT defer. The next invocation inherits whatever you leave behind.