Email Guy

Email Guy

@EmailAIguy

Free thing I built

Swipe your inbox. Teach your agent.

Email Swipe is stupid simple: left for junk, right for keep, double-tap if it actually matters. You swipe through real mail for a few minutes — your agent picks up how you think, without you writing a 50-rule preferences doc.

Paste this into your agent

Cursor, OpenClaw, Claude — it'll grab the rest from GitHub

Install Email Swipe from github.com/EmailGuy42069/email-swipe and help me train my agent on how I triage inbox email.

It's on GitHub. Free. Your swipes stay on your machine.

Under the hood

Simple swipe UI on top. Underneath: a memory compiler, trust-preserving automation layer, and a runtime contract built for real agents — capture raw signals, compile safe reusable memory, surface uncertainty, expose only what the agent needs.

Memory contract — preferences.json vs training-pack.json

The biggest architectural split. preferences.json is raw training data: every swipe, metadata, correction notes. Lives at ~/.config/email-swipe/ via serve-ui.py.

training-pack.json is the agent-facing artifact — compact, curated, privacy-aware. Few-shot examples, watch rules, safe platform candidates, runtimeGuidance. The agent reads this at runtime, not a noisy swipe log. Contract is explicit in SKILL.md, analyze-preferences.py, and watch-preferences.py.

Lossy compression in the right direction: ~12 diverse examples plus stable rules and caveats — not 500 raw swipes stuffed into context every run.

Compiler — analyze-preferences.py

Swipes compile into abstractions, not just stored history. One pass produces:

  • training-pack.json — primary runtime artifact (examples + guidance)
  • agent-watchlist.json — Needs Attention rules, urgent keywords, inconsistent-sender warnings
  • platform-rules.json — label/star suggestions; preservesInbox: true, autoApply: false
  • folder-suggestions.json — organizational proposals within folder budget
  • analysis-summary.json — human-readable digest for the agent's next conversation turn

select_diverse_examples() picks representative decisions — not brittle prompt stuffing, a small domain model compiled from behavior.

Truthful memory + uncertainty as signal

Examples store the user's actual decision and optional correction note. No fabricated post-hoc reasoning — the system stays honest about what it knows.

Mixed decisions on the same sender/domain become inconsistentSenders. That's a better agent signal than pretending every pattern is clean.

runtimeGuidance ships with the pack: token budget advice, never auto-delete, never skip inbox without approval. Memory encodes preferences and safe agent behavior constraints.

Active-learning queue — orderEmailQueue()

Queue is active-learning-ish, not chronological. scoreEmailForQueue() ranks by uncertainty and urgency — prior swipes by domain, keyword hints (urgent, action required, etc.). Next best training example surfaces first; you teach faster.

Inline hints calibrate trust in real time:

  • High confidence → “Similar to 3 you marked spam”
  • Low confidence → “Help me learn this one”

Adapts without pretending it knows more than it does.

Batch spam — trust-calibrated shortcut

detectBatchOpportunity() never auto-batches. Batch spam is offered only when all three conditions hold:

  • You manually marked one email from the domain as spam
  • Remaining unswiped mail shares that sender domain
  • The model would independently predict spam (confidence ≥ threshold)

Earned shortcut — magic through trust calibration, not reckless automation.

Victory screen — closed correction loop

Session end closes the learning loop, not just UI polish:

  • Pile breakdown (spam / keep / important counts)
  • Grades scorable predictions against what you actually swiped
  • Surfaces misses while context is fresh
  • Captures correction notes → feeds the next compile

Review happens at the moment you still remember why you swiped — better training data, not a throwaway animation.

Runtime pipeline — token-efficient execution

Artifact is shaped for operational cost, not just storage. Agent runtime:

  1. Fetch inbox metadata only (from, subject, date, id)
  2. Local rule match from platform-rules.json — no LLM
  3. Watchlist pre-filter (keywords, senders, inconsistent-sender flags)
  4. LLM only for remaining Needs Attention candidates

Two execution tiers: Platform (label suggestions, zero ongoing tokens) vs Agent (reasoning layer, scoped LLM). Agent reads training-pack.json + analysis-summary.json, not full swipe history.

Human-in-the-loop by design

Platform rules are suggest_only — labels and stars OK; skipping inbox is not. Needs Attention is agent-managed reasoning, not a hidden Gmail filter. Mail stays visible until you act.

Helpful automation without silent control loss. Inbox is sacred.

Architecture — local-first, layered, degrades gracefully
  • UI layer — captures actions; IndexedDB in browser; serve-ui.py persists to ~/.config/email-swipe/preferences.json. UI never calls email APIs directly.
  • Compiler layerimport-preferences.py + analyze-preferences.py derives all memory artifacts
  • MCP layerwatch-preferences.py exposes get_training_pack, get_watch_rules; distilled artifact only

baseline-predictions.js — heuristic cold start from email #1; learned behavior takes over as swipes accumulate. Export falls back to download if local save unavailable; compiler runs from preferences if pack doesn't exist yet.

Minimal UI settings, richer chat context: job/goals live in agent conversation, not a bloated settings form — stable memory schema, flexible use cases.

Email is becoming a space of perfect information.

Everyone thinks AI in email = more spam. I think the opposite — but only if both sides of the inbox get smarter at the same time.

Consumer side

Your inbox

AI sorting gets better at knowing what you actually want. The junk never lands. Your inbox stops feeling like a firehose — not because people sent less, but because the wrong stuff got filtered out before you saw it.

Business side

Your audience

Senders stop blasting one message to everyone. They learn what each group actually cares about and write to real interests — not fake {first_name} merge tags, but emails that feel like they were meant for you.

Better sorting on one end. Better targeting on the other. That's how email becomes high-signal instead of more noise.

Follow on X ↗

Building email systems, agent workflows, or audience personalization for your team?

Book a consultation ↗