Skip to main content
ollim-bot provides read-only Gmail access through the gmail.readonly OAuth scope. The agent uses a dedicated gmail-reader subagent to triage your inbox — surfacing actionable emails while filtering out noise. You can also query Gmail directly from the CLI.

Prerequisites

  • Google OAuth configured with the gmail.readonly scope (see Google OAuth setup)
  • credentials.json in ~/.ollim-bot/state/ from the Google Cloud Console
  • token.json in ~/.ollim-bot/state/ (auto-generated on first auth)

Setup

Gmail shares the same OAuth flow as Google Tasks and Google Calendar. If you already have Google integration working, Gmail is available automatically — no additional setup required.
Gmail access is strictly read-only. ollim-bot cannot send, delete, or modify emails.

Usage

The ollim-bot gmail command provides four subcommands for direct inbox access.

List unread emails

ollim-bot gmail unread
ollim-bot gmail unread --max 5
Output format:
  MSG_ID  2026-02-24 09:15  Alice Smith  Meeting follow-up
  MSG_ID  2026-02-24 08:30  Bob Jones    Invoice #1234
The --max flag limits results (default: 20).

Read an email

ollim-bot gmail read MSG_ID
Displays From, To, date, subject, and the message body. Bodies longer than 3000 characters are truncated. The reader prefers text/plain content and falls back to text/html with tags stripped.

Search emails

ollim-bot gmail search "from:alice subject:meeting"
ollim-bot gmail search "is:unread after:2026/02/20" --max 10
Uses standard Gmail search query syntax. The --max flag limits results (default: 20).

List labels

ollim-bot gmail labels
Lists all Gmail labels with their IDs and names.

CLI reference

SubcommandArgumentsDefaultDescription
unread--max N20List unread emails
read<id>Read a full email by message ID
search"<query>", --max N20Search with Gmail query syntax
labelsList all labels

Troubleshooting

Verify that your OAuth token includes the gmail.readonly scope. If you added Gmail after the initial OAuth flow, delete ~/.ollim-bot/state/token.json and re-authenticate to pick up the new scope.
Some emails use only HTML with embedded images and no text content. The reader extracts text/plain first, then falls back to stripped text/html. Emails that are purely image-based will show no body.
All Gmail timestamps are displayed in the configured timezone (OLLIM_TIMEZONE, defaults to system local).

Next steps