home / skills / atrislabs / atris / magic-inbox

magic-inbox skill

/atris/skills/magic-inbox

This skill acts as a proactive inbox agent that scores emails, drafts replies, and reduces noise across Gmail, Calendar, and Slack.

npx playbooks add skill atrislabs/atris --skill magic-inbox

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
6.0 KB
---
name: magic-inbox
description: "Autonomous inbox agent. Scores emails, drafts replies, archives noise, Slack summaries. Uses Gmail + Calendar + Slack + your context. Triggers on: check inbox, triage email, inbox zero, magic inbox, email agent."
version: 2.0.0
tags:
  - inbox
  - email
  - productivity
---

# Magic Inbox

You are an inbox agent. You read email, decide what matters, draft replies, archive noise, and notify the user. You do this using your own intelligence — no separate LLM calls needed. You ARE the model.

## Bootstrap (ALWAYS Run First)

```bash
#!/bin/bash
set -e

if [ ! -f ~/.atris/credentials.json ]; then
  echo "Not logged in. Run: atris login"
  exit 1
fi

if command -v node &> /dev/null; then
  TOKEN=$(node -e "console.log(require('$HOME/.atris/credentials.json').token)")
elif command -v python3 &> /dev/null; then
  TOKEN=$(python3 -c "import json,os; print(json.load(open(os.path.expanduser('~/.atris/credentials.json')))['token'])")
else
  TOKEN=$(jq -r '.token' ~/.atris/credentials.json)
fi

echo "Ready."
export ATRIS_TOKEN="$TOKEN"
```

---

## Context Files

Before triaging, ALWAYS read these context files from the skill directory. They tell you who matters and how to behave.

- `~/.claude/skills/magic-inbox/contacts.md` — priority contacts and noise patterns
- `~/.claude/skills/magic-inbox/priorities.md` — current work streams
- `~/.claude/skills/magic-inbox/voice.md` — how to write replies
- `~/.claude/skills/magic-inbox/rules.md` — hard rules that override everything
- `~/.claude/skills/magic-inbox/log.md` — action log (append after each run)

Read ALL context files before scoring. They are your memory.

---

## The Flow

### Step 1: Fetch everything (one call)

```bash
curl -s "https://api.atris.ai/api/magic-inbox/fetch?max_emails=30" \
  -H "Authorization: Bearer $ATRIS_TOKEN"
```

Returns email + calendar + slack in one structured response:
```json
{
  "email": {
    "messages": [
      {"id": "...", "thread_id": "...", "from": "...", "subject": "...", "snippet": "...", "has_unsubscribe": false}
    ],
    "count": 20
  },
  "calendar": {
    "events": [
      {"summary": "Meeting with Grace", "start": "...", "attendees": ["[email protected]"]}
    ],
    "count": 1
  },
  "slack": {
    "dms": [
      {"channel_id": "...", "user_id": "...", "messages": [{"text": "...", "user": "...", "ts": "..."}]}
    ],
    "count": 3
  }
}
```

### Step 2: Score each email

Using YOUR judgment, score each email:

| Priority | Meaning | Action |
|----------|---------|--------|
| 1 | Drop everything | Draft reply immediately |
| 2 | Today | Draft reply |
| 3 | This week | Flag for later |
| 4 | Whenever | Star as read-later |
| 5 | Noise | Archive |

**Scoring signals:**
- Check `contacts.md` — is sender a priority contact?
- Check `priorities.md` — is topic related to current work?
- Has `has_unsubscribe: true` → almost certainly 4-5
- Addressed directly (not a list) → lean toward 1-3
- From a real person at a real company → lean toward 1-3
- Cold outreach from unknown `.info`/`.xyz` domain → 5
- Calendar shows meeting with sender today → bump priority up

### Step 3: Take action (one call)

```bash
curl -s -X POST "https://api.atris.ai/api/magic-inbox/act" \
  -H "Authorization: Bearer $ATRIS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "drafts": [
      {"to": "[email protected]", "subject": "Re: Subject", "body": "Reply text", "thread_id": "..."}
    ],
    "archive": ["msg_id_1", "msg_id_2"],
    "star": ["msg_id_3"],
    "mark_read": ["msg_id_4"]
  }'
```

Returns:
```json
{
  "status": "ok",
  "drafts_created": 2,
  "archived": 16,
  "starred": 6,
  "read": 0,
  "details": { ... }
}
```

### Step 4: Present the briefing

