2026-11-26 15:49 UTC

Nuvrail adds human approval for AI agents’ email writes

state: seedheat: mediumuncertainty: mediumrelevance: highagent-approval email-agentsagens-field

What is this?

Nuvrail is an AGPL-3.0, self-hosted IMAP/SMTP proxy from the agens-field GitHub project, introduced in a Show HN post on 28 October 2026. It presents agents with ordinary mail protocols, passes reads through, and stages actions such as sending, moving, or deleting mail for human approval; its documentation says permanent deletion via EXPUNGE is blocked. The project documents a local demo and says Gmail and a generic IMAP/SMTP provider have been tested on live accounts, while Outlook and iCloud have not. The HN author describes it as early and says they use it internally. Later search results show releases through v0.1.4 and a v0.1.4 hardening/redaction-filter change, but the supplied results do not provide release details sufficient to assess those changes independently.

Why it matters

This is a concrete example of putting a human approval boundary in the communications protocol rather than relying on an agent to follow instructions or on read-only credentials. If it works reliably, agents could handle inbox research while requiring consent for consequential writes, and the open, self-hostable design makes that control available outside a single platform. Its maturity and security in real deployments remain uncertain: the project is early, some providers are unverified, and the featured demo uses a script and local test server.

Current assessment

New evidence: the repository search results list releases v0.1.0 through v0.1.4; the v0.1.4 result describes proxy hardening and a redaction filter, but those are search snippets, not enough to establish what changed or how well it works. The project documentation describes an IMAP/SMTP gateway with a review UI, audit log, per-agent credentials, encrypted stored credentials, and staged writes; these are project claims, not an independent security evaluation. The supplied demo is explicitly recorded in CI against a local test mail server with a short script, so it demonstrates the intended flow rather than broad agent or provider reliability. The documentation reports live Gmail/Google Workspace and generic-provider use by the project, but says Outlook and iCloud have not been tested against live accounts. The main implication is a practical, protocol-level pattern for human control over email agents, potentially reducing risk without modifying the agent client. Open questions include adoption, operational burden, edge cases in protocol behavior, and whether the security guarantees withstand real-world deployment.

Measured heat

now 0 pts/hpeak 0 pts/hcomments 0/hpeers p10momentum: steady1 platformsage 700h
points/hour across evidence Β· reading as of 2026-11-27 02:23:58.509736+11:00 Β· deterministic, not a model opinion

How the heat travelled

10-28 11:07⭐ origin directly observedShow HN: Nuvrail – make an AI agent ask before it sends, moves or deletes email
mmodahl on hacker news
β€”
10-28 11:07amplified on hacker news πŸ‘‘hn.story.50271669
mmodahl
peak 2 Β· 1 comments Β· 98% of case engagement
10-28 11:26our radar first saw it Β· +0.3hdiscovery anchor: hn.story.50271669β€”
pace: p35 vs 1845 stories at the 336h mark (now 700h old) β€” ahead of adobe-max-ai-agents-creative-tools-mcp (1.5x), behind 42loop-agent-operated-product-experiment (0.8x)

Evidence (1) β€” ⭐ canonical anchor

sourceobjectauthorscorecomments
🟧 hn ⭐Show HN: Nuvrail – make an AI agent ask before it sends, moves or deletes email
Retrieved article excerpt

Open article Β· Retrieved 2026-10-28T11:28:01.757371+00:00

# Nuvrail

**The approval layer between AI agents and your inbox.**

