For anyone running Gmail agents in OpenClaw who is tired of duplicate alerts, stateless cron runs, and wasted tokens.
My OpenClaw agent flagged the same email from my lawyer 8 times across different cron runs.
Every session was stateless, so none of them knew the email had already been handled.
So I built BetterEmail — an OpenClaw plugin that adds persistent email state and scheduled triage.
Install
openclaw plugins install @better_openclaw/betteremail
- Visit the github repo link or ask your agent to read through the package repo to set up a useful cron job automatically
Why this exists
Agent sessions are inherently stateless.
If you run Gmail triage on cron jobs or across multiple sessions, there’s no shared memory of what has already been processed.
That leads to:
- duplicate alerts
- wasted tokens
- repeated triage work
What BetterEmail does
BetterEmail polls your Gmail accounts in the background via gog, deduplicates everything, and keeps a persistent digest that tracks what’s been seen, handled, dismissed, or deferred.
The agent triages on a cron schedule in an isolated session and only pings you in main when something actually matters.
No more burning 30k tokens on raw
gogcalls just to find out there’s nothing new.
Architecture
Gmail → gog → BetterEmail poller
↓
persistent digest
↓
scheduled agent triage
↓
notify main session if needed
What it does
- Background polling (no agent tokens wasted on fetching)
- Persistent state across all sessions — dismissed stays dismissed
- Auto-resolves threads you’ve already replied to
- Simple tools:
get_digest,handle,dismiss,defer - Agent runs triage in an isolated cron session and announces to main
How is this different from OpenClaw’s built-in Gmail Pub/Sub?
The built-in Gmail Pub/Sub fires a webhook on every incoming email.
That means a new agent session spins up for each one — newsletters, spam, DMARC reports, everything.
Each session has no memory of what previous sessions already handled, so you get duplicate alerts and wasted tokens.
It also needs extra infrastructure:
- GCP project with a Pub/Sub topic
- Tailscale funnel for the webhook endpoint
gog watchrunning as a daemon- OpenClaw webhook config wired together
BetterEmail’s approach
BetterEmail takes a different approach.
It polls in the background (no GCP, no Tailscale, no webhooks), deduplicates at the plugin level, and keeps persistent state across sessions.
Instead of reacting to every email individually, it collects them into a digest and lets the agent triage in batch on a schedule.
Dismissed stays dismissed.
Handled stays handled — even across cron jobs and context resets.
📊 TL;DR — Architecture difference
Gmail Pub/Sub
- Event-driven (one agent session per email)
- Stateless
- Requires GCP + webhook infrastructure
- Token cost scales per email
BetterEmail
- Scheduled batch digest
- Persistent state across sessions
- No extra infrastructure
- Token cost per triage run
BetterEmail turns email handling from stateless event spam into stateful scheduled triage.
Links
GitHub
https://github.com/maximilianspitzer/openclaw-betteremail
npm
https://www.npmjs.com/package/@better_openclaw/betteremail
Latest release info
#1479636402214797423 message
Maintainer
Maximilian Spitzer (@maximilianspitzer)
Feedback
If you’re running agents on email workflows, I’d love feedback on edge cases, better triage patterns, or additional agent tools.
Would love to get this on the community plugins page if it meets the bar.