Agent skill

Gmail Inbox Watcher

by googleworkspace in googleworkspace/cli

Streams new Gmail messages as NDJSON from the gws command line tool using Google Pub/Sub, with label filters, batch settings and optional per-message files.

Apache-2.0Auto-check passedProductivity & Automation

Install Gmail Inbox Watcher

skills CLI
$ npx skills add googleworkspace/cli --skill gws-gmail-watch -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install googleworkspace/cli gws-gmail-watch --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/googleworkspace/cli.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/gws-gmail-watch .claude/skills/gws-gmail-watch && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
gws-gmail-watch
GitHub stars
31k
Used in
1 other repo
Token cost
~476 tokens
SKILL.md length
151 words
Files
1
Skills in repo
77
Repo updated
First seen
Licence
Apache-2.0

At a glance

Streams new Gmail messages as NDJSON from the gws command line tool using Google Pub/Sub, with label filters, batch settings and optional per-message files.

  • Feeding incoming Gmail messages into a script or pipeline as they arrive
  • SKILL.md covers Usage, Flags, Examples and Tips, plus 1 more section
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Watching only the inbox or unread messages through label filters

What it does

The gws gmail +watch command listens for new email and prints each message as a line of NDJSON. It is part of the Google Workspace CLI, and its prerequisite is reading the shared gws skill for authentication, global flags and security rules, which can be created with gws generate-skills if it is missing.

Flags control where the stream comes from and how it behaves: a GCP project for Pub/Sub resources, an existing subscription or topic, a comma-separated list of Gmail label IDs such as INBOX and UNREAD, a maximum number of messages per pull (default 10), a pull interval in seconds (default 5), a message format of full, metadata, minimal or raw, a single-pull mode, cleanup of created resources on exit and an output directory that writes each message to its own JSON file.

A Gmail watch expires after 7 days and must be re-run to renew. Without the cleanup flag, the Pub/Sub resources persist so a later run can reconnect, and Ctrl-C stops the stream gracefully.

When your agent uses it

  • Feeding incoming Gmail messages into a script or pipeline as they arrive
  • Watching only the inbox or unread messages through label filters
  • Saving each new message as its own JSON file for later processing

Example prompts

  • “Watch my inbox for new emails and stream them as NDJSON using my-gcp-project.”
  • “Pull the unread messages once in metadata format and then exit.”
  • “Write every new message to ./incoming as separate JSON files and clean up Pub/Sub when I stop.”

Requirements

  • The gws command line tool, authenticated as described in the gws-shared skill
  • A GCP project with Pub/Sub, or an existing topic or subscription

What it can do on your machine

Read from SKILL.md and the folder at commit a3768d0. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are bash).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Gmail Inbox Watcher loads about 476 tokens when it runs. Until then it costs about 18 tokens; SKILL.md has 151 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~18
When it runs · the whole SKILL.md, loaded when a task matches
~476

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from googleworkspace/cli at commit a3768d0, republished under its Apache-2.0 licence (© googleworkspace). 151 words, ~476 tokens.

