Agent skill

Google Loops

by garrytan in garrytan/gbrain

Set up and operate the Gmail/Calendar/Contacts connector and the open-loop engine: who is waiting on the user, what they promised, and the context needed to respond.

MITAuto-check passedBackend & APIs

Install Google Loops

skills CLI
$ npx skills add garrytan/gbrain --skill google-loops -a claude-code

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

GitHub CLI
$ gh skill install garrytan/gbrain google-loops --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/garrytan/gbrain.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/google-loops .claude/skills/google-loops && 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
google-loops
GitHub stars
31k
Token cost
~2.3k tokens
SKILL.md length
1,100 words
Files
1
Skills in repo
47
Repo updated
First seen
Licence
MIT

At a glance

Set up and operate the Gmail/Calendar/Contacts connector and the open-loop engine: who is waiting on the user, what they promised, and the context needed to respond.

  • Works in 5 steps: Relay [SHOW USER] blocks verbatim. Setup… → The whole setup is exactly two user… → Never put secrets in argv or chat when… → …
  • Tasks that involve Email management
  • SKILL.md covers Contract for the harness (read…, Setup (the one command), Daily operation and Continuous ingestion, plus 5 more sections
  • Needs GOOGLE_CLIENT_SECRET

What it does

Google Loops is an agent skill from garrytan/gbrain. Set up and operate the Gmail/Calendar/Contacts connector and the open-loop engine: who is waiting on the user, what they promised, and the context needed to respond. Covers painless BYO OAuth setup (exactly two user interactions), the daily gbrain waiting digest, loop closing/muting, and troubleshooting via the typed error catalog.

Its SKILL.md is about 2.3k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Backend & APIs, covering Email management. It works with Gmail. The repository describes itself as: Garry's Opinionated OpenClaw/Hermes Agent Brain. The licence is MIT.

When your agent uses it

  • Tasks that involve Email management

Example prompts

  • “/google-loops”

Requirements

  • A credential in GOOGLE_CLIENT_SECRET

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. Relay [SHOW USER] blocks verbatim. Setup commands print fenced
  2. The whole setup is exactly two user interactions. (1) The Google
  3. Never put secrets in argv or chat when avoidable. When the user drops
  4. Every command speaks JSON. Add --json and read
  5. Re-running is always safe. gbrain google connect and

What it can do on your machine

Read from SKILL.md and the folder at commit fc54831. 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 these keys or tokens, usually read from environment variables:

    • GOOGLE_CLIENT_SECRET

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

Context cost

Google Loops loads about 2.3k tokens when it runs. Until then it costs about 87 tokens; SKILL.md has 1,100 words of instructions outside code blocks.

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

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 garrytan/gbrain at commit fc54831, republished under its MIT licence (© garrytan). 1,100 words, ~2,310 tokens.

Download SKILL.mdSave it as .claude/skills/google-loops/SKILL.md (or your agent's skills folder).
name
google-loops
description
Set up and operate the Gmail/Calendar/Contacts connector and the open-loop engine: who is waiting on the user, what they promised, and the context needed to respond. Covers painless BYO OAuth setup (exactly two user interactions), the daily `gbrain waiting` digest, loop closing/muting, and troubleshooting via the typed error catalog.
version
1.0.0
triggers
connect gmail, connect google, connect calendar, connect contacts, who is waiting on me, what do I owe people, open loops, unanswered email, set up email…
tools
open_loops, loops_close, loops_mute, entity, context_pack
mutating
true
writes_pages
false

Google Loops — Setup and Daily Operation

The connector ingests Gmail threads, calendar events, and contacts into the brain and maintains the open-loop record behind gbrain waiting. Full references: docs/guides/google-connect.md (setup + every error and its fix) and docs/guides/open-loops.md (how detection works).

Contract for the harness (read first)

  1. Relay [SHOW USER] blocks verbatim. Setup commands print fenced [SHOW USER] ... [/SHOW USER] blocks — numbered steps with deep links. Pass them to the user unchanged (paraphrasing loses load-bearing detail like "Desktop app, NOT Web application"). Batch everything into ONE message per block.
  2. The whole setup is exactly two user interactions. (1) The Google Cloud checklist + the user hands back the downloaded client JSON. (2) The user clicks one consent URL. If you find yourself asking a third question, re-read the block you skipped.
  3. Never put secrets in argv or chat when avoidable. When the user drops client_secret_*.json into chat, save it to a file (mode 0600) and pass the path: gbrain google connect --client-json <path>. Env (GOOGLE_CLIENT_ID/GOOGLE_CLIENT_SECRET) also works. Raw --client-id/--client-secret flags are the last resort.
  4. Every command speaks JSON. Add --json and read { ok, status, next_action: { command, user_message }, error }. When next_action.user_message is present, that IS the message to show the user; when next_action.command is present, that is your next call. Errors carry { code, problem, cause, fix, doc_url } — show the user problem + fix, nothing else.
  5. Re-running is always safe. gbrain google connect and gbrain google setup are idempotent state machines — the documented fix for most errors is "run it again."

Setup (the one command)

bash
gbrain google setup --json

Handles: credential intake (prints the GCP checklist when nothing is on file) → consent (loopback locally; auto paste-back over SSH/headless — non-TTY flows complete via a second call: gbrain google connect --code "<pasted-redirect-url>") → source registration → a budgeted first sync (newest mail first; the deep backfill resumes on later syncs automatically) → the first gbrain waiting digest.

Multiple accounts: repeat with --account work@example.com.

Already holding Google access another way (a Google CLI with its own auth, gcloud, a credential gateway that mints tokens)? Skip OAuth and point the source at it — no credential enters gbrain:

bash
gbrain sources add gmail-work --kind google --account you@example.com \
  --access command --token-command "<command that prints an access token>"

(--access env --token-env <VAR> reads an externally-refreshed token from the environment instead.) Then gbrain sync --source gmail-work and gbrain waiting work identically.

Verify health afterwards: gbrain google status --json (per-account refresh probe) — and gbrain doctor carries a google_oauth check that warns once a Testing-mode account goes 5+ days without a successful refresh. An actively-syncing account gets no pre-warning before the 7-day Testing-mode expiry — publishing to Production is the real fix.

Daily operation

bash
gbrain waiting --json        # the killer output: ranked people waiting
gbrain loops done <id>       # user handled it
gbrain loops drop <id>       # user is not going to do it
gbrain loops mute sender <email>   # never track this sender again
  • waiting REFUSES on stale data (no successful sync in 24h) and names the exact fix (gbrain sync --source <id>). Run the sync, then retry. Only use --stale-ok when the user explicitly accepts stale results.
  • completeness: "partial" means some mail in the last 14 days is held after repeated import failures (listed in held). Present the answer as partial: name each held item (sender, and subject when shown) and its retry command (gbrain sources retry-held <id>). Never say "you are clean" on a partial answer.
  • When presenting loops, show: the counterparty, what's owed (summary), the evidence quote, the deep link (opens the exact Gmail thread in the right account), and the due date when present. The trusted-local result already carries a paste-ready text digest — reuse it.
  • For "context to respond": each group carries the counterparty's entity card (summary, recent history, other open threads). Need more, call context_pack with the counterparty slug.
  • After the user says they replied/handled something, close the loop (loops done) — thread loops also self-close on the next sync when the reply is visible in Gmail.

Continuous ingestion

Google sources sync like any source: autopilot and gbrain sync --all pick them up automatically. No cron of its own. A bare un-targeted gbrain sync does NOT reach them — use --source <id> or --all.

Show full SKILL.md (469 more words)Show less

Troubleshooting

Every failure has a typed code with the fix attached — docs/guides/google-connect.md#troubleshooting is the canonical table. The three the user will actually hit:

  • "Google hasn't verified this app" during consent → expected; it's the user's own app: Advanced → Continue. Warn them BEFORE they click the URL.
  • access_denied_test_user → they forgot to add themselves as a test user (the error carries the deep link).
  • invalid_grant_testing_expiry (everything silently stopped ~day 7) → their consent screen is still in Testing; publish to Production, then gbrain google connect --reauth <email>.

Cost honesty

Commitment extraction sends recent email text (≤30 days, ≤50 threads/sweep) to the configured chat provider. Tell the user once during setup; the off switch is gbrain config set loops.extraction_enabled false. The unanswered-thread detector is free and unaffected.

Output Format

When relaying gbrain waiting, present per counterparty, most urgent first, then the ## No counterparty section (loops that name no person) last:

## <Counterparty> (<N> open)
- [<loop_type>] <what's owed> (<age>) — due <date if any>
  > "<evidence quote>"
  <Gmail deep link>

The trusted-local --json result already carries this as a paste-ready text field — prefer relaying it over re-rendering. For setup commands, relay [SHOW USER] blocks verbatim and error.problem + error.fix on failures; never dump raw JSON envelopes at the user.

When it fails

Follow the agent operator protocol for any gbrain error code, exit code, [AGENT] block or notice block. Specific to this skill:

  • Setup prints [SHOW USER] blocks: relay them verbatim, one message per block. gbrain mcp expose and gbrain google still exit 2 when they need the user's confirmation (documented legacy), so read the block, not just the exit code.
  • A Google credential error (invalid_grant_revoked, consent_timeout, wrong_account_consented, …) carries { code, problem, cause, fix }: show the user the problem and fix; most fixes are "run it again" by the user.
  • gbrain waiting refuses on stale data or reports partial coverage from held items: run the sync it names, or gbrain sources status <id> then, after the user agrees, gbrain sources retry-held <id>.

Anti-Patterns

  • Paraphrasing a [SHOW USER] block. The checklists carry load-bearing detail ("Desktop app, NOT Web application", the test-user step). Relay verbatim, one message per block.
  • Asking the user for client_id/client_secret as chat text. Take the downloaded JSON as a 0600 file (--client-json <path>) or env vars; secrets in argv/chat are the last resort, never the default.
  • Answering "who is waiting on me" from query/search. The open-loop record is open_loops / gbrain waiting — search results have no loop-state semantics and will happily surface answered threads.
  • Dropping completeness: "partial". A partial answer with no loops is not an empty inbox; say which items are held and how to re-attempt them.
  • Bypassing the staleness refusal with --stale-ok silently. Run the named gbrain sync --source <id> first; only pass --stale-ok when the user explicitly accepts possibly-outdated loops.
  • Marking loops done for the user. Close (gbrain loops done <id>) only after the user says it's handled; thread loops self-close on the next sync when the reply is visible in Gmail.

© garrytan, MIT. 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/google-loops of garrytan/gbrain.

Open the folder on GitHubat commit fc54831

Compare with similar skills

Google Loops 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.

Google Loops compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Google Loops this skillgarrytan/gbrain31k—~2.3kAutomated safety check: PassMIT
Smtp Email Senderopenakita/openakita2k—~693Automated safety check: NotesAGPL-3.0
Deliverability Test Publicgrowthenginenowoslawski/coldoutboundskills751—~1kAutomated safety check: PassMIT
Google WorkspaceRedWoodOG/Hermes-Desktop177—~2.1kAutomated safety check: PassMIT
Agentmailsundial-org/awesome-openclaw-skills6631 repos~1.5kAutomated safety check: WarnNone
GmailCraftOS-dev/CraftBot3922 repos~2.2kAutomated safety check: PassMIT

Similar skills

  • Smtp Email Sender

    openakita/openakita

    Send emails via SMTP (Gmail, Outlook, etc.). An agent skill from openakita/openakita.

    2k GitHub stars~693 tokensUpdated 15 days ago
    Backend & APIsAuto-check: notes
  • Deliverability Test Public

    growthenginenowoslawski/coldoutboundskills

    Compare reply rates, bounce rates, and positive reply rates broken down by inbox type (SMTP / Gmail / Outlook) for a Smartlead account.

    751 GitHub stars~1k tokensUpdated 3 days ago
    Backend & APIsAuto-check passed
  • Google Workspace

    RedWoodOG/Hermes-Desktop

    Gmail, Calendar, Drive, Contacts, Sheets, and Docs integration via Python.

    177 GitHub stars~2.1k tokensUpdated 4 mo ago
    Backend & APIsAuto-check passed
  • Agentmail

    sundial-org/awesome-openclaw-skills

    API-first email platform designed for AI agents. An agent skill from sundial-org/awesome-openclaw-skills.

    663 GitHub starsUsed in 1 repo~1.5k tokens
    Backend & APIsAuto-check: warnings
  • Gmail

    CraftOS-dev/CraftBot

    Gmail API integration with managed OAuth. An agent skill from CraftOS-dev/CraftBot.

    392 GitHub starsUsed in 2 repos~2.2k tokens
    Backend & APIsAuto-check passed
  • 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

More from garrytan/gbrain

All 47 skills in this repo
  • Traces a factual error the user points out back to its source (a brain page, a memory file, SOUL.md or USER.md, or a hallucination) and fixes that source instead of just noting the correction.

    31k GitHub stars~3.4k tokensUpdated today
    Auto-check passed
  • Searches and writes a company-wide knowledge brain through the gbrain CLI, so durable decisions and facts about people, projects and history stay findable beyond one session.

    31k GitHub stars~875 tokensUpdated today
    Auto-check passed
  • Idea Ingest

    garrytan/gbrain

    Ingest links, articles, tweets, and ideas into the brain. An agent skill from garrytan/gbrain.

    31k GitHub stars~1.6k tokensUpdated today
    Auto-check passed
  • Sends what your notes already know about a topic to Perplexity, so the cited web search reports only what is new, such as entity updates or deal changes.

    31k GitHub stars~2k tokensUpdated today
    Auto-check: notes
  • Schema Unify

    garrytan/gbrain

    Migrate a brain from gbrain-base (or any pack) to gbrain-base-v2's 14-canonical-type taxonomy via gbrain onboard --check + the unify-types Minion handler.

    31k GitHub stars~3.4k tokensUpdated today
    Auto-check passed
  • Skillpack Check

    garrytan/gbrain

    Run gbrain skillpack-check to produce an agent-readable JSON health report for the gbrain install.

    31k GitHub stars~1.4k tokensUpdated today
    Auto-check passed

Works with

Questions about Google Loops

What does Google Loops do?

Set up and operate the Gmail/Calendar/Contacts connector and the open-loop engine: who is waiting on the user, what they promised, and the context needed to respond. Google Loops is an agent skill from garrytan/gbrain. Set up and operate the Gmail/Calendar/Contacts connector and the open-loop engine: who is waiting on the user, what they promised, and the context needed to respond.

When should I use Google Loops?

Google Loops fits situations like: tasks that involve Email management.

How do I install Google Loops in Claude Code?

Run `npx skills add garrytan/gbrain --skill google-loops -a claude-code`. Or copy the skill folder (skills/google-loops in garrytan/gbrain) into .claude/skills/google-loops in your project. Claude Code loads it when a task matches its description.

How do I install Google Loops in Codex?

Run `npx skills add garrytan/gbrain --skill google-loops -a codex`. Or copy the skill folder (skills/google-loops in garrytan/gbrain) into .agents/skills/google-loops in your project. Codex loads it when a task matches its description.

Can I use Google Loops 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 garrytan/gbrain --skill google-loops -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/google-loops, .gemini/skills/google-loops, .github/skills/google-loops and .opencode/skills/google-loops in your project.

What does Google Loops need to run?

Going by SKILL.md and its folder, Google Loops needs credentials named GOOGLE_CLIENT_SECRET. Our summary lists: A credential in GOOGLE_CLIENT_SECRET.

Does Google Loops 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 Google Loops 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 Google Loops use?

Google Loops is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Google Loops use?

About 2.3k tokens (SKILL.md is roughly 9.2k 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 Google Loops?

Skills that share tags, products or a category with Google Loops: Smtp Email Sender (openakita/openakita, 2k stars), Deliverability Test Public (growthenginenowoslawski/coldoutboundskills, 751 stars), Google Workspace (RedWoodOG/Hermes-Desktop, 177 stars) and Agentmail (sundial-org/awesome-openclaw-skills, 663 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Google Loops?

garrytan (a GitHub user) maintains it in garrytan/gbrain, which has 30,701 GitHub stars. The repository holds 47 skills in this directory. The repository was last updated on October 9, 2026.

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