gog-advanced
Use gog (gogcli) for Google Workspace: Gmail, Calendar, Drive, Contacts, Sheets, Docs.
This skill is optimized for agent reliability:
- Prefer list/inspect first, don’t assume resource IDs.
- Prefer
--json for parsing; treat human tables as fallback.
- For “agenda / today / tomorrow / this week” questions: search across ALL calendars by default.
- For write actions (send email, create/update events, modify Drive/Sheets/Docs): confirm intent and summarize the exact action first.
Prereqs / Setup (once)
- Store OAuth client credentials:
gog auth credentials /path/to/client_secret.json
- Add an account (request only needed services):
gog auth add you@gmail.com --services gmail,calendar,drive,contacts,sheets,docs
- Make account default to avoid repeating flags:
export GOG_ACCOUNT=you@gmail.com
Notes:
- CLI help is discoverable:
gog --help, gog calendar --help, etc.
gog supports multiple accounts; use --account or GOG_ACCOUNT. (Prefer env var.)
Global agent rules (non-negotiable)
Calendar agenda queries
- If user asks “what’s on my calendar today / tomorrow / this week / next N days”:
- Run:
gog calendar events --all --today|--tomorrow|--week|--days N --json
- If results are empty, only then troubleshoot (timezone, account, auth status).
- Only use a specific calendarId if the user explicitly asks for a specific calendar or name.
Calendar identification
- If you need a calendarId (because the user wants a specific calendar):
- Run:
gog calendar calendars --json
- Match by calendar name/summary and then query that calendarId.
Timezone
- For date-scoped queries, be explicit with
--today/--tomorrow/--week/--days when possible.
- If user’s timezone matters or results look off, check with:
gog calendar time --timezone <IANA_TZ>
- Prefer returning times in user-local timezone if JSON includes localized fields.
Writes require confirmation
- Before:
gog gmail send ...
gog calendar create ...
gog calendar update ...
- any Sheets update/append/clear
- Do a “plan” message: recipients/calendar, subject/summary, time range, and ask for “yes”.
High-signal command recipes
Calendar: “What’s on my calendar today?”
Default: all calendars.
gog calendar events --all --today --json
Tomorrow / week / next 3 days:
gog calendar events --all --tomorrow --json
gog calendar events --all --week --json
gog calendar events --all --days 3 --json
Search events across time window (keyword):
gog calendar search "standup" --days 30 --json
gog calendar search "meeting" --from 2026-02-01T00:00:00Z --to 2026-03-01T00:00:00Z --max 50 --json
Specific calendar (only when asked):
- Find calendarId:
gog calendar calendars --json
- Query it:
gog calendar events <calendarId> --today --json
Gmail: search + read + send (confirm sends)
Search:
gog gmail search 'newer_than:7d' --max 10 --json
gog gmail search 'from:boss@example.com newer_than:30d' --max 20 --json
Send (REQUIRES CONFIRMATION FIRST):
gog gmail send --to a@b.com --subject "Hi" --body "Hello"
Drive: find files
gog drive search "invoice" --max 10 --json
Contacts: list/search
gog contacts list --max 50 --json
Sheets: safe read/write (confirm writes)
Read:
gog sheets get <sheetId> "Tab!A1:D10" --json
Update (REQUIRES CONFIRMATION FIRST):
gog sheets update <sheetId> "Tab!A1:B2" --values-json '[["A","B"],["1","2"]]' --input USER_ENTERED
Append (REQUIRES CONFIRMATION FIRST):
gog sheets append <sheetId> "Tab!A:C" --values-json '[["x","y","z"]]' --insert INSERT_ROWS
Clear (REQUIRES CONFIRMATION FIRST):
gog sheets clear <sheetId> "Tab!A2:Z"
Docs: export/cat
gog docs export <docId> --format txt --out /tmp/doc.txt
gog docs cat <docId>
Troubleshooting checklist (fast)
If calendar results look wrong or empty:
- Confirm account:
- List calendars to confirm visibility:
gog calendar calendars --json
- Ensure you used all-calendars for agenda:
gog calendar events --all --today --json
- If still empty, verify timezone assumptions:
gog calendar time --timezone <IANA_TZ>
1---2name: gog-advanced3description: Reliable Google Workspace CLI skill (gogcli). Defaults to all-calendars for agenda queries; JSON-first; safe writes.4---56# gog-advanced78Use `gog` (gogcli) for Google Workspace: Gmail, Calendar, Drive, Contacts, Sheets, Docs.910This skill is optimized for **agent reliability**:11- Prefer **list/inspect first**, don’t assume resource IDs.12- Prefer **`--json`** for parsing; treat human tables as fallback.13- For “agenda / today / tomorrow / this week” questions: **search across ALL calendars by default**.14- For write actions (send email, create/update events, modify Drive/Sheets/Docs): **confirm intent** and summarize the exact action first.1516## Prereqs / Setup (once)17181) Store OAuth client credentials:19- `gog auth credentials /path/to/client_secret.json`20212) Add an account (request only needed services):22- `gog auth add you@gmail.com --services gmail,calendar,drive,contacts,sheets,docs`23243) Make account default to avoid repeating flags:25- `export GOG_ACCOUNT=you@gmail.com`2627Notes:28- CLI help is discoverable: `gog --help`, `gog calendar --help`, etc.29- `gog` supports multiple accounts; use `--account` or `GOG_ACCOUNT`. (Prefer env var.)3031## Global agent rules (non-negotiable)32331) **Calendar agenda queries**34 - If user asks “what’s on my calendar today / tomorrow / this week / next N days”:35 - Run: `gog calendar events --all --today|--tomorrow|--week|--days N --json`36 - If results are empty, only then troubleshoot (timezone, account, auth status).37 - Only use a specific calendarId if the user explicitly asks for a specific calendar or name.38392) **Calendar identification**40 - If you need a calendarId (because the user wants a specific calendar):41 - Run: `gog calendar calendars --json`42 - Match by calendar name/summary and then query that calendarId.43443) **Timezone**45 - For date-scoped queries, be explicit with `--today/--tomorrow/--week/--days` when possible.46 - If user’s timezone matters or results look off, check with:47 - `gog calendar time --timezone <IANA_TZ>`48 - Prefer returning times in user-local timezone if JSON includes localized fields.49504) **Writes require confirmation**51 - Before:52 - `gog gmail send ...`53 - `gog calendar create ...`54 - `gog calendar update ...`55 - any Sheets update/append/clear56 - Do a “plan” message: recipients/calendar, subject/summary, time range, and ask for “yes”.5758## High-signal command recipes5960### Calendar: “What’s on my calendar today?”61Default: all calendars.62- `gog calendar events --all --today --json`6364Tomorrow / week / next 3 days:65- `gog calendar events --all --tomorrow --json`66- `gog calendar events --all --week --json`67- `gog calendar events --all --days 3 --json`6869Search events across time window (keyword):70- `gog calendar search "standup" --days 30 --json`71- `gog calendar search "meeting" --from 2026-02-01T00:00:00Z --to 2026-03-01T00:00:00Z --max 50 --json`7273Specific calendar (only when asked):741) Find calendarId:75- `gog calendar calendars --json`762) Query it:77- `gog calendar events <calendarId> --today --json`7879### Gmail: search + read + send (confirm sends)8081Search:82- `gog gmail search 'newer_than:7d' --max 10 --json`83- `gog gmail search 'from:boss@example.com newer_than:30d' --max 20 --json`8485Send (REQUIRES CONFIRMATION FIRST):86- `gog gmail send --to a@b.com --subject "Hi" --body "Hello"`8788### Drive: find files89- `gog drive search "invoice" --max 10 --json`9091### Contacts: list/search92- `gog contacts list --max 50 --json`9394### Sheets: safe read/write (confirm writes)9596Read:97- `gog sheets get <sheetId> "Tab!A1:D10" --json`9899Update (REQUIRES CONFIRMATION FIRST):100- `gog sheets update <sheetId> "Tab!A1:B2" --values-json '[["A","B"],["1","2"]]' --input USER_ENTERED`101102Append (REQUIRES CONFIRMATION FIRST):103- `gog sheets append <sheetId> "Tab!A:C" --values-json '[["x","y","z"]]' --insert INSERT_ROWS`104105Clear (REQUIRES CONFIRMATION FIRST):106- `gog sheets clear <sheetId> "Tab!A2:Z"`107108### Docs: export/cat109- `gog docs export <docId> --format txt --out /tmp/doc.txt`110- `gog docs cat <docId>`111112## Troubleshooting checklist (fast)113114If calendar results look wrong or empty:1151) Confirm account:116- `gog auth status`1172) List calendars to confirm visibility:118- `gog calendar calendars --json`1193) Ensure you used all-calendars for agenda:120- `gog calendar events --all --today --json`1214) If still empty, verify timezone assumptions:122- `gog calendar time --timezone <IANA_TZ>`