Download SKILL.mdSave it as .claude/skills/gws-gmail-watch/SKILL.md (or your agent's skills folder).
name
gws-gmail-watch
description
Gmail: Watch for new emails and stream them as NDJSON.
metadata.version
0.22.5

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

bash
gws gmail +watch

Flags

FlagRequiredDefaultDescription
--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—10Max messages per pull batch
--poll-interval—5Seconds between pulls
--msg-format—fullGmail 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

bash
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

© googleworkspace, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/gws-gmail-watch of googleworkspace/cli.

Open the folder on GitHubat commit a3768d0

Used in 1 other repository

We found 1 copy of this SKILL.md (exact, near-identical or edited) in other folders, from 1 other GitHub owner. This page covers the copy in googleworkspace/cli, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Gmail Inbox Watcher next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Gmail Inbox Watcher compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Gmail Inbox Watcher this skillgoogleworkspace/cli31k1 repos~476Automated safety check: PassApache-2.0
Google Workspaceericrisco/rsc-harness174—~3.2kAutomated safety check: PassMIT
GCP Workspace Pivotwgpsec/AboutSecurity1.8k—~2.9kAutomated safety check: PassNone
GwsLeoYeAI/openclaw-master-skills2.2k—~4.9kAutomated safety check: PassMIT
Google WorkspaceAlexAI-MCP/hermes-CCC135—~1.2kAutomated safety check: PassMIT
Bootstrap Google Toolsgoogle/adk-recipes10k—~5kAutomated safety check: WarnApache-2.0

Similar skills

  • Google Workspace

    ericrisco/rsc-harness

    A skill your agent uses when server-side code reads or writes Gmail, Drive, Calendar, or Sheets with a GCP service account and no human in the OAuth loop: picking the auth mode (app-owned vs…

    174 GitHub stars~3.2k tokensUpdated yesterday
    Backend & APIsAuto-check passed
  • GCP Workspace Pivot

    wgpsec/AboutSecurity

    GCP 到 Google Workspace 的穿越攻击方法论。当已获取 GCP Service Account 或 Project 权限并发现目标组织使用 Google Workspace、需要从云平台穿越到企业邮件/文档/管理控制台、或发现 Domain-Wide Delegation 配置时使用。覆盖 Domain-Wide Delegation 滥用、OAuth…

    1.8k GitHub stars~2.9k tokensUpdated today
    Backend & APIsAuto-check passed
  • Gws

    LeoYeAI/openclaw-master-skills

    Google Workspace CLI. An agent skill from LeoYeAI/openclaw-master-skills.

    2.2k GitHub stars~4.9k tokensUpdated 2 mo ago
    Documents & OfficeAuto-check passed
  • Google Workspace

    AlexAI-MCP/hermes-CCC

    Automate Google Workspace — Gmail, Drive, Sheets, Docs, Calendar via Google API Python client or gcloud CLI.

    135 GitHub stars~1.2k tokensUpdated 6 mo ago
    Documents & OfficeAuto-check passed
  • Bootstrap Google Tools

    google/adk-recipes

    Official

    Install/auth CLIs the sandbox lacks - gws (Drive, Gmail, Sheets, Calendar), gcloud, agents-cli, mcp-cli (MCP servers).

    10k GitHub stars~5k tokensUpdated today
    Agent WorkflowsAuto-check: warnings
  • Gws

    kv0906/pm-kit

    This skill should be used when the user asks to "set up gws", "install Google Workspace CLI", "connect Gmail to Claude", "manage Google Drive from terminal", "send email from CLI", "check my…

    138 GitHub stars~1.6k tokensUpdated 3 mo ago
    Documents & OfficeAuto-check passed

More from googleworkspace/cli

All 77 skills in this repo
  • Workspace Events Subscribe

    googleworkspace/cli

    Subscribes to Google Workspace events with the gws CLI and streams them as NDJSON, with flags for the target resource, event types, Pub/Sub project and output directory.

    31k GitHub stars~509 tokensUpdated 2 days ago
    Auto-check passed
  • Gmail Message Forwarder

    googleworkspace/cli

    Forwards an existing Gmail message to new recipients from the command line with the gws CLI, with options for notes, attachments, CC, BCC and drafts.

    31k GitHub stars~763 tokensUpdated 2 days ago
    Auto-check passed
  • Gmail Reply via gws

    googleworkspace/cli

    Replies to a Gmail message from the gws CLI with automatic threading, plus CC, BCC, extra recipients, attachments, HTML bodies and draft or dry-run modes.

    31k GitHub stars~655 tokensUpdated 2 days ago
    Auto-check passed
  • Gws Calendar Agenda

    googleworkspace/cli

    Google Calendar: Show upcoming events across all calendars. An agent skill from googleworkspace/cli.

    31k GitHub starsUsed in 1 repo~389 tokens
    Auto-check passed
  • Gmail Reply-All Command

    googleworkspace/cli

    Replies to everyone on a Gmail message through the gws CLI, with threading handled automatically, options to add or drop recipients, and a draft mode.

    31k GitHub stars~736 tokensUpdated 2 days ago
    Auto-check passed
  • Gws Drive Upload

    googleworkspace/cli

    Google Drive: Upload a file with automatic metadata. An agent skill from googleworkspace/cli.

    31k GitHub starsUsed in 1 repo~322 tokens
    Auto-check passed

Questions about Gmail Inbox Watcher

What does Gmail Inbox Watcher do?

Streams new Gmail messages as NDJSON from the gws command line tool using Google Pub/Sub, with label filters, batch settings and optional per-message files. The gws gmail +watch command listens for new email and prints each message as a line of NDJSON. It is part of the Google Workspace CLI, and its prerequisite is reading the shared gws skill for authentication, global flags and security rules, which can be created with gws generate-skills if it is missing.

When should I use Gmail Inbox Watcher?

Gmail Inbox Watcher fits situations like: feeding incoming Gmail messages into a script or pipeline as they arrive; watching only the inbox or unread messages through label filters; saving each new message as its own JSON file for later processing.

How do I install Gmail Inbox Watcher in Claude Code?

Run `npx skills add googleworkspace/cli --skill gws-gmail-watch -a claude-code`. Or copy the skill folder (skills/gws-gmail-watch in googleworkspace/cli) into .claude/skills/gws-gmail-watch in your project. Claude Code loads it when a task matches its description.

How do I install Gmail Inbox Watcher in Codex?

Run `npx skills add googleworkspace/cli --skill gws-gmail-watch -a codex`. Or copy the skill folder (skills/gws-gmail-watch in googleworkspace/cli) into .agents/skills/gws-gmail-watch in your project. Codex loads it when a task matches its description.

Can I use Gmail Inbox Watcher in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add googleworkspace/cli --skill gws-gmail-watch -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/gws-gmail-watch, .gemini/skills/gws-gmail-watch, .github/skills/gws-gmail-watch and .opencode/skills/gws-gmail-watch in your project.

What does Gmail Inbox Watcher need to run?

SKILL.md names no scripts, command-line tools or credentials: Gmail Inbox Watcher is instructions for the agent only. Our summary lists: The gws command line tool, authenticated as described in the gws-shared skill; A GCP project with Pub/Sub, or an existing topic or subscription.

Does Gmail Inbox Watcher access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Gmail Inbox Watcher safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Gmail Inbox Watcher use?

Gmail Inbox Watcher is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Gmail Inbox Watcher use?

About 476 tokens (SKILL.md is roughly 1.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Gmail Inbox Watcher?

Skills that share tags, products or a category with Gmail Inbox Watcher: Google Workspace (ericrisco/rsc-harness, 174 stars), GCP Workspace Pivot (wgpsec/AboutSecurity, 1.8k stars), Gws (LeoYeAI/openclaw-master-skills, 2.2k stars) and Google Workspace (AlexAI-MCP/hermes-CCC, 135 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Gmail Inbox Watcher?

googleworkspace (a GitHub organization) maintains it in googleworkspace/cli, which has 31,280 GitHub stars. The repository holds 77 skills in this directory. The repository was last updated on October 6, 2026.

Source: googleworkspace/cli on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.