From brain-os
Executes Gmail triage actions: archive, delete, label, star, unsubscribe inbox emails; drafts replies from vault reports; backfills calendar events. Use /gmail for cleanup or drafting.
npx claudepluginhub sonthanh/brain-os-pluginThis skill uses the workspace's default tool permissions.
**Vault path:** Read from `${CLAUDE_PLUGIN_ROOT}/brain-os.config.md`
Scans unread emails from Gmail or Hey.com, scores by priority (VIP, urgency, deadlines), classifies, saves relevant as vault notes, generates triage report.
Guides Next.js Cache Components and Partial Prerendering (PPR) with cacheComponents enabled. Implements 'use cache', cacheLife(), cacheTag(), revalidateTag(), static/dynamic optimization, and cache debugging.
Guides building MCP servers enabling LLMs to interact with external services via tools. Covers best practices, TypeScript/Node (MCP SDK), Python (FastMCP).
Share bugs, ideas, or general feedback.
Vault path: Read from ${CLAUDE_PLUGIN_ROOT}/brain-os.config.md
Reads the latest triage report from the vault, executes cleanup actions, and drafts replies. Designed to be conflict-safe — checks message state before acting, so it won't re-process emails you've already handled manually.
/gmail — Process latest triage reportFind latest report: Read the most recent file in {vault}/daily/gmail-triage/
Parse ## Actions section: Each line is - [ ] action | msg_id | context
Check current state: For each action, verify the message still exists and hasn't been handled already
Execute actions via tsx ${CLAUDE_PLUGIN_ROOT}/skills/gmail/scripts/gmail-clean.ts:
| Action | What it does |
|---|---|
archive | Remove INBOX label |
delete | Move to trash |
label:name | Add label (create if doesn't exist) |
star | Add STARRED label |
mark-important | Add IMPORTANT label |
unsubscribe | Move to trash + create filter to auto-delete future emails from sender |
needs-reply | Skip — handled separately with /gmail draft |
Update report: Check off completed actions in the triage file
Report summary: "Processed 12 actions: 5 archived, 3 deleted, 2 labeled, 1 starred, 1 unsubscribed. 2 skipped (already handled)."
/gmail draft — Draft replies for flagged emails (interactive)needs-reply actions{vault}/context/about-me.md and {vault}/context/business.md for voice/contextgmail_create_draft with the approved text
/gmail auto-draft — Autonomously draft replies (no approval needed)Fully autonomous mode — reads needs-reply queue, generates drafts, creates them in Gmail. Safe because drafts are never sent.
{vault}/commands/gmail-auto-draft.md/gmail create <descriptor> — Backfill a missing calendar eventThe triage workflow appends a ## Meetings — missing-on-calendar section to the human-summary MD whenever a personal forwarded/plain-text meeting is detected that isn't already on the user's Google Calendar. (Direct .ics invites are auto-processed by Google — never appear here.)
The workflow also adds the IMPORTANT Gmail label to each missing-event email so the user can filter is:important in Gmail mobile to find what needs calendar attention. Each entry in the section also includes the email's From, Subject, and a mail.google.com#search/rfc822msgid: link that deep-links to the Gmail app on mobile (when Gmail is the default mail handler).
When the user says /gmail create <descriptor> (e.g. /gmail create carrosserie):
Find the latest triage MD in {vault}/daily/gmail-triage/.
Locate the ## Meetings — missing-on-calendar section.
Match <descriptor> against entry titles + locations (case-insensitive substring; ask the user if multiple match).
Extract: title, datetime_iso, timezone, duration_min, location, description (build from Source: line + Gmail thread link in the entry).
For physical meetings, enrich location with a real address via web search if the entry's location is incomplete (e.g. just a business name). Online meetings already carry the URL — skip enrichment.
Run:
bun ${CLAUDE_PLUGIN_ROOT}/skills/gmail/scripts/calendar-create.ts \
--title "<title>" \
--start "<datetime_iso>" \
--end "<datetime_iso + duration>" \
--tz "<timezone>" \
--location "<enriched_location>" \
--description "<description>"
The script returns the event URL. Edit the matching entry in the triage MD: replace the leading - with - [x] and append → Created: <event_url> to the title line so future re-checks are idempotent (the workflow's existence-check skips when ## Meetings — is already present).
The script reuses the plugin's .credentials.json — must have calendar.events scope. Run tsx ${CLAUDE_PLUGIN_ROOT}/skills/gmail/scripts/setup-oauth.ts once to grant it.
/gmail status — Show pending actions + SLA state{vault}/daily/gmail-triage/{vault}/business/intelligence/emails/sla-open.md. Print:
fast, normal, slow)/gmail sla — SLA ledger maintenanceThe SLA ledger lives at {vault}/business/intelligence/emails/sla-open.md. The triage workflow appends new items each run; resolution/cleanup is interactive via this command.
/gmail sla list — render the open ledger to terminal, sorted by tier severity then age.
/gmail sla resolve <message_id> — manually mark a ledger row resolved.
## Breached or ## Open## Resolved (last 7 days, audit trail) with Resolved (UTC) = now and Resolved by = manual/gmail sla check — for each open item, use Gmail API (gmail_read_message on the message ID, walk the thread) to detect resolution per the 4-guard rule in business/intelligence/gmail-rules.md § SLA monitoring → Resolution detection:
me address OR a team-member domain listed in {vault}/business/intelligence/gmail-rules.md → ### Team domains (internal)Auto-Submitted headerIf all 4 met → move to Resolved with Resolved by = sender of the qualifying reply.
If a NEW external message arrived AFTER the team's reply → re-open at the same tier with received_at = the new external message's date.
Print a diff: how many resolved, how many re-opened, how many still open/breached.
Resolution detection also runs automatically in the GHA workflow (via /tmp/sla-threads.json from gmail-fetch@v0). This command is for ad-hoc checks between workflow runs.
Requires Google OAuth credentials for the Gmail API. Run the setup script:
tsx ${CLAUDE_PLUGIN_ROOT}/skills/gmail/scripts/setup-oauth.ts
This creates ${CLAUDE_PLUGIN_ROOT}/skills/gmail/.credentials.json (gitignored).
The skill reads {vault}/business/intelligence/gmail-rules.md for user-defined patterns. AI judgment is used as fallback when no rule matches.
After each /gmail or /gmail auto-draft run, append one line to {vault}/daily/skill-outcomes/gmail.log:
{date} | gmail | {mode} | ~/work/brain-os-plugin | {vault}/daily/gmail-triage/{triage-file} | commit:N/A | {result}
mode: triage, draft, or auto-drafttriage-file: the filename of the triage report processed (e.g., 2026-04-11-triage.md)result: pass if all actions executed cleanly, partial if some skipped/already-handled, fail if errorsThis log feeds /improve gmail to detect patterns in skipped actions, draft rejections, and triage errors.