OpenCode School

Exercise 8

Achieve inbox zero

Triage your email inbox, batch-process messages, and send emails using Gmail.

Email is one of the most time-consuming daily tasks. In this exercise, you’ll connect OpenCode to your Gmail account and use it to triage your inbox in bulk, batch-process messages, and compose and send email, all without opening Gmail in a browser. The agent reads, categorizes, and acts on your messages so you can get to inbox zero faster.

Prerequisites

You’ll need a Gmail account and two CLI tools:

Google Cloud SDK (gcloud) provides the authentication infrastructure. Install it with:

brew install google-cloud-sdk

On Windows or Linux, download from cloud.google.com/sdk.

Google Workspace CLI (gws) is the tool that actually talks to Gmail. Install it with:

brew install googleworkspace-cli

Once both are installed, run gws auth setup --login to create a GCP project, configure OAuth, and authenticate with your Gmail account in one step. A browser window opens for Google sign-in, but you don’t need to touch the Google Cloud console manually.

What you’ll do

  • Triage your unread inbox in one pass — the agent reads all your messages, categorizes them (needs reply, FYI, archive, junk), and presents a summary so you can make decisions at a glance
  • Batch-process messages — archive noise, mark newsletters as read, and clear out low-priority threads in bulk instead of one at a time
  • Search your mailbox using Gmail query syntax to find messages by sender, date, subject, or attachments
  • Compose and send an email with a draft-first safety pattern — always review before sending
  • Create a skill that teaches OpenCode how to manage your specific Gmail account

Drafts first

Every outgoing email goes through a draft step. The agent composes the message, shows you the recipient, subject, and body, and waits for your explicit go-ahead before sending. There is no undo for sent email, so the draft step is your safety net.

Beyond Gmail

The gws CLI covers more than just email. It supports Drive, Calendar, Sheets, Docs, Chat, Admin, and other Google Workspace services. Once you’re comfortable with the Gmail workflow, you can expand your skill to cover other services by authenticating with additional scopes:

gws auth login -s gmail,drive,calendar