Beginner’s Guide to Building a Personal Email Assistant
Beginner’s Guide to Building a Personal Email Assistant

Let's be honest: email is a disaster.
You open your inbox on Monday morning and you're looking at 87 unread messages. Half of them are newsletters you forgot you subscribed to, a quarter are internal threads that someone else already handled, and buried somewhere in the noise are three genuinely important emails that needed a response yesterday. You spend 45 minutes triaging, another 30 drafting replies, and by the time you're done, you've lost the most productive chunk of your morning to something that feels like it should have been automated ten years ago.
Here's the good news: it can be automated now. Not with some overpriced SaaS tool that reads your entire inbox and pipes it to a third-party server, but with an open-source agent you control, running on your own machine, connected to your own email account, behaving exactly the way you tell it to.
That tool is OpenClaw, and in this guide, I'm going to walk you through setting up your own personal email assistant from scratch — even if you've never built an AI agent before.
Why Most Email AI Tools Suck (And Why OpenClaw Doesn't)
Before we get into the build, let's talk about why the existing options leave so much to be desired.
Gmail's built-in AI features are fine for one-off suggestions, but they have zero understanding of your workflow, your priorities, or your tone. They're generic by design. They'll happily suggest "Sounds good, thanks!" for an email that clearly requires a nuanced three-paragraph response.
Tools like Superhuman and Shortwave are slick, but they're closed-source, expensive, and you're trusting them with the full contents of your inbox. For a lot of people — freelancers, founders, anyone handling sensitive client communication — that's a dealbreaker.
The typical open-source projects on GitHub are demos. They work for a 3-minute screen recording and then break the moment you point them at a real inbox with 10,000 threads, attachments, calendar invites, and the messy reality of how actual email works.
OpenClaw sits in a different category. It's built on LangGraph — which means it uses a state-machine architecture instead of the chaotic "let the LLM decide everything" approach that makes most agents unreliable. It connects to Gmail and Outlook via OAuth. It can run locally using Ollama or LM Studio, or you can point it at a hosted model when you need heavier reasoning. And critically, it comes with community-tested workflow templates for the things people actually use email agents for: triage, summarization, drafting, follow-ups, and archiving.
It's not a demo. It's a production-grade email agent framework that people are running 24/7 on real inboxes.
What You're Going to Build
By the end of this guide, you'll have a working email assistant that:
- Triages your inbox — automatically labels incoming emails by priority and category
- Summarizes threads — gives you a one-liner for long email chains so you can scan instead of read
- Drafts replies — in your tone, using your past sent emails as style references
- Flags items that need human attention — with a human-in-the-loop approval step before anything gets sent
- Archives the noise — newsletters, notifications, and low-priority updates get handled silently
This is the classic "executive assistant" workflow, and it's the single most popular OpenClaw template for good reason: it eliminates 70-80% of the manual work most people do in their inbox every day.
Step 0: Get the OpenClaw Starter Pack
If you want the fastest possible path from zero to working email agent, I'd genuinely recommend starting with Felix's OpenClaw Starter Pack. Felix put this together specifically for people who are new to OpenClaw and want pre-configured workflow templates, example prompts tuned for email use cases, and a walkthrough that cuts through the setup friction.
I'm recommending it not because it's the only way to get started — OpenClaw is fully open-source and you can absolutely do everything from the raw GitHub repo — but because the Starter Pack saves you a solid afternoon of configuration and trial-and-error. It's the difference between following a recipe and trying to reverse-engineer a dish from a photo. Both get you there; one gets you there before dinner.
Step 1: Install OpenClaw
OpenClaw ships with Docker support, which means your setup is essentially one command regardless of what OS you're running.
# Clone the repo
git clone https://github.com/openclaw/openclaw.git
cd openclaw
# Copy the example environment file
cp .env.example .env
# Launch with Docker Compose
docker compose up -d
That spins up the OpenClaw server, a local vector database (Chroma by default, but you can swap in Qdrant or LanceDB if you prefer), and the web dashboard where you'll configure your workflows.
Before you go further, open up that .env file and configure your LLM backend:
# Option A: Local model via Ollama (free, private)
LLM_PROVIDER=ollama
OLLAMA_MODEL=llama3.1:8b
OLLAMA_BASE_URL=http://host.docker.internal:11434
# Option B: API model (better reasoning, costs money)
# LLM_PROVIDER=openai-compatible
# API_BASE_URL=https://your-endpoint.com/v1
# API_KEY=your-key-here
# MODEL_NAME=your-model
My recommendation: start with a local model via Ollama for triage and summarization (these tasks don't require frontier-model intelligence), and only route complex drafting tasks to a more capable model. OpenClaw has a built-in smart routing feature that does exactly this — it estimates task complexity and only escalates when the local model's confidence is low. This keeps your API costs near zero for 90% of emails.
Step 2: Connect Your Email
This is the part that trips up most people with open-source email tools, so let's be precise.
OpenClaw uses OAuth 2.0 to connect to Gmail or Outlook. It does not ask for your password. It requests specific, limited scopes — and you control exactly which ones.
For Gmail:
- Go to the Google Cloud Console and create a new project
- Enable the Gmail API
- Create OAuth 2.0 credentials (Desktop app type)
- Download the
credentials.jsonfile and place it in your OpenClaw config directory
# Place your credentials file
cp ~/Downloads/credentials.json ./config/gmail_credentials.json
# Run the OAuth flow
docker compose exec openclaw python scripts/auth_gmail.py
This opens a browser window where you authorize OpenClaw to access your Gmail. The key thing to understand: OpenClaw uses least-privilege scopes by default. The initial setup only requests read access. You explicitly opt in to send/modify scopes later, and even then, you can set granular rules like:
- Only allow replies to contacts I've emailed before
- Require human approval for any external sends
- Never modify emails from specific senders
These aren't theoretical features — they're the guardrails that make the difference between a useful assistant and an anxiety-inducing liability.
# Example: Permission rules in config/permissions.yaml
send_rules:
- action: allow
condition: recipient_in_sent_history
approval: auto
- action: allow
condition: recipient_is_internal_domain
domain: "yourcompany.com"
approval: auto
- action: allow
condition: any_external
approval: human_required
- action: block
condition: recipient_is_new_contact
note: "Flag for manual review"
This is one of the things the community praises most about OpenClaw — the permission system is genuinely thoughtful. You're not just handing over the keys.
Step 3: Build Your First Workflow
Here's where it gets fun. OpenClaw workflows are defined as LangGraph state machines, which sounds intimidating but is actually beautifully intuitive once you see it.
A workflow is a series of nodes (things the agent does) connected by edges (decisions about what to do next). Each node has a clear, single responsibility. The agent doesn't freestyle — it follows the graph.
Here's the core email assistant workflow:
from openclaw.workflows import EmailWorkflow
from openclaw.nodes import (
fetch_new_emails,
classify_priority,
summarize_thread,
check_needs_reply,
draft_reply,
human_approval,
send_reply,
auto_archive,
apply_labels
)
# Define the workflow
workflow = EmailWorkflow(name="daily-email-assistant")
# Add nodes
workflow.add_node("fetch", fetch_new_emails)
workflow.add_node("classify", classify_priority)
workflow.add_node("summarize", summarize_thread)
workflow.add_node("needs_reply", check_needs_reply)
workflow.add_node("draft", draft_reply)
workflow.add_node("approve", human_approval)
workflow.add_node("send", send_reply)
workflow.add_node("archive", auto_archive)
workflow.add_node("label", apply_labels)
# Define the flow
workflow.add_edge("fetch", "classify")
workflow.add_edge("classify", "summarize")
# Conditional routing based on classification
workflow.add_conditional_edge(
"summarize",
lambda state: state["priority"],
{
"high": "needs_reply",
"medium": "needs_reply",
"low": "archive",
"noise": "archive"
}
)
workflow.add_conditional_edge(
"needs_reply",
lambda state: state["requires_response"],
{
True: "draft",
False: "label"
}
)
workflow.add_edge("draft", "approve")
workflow.add_conditional_edge(
"approve",
lambda state: state["approved"],
{
True: "send",
False: "label" # Park it for manual handling
}
)
workflow.add_edge("send", "label")
workflow.add_edge("archive", "label")
# Compile and register
workflow.compile()
Read this top to bottom and it makes immediate sense: fetch emails, classify them, summarize threads, check if they need a reply, draft one if so, get human approval, send it, label everything. Low-priority stuff gets archived automatically. Nothing gets sent without your sign-off (unless you explicitly configure auto-send for certain conditions later).
This is what the LangGraph architecture gives you that raw ReAct agents can't: predictability. The agent can't decide to go rogue and start emailing your contacts because it's following a defined graph, not improvising from a system prompt.
Step 4: Teach It Your Writing Style
This is the feature that makes OpenClaw feel like magic instead of a gimmick.
OpenClaw includes a Style RAG system that indexes your sent folder and retrieves similar past replies when drafting new ones. Instead of generic AI slop, your drafts actually sound like you.
# Index your sent emails for style matching
from openclaw.style import StyleIndexer
indexer = StyleIndexer(
email_account="your-gmail",
sent_folder="SENT",
max_emails=500, # How far back to index
vector_store="chroma" # or "qdrant", "lancedb"
)
# Build the style index
indexer.build()
# The draft node automatically uses this index
# When drafting, it retrieves 3-5 similar past replies
# and uses them as few-shot examples for tone matching
Here's what's happening under the hood: when the agent needs to draft a reply to, say, a client asking about project timelines, it searches your sent folder for emails where you previously discussed timelines with clients. It pulls 3-5 of those as examples and includes them in the prompt context. The result is a draft that uses your vocabulary, your level of formality, your typical sign-off — all without fine-tuning a model.
People on Discord have reported that after indexing ~300 sent emails, the drafts are good enough that they only need minor tweaks before sending. That's the goal: not full automation, but reducing a 5-minute drafting task to a 30-second review.
Step 5: Set Up the Guardrails
OpenClaw's guardrail system is what separates it from the "fun weekend project" category and puts it into the "I actually trust this running on my inbox" category.
# config/guardrails.yaml
max_agent_steps: 10 # Kill the loop if it takes more than 10 steps
max_sends_per_hour: 5 # Rate limit on outgoing emails
require_human_approval: true # Global toggle
undo_window_seconds: 30 # Time to undo a sent email (Gmail only)
# Fact verification
verify_facts: true # Cross-reference claims against original email
block_if_uncertain: true # Don't send if confidence < threshold
# Content rules
blocked_phrases:
- "as an AI"
- "I'm an artificial intelligence"
- "I don't have personal experiences"
tone_check: true # Flag drafts that deviate significantly from your style index
The blocked_phrases list is particularly important — nothing breaks the illusion faster than your "personal assistant" telling someone it's an AI language model. OpenClaw checks drafts against this list before they ever reach the approval step.
The persistent checkpointer is another community favorite. Every state transition in the workflow is saved, which means if something goes wrong — Docker crashes, power outage, whatever — the agent picks up exactly where it left off instead of re-processing your entire inbox.
Step 6: Run It
# Start the workflow on a schedule (every 5 minutes)
docker compose exec openclaw python -m openclaw.run \
--workflow daily-email-assistant \
--schedule "*/5 * * * *"
# Or run it once manually
docker compose exec openclaw python -m openclaw.run \
--workflow daily-email-assistant \
--once
The first time you run it, I'd recommend --once mode so you can watch what it does, review the classifications and drafts, and tweak your prompts. Once you're confident it's behaving well, switch to the scheduled mode and let it run in the background.
The web dashboard (default at http://localhost:8080) gives you a real-time view of what the agent is doing: which emails it's processing, how it classified them, what drafts it generated, and what's sitting in the approval queue waiting for you.
What to Do When Things Go Wrong
They will. Here are the most common issues and fixes:
"The agent classified everything as high priority." Your classification prompt needs tuning. OpenClaw's default classification prompt is decent but generic. Customize it with examples from your actual inbox — give it 5-10 examples of what you consider high, medium, and low priority. The Starter Pack includes pre-tuned classification prompts for different use cases (founder, freelancer, support team, etc.) that you can use as a starting point.
"Gmail API quota errors after processing 200 emails."
Google rate-limits the Gmail API aggressively for free-tier projects. OpenClaw has built-in rate limiting, but you need to configure it in your .env:
GMAIL_RATE_LIMIT=10 # requests per second
GMAIL_BATCH_SIZE=50 # emails per batch
"The drafts sound nothing like me."
Your style index probably doesn't have enough data, or it's pulling from the wrong kinds of emails. Try increasing max_emails to 500+ and adding a filter to only index replies (not forwards or new threads):
indexer = StyleIndexer(
email_account="your-gmail",
sent_folder="SENT",
max_emails=500,
filter_type="replies_only", # Only index your replies
vector_store="chroma"
)
"The agent is slow." If you're running a local model, this is usually a hardware bottleneck. The 8B parameter models run well on most modern machines, but if you're processing a large backlog, consider using the smart routing feature to batch simple tasks (labeling, archiving) and only invoke the LLM for tasks that need it (classification, drafting).
Where to Go From Here
Once your basic email assistant is running, the natural next steps are:
-
Calendar integration — OpenClaw has experimental support for Google Calendar. You can have the agent detect meeting requests, check your availability, and draft responses with proposed times.
-
Multi-account support — If you manage separate personal and work inboxes, you can run multiple workflow instances with different configurations, different style indices, and different permission rules.
-
Custom nodes — The real power of the LangGraph architecture is that you can add your own nodes. Want the agent to check a CRM before replying to a sales email? Write a node that queries your CRM API and adds context to the state. Want it to create Notion tasks from action-item emails? Same idea.
-
Escalation workflows — Set up notifications (Slack, Discord, SMS) for emails that the agent flags as urgent but can't handle automatically. This is the "Do Not Disturb" mode people have been asking for: the agent triages everything silently and only pings you when something truly needs your attention.
The Bottom Line
Building a personal email assistant used to be a pipe dream — something you'd see in a demo video and think "cool, but that'll never work on my actual inbox." OpenClaw changes that. The LangGraph architecture gives it the reliability of a workflow engine with the intelligence of a modern language model. The permission system means you're not taking a leap of faith. The style matching means the output actually sounds like you.
Is it perfect? No. Local models still struggle with complex multi-step reasoning, the Gmail OAuth setup is still more fiddly than it should be, and you'll spend your first hour tweaking classification prompts to match your priorities. But it works. It runs. People are using it on real inboxes, every day, and getting hours back every week.
If you want to skip the yak-shaving phase and jump straight to a working setup, grab Felix's OpenClaw Starter Pack. It bundles the workflow templates, pre-tuned prompts, and setup guide that'll get you from zero to a functioning email agent in an afternoon instead of a weekend.
Your inbox isn't going to fix itself. But you can build something that will.