Desktop email client with AI agent - agentic-inbox port to Electron + IMAP/SMTP + local SQLite + Mistral
  • TypeScript 98.9%
  • HTML 0.8%
  • JavaScript 0.2%
  • CSS 0.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
forge-bot f2086efd7f Luau Mail v0.1.0: agentic-inbox ported to Electron desktop
- Upstream React frontend reused (SPA mode), Kumo UI intact
- Local backend: better-sqlite3 storage, IMAP sync (imapflow, poll),
  SMTP send (nodemailer), Mistral agent over WS (agents-SDK protocol subset)
- 9 agent tools against local SQLite; chat history persisted
- AppImage packaging; verified headless E2E (renderer + API + WS + agent tool round-trip)
2026-11-04 15:02:24 +00:00
.wrangler/deploy Luau Mail v0.1.0: agentic-inbox ported to Electron desktop 2026-11-04 15:02:24 +00:00
app Luau Mail v0.1.0: agentic-inbox ported to Electron desktop 2026-11-04 15:02:24 +00:00
build/client Luau Mail v0.1.0: agentic-inbox ported to Electron desktop 2026-11-04 15:02:24 +00:00
electron Luau Mail v0.1.0: agentic-inbox ported to Electron desktop 2026-11-04 15:02:24 +00:00
public Luau Mail v0.1.0: agentic-inbox ported to Electron desktop 2026-11-04 15:02:24 +00:00
scripts Luau Mail v0.1.0: agentic-inbox ported to Electron desktop 2026-11-04 15:02:24 +00:00
shared Luau Mail v0.1.0: agentic-inbox ported to Electron desktop 2026-11-04 15:02:24 +00:00
workers Luau Mail v0.1.0: agentic-inbox ported to Electron desktop 2026-11-04 15:02:24 +00:00
.env.example Luau Mail v0.1.0: agentic-inbox ported to Electron desktop 2026-11-04 15:02:24 +00:00
.gitignore Luau Mail v0.1.0: agentic-inbox ported to Electron desktop 2026-11-04 15:02:24 +00:00
LICENSE Luau Mail v0.1.0: agentic-inbox ported to Electron desktop 2026-11-04 15:02:24 +00:00
package-lock.json Luau Mail v0.1.0: agentic-inbox ported to Electron desktop 2026-11-04 15:02:24 +00:00
package.json Luau Mail v0.1.0: agentic-inbox ported to Electron desktop 2026-11-04 15:02:24 +00:00
react-router.config.ts Luau Mail v0.1.0: agentic-inbox ported to Electron desktop 2026-11-04 15:02:24 +00:00
README.md Luau Mail v0.1.0: agentic-inbox ported to Electron desktop 2026-11-04 15:02:24 +00:00
tsconfig.cloudflare.json Luau Mail v0.1.0: agentic-inbox ported to Electron desktop 2026-11-04 15:02:24 +00:00
tsconfig.json Luau Mail v0.1.0: agentic-inbox ported to Electron desktop 2026-11-04 15:02:24 +00:00
tsconfig.node.json Luau Mail v0.1.0: agentic-inbox ported to Electron desktop 2026-11-04 15:02:24 +00:00
vite.config.ts Luau Mail v0.1.0: agentic-inbox ported to Electron desktop 2026-11-04 15:02:24 +00:00

Luau Mail

A desktop email client with an AI agent — a port of Cloudflare's agentic-inbox to Linux desktop, with the Cloudflare Workers/Durable Objects/R2 backend replaced by:

  • Local SQLite (better-sqlite3, ~/.local/share/luau-mail/luau-mail.db)
  • Direct IMAP (imapflow) against your own mail server
  • Direct SMTP (nodemailer) for sending
  • Mistral API for the AI agent (streamed over WebSocket, same chat UX)

The React frontend (mailboxes, folders, threads, compose, search, agent panel) is reused from upstream with no functional changes.

Architecture

┌──────────────┐   HTTP/WS    ┌─────────────────────┐
│  Electron    │─────────────▶│  local Hono server  │──▶ SQLite (emails, drafts,
│  React SPA   │  127.0.0.1   │  /api/v1 (REST)     │      agent history)
│  AgentPanel  │              │  /agents/* (WS)     │──▶ Mistral API (streamText)
└──────────────┘              └─────────────────────┘──▶ IMAP poll: mail host
                                                        SMTP send: mail host

The agent speaks the same cf_agent_chat WebSocket protocol subset as the Cloudflare Agents SDK, so the upstream useAgent/useAgentChat hooks work unchanged. Tools (list/get/thread/search/draft/move/mark-read/discard) run against local SQLite.

Setup

Requirements: Node 20+, an Electron-capable Linux desktop, a mail account with IMAPS (993) and SMTPS (465) — tested against Mailu.

npm install
npx @electron/rebuild -f -w better-sqlite3   # match electron's ABI
npm run build          # frontend SPA
npm run build:electron # main process (dist-electron/*.cjs)
npm start              # launches the desktop app

Environment (never commit secrets — use a .env file or systemd Environment=):

MISTRAL_API_KEY=...            # required for the agent
LUAU_MAIL_ADDRESS=agent@luau.software   # default mailbox to seed
LUAU_MAIL_DOMAINS=luau.software
LUAU_IMAP_HOST=mail.luau.software       # default
LUAU_IMAP_PORT=993
LUAU_IMAP_USER=agent@luau.software      # defaults to LUAU_MAIL_ADDRESS
LUAU_IMAP_PASS=...
LUAU_SMTP_HOST=mail.luau.software       # default
LUAU_SMTP_PORT=465
LUAU_SMTP_USER=agent@luau.software      # defaults to LUAU_MAIL_ADDRESS
LUAU_SMTP_PASS=...                      # defaults to LUAU_IMAP_PASS
LUAU_MISTRAL_MODEL=mistral-large-latest
LUAU_IMAP_POLL_MS=30000

Packaging

npm run package   # produces release/Luau Mail-*.AppImage

Status / phase 1 scope

Done:

  • Full UI reuse (mailboxes, folders, threaded inbox, compose, reply/forward, search, settings incl. per-mailbox agent system prompt)
  • Local SQLite storage, threading identical to upstream (references/subject)
  • IMAP incremental sync of INBOX/Sent/Archive/Trash/Junk (30 s poll) with two-way flag push (read/starred)
  • SMTP send with threading headers; sent mail stored locally
  • Agent: 9 tools over SQLite, Mistral streaming, persisted chat history, draft_reply/draft_email land in the Drafts folder like upstream

Not in phase 1 (candidates for phase 2):

  • IDLE push instead of polling; full folder sync both ways (moves/deletes)
  • MCP server endpoint (upstream's /mcp)
  • Attachments on outbound compose (inbound attachments are stored and viewable)
  • Multiple accounts in one window (schema supports it; UI is single-account)
  • Auto-draft on new mail (upstream triggers the agent on delivery)

License

Apache 2.0 (upstream Cloudflare code) — see LICENSE.