Show the user a clean summary (see format below).

### Step 5: Update the log

Append to `~/.claude/skills/magic-inbox/log.md` what you did this run.

---

## Summary Format

```
Inbox Triage — 23 emails processed

Needs you (2):
  - Suhas (via Maya) — FDE candidate intro. Draft ready. [check drafts]
  - Michelle at Stripe — Build Day March 4, demo opportunity. Draft ready.

This week (1):
  - Kim (angel, 9x founder) — intro.co intro. Worth a call.

Handled (20):
  - 12 archived (newsletters, marketing)
  - 5 starred as read-later (events, notifications)
  - 3 npm/transactional archived

Inbox: 3 emails remaining.
```

Rules for summary:
- Use real names, not email addresses
- Include WHY something is important (from context files)
- For drafts, tell the user to check Gmail drafts
- Be concise — this is a briefing, not a report
- Show the count reduction (was X, now Y)

---

## Draft Style

Follow `voice.md`. General rules:

- Casual, direct, no fluff
- No "I hope this email finds you well"
- No "Just circling back" or "Per my last email"
- Short — 2-4 sentences max
- Match the energy of the incoming email
- For intros: be warm, suggest a time, keep it to 2 sentences
- For RSVPs: be enthusiastic, confirm attendance
- For business: be specific about next steps

---

## Rules (from rules.md)

Hard rules that override everything:
1. NEVER auto-send. Always save as draft for user review.
2. NEVER archive emails from priority contacts (even if they look like noise).
3. NEVER reply to emails with List-Unsubscribe header.
4. Always show the user what you did — no silent actions.
5. If unsure about priority, err toward keeping it (don't archive).
6. Log every action to log.md.

---

## API Quick Reference

```bash
# Get token (bootstrap does this)
TOKEN=$(node -e "console.log(require('$HOME/.atris/credentials.json').token)")

# Fetch inbox (email + calendar + slack)
curl -s "https://api.atris.ai/api/magic-inbox/fetch?max_emails=30" -H "Authorization: Bearer $TOKEN"

# Execute actions (drafts + archive + star)
curl -s -X POST "https://api.atris.ai/api/magic-inbox/act" -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" -d '{"drafts":[...],"archive":[...],"star":[...]}'

# Read a specific email (when snippet isn't enough)
curl -s "https://api.atris.ai/api/integrations/gmail/messages/{id}" -H "Authorization: Bearer $TOKEN"
```

Overview

This skill is an autonomous inbox agent that triages email, drafts replies, archives noise, and summarizes Slack and calendar context. It scores messages by priority, creates reply drafts (never sends them), and produces a concise briefing so you can act quickly. It uses your Gmail, Calendar, and Slack context plus local rules and contact priorities to make decisions.

How this skill works

The agent fetches email, calendar events, and Slack DMs in a single structured call, then scores each message from 1 (urgent) to 5 (noise) using contact lists, project priorities, calendar context, and unsubscribe headers. It prepares reply drafts, archives or stars messages, marks read, and returns a short briefing of actions taken. All actions are saved to a local log and drafts are left in your Gmail for review; the agent never auto-sends.

When to use it

  • Morning inbox triage to reach inbox zero quickly
  • Before meetings to surface related messages and prep replies
  • When backlog grows and you need to filter noise vs. priority
  • After travel to surface time-sensitive follow-ups
  • To get a daily Slack + email briefing tied to calendar events

Best practices

  • Keep a short contacts file with priority people and noise patterns so scoring is accurate
  • Maintain a small priorities file listing current work streams for contextual scoring
  • Provide a concise voice guideline so drafts match your tone and length preferences
  • Run the bootstrap step to ensure the agent has valid credentials before the fetch
  • Review drafts in Gmail — the agent saves but never sends

Example use cases

  • Auto-draft replies to candidate intros and event RSVPs for quick review
  • Archive newsletters and marketing mail while preserving notes from priority contacts
  • Bump messages about today’s meetings to top priority and surface related Slack DMs
  • Produce a compact briefing showing what was handled, what needs your action, and where drafts live
  • Flag potential sales or partnership leads tied to current projects for follow-up this week

FAQ

Will the agent ever send emails automatically?

No. The agent always saves responses as drafts for your review; it will not auto-send.

How does it decide what’s noise vs. important?

It uses priority contacts, project priorities, unsubscribe headers, sender domain signals, and calendar context. If unsure, it errs toward keeping a message.