Build This BEFORE Your Website: The Claude Code Inbox Triage

Most Claude Code tutorials hand you a landing page or a SaaS scaffold on day one. Wrong order. If you're a solopreneur drowning in 80-150 emails a day and replying to leads twelve hours late, your highest-ROI build isn't a website — it's an inbox classifier that pushes hot leads to your phone in under a minute. Here's the exact 4-file system I run on a home server for about $5/month.
Why the inbox is the real bottleneck (not your website)
Pull out yesterday's numbers and the math is brutal. The average solopreneur receives 80-150 emails per day. Of those, 5-10 are real leads. The rest is Stripe receipts, hosting renewals, LinkedIn notifications, newsletters, and cold pitches from outsourcing agencies in Bangalore.
When a lead lands at position 47 in that pile, one of three things happens:
- You reply 12+ hours late and lose the deal to whoever replied first.
- You miss it entirely.
- You compulsively check Gmail 20 times a day to avoid the first two — which kills 2-3 hours of deep work to context-switching tax.
A landing page doesn't fix that. A funnel doesn't fix that. The thing that protects your revenue today is a classifier that reads every inbound message, decides whether it's money or noise, and only interrupts you for the former.
Why off-the-shelf solutions don't work
- Gmail filters are dumb keyword matchers. The moment a prospect writes "quick question about your work" instead of "pricing", you're cooked.
- Zapier flows break when phrasing drifts — and the multi-step zaps that "understand intent" cost $50-80/month.
- SaaS AI inboxes charge $30-50/seat/month, read all your mail on their cloud, and still can't separate a buying signal from a tire-kicker.
You need something that runs locally, understands intent, and routes to where you actually look — which for most solopreneurs is Telegram or WhatsApp, not Gmail.
The architecture: 4 files, one cron job, $5/month
Here's the entire system. No agent swarm, no LangChain, no vector database. One Python process triggered every 5 minutes by cron.
inbox-triage/
├── CLAUDE.md # ~40 lines — the brain / instruction manual
├── classify.py # ~60 lines — pulls Gmail, calls Claude
├── route.py # ~50 lines — label, archive, or ping phone
└── send_telegram.py # ~12 lines — Telegram bot API wrapper
Runtime stack:
| Component | Choice | Why |
|---|---|---|
| Host | Home server (mini PC, WSL Ubuntu) | Zero cloud cost, full data control |
| Scheduler | cron every 5 min |
Simpler than any orchestrator |
| LLM | Claude (Haiku tier for classify) | ~$0.005 per email at current pricing |
| Gmail API (OAuth, read + modify) | Native labels, native archive | |
| Notification | Telegram Bot API | Free, instant, on the device you actually check |
Total monthly spend: $4-6 in Claude API calls. No VPS, no Vercel, no AWS line item.
File 1 — CLAUDE.md: the entire brain in 40 lines
This is the instruction manual Claude reads on every classification call. It's the difference between a flaky toy and a system you trust with revenue.
# Inbox Triage Agent
You are an inbox triage agent. You classify incoming emails into
exactly one of four buckets:
- LEAD — someone asking about pricing, scope, availability, timelines,
a discovery call, or a specific project. Real buying intent.
Examples:
"Hey, do you take on Shopify automation projects in December?"
"What's the cost for a 2-week sprint on a Telegram bot?"
- INVOICE — anything from Stripe, PayPal, Wise, my accounting tool,
or a client confirming payment.
Examples:
"Your Stripe payout of €1,240 is on the way"
"Invoice #4471 paid"
- VENDOR — hosting, domain, SaaS subscription, anything I pay for.
Examples:
"Your Hetzner invoice is ready"
"Namecheap auto-renewal confirmation"
- NOISE — newsletters, LinkedIn, calendar invites, cold pitches with
no specific ask, generic agency outreach.
## Explicit non-leads (always NOISE):
- SEO services, link building, backlinks
- "Dev team outsourcing" / "white-label developers"
- Generic agency outreach ("we work with companies like yours")
- Course / mastermind invites
- "Quick 15-min chat to explore synergies"
## Output format
Return ONLY a JSON object:
{"bucket": "LEAD|INVOICE|VENDOR|NOISE", "confidence": 0.0-1.0, "summary": "one sentence"}
That explicit non-leads block is the single most valuable section. More on why in the "what breaks" section below.
File 2 — classify.py: pull, prompt, parse
Sixty lines. Pulls every unread message from the last 15 minutes, sends subject + first 500 characters of body to Claude with one prompt.
import os, json, base64, time
from anthropic import Anthropic
from googleapiclient.discovery import build
from google.oauth2.credentials import Credentials
client = Anthropic()
gmail = build("gmail", "v1", credentials=Credentials.from_authorized_user_file("token.json"))
SYSTEM = open("CLAUDE.md").read()
def fetch_recent_unread(minutes=15):
q = f"is:unread newer_than:{minutes}m"
res = gmail.users().messages().list(userId="me", q=q).execute()
return res.get("messages", [])
def get_email(mid):
msg = gmail.users().messages().get(userId="me", id=mid, format="full").execute()
headers = {h["name"]: h["value"] for h in msg["payload"]["headers"]}
body = extract_body(msg["payload"])[:500]
return {
"id": mid,
"from": headers.get("From", ""),
"subject": headers.get("Subject", ""),
"body": body,
}
def classify(email):
prompt = f"From: {email['from']}\nSubject: {email['subject']}\n\n{email['body']}"
resp = client.messages.create(
model="claude-haiku-4-5",
max_tokens=200,
system=SYSTEM,
messages=[{"role": "user", "content": prompt}],
)
return json.loads(resp.content[0].text)
if __name__ == "__main__":
msgs = fetch_recent_unread()
for i, m in enumerate(msgs):
email = get_email(m["id"])
verdict = classify(email)
route(email, verdict) # imported from route.py
if i % 20 == 19:
time.sleep(2) # rate-limit guardrail
One LLM call per email. No chain-of-thought, no tool use, no agent loop. At Haiku pricing this is roughly half a cent per email. On a 100-email day that's $0.50.
Why no agent loop
I get asked this every week. The answer: classification doesn't need one. It's a single-turn decision with a fixed output schema. Adding a planner, a tool router, or a reflection step would 5x the latency, 10x the cost, and make the failure modes harder to debug. Save agents for tasks that actually need reasoning over multiple steps.
File 3 — route.py: where the money is made
This is the file that converts a classification into action. Lead → phone. Invoice → label. Vendor → label. Noise → archive.
from send_telegram import send
from googleapiclient.discovery import build
LABELS = {
"INVOICE": "Label_Invoices",
"VENDOR": "Label_Vendors",
}
def route(email, verdict):
bucket = verdict["bucket"]
conf = verdict["confidence"]
if bucket == "LEAD" and conf >= 0.7:
msg = (
f"🔥 LEAD ({conf:.2f})\n"
f"From: {email['from']}\n"
f"Subject: {email['subject']}\n\n"
f"{verdict['summary']}"
)
send(msg)
return
if bucket in LABELS:
apply_label(email["id"], LABELS[bucket])
mark_read(email["id"])
return
if bucket == "NOISE":
archive(email["id"])
return
The confidence >= 0.7 threshold is the dial that controls how aggressively you get pinged. Below 0.7, a possible lead gets a Review label instead of a Telegram ping. You skim those once a day. I have not missed a real lead in four months.
File 4 — send_telegram.py: 12 lines
import os, requests
TOKEN = os.environ["TELEGRAM_BOT_TOKEN"]
CHAT_ID = os.environ["TELEGRAM_CHAT_ID"]
def send(text):
requests.post(
f"https://api.telegram.org/bot{TOKEN}/sendMessage",
json={"chat_id": CHAT_ID, "text": text, "parse_mode": "Markdown"},
timeout=10,
)
That's it. WhatsApp users can swap this for the Cloud API — same shape, more boilerplate for templated messages.
The cron line
*/5 * * * * cd /home/lazar/inbox-triage && /usr/bin/python3 classify.py >> log.txt 2>&1
Every 5 minutes. Logs to a file. If something breaks at 3am, I see it in the morning.
What breaks at month 3 (and how to fix it)
I've been running this exact pattern for months. Two things break. Both have one-line fixes.
1. False positives from clever cold pitches. Outbound SDRs have learned to write like warm prospects. "Hey Lazar, quick question about your automation work — got 15 min this week?" reads exactly like a lead. Before guardrails, my false positive rate was around 12%. After adding the explicit non-leads block in CLAUDE.md, it dropped to under 2%. The fix is one paragraph of prompt, not a fine-tune.
2. Rate limits when a newsletter blast collides with real mail. If MailChimp dumps 40 newsletters into your inbox at the same minute a Stripe payout fires, you can hit the Gmail API or Anthropic quota. Fix: batch by 20, sleep 2 seconds. Five lines. The time.sleep(2) in classify.py above is exactly that.
The third thing people expect to break — Claude misclassifying an invoice as a lead — basically never happens. Stripe, PayPal, and accounting tools have such consistent sender domains and templates that confidence on INVOICE is almost always > 0.95.
Real numbers from yesterday
Between 9:00 and 18:00 yesterday, the system processed:
| Metric | Value |
|---|---|
| Total emails classified | 94 |
| Tagged as LEAD | 7 |
| Actual leads (precision) | 7 / 7 |
| Discovery calls booked this week | 3 |
| Avg time from Gmail → Telegram ping | 41 seconds |
| Times I opened Gmail during work hours | 0 |
| Claude API cost for the day | $0.47 |
The unlock isn't "managing my inbox better." It's that I stopped managing my inbox at all. The inbox now feeds me the only thing that matters — qualified human attention that wants to buy something — and silences everything else.
Why bizflowai.io helps with this
Most of the systems I build at bizflowai.io for solopreneur and small-team clients start with this exact pattern: a local-first classifier that sits between a noisy channel (Gmail, WhatsApp, a contact form, a Calendly webhook) and the human's actual attention surface. The same 4-file shape extends cleanly to multi-channel triage, CRM enrichment on detected leads, and auto-drafted replies that wait for a one-tap approval from your phone. Nothing fancy — just the boring plumbing that protects revenue while you go build the website.
Frequently asked questions
What is an inbox classifier for solopreneurs?
An inbox classifier is a small automation that reads incoming email and sorts each message into categories like lead, invoice, vendor, or noise. For solopreneurs receiving 80 to 150 emails a day, it surfaces the 5 to 10 real buying signals and routes them to where you actually look, such as Telegram or WhatsApp, instead of letting them get buried in Gmail.
How do I build an AI email classifier with Claude Code?
You need four files. CLAUDE.md defines the agent's behavior and four buckets (lead, invoice, vendor, noise). classify.py uses the Gmail API to pull unread mail and sends the subject plus first 500 characters to Claude for one classification call. route.py acts on the result, and send_telegram.py wraps the Telegram bot API. Run it via cron every five minutes.
Why does email triage matter more than building a website first?
Email triage protects revenue directly. Solopreneurs lose money when lead emails land at position 47 in a cluttered inbox, causing slow replies or missed responses. Context-switching into Gmail twenty times a day costs two to three hours daily. Building a classifier before a landing page or SaaS ensures buying signals reach you immediately, preserving income you've already earned the right to capture.
When should I use a custom Claude classifier vs Gmail filters or AI inbox apps?
Use Gmail filters only for simple keyword routing. Use a custom Claude classifier when you need intent detection, since Zapier flows break on unusual phrasing and Gmail filters are dumb keyword matchers. Avoid commercial AI inbox apps ($30-50/month per seat) when you want privacy, lower cost (around $4-6/month in API calls), and routing to Telegram or WhatsApp instead of Gmail.
How much does a self-hosted Claude email classifier cost to run?
Total monthly spend is roughly 4 to 6 dollars in Claude API calls, at about half a cent per email classified. There are no cloud hosting costs because it runs on a small home server via a cron job every five minutes. This compares favorably to commercial AI inbox tools that charge 30 to 50 dollars per seat per month.
Want more like this?
I publish practical AI automation, GenAI engineering, and faceless content workflows on YouTube every week.
Subscribe to bizflowai.io on YouTube — never miss a new tutorial.
Planning an AI automation project or need a second opinion on your architecture?
Connect with me on LinkedIn — Lazar Milicevic, GenAI Engineer & bizflowai.io Founder.
Visit bizflowai.io for our services, case studies, and AI consulting.
Frequently asked questions
What is an inbox classifier for solopreneurs?
An inbox classifier is a small automation that reads incoming email and sorts each message into categories like lead, invoice, vendor, or noise. For solopreneurs receiving 80 to 150 emails a day, it surfaces the 5 to 10 real buying signals and routes them to where you actually look, such as Telegram or WhatsApp, instead of letting them get buried in Gmail.
How do I build an AI email classifier with Claude Code?
You need four files. CLAUDE.md defines the agent's behavior and four buckets (lead, invoice, vendor, noise). classify.py uses the Gmail API to pull unread mail and sends the subject plus first 500 characters to Claude for one classification call. route.py acts on the result, and send_telegram.py wraps the Telegram bot API. Run it via cron every five minutes.
Why does email triage matter more than building a website first?
Email triage protects revenue directly. Solopreneurs lose money when lead emails land at position 47 in a cluttered inbox, causing slow replies or missed responses. Context-switching into Gmail twenty times a day costs two to three hours daily. Building a classifier before a landing page or SaaS ensures buying signals reach you immediately, preserving income you've already earned the right to capture.
When should I use a custom Claude classifier vs Gmail filters or AI inbox apps?
Use Gmail filters only for simple keyword routing. Use a custom Claude classifier when you need intent detection, since Zapier flows break on unusual phrasing and Gmail filters are dumb keyword matchers. Avoid commercial AI inbox apps ($30-50/month per seat) when you want privacy, lower cost (around $4-6/month in API calls), and routing to Telegram or WhatsApp instead of Gmail.
How much does a self-hosted Claude email classifier cost to run?
Total monthly spend is roughly 4 to 6 dollars in Claude API calls, at about half a cent per email classified. There are no cloud hosting costs because it runs on a small home server via a cron job every five minutes. This compares favorably to commercial AI inbox tools that charge 30 to 50 dollars per seat per month.