If your inbox looks anything like mine, the most useful information is hidden five replies deep in a quoted mess. I wanted an agent that reads the whole thing and hands back: 1) what we decided, 2) what I need to do, 3) when it’s due. This article shows exactly how I wired OpenClaw to do that. No marketing fluff—just commands, config, and the hiccups I hit on the way.

Why use OpenClaw for email thread summarization?

I tried classic GPT-in-the-loop scripts before. The problem: they broke whenever the thread got forwarded, or when someone replied with inline comments. OpenClaw gives me:

  • Reliable ingestion. 800+ Composio connectors (I’m using Gmail and Outlook) so I don’t have to maintain IMAP code.
  • Memory and context. The agent remembers if the same topic shows up next week.
  • Scheduling. Summaries drop into Slack at 09:00, not 03:00 when the cron job decides.
  • Self-hosting or Cloud. I run prod on ClawCloud. Local dev happens on my laptop with node 22.2.0.

Below is the exact workflow I shipped last Friday so management stops asking, “Where are we on that launch email?”.

Prerequisites: versions, tokens, and one weird Gmail setting

1. Install OpenClaw 3.7+

The summarizer toolset landed in openclaw@3.7.0. Make sure you’re on that or newer:

npm i -g openclaw@latest openclaw --version # should print 3.7.x or 3.8.x

2. Node.js 22+

I built against 22.6.1. 20.x works but spams deprecation warnings on fs/promises.

3. Composio Gmail connection

Create a “Server side” OAuth client and enable the Gmail API > read-only scope. The redirect URI should be https://gateway.claw.cloud/oauth/callback.

Save the COMPOSIO_CLIENT_ID and COMPOSIO_CLIENT_SECRET. You’ll paste them into the agent in a second.

4. Optional: Slack webhook

For push summaries. Grant chat:write and copy the Webhook URL.

One-off: forward any email thread for an instant summary

This is the quick win: no automation, just forward and read. Great for demos or that one out-of-control thread.

  1. Create an agent on ClawCloud. Mine is called winston-summarizer.
  2. Note the dedicated address ClawCloud gives you: inbox+abcd1234@agents.claw.cloud.
  3. From your mail client hit Forward > send entire thread to that address.

Under the hood, ClawCloud stores the raw RFC-822 payload in the agent’s memory, then triggers the summarize-email skill. You’ll see a response in the web UI within ~20 s:

# Winston Summarizer — 2024-05-03 14:12
Subject: Re: Q3 pricing launch

🔑 Key decisions
– We drop the freemium tier on Aug 1
– Enterprise plan renamed to "Scale"

🗓 Deadlines
– Marketing pages freeze: Jul 15 (Paul)
– Pricing PDF to partners: Jul 22 (Dana)

✅ Action items
1. Paul: update stripe SKUs (due Jul 10)
2. Dana: draft partner email (due Jul 18)
3. Me: record internal FAQ video (due Jul 25)

That format is customizable (next section) but the default already saved me 40 min of scrolling.

Always-on: monitor a mailbox and auto-summarize long threads

Manual forwarding is nice; real value kicks in when the agent watches my Product/Launches label and summarizes anything with >4 replies.

1. Enable Gmail polling via Composio

Add this block to claw.config.yaml (file lives next to package.json):

sources: - type: gmail auth: clientId: ${COMPOSIO_CLIENT_ID} clientSecret: ${COMPOSIO_CLIENT_SECRET} refreshToken: ${GMAIL_REFRESH_TOKEN} poll: "*/5 * * * *" # every 5 min filter: "label:Product/Launches newer_than:14d"

2. Define the summarization skill

Put this in skills/summarize-thread.ts (shortened; full file in the repo):

import { Skill, EmailMessage } from "openclaw"; import { summarizerLLM } from "./llm"; export const summarizeThread: Skill = async ({ input, memory, tools }) => { const thread = input as EmailMessage[]; if (thread.length < 5) return "Thread not long enough"; const prompt = `You are an operations analyst. Summarize the thread. Focus on decisions, deadlines, action items. Use markdown bullets.`; const raw = thread.map(m => `From: ${m.from}\n${m.body}`).join("\n---\n"); const summary = await summarizerLLM(prompt + raw); await tools.slack.post(summary); return summary; };

Compile:

npm run build

and start the daemon:

openclaw run --config claw.config.yaml

The agent now checks Gmail every five minutes, grabs unread threads, and posts a tidy summary to Slack. If you’re on ClawCloud, flip the toggle Run 24/7 in the dashboard and you’re set.

Customizing the summary format

Teams read differently. Design loves emoji, finance doesn’t. Here’s how I tweak output without editing the TypeScript every time.

1. Template files

Create templates/email-summary.md:

# {{subject}} 🔑 **Decisions** {{#each decisions}} – {{this}} {{/each}} 🗓 **Deadlines** {{#each deadlines}} – {{this.owner}} → {{this.date}} {{/each}} ✅ **Actions** {{#each actions}} {{@index}}. {{this.owner}}: {{this.text}} (due {{this.date}}) {{/each}}

I’m using Handlebars because it’s built into OpenClaw’s template engine since 3.6.

2. Pass dynamic rendering options

Update the skill:

const summary = await summarizerLLM(schema, rawThread); return tools.renderer.render("email-summary.md", summary);

Now non-tech teammates can PR changes to the template. The agent simply reloads on the next run.

3. Extracting specific entities

If the model misses a date, force-extract with regex post-processing:

const dateRegex = /(\b\d{1,2} (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\b)/gi; summary.deadlines = summary.raw.match(dateRegex) ?? [];

Yes, regex and LLMs together feel dirty, but it bumps accuracy from 84 % → 96 % in my tests (n=50 threads).

Surfacing summaries where people already work

Email is input; output should land where work happens. I push to Slack and Linear.

1. Slack

You already saw the webhook call. Pro tip: thread summaries in a dedicated #summaries channel, then copy a link in the original email channel. Cuts noise.

2. Linear (or Jira)

OpenClaw’s Composio integration exposes linear.createComment. Inside the skill:

await tools.linear.createComment({ issueId: env.LAUNCH_TICKET_ID, body: summary, });

Now PMs don’t have to open Slack or Gmail; they see the distilled thread attached to the roadmap ticket.

Gotchas, rate limits, and security notes

  • Gmail API quota: 250 requests/user/day free. Polling every minute will blow that. Five-minute cron is safe (≈288 hits/day) only because each poll batches users.messages.list with maxResults=10. Tune according to your traffic.
  • Thread fragmentation: If someone removes References: headers (Apple Mail is guilty), Gmail treats replies as new threads. I dedupe by Subject when length ≥ 3 and no ticket number changed.
  • Model hallucinations: I pin gpt-4o-2024-05-13. When I tried gpt-3.5-turbo-0125, the agent invented a deadline twice. Stick to higher-context models (>32k) if the thread includes attachments.
  • Attachments: PDFs aren’t auto-read. I pipe them through pdf-parse and append text to rawThread. Adds ~4 seconds latency.
  • P-II data: Summaries often leak phone numbers. I strip them with /\+?\d[\d\s.-]{7,}/g before posting to public Slack channels.

Where to go next

I started with a single Slack summary but the same agent now posts weekly digests to Notion and creates GitHub issues for any action item assigned to me. The boilerplate above should get you from “ugh another 60-message chain” to a tidy bulleted list in under an hour. Clone the repo (github.com/you/winston-summarizer), swap your tokens, and run openclaw run. Your inbox will stay noisy, but at least you won’t have to read it.