# Reach inbox zero with an AI agent

Source: https://developer.nylas.com/docs/cookbook/agents/inbox-zero/

The hard part of inbox zero isn't the cleaning — it's the *daily* cleaning. Most people stick with it for a week and then quit when the queue fills back up. An interactive agent flips the calculus: the agent does the sorting and drafting, you spend five minutes approving. The 50-message backlog from yesterday is empty before your second coffee.

This recipe is the interactive cousin of the [triage agent](/docs/cookbook/agents/email-triage-agent/) — same four-bucket model, but with a human in the loop.

## The four-step flow

**1. Pull a manageable batch** with [`nylas email list`](https://cli.nylas.com/docs/commands/email-list):

```bash
nylas email list --unread --limit 50 --json
```

50 is the sweet spot. Smaller and you'll feel like the agent isn't doing much. Larger and you'll exceed the LLM context budget and the approval review will get tedious.

**2. Categorize into four buckets.**

| Bucket | Reply window |
| --- | --- |
| **Urgent** | Within hours — client issue, manager request |
| **Action required** | Today — meeting follow-up, review |
| **FYI** | No response — newsletter, status, shared doc |
| **Archive** | Now — marketing, automated alerts |

The agent shows you a summary table:

```
Urgent (3)         Action (8)       FYI (24)       Archive (15)
────────────       ──────────       ────────       ─────────────
Ada / Q2 plan      Rin / Review     Eng team / …   Newsletter / …
…                  …                …              …
```

Audit the categories before going further. If "FYI" should have been "Action", recategorize at this step — the agent will draft what you correct it to.

**3. Draft replies for Urgent and Action.**

The agent generates a draft per item. You see each one:

```
TO:      ada@acme.test
RE:      Q2 plan
DRAFT:
  Hey Ada — let me block 30 minutes tomorrow morning to walk through this.
  I can offer 9am or 11am PT — what works?
```

You can edit, approve, or skip. Skipped drafts stay in the queue and you can revisit them at the end.

**4. Execute approved actions.**

After your approvals:

- Approved drafts get sent ([`nylas email send --yes`](https://cli.nylas.com/docs/commands/email-send)).
- Items marked Archive get archived (`nylas email archive <id>`).
- FYI items are left untouched.

## What the agent never does

**Never send without explicit approval.** This is the rule. The agent drafts; the human ships. Even if a draft is obviously fine, the click matters — it's the difference between "AI wrote this" and "I wrote this with help".

## Customize the rules over time

The first run will misclassify some messages. Encode the corrections as ongoing rules:

```yaml
# Inbox-zero rules

always_fyi:
  - "from: sales@*"
  - "from: noreply@*"
  - "subject: ^\\[GitHub\\]"

always_urgent:
  - "from: *@board.example.com"
  - "subject: \\b(p0|incident|outage)\\b"
```

Drop these in your skill or your agent prompt. Each pass gets faster as the agent learns your context.

## Daily habit

The compounding interest of inbox zero comes from doing it every day. Five minutes a day is sustainable. A two-hour purge once a month is not.

A pattern that works:

- 8:30 AM — `agent run inbox-zero` while the coffee brews
- 8:35 AM — done, all action items in your drafts folder, noise archived
- The rest of the day — the inbox only has new mail, and you can decide in real-time whether it's urgent

## Run it from the CLI

If you're not using Manus, the same flow works as a Python script driving the CLI directly. The shape:

```python
unread = fetch_unread(limit=50)
buckets = classify_all(unread)              # 4-bucket categorization
print_summary_table(buckets)
for msg in input_corrections(buckets):      # interactive correction
    pass
drafts = [draft_reply(m) for m in buckets["URGENT"] + buckets["ACTION"]]
for draft in interactive_approval(drafts):  # one-by-one Y/N/edit
    if draft.approved:
        send(draft)
for msg in buckets["ARCHIVE"]:
    archive(msg)
```

The interactive bit is what differentiates this from the cron-driven [triage agent](/docs/cookbook/agents/email-triage-agent/). Both share the four-bucket model.

## Things to know

- **20–50 per session is the sweet spot.** Below 20 you waste setup overhead. Above 50 you exhaust both your patience and the LLM context.
- **Multiple passes for backlogs.** If you're starting from 800 unread, run the loop a few times rather than asking the agent to handle the lot at once.
- **Custom buckets later.** Some teams add a fifth "delegate" bucket that auto-cc's a teammate. Doable; do it after the four-bucket version is bedded in.

## Next steps

- [Email triage agent](/docs/cookbook/agents/email-triage-agent/) — the cron-driven version
- [Email support agent](/docs/cookbook/agents/email-support-agent/)
- [Build a Manus skill for Nylas](/docs/cookbook/cli/manus-skill/)
- [Nylas CLI](https://cli.nylas.com/) — installation and full [command reference](https://cli.nylas.com/docs/commands)