Skip to content

weekly maintenance: email the report via gws Google Workspace CLI#31

Merged
stevepridemore merged 0 commit into
mainfrom
weekly-maintenance-email
May 10, 2026
Merged

weekly maintenance: email the report via gws Google Workspace CLI#31
stevepridemore merged 0 commit into
mainfrom
weekly-maintenance-email

Conversation

@stevepridemore
Copy link
Copy Markdown
Owner

@stevepridemore stevepridemore commented May 10, 2026

Summary

Adds Step 12 to the weekly-maintenance routine: email the generated report to `user@example.com` via the locally-installed `gws` (Google Workspace CLI). One command, no script, no new deps, no app passwords.

What changed

`prompts/weekly-maintenance.md`:

  • New Step 12 between report-write (step 11) and lock-release. Calls `gws gmail +send` with subject including counts, body = full markdown inline, and `.md` file attached.
  • Step 13 (release lock) renumbered from old step 12.
  • Email step is best-effort — failures log to `weekly-maintenance-errors.log` but don't abort; the report file is already written and the lock release is non-negotiable.
  • Calls out the common `invalid_rapt` failure mode (Google's periodic re-auth requirement) so a morning triage immediately knows the cause.

Why `gws` and not other options

Considered:

  • Gmail MCP create_draft: works but requires you to manually hit Send each week — defeats the point of automation.
  • SMTP with app password: works but adds a stored secret in `.env`.
  • Gmail API via gcloud ADC: works but requires `gcloud auth application-default login --scopes=...gmail.send` plus enabling Gmail API in the GCP project.
  • `gws` (chosen): already installed at `~/AppData/Roaming/npm/gws`, OAuth client + refresh token already in OS keyring, just needed a token refresh via `gws auth login`. Verified by sending a draft (visible in your Drafts folder).

Test plan

  • `gws gmail +send --draft` round-trips successfully (draft created)
  • First scheduled run on Sunday 6 AM produces an email in your inbox with subject `Weekly Graph Maintenance — 2026-05-17 (...)` and the .md file attached
  • Verify the email body renders the markdown readably as plain text in Gmail's web UI

🤖 Generated with Claude Code

@stevepridemore stevepridemore merged this pull request into main May 10, 2026
2 checks passed
@stevepridemore stevepridemore deleted the weekly-maintenance-email branch May 10, 2026 05:07
stevepridemore added a commit that referenced this pull request May 10, 2026
Adds Step 12 (email the report) between report-write and lock-release.
Uses the locally-installed gws (Google Workspace CLI) to send via the
authenticated user@example.com Gmail account, with the report body
inline as plain text and the .md file attached for searchable archive.

Subject line includes prune count and action-item count so the email
is triageable from the inbox list without opening:

  "Weekly Graph Maintenance — YYYY-MM-DD (N pruned, M action items)"

The email step is best-effort. Failures (auth expired, network, quota)
are logged to weekly-maintenance-errors.log but do NOT abort the run —
the report file is already written on disk and the lock release in
step 13 must still happen. Common failure mode (invalid_rapt — Google
periodic re-auth required) is called out in the prompt so the morning
report-check makes the cause obvious.

Step 13 (release lock) renumbered from the old step 12. The lock-
release rule's exit-path enumeration updated to include email failure.

No script, no new dependencies, no app passwords, no env vars. The
gws OAuth setup (already in place locally, refresh token in OS keyring)
handles auth.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant