gws-gmail-watch

A Gmail command that waits for new emails and outputs them as newline-delimited JSON, a format with one JSON object per line. It can use Google Cloud Pub/Sub, a messaging service, to receive Gmail notifications.

In plain words
What is it for?
Use it to monitor selected Gmail labels, pull messages once or continuously, choose the message detail level, and optionally save each message as a JSON file.
Why use it?
It removes the need to repeatedly check the inbox manually or write the notification and polling setup yourself.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/googleworkspace/cli/gws-gmail-watch
Any agent
npx skills add googleworkspace/cli --skill gws-gmail-watch
Clone the repo
git clone --depth 1 https://github.com/googleworkspace/cli

Made for: Claude Code, Codex.

Per session 20 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 539 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00020 $0.00539
Opus 5 $0.00010 $0.00269
Sonnet 5 $0.00004 $0.00108
Haiku 4.5 $0.00002 $0.00054

Measured 3d ago against content hash c59aa44f2278, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

gws-gmail-watch scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

4 near-identical copies found in the catalogue:

skills/gws-gmail-watch/SKILL.md · 60 lines

What it actually says

gmail +watch

PREREQUISITE: Read ../gws-shared/SKILL.md for auth, global flags, and security rules. If missing, run gws generate-skills to create it.

Watch for new emails and stream them as NDJSON

Usage

gws gmail +watch

Flags

Flag Required Default Description
--project GCP project ID for Pub/Sub resources
--subscription Existing Pub/Sub subscription name (skip setup)
--topic Existing Pub/Sub topic with Gmail push permission already granted
--label-ids Comma-separated Gmail label IDs to filter (e.g., INBOX,UNREAD)
--max-messages 10 Max messages per pull batch
--poll-interval 5 Seconds between pulls
--msg-format full Gmail message format: full, metadata, minimal, raw
--once Pull once and exit
--cleanup Delete created Pub/Sub resources on exit
--output-dir Write each message to a separate JSON file in this directory

Examples

gws gmail +watch --project my-gcp-project
gws gmail +watch --project my-project --label-ids INBOX --once
gws gmail +watch --subscription projects/p/subscriptions/my-sub
gws gmail +watch --project my-project --cleanup --output-dir ./emails

Tips

  • Gmail watch expires after 7 days — re-run to renew.
  • Without --cleanup, Pub/Sub resources persist for reconnection.
  • Press Ctrl-C to stop gracefully.

See Also

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 60 lines · 20 tokens per session scan A c59aa44f2278

Subscribe to this mod's changes

gws-gmail-watch is a skill published in the GitHub repository googleworkspace/cli (30,691 stars, last pushed 7d ago), licensed Apache-2.0. It adds 20 tokens to every session and 539 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

managing-google-workspace

Manages Google Workspace operations across 12 services (Gmail, Drive, Calendar, Docs, Sheets, Slides, Forms, Tasks, Contacts, Chat, Apps Script, Custom Search). Supports MCP tools or CLI via uvx workspace-mcp --cli. Provides tool routing, workflows, and parameter guidance for 114 tools. Triggers for "check my email"…

taylorwilsdon/google_workspace_mcp · 123 tokens

gws-cli

Use the Google Workspace CLI to inspect schemas, authenticate safely, and run Google Workspace API commands. Use when the user wants to work with Drive, Gmail, Sheets, Docs, Calendar, Chat, Tasks, or other Google Workspace APIs through the gws command.

fabioeloi/gws-cli-skill · 56 tokens

workspace-mcp

Use when you need to access email, calendar, or cloud drive. Provides 35 tools for Microsoft 365, Google Workspace, and IMAP — read/search/manage email, create/check calendar events, browse/upload/share files. Triggers on: email, inbox, calendar, meeting, schedule, drive, files, OneDrive, Gmail, Outlook.

rumbitopi/mail-cal-drive-mcp · 74 tokens

hr-onboarding

A new-hire onboarding plan as a single page — first week schedule, buddy + manager intro, learning track, equipment checklist, and "you're set when…" outcomes. Use when the brief mentions "onboarding", "new hire", "first week plan", or "入职".

nexu-io/open-design · 62 tokens

feishu

Work with Feishu or Lark bots, docs, sheets, bitables, approval flows, and OpenAPI/MCP setup without hardcoding credentials.

Hmbown/CodeWhale · 33 tokens

mochi-remind

Handle due reminders — notify the user with natural language and mark them done.

kirodotdev/KiroCrew · 20 tokens