AI Mail Assistant

Every message,routed.

Rules sort your Gmail every hour. A model reads only the mail no rule can place, requests become Google Tasks, and nothing moves until you say so.

Open source · MIT · Gmail · Copilot CLI or Claude Code

    Departures · the 08:00 run
    Rulesplain Gmail queries, first match winsrouted27
    First passgpt-6-luna, one batchread10
    Escalationgpt-6.1-sol, with bounded body textread3
    Google Tasksone per request, with a due datecreated4
    Waiting for youunsure, so left untagged in the inboxheld1
    The real engine, run on an invented mailbox: 27 by rules + 10 by the model = 37 arrived, in 2 model calls.

    Rules first. The model last.

    Searching, tagging what a rule can match, sweeping old notifications, syncing finished tasks and writing the report are plain code. A model is called only for human mail that needs interpreting, and only after the rules have had their turn.

    1. Sync tasks

      Every run starts here: finished Google Tasks archive their thread, if the tag says so.

    2. Rules

      Your Gmail queries in rules.json, in order. First match wins; the message never reaches a model.

    3. Sweep

      Per tag, archive or mark read what is done: resolved alerts, yesterday's newsletters. Starred mail is left alone.

    4. First pass

      What is left goes in batches of 25, as untrusted data, to a small, cheap model.

    5. Escalation

      Only low-confidence cases go to a stronger model, with a bounded slice of the body, up to ten per run.

    6. Validate, then write

      Plain code checks IDs, tags, task policy and dates, rechecks the inbox, then writes tasks first and labels second.

    Your nine o'clock inbox.

    At eight, the demo inbox holds 38 unread messages. Thirty-seven arrived this week: requests, invites, alerts, pull requests, newsletters, promotions. The 38th is an older thread outside the seven-day window, so the run leaves it alone. One applied run later, every message from this week carries a label except one that waits for you, and four requests are tasks with due dates.

    The demo inbox before the run: thirty-eight unread messages, none labelled.
    Before 38 unread: 37 this week, 1 older
    The same inbox after one applied run: every message labelled AI/ something, eleven archived, one left unlabelled for review.
    After one run labelled, swept, one waiting
    Four Google Tasks created from requests, each with a title, a due date and a link back to the mail thread.
    • 11messages archived by sweeps: a resolved alert, older pull-request noise and newsletters, three promotions.
    • 4requests turned into tasks, with the deadline the mail actually states, or two business days when it states none.
    • 1sender proposed as a new rule, three bulk webinar mails from the same address. You approve it; the runner never edits your rules.
    • 1"Are you around on Friday?" Neither model was sure, so it stays untagged in your inbox.
    Open the demo console

    The express spur stays dark.

    The model is the expensive branch line, and most hours it carries nothing. Classifications are cached for the day, so applying a reviewed dry run costs no second call, and an hour with nothing new to read launches no model at all. The classifier is the CLI you already pay for: the GitHub Copilot CLI or Claude Code.

    RunWhat happenedSpurModel calls
    make classifyDry-run preview27 routed by rules; 10 sent to the first pass, 3 of them escalated. Nothing in Gmail changes.2
    make applyApplied runReuses the preview's validated decisions: labels, sweeps and four tasks written.0
    Next hourScheduled runNothing new. The one message waiting for you is not re-sent today.0
    Task doneScheduled runYou ticked "Approve the Q4 hiring plan"; its thread is archived.0
    Every call is logged to state/usage.jsonl; make usage totals it. In the demo, a stand-in CLI estimates tokens from text length.

    What a month costs

    Rules and cache resolve everything
    $0
    Two small-model calls a day
    $0.15
    Twelve small-model calls and one escalation a day
    $2.46

    Illustrative estimates over 22 workdays at Copilot rates, from the project's cost guide. Not caps: your real numbers come from make usage.

    Nothing moves without your say-so.

    Every command that would change your mailbox is a preview until you add --apply. The model proposes; plain code decides whether the proposal is even allowed.

    A dry run on the demo mailbox: every planned label and sweep, nothing applied.

    The film.

    Narrated with a synthetic voice, subtitled. Every message shown is from the invented demo mailbox. The interactive version with chapters.

    Board with one command.

    make setup installs what is missing with Homebrew, creates your private rules and state, signs you in to Google (Gmail and Tasks only) and to your classifier CLI, then runs the tests and a read-only preview. It is safe to re-run, and it never changes mail or installs the schedule.

    1. Set up, then check.

      make setup-preview prints every command first; make doctor ticks off every install and login.

    2. Personalise your rules.

      The mail-setup skill, in Copilot or Claude Code, reads at most 200 recent messages, read-only, and proposes sender rules for you to approve.

    3. Preview, apply, schedule.

      make preview, then make apply when it looks right, then make schedule-install: weekdays, hourly, 08:00 to 19:00.

    # a Mac with Homebrew
    $ git clone https://github.com/mmornati/ai-email-assistant.git
    $ cd ai-email-assistant
    $ make setup          # or: bash scripts/setup-macos.sh --cli claude
    $ make doctor
    $ make preview        # read-only, no model
    
    # or try it with no account at all
    $ make demo

    What it won't do.

    Said as plainly as what it does.