[Demo: an AI agent's bulk delete is staged by Nuvrail and rejected with one tap; the mailbox is untouched.](https://github.com/agens-field/nuvrail/blob/main/docs/assets/3am-demo/3am-demo.gif)

*An agent tries to delete 38 emails at 3am. Nothing happens until a human says yes.*  
The agent's `EXPUNGE` gets `OK Noted` and is never forwarded; the staged delete is rejected with one tap.
Recorded in CI against a local test mail server; the "agent" is a short script, and any IMAP client behaves the same through the proxy.
[Reproduce it yourself](https://github.com/agens-field/nuvrail/blob/main/docs/assets/3am-demo/README.md) Β· [MP4 (67 s)](https://github.com/agens-field/nuvrail/blob/main/docs/assets/3am-demo/3am-demo.mp4)

[License: AGPL v3](https://github.com/agens-field/nuvrail/blob/main/LICENSE)
[Self-host](https://github.com/agens-field/nuvrail#-try-it-in-60-seconds-local)
[PRs welcome](https://github.com/agens-field/nuvrail/blob/main/CONTRIBUTING.md)
[Stars](https://github.com/agens-field/nuvrail/stargazers)

> Email is the most dangerous thing you can hand an AI agent. Nuvrail makes it safe to try β€”
> reads flow through instantly, every write waits for one human tap. **If that sounds useful,
> [β˜… star the repo](https://github.com/agens-field/nuvrail) and [self-host it in 60 seconds](https://github.com/agens-field/nuvrail#-try-it-in-60-seconds-local).**

AI agents that can send email are useful. AI agents that can send email *without any human check* are a liability. Nuvrail sits between your AI agent and your real mail server. The agent sees a normal IMAP/SMTP server. Every write β€” every move, delete, flag change, and outbound send β€” is staged for your approval before it touches the real mailbox. Reads pass through instantly; nothing blocks the agent from working. Only destructive or irreversible actions require a human to say yes.

---

## How it works

```
  AI agent                  Nuvrail                   Real mail server
  ────────     IMAP/SMTP     ───────     IMAP/SMTP     ────────────────
  (Claude,  ──────────────► gateway ──────────────►  (Gmail, iCloud,
   Cursor,   reads: pass       β”‚       on approval    Outlook, or any
   custom)   through           β”‚       only           IMAP/SMTP server)
             instantly         β”‚
                         writes: staged
                         β†’ human reviews
                           & approves
```

1. **Agent writes a command** β€” e.g. `UID MOVE 42 Trash` or sends an email via SMTP.
2. **Gateway intercepts it** β€” returns `OK [STAGED]` immediately so the agent can keep working.
3. **You get a notification** β€” a push notification on your phone or browser shows you exactly what the agent wants to do, with the subject, sender, and destination.
4. **You approve or reject** β€” one tap. On approval the operation executes against the real server. On rejection the proxy reverts its local state and silently surfaces the rejection to the agent on its next command.

The agent can never permanently delete mail. `EXPUNGE` is blocked at the gateway layer, and a delete (`\Deleted`) is staged like any other write β€” the worst the agent can do is ask to delete a message, and even that requires your sign-off.

> πŸ“– **Why this exists:** [Why email is the most dangerous thing you can give an AI agent](https://github.com/agens-field/nuvrail/blob/main/docs/why-email-is-dangerous.md) β€”
> the failure modes, why scoped OAuth and read-only tokens don't close them, and why the fix belongs on the wire.
>
> 🧭 **Guides:** [Stop an AI agent from deleting your emails](https://github.com/agens-field/nuvrail/blob/main/docs/guides/stop-ai-agent-deleting-emails.md) ·
> [Add human approval before an AI agent sends email](https://github.com/agens-field/nuvrail/blob/main/docs/guides/human-approval-before-ai-agent-sends-email.md) Β·
> [Human in the loop for LLM email agents](https://github.com/agens-field/nuvrail/blob/main/docs/guides/human-in-the-loop-llm-email-agent.md)

**Wiring up a specific agent?** Step-by-step recipes: [Claude Desktop](https://github.com/agens-field/nuvrail/blob/main/docs/integrations/claude-desktop.md) Β·
[Cursor](https://github.com/agens-field/nuvrail/blob/main/docs/integrations/cursor.md) Β· [LangChain](https://github.com/agens-field/nuvrail/blob/main/docs/integrations/langchain.md).

---

## ⚑ Try it in 60 seconds (local)

Just want to see it work? You need **Docker with the Compose plugin** β€” nothing else. No
domain, no TLS, no nginx. This runs everything on `localhost` for evaluation.

```
git clone https://github.com/agens-field/nuvrail.git
cd nuvrail
cp .env.example .env

docker compose up --build
```

> πŸ”Œ **Port 3000 already taken?** Set `NUVRAIL_HOST_WEB_PORT=3400` in `.env`
> (likewise `NUVRAIL_HOST_API_PORT`, `NUVRAIL_HOST_IMAP_PORT`, `NUVRAIL_HOST_SMTP_PORT`)
> and use that port in the URLs below. Ports are published host-side only β€” nothing
> about the host or port is baked into the web bundle, so `docker compose up -d` picks
> the change up without a rebuild.

> ⏱️ **First build takes several minutes β€” this is normal, not a hang.** The initial
> `--build` compiles both images from scratch (Python deps for the gateway, a Vite build
> for the web PWA), so a true fresh clone with a cold cache is typically **~5–9 min** on
> first run β€” not 60 seconds. Later `docker compose up` runs start in seconds. If the
> terminal sits quiet mid-build, it is compiling, not stuck; let it finish.

Sign-up is **closed by default** (`NUVRAIL_SIGNUP_MODE=closed`), so the web app has no
"create account" button. Create your first account from the CLI once the containers are up
(it prompts for a password):

```
docker compose exec gateway python3 scripts/manage_users.py create [email protected] --name "You"
```

Then open **<http://localhost:3000>** and log in. (Prefer self-serve sign-up? See
[Account creation](https://github.com/agens-field/nuvrail#account-creation-signup-modes).) The API is on
`http://localhost:8080`:

```
# Give the containers ~10–20s after the build finishes to come up healthy,
# then this returns {"status": "ok", ...}. A connection-refused here just
# means the gateway is still starting β€” wait a moment and retry.
curl -s http://localhost:8080/health   # β†’ {"status": "ok", ...}
```

That's it β€” the approval UI, REST API, and IMAP/SMTP proxies (`localhost:10143` / `localhost:10587`)
are all running. Point a test IMAP/SMTP client at the proxy ports and watch writes get staged for
approval in the UI.

> 🌐 **Running it on a remote box?** The browser never calls the API directly β€”
> the web container proxies `/api/` to the gateway over the compose network β€” so only
> the web port needs publishing. Set `NUVRAIL_BIND_ADDR=0.0.0.0` in `.env`, rerun
> `docker compose up -d`, and open `http://<host>:3000`. No rebuild, no `VITE_API_URL`,
> no CORS entry. Do this on a trusted network only: it is plain HTTP carrying bearer
> tokens β€” see [Deploying to production](https://github.com/agens-field/nuvrail#deploying-to-production) for the TLS path.

> ℹ️ **Local trial only.** With `NUVRAIL_MASTER_KEY` left blank the gateway auto-generates a
> key on first run (fine for kicking the tires, **not** for real mail). To connect a real
> mailbox with agents on other machines, follow [Deploying to production](https://github.com/agens-field/nuvrail#deploying-to-production)
> below β€” that adds TLS, nginx, and a persisted master key.

Like what you see? **[β˜… Star the repo](https://github.com/agens-field/nuvrail)** β€” it's the
fastest way to help other people find it.

---

## Architecture

```
Internet
    β”‚
    β”œβ”€β”€β–Ί :993  IMAPS  ──► nginx (TLS) ──► IMAP proxy (10143)  ──► upstream IMAP
    β”œβ”€β”€β–Ί :465  SMTPS  ──► nginx (TLS) ──► SMTP proxy (10587)  ──► upstream SMTP
    └──► :443  HTTPS  ──► nginx (TLS) ──► Web PWA + REST API (3000/8080)

All external TLS terminates at nginx. Docker containers are bound to 127.0.0.1 only.
No plain-text port is reachable from outside the host.
```

**Components:**

- **IMAP proxy** (`gateway/proxy.py`) β€” asyncio IMAP4rev1 state machine. Intercepts writes, passes reads, maintains a local SQLite mirror for optimistic consistency.
- **SMTP proxy** (`gateway/smtp_proxy.py`) β€” asyncio. Intercepts `DATA` (outbound sends), stages them. Relays on approval.
- **Staging engine** (`gateway/staging.py`) β€” assigns op IDs, stores snapshots for revert, tracks 48-hour expiry.
- **REST API** (`api/`) β€” FastAPI. Approve/reject operations, manage agents, audit log, push subscriptions.
- **Web PWA** (`web/`) β€” React 18 + Vite + TypeScript + Tailwind. Login, pending operations, audit log, agent management. Installable as a PWA on iOS/Android.

**Key design constraints:**

- Standard IMAP/SMTP on both ends β€” no agent modifications required
- EXPUNGE and CLOSE never forwarded; `\Deleted` is staged for approval like any other write
- AES-256-GCM for all credentials at rest; TLS everywhere in transit
- Push payloads are end-to-end encrypted to your device (Web Push, RFC 8291), so the push relay never sees email metadata
- Immutable audit log β€” every action is recorded forever

---

## Deploying to production

The 60-second path above is for evaluation on `localhost`. To run Nuvrail as a real service β€”
reachable by an agent on another machine, terminating TLS, connecting a real mailbox β€” follow
the full deployment below.

### Prerequisites

- Ubuntu 22.04 LTS (or equivalent Debian-based distro)
- DNS `A` record pointing at your server:
  - `nuvrail.example.com` β†’ server IP (approval UI + proxy)
- Git, Docker Engine + Compose plugin, nginx with stream module, certbot

```
# Docker Engine
curl -fsSL https://get.docker.com | sh
sudo usermod -aG docker $USER   # log out and back in

# nginx with stream module + certbot
sudo apt install -y nginx libnginx-mod-stream certbot python3-certbot-nginx
```

---

### Step 1 β€” Clone and configure

```
sudo mkdir -p /opt/nuvrail && sudo chown $USER:$USER /opt/nuvrail
git clone https://github.com/agens-field/nuvrail.git /opt/nuvrail
cd /opt/nuvrail
cp .env.example .env
nano .env
```

Required environment variables:

| Variable | Description |
| --- | --- |
| `NUVRAIL_MASTER_KEY` | 64 hex chars β€” `python3 -c "import secrets; print(secrets.token_bytes(32).hex())"` |
| `NUVRAIL_CORS_ORIGINS` | `https://nuvrail.example.com` |
| `NUVRAIL_SIGNUP_MODE` | Who may create accounts: `closed` (default), `invite`, or `open`. See [Account creation](https://github.com/agens-field/nuvrail#account-creation-signup-modes). |
| `NUVRAIL_ALLOW_OPEN_SIGNUP` | Required ack (`1`) **only** when `NUVRAIL_SIGNUP_MODE=open`; the API refuses to start with `open` unless this is set. |
| `NUVRAIL_VAPID_EMAIL` | Admin contact email, e.g. `mailto:[email protected]` |
| `GOOGLE_CLIENT_ID` | GCP OAuth2 client ID (required for Gmail agent setup) |
| `GOOGLE_CLIENT_SECRET` | GCP OAuth2 client secret (required for Gmail agent setup) |
| `GOOGLE_REDIRECT_URI` | `https://nuvrail.example.com/api/v1/oauth2/google/callback` |
| `MICROSOFT_CLIENT_ID` | Azure AD app client ID (required for Outlook/O365 agent setup) |
| `MICROSOFT_CLIENT_SECRET` | Azure AD app client secret (required for Outlook/O365 agent setup) |
| `MICROSOFT_REDIRECT_URI` | `https://nuvrail.example.com/api/v1/oauth2/microsoft/callback` |
| `MICROSOFT_TENANT` | Azure AD tenant β€” `common` (default) for personal + multi-tenant, or a tenant GUID/domain for single-tenant |

> ⚠️ **Back up `NUVRAIL_MASTER_KEY`.** It encrypts every upstream credential in the
> database. Losing it makes all stored agent credentials unrecoverable.

**Choose your signup mode now** β€” it decides who can create an account on this
deployment and it is fail-closed, so a fresh `.env` is already private. Pick one
and put the matching lines in `.env`:

```
# closed (DEFAULT) β€” no public sign-up; you provision users from the admin CLI.
# This is also what you get if you set nothing at all. Best for a private /
# single-tenant instance.
NUVRAIL_SIGNUP_MODE=c
mmodahl21

Interpretation history

Decision trace