inboxd 1.1.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/inbox-assistant/SKILL.md +216 -87
- package/CLAUDE.md +43 -41
- package/README.md +32 -32
- package/package.json +3 -3
- package/scripts/postinstall.js +5 -5
- package/src/cli.js +107 -36
- package/src/gmail-auth.js +1 -1
- package/src/gmail-monitor.js +138 -1
- package/tests/filter.test.js +1 -1
- package/tests/json-output.test.js +4 -4
- package/tests/older-than.test.js +1 -1
- package/tests/search-enhancements.test.js +352 -0
- package/tests/setup.test.js +1 -1
|
@@ -113,7 +113,7 @@ When a user has a heavy inbox (>20 unread emails), use this optimized workflow:
|
|
|
113
113
|
### 1. Quick Assessment
|
|
114
114
|
|
|
115
115
|
```bash
|
|
116
|
-
|
|
116
|
+
inboxd summary --json
|
|
117
117
|
```
|
|
118
118
|
|
|
119
119
|
Identify which account(s) have the bulk of unread emails.
|
|
@@ -123,7 +123,7 @@ Identify which account(s) have the bulk of unread emails.
|
|
|
123
123
|
For heavy inboxes, **always start with grouped analysis**:
|
|
124
124
|
|
|
125
125
|
```bash
|
|
126
|
-
|
|
126
|
+
inboxd analyze --count 100 --account <name> --group-by sender
|
|
127
127
|
```
|
|
128
128
|
|
|
129
129
|
This reveals:
|
|
@@ -163,7 +163,7 @@ Delete all LinkedIn job alerts and old newsletters?
|
|
|
163
163
|
For cleanup of old emails, use server-side filtering:
|
|
164
164
|
|
|
165
165
|
```bash
|
|
166
|
-
|
|
166
|
+
inboxd analyze --older-than 30d --group-by sender
|
|
167
167
|
```
|
|
168
168
|
|
|
169
169
|
Old emails (>30 days) are usually safe to batch delete:
|
|
@@ -194,19 +194,84 @@ Unread count?
|
|
|
194
194
|
|
|
195
195
|
---
|
|
196
196
|
|
|
197
|
+
## Autonomous Backlog Processing
|
|
198
|
+
|
|
199
|
+
> [!TIP]
|
|
200
|
+
> Use this workflow when cleanup involves more emails than a single search returns.
|
|
201
|
+
|
|
202
|
+
### Detecting Scale
|
|
203
|
+
|
|
204
|
+
If search returns exactly the limit (e.g., 100 emails), assume more exist:
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
inboxd search -q "from:linkedin.com" --count
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Use `--count` to get a quick estimate before fetching all emails.
|
|
211
|
+
|
|
212
|
+
### Processing Loop
|
|
213
|
+
|
|
214
|
+
1. **Assess scale:** `inboxd search -q "..." --count`
|
|
215
|
+
2. **Inform user:** "Found ~N emails. I'll process in batches of 50."
|
|
216
|
+
3. **For each batch:** Fetch → Propose (per Batch Deletion Proposal Protocol) → Wait for approval → Execute → Report progress
|
|
217
|
+
4. **Control points:** "Continue?" after each batch unless user said "yes to all"
|
|
218
|
+
|
|
219
|
+
### Autonomy Levels
|
|
220
|
+
|
|
221
|
+
| User Says | Agent Behavior |
|
|
222
|
+
|-----------|----------------|
|
|
223
|
+
| "Clean up newsletters" | Single batch, ask before each |
|
|
224
|
+
| "Clean up ALL newsletters" | Multi-batch, ask after first batch, then auto-continue |
|
|
225
|
+
| "Delete everything from X, go ahead" | Multi-batch, no confirmation (explicit consent given) |
|
|
226
|
+
|
|
227
|
+
### Guardrails
|
|
228
|
+
|
|
229
|
+
- **Max 500 deletions per session** - Stop and ask if approaching this limit
|
|
230
|
+
- **Pause on any API error** - Don't continue blindly
|
|
231
|
+
- **Checkpoint every 100 deletions** - Report progress: "Deleted 100 so far, 200 remaining. Continue?"
|
|
232
|
+
- **First batch always requires approval** - Even with "yes to all", confirm the first batch
|
|
233
|
+
|
|
234
|
+
### Example Backlog Workflow
|
|
235
|
+
|
|
236
|
+
**User:** "Delete all my LinkedIn job alerts"
|
|
237
|
+
|
|
238
|
+
**Agent:**
|
|
239
|
+
```
|
|
240
|
+
Checking scale...
|
|
241
|
+
~150 LinkedIn emails found. I'll process in batches of 50.
|
|
242
|
+
|
|
243
|
+
## Batch 1 of 3
|
|
244
|
+
|
|
245
|
+
### Deletion Proposal: personal (50 emails)
|
|
246
|
+
- Job alerts: 45
|
|
247
|
+
- Connection requests: 5
|
|
248
|
+
|
|
249
|
+
Representative sample:
|
|
250
|
+
| Sender | Subject | Age |
|
|
251
|
+
|--------|---------|-----|
|
|
252
|
+
| LinkedIn | 15 new jobs... | 2d |
|
|
253
|
+
...
|
|
254
|
+
|
|
255
|
+
Delete this batch? (yes / no / yes to all)
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
197
260
|
## Quick Start
|
|
198
261
|
|
|
199
262
|
| Task | Command |
|
|
200
263
|
|------|---------|
|
|
201
|
-
| Check status | `
|
|
202
|
-
| Full triage | `
|
|
203
|
-
| Analyze by sender | `
|
|
204
|
-
| Find old emails | `
|
|
205
|
-
|
|
|
206
|
-
|
|
|
207
|
-
|
|
|
208
|
-
| Delete by
|
|
209
|
-
|
|
|
264
|
+
| Check status | `inboxd summary --json` |
|
|
265
|
+
| Full triage | `inboxd analyze --count 50` → classify → present |
|
|
266
|
+
| Analyze by sender | `inboxd analyze --count 50 --group-by sender` |
|
|
267
|
+
| Find old emails | `inboxd analyze --older-than 30d` |
|
|
268
|
+
| Quick count | `inboxd search -q "from:linkedin.com" --count` |
|
|
269
|
+
| Fetch all matches | `inboxd search -q "from:linkedin.com" --all --max 200` |
|
|
270
|
+
| Extract links from email | `inboxd read --id <id> --links` |
|
|
271
|
+
| Delete by ID | `inboxd delete --ids "id1,id2" --confirm` |
|
|
272
|
+
| Delete by sender | `inboxd delete --sender "linkedin" --dry-run` → confirm → delete |
|
|
273
|
+
| Delete by subject | `inboxd delete --match "weekly digest" --dry-run` |
|
|
274
|
+
| Undo deletion | `inboxd restore --last N` |
|
|
210
275
|
|
|
211
276
|
## Package Information
|
|
212
277
|
|
|
@@ -214,7 +279,7 @@ Unread count?
|
|
|
214
279
|
|---|---|
|
|
215
280
|
| **Package** | `inboxd` |
|
|
216
281
|
| **Install** | `npm install -g inboxd` |
|
|
217
|
-
| **Setup** | `
|
|
282
|
+
| **Setup** | `inboxd setup` (interactive wizard) |
|
|
218
283
|
| **Documentation** | https://github.com/dparedesi/inboxd |
|
|
219
284
|
| **npm** | https://www.npmjs.com/package/inboxd |
|
|
220
285
|
|
|
@@ -224,10 +289,10 @@ Before any inbox operation, always verify the setup:
|
|
|
224
289
|
|
|
225
290
|
```bash
|
|
226
291
|
# 1. Check if inboxd is installed
|
|
227
|
-
|
|
292
|
+
inboxd --version
|
|
228
293
|
|
|
229
294
|
# 2. Check if accounts are configured
|
|
230
|
-
|
|
295
|
+
inboxd accounts
|
|
231
296
|
```
|
|
232
297
|
|
|
233
298
|
## Account Management
|
|
@@ -235,24 +300,24 @@ inbox accounts
|
|
|
235
300
|
### Adding New Accounts
|
|
236
301
|
If the user wants to add an account (e.g. "add my work email"):
|
|
237
302
|
```bash
|
|
238
|
-
|
|
239
|
-
# Example:
|
|
303
|
+
inboxd auth -a <name>
|
|
304
|
+
# Example: inboxd auth -a work
|
|
240
305
|
```
|
|
241
306
|
|
|
242
307
|
### Listing Accounts
|
|
243
308
|
```bash
|
|
244
|
-
|
|
309
|
+
inboxd accounts
|
|
245
310
|
```
|
|
246
311
|
|
|
247
312
|
### Removing Accounts
|
|
248
313
|
```bash
|
|
249
|
-
|
|
250
|
-
|
|
314
|
+
inboxd logout -a <name> # Remove specific account
|
|
315
|
+
inboxd logout --all # Remove all accounts
|
|
251
316
|
```
|
|
252
317
|
|
|
253
318
|
### Re-authenticating (Token Expired)
|
|
254
319
|
```bash
|
|
255
|
-
rm ~/.config/inboxd/token-<account>.json &&
|
|
320
|
+
rm ~/.config/inboxd/token-<account>.json && inboxd auth -a <account>
|
|
256
321
|
```
|
|
257
322
|
|
|
258
323
|
### If Not Installed
|
|
@@ -264,7 +329,7 @@ rm ~/.config/inboxd/token-<account>.json && inbox auth -a <account>
|
|
|
264
329
|
inboxd is not installed. To install:
|
|
265
330
|
|
|
266
331
|
1. Run: npm install -g inboxd
|
|
267
|
-
2. Run:
|
|
332
|
+
2. Run: inboxd setup
|
|
268
333
|
3. Follow the wizard to configure your Gmail account
|
|
269
334
|
|
|
270
335
|
The setup requires creating OAuth credentials in Google Cloud Console.
|
|
@@ -272,7 +337,7 @@ The setup requires creating OAuth credentials in Google Cloud Console.
|
|
|
272
337
|
|
|
273
338
|
### If No Accounts Configured
|
|
274
339
|
```
|
|
275
|
-
No Gmail accounts configured. Run:
|
|
340
|
+
No Gmail accounts configured. Run: inboxd setup
|
|
276
341
|
|
|
277
342
|
This will guide you through:
|
|
278
343
|
1. Creating OAuth credentials in Google Cloud Console
|
|
@@ -284,9 +349,9 @@ This will guide you through:
|
|
|
284
349
|
Users can enable automatic inbox checking with notifications:
|
|
285
350
|
|
|
286
351
|
```bash
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
352
|
+
inboxd install-service # Check every 5 minutes
|
|
353
|
+
inboxd install-service --interval 10 # Check every 10 minutes
|
|
354
|
+
inboxd install-service --uninstall # Remove service
|
|
290
355
|
```
|
|
291
356
|
|
|
292
357
|
This installs and starts a background service that:
|
|
@@ -304,43 +369,46 @@ This installs and starts a background service that:
|
|
|
304
369
|
|
|
305
370
|
| Command | Description | Output |
|
|
306
371
|
|---------|-------------|--------|
|
|
307
|
-
| `
|
|
308
|
-
| `
|
|
309
|
-
| `
|
|
310
|
-
| `
|
|
311
|
-
| `
|
|
312
|
-
| `
|
|
313
|
-
| `
|
|
314
|
-
| `
|
|
315
|
-
| `
|
|
316
|
-
| `
|
|
317
|
-
| `
|
|
372
|
+
| `inboxd summary --json` | Quick inbox overview | `{accounts: [{name, email, unreadCount}], totalUnread}` |
|
|
373
|
+
| `inboxd analyze --count 50` | Get email data for analysis | JSON array of email objects |
|
|
374
|
+
| `inboxd analyze --count 50 --all` | Include read emails | JSON array (read + unread) |
|
|
375
|
+
| `inboxd analyze --since 7d` | Only emails from last 7 days | JSON array (filtered by date) |
|
|
376
|
+
| `inboxd analyze --older-than 30d` | Only emails older than 30 days | JSON array (server-side filtered) |
|
|
377
|
+
| `inboxd analyze --group-by sender` | Group emails by sender domain | `{groups: [{sender, count, emails}], totalCount}` |
|
|
378
|
+
| `inboxd read --id <id>` | Read full email content | Email headers + body |
|
|
379
|
+
| `inboxd read --id <id> --links` | Extract links from email | List of URLs with optional link text |
|
|
380
|
+
| `inboxd read --id <id> --links --json` | Extract links as JSON | `{id, subject, from, linkCount, links}` |
|
|
381
|
+
| `inboxd search -q "query"` | Search using Gmail query syntax (default: 100 results) | JSON array of matching emails |
|
|
382
|
+
| `inboxd search -q "query" --count` | Quick count without fetching details | `{estimate, isApproximate, hasMore}` |
|
|
383
|
+
| `inboxd search -q "query" --all` | Fetch all matching emails (up to 500) | JSON array with `totalFetched`, `hasMore` |
|
|
384
|
+
| `inboxd search -q "query" --all --max 200` | Fetch all up to custom limit | JSON array with pagination info |
|
|
385
|
+
| `inboxd accounts` | List configured accounts | Account names and emails |
|
|
318
386
|
|
|
319
387
|
### Actions
|
|
320
388
|
|
|
321
389
|
| Command | Description |
|
|
322
390
|
|---------|-------------|
|
|
323
|
-
| `
|
|
324
|
-
| `
|
|
325
|
-
| `
|
|
326
|
-
| `
|
|
327
|
-
| `
|
|
328
|
-
| `
|
|
329
|
-
| `
|
|
330
|
-
| `
|
|
331
|
-
| `
|
|
332
|
-
| `
|
|
333
|
-
| `
|
|
334
|
-
| `
|
|
335
|
-
| `
|
|
336
|
-
| `
|
|
337
|
-
| `
|
|
338
|
-
| `
|
|
339
|
-
| `
|
|
340
|
-
| `
|
|
341
|
-
| `
|
|
342
|
-
| `
|
|
343
|
-
| `
|
|
391
|
+
| `inboxd delete --ids "id1,id2,id3" --confirm` | Move emails to trash by ID |
|
|
392
|
+
| `inboxd delete --sender "pattern" --dry-run` | Preview deletion by sender filter |
|
|
393
|
+
| `inboxd delete --match "pattern" --dry-run` | Preview deletion by subject filter |
|
|
394
|
+
| `inboxd delete --sender "X" --match "Y" --confirm` | Delete by combined filters (AND) |
|
|
395
|
+
| `inboxd delete --sender "X" --limit 100 --confirm` | Override 50-email safety limit |
|
|
396
|
+
| `inboxd delete --sender "ab" --force --confirm` | Override short-pattern warning |
|
|
397
|
+
| `inboxd restore --last N` | Restore last N deleted emails |
|
|
398
|
+
| `inboxd restore --ids "id1,id2"` | Restore specific emails |
|
|
399
|
+
| `inboxd mark-read --ids "id1,id2"` | Mark emails as read (remove UNREAD label) |
|
|
400
|
+
| `inboxd mark-unread --ids "id1,id2"` | Mark emails as unread (add UNREAD label) |
|
|
401
|
+
| `inboxd archive --ids "id1,id2" --confirm` | Archive emails (remove from inbox, keep in All Mail) |
|
|
402
|
+
| `inboxd unarchive --last N` | Undo last N archived emails |
|
|
403
|
+
| `inboxd unarchive --ids "id1,id2"` | Unarchive specific emails |
|
|
404
|
+
| `inboxd stats` | Show email activity dashboard (deletions, sent counts) |
|
|
405
|
+
| `inboxd stats --days 7 --json` | Get stats as JSON for custom period |
|
|
406
|
+
| `inboxd cleanup-suggest` | Get smart cleanup suggestions based on deletion patterns |
|
|
407
|
+
| `inboxd deletion-log` | View recent deletions |
|
|
408
|
+
| `inboxd deletion-log --json` | Get deletion log as JSON |
|
|
409
|
+
| `inboxd accounts --json` | List accounts as JSON |
|
|
410
|
+
| `inboxd delete --dry-run --json` | Preview deletion as structured JSON |
|
|
411
|
+
| `inboxd restore --json` | Get restore results as JSON |
|
|
344
412
|
|
|
345
413
|
### Smart Filtering Options
|
|
346
414
|
|
|
@@ -405,7 +473,7 @@ You have 5 emails from LinkedIn. Delete them all?
|
|
|
405
473
|
|
|
406
474
|
### 1. Check Inbox Status
|
|
407
475
|
```bash
|
|
408
|
-
|
|
476
|
+
inboxd summary --json
|
|
409
477
|
```
|
|
410
478
|
Report the total unread count and per-account breakdown.
|
|
411
479
|
|
|
@@ -443,7 +511,7 @@ Want me to triage that first?
|
|
|
443
511
|
|
|
444
512
|
### 3. Fetch Emails for Analysis
|
|
445
513
|
```bash
|
|
446
|
-
|
|
514
|
+
inboxd analyze --count 50 --account <name>
|
|
447
515
|
```
|
|
448
516
|
Parse the JSON output and classify each email.
|
|
449
517
|
|
|
@@ -458,9 +526,21 @@ Categorize each email using the **Action Type Matrix**:
|
|
|
458
526
|
- Contains urgent keywords: "urgent", "asap", "action required", "deadline", "expiring"
|
|
459
527
|
- Calendar invites requiring RSVP
|
|
460
528
|
|
|
529
|
+
#### Financial (Archive, Never Delete)
|
|
530
|
+
- Bank statements, balance alerts, payment confirmations
|
|
531
|
+
- Investment alerts (dividends, portfolio updates)
|
|
532
|
+
- Tax documents, W2/1099 notifications
|
|
533
|
+
- **Signals:** bank, chase, wellsfargo, fidelity, "statement", "balance", "tax"
|
|
534
|
+
- **Action:** Suggest archiving, NEVER include in cleanup
|
|
535
|
+
|
|
536
|
+
#### Purchase Receipts (FYI, Deletable After 30d)
|
|
537
|
+
- Order confirmations, receipts
|
|
538
|
+
- Delivery notifications ("Your package was delivered")
|
|
539
|
+
- Subscription renewals (Netflix, Spotify)
|
|
540
|
+
- **Signals:** "order confirmation", "receipt", "delivered", amazon, apple
|
|
541
|
+
- **Action:** FYI for recent (<7d), cleanup candidate if >30d old
|
|
542
|
+
|
|
461
543
|
#### Important FYI (mention, don't push)
|
|
462
|
-
- Order confirmations, receipts, delivery notifications
|
|
463
|
-
- Bank statements, payment confirmations
|
|
464
544
|
- Security alerts (if expected/authorized)
|
|
465
545
|
- Stats, reports, summaries (Substack stats, analytics)
|
|
466
546
|
|
|
@@ -545,7 +625,7 @@ Confirm deletion? (y/n)
|
|
|
545
625
|
|
|
546
626
|
Only after explicit user confirmation:
|
|
547
627
|
```bash
|
|
548
|
-
|
|
628
|
+
inboxd delete --ids "id1,id2,id3,..." --account <name> --confirm
|
|
549
629
|
```
|
|
550
630
|
|
|
551
631
|
### 8. Confirm & Remind About Undo
|
|
@@ -554,7 +634,7 @@ After deletion:
|
|
|
554
634
|
```
|
|
555
635
|
Deleted 8 emails.
|
|
556
636
|
|
|
557
|
-
To undo: `
|
|
637
|
+
To undo: `inboxd restore --last 8`
|
|
558
638
|
```
|
|
559
639
|
|
|
560
640
|
---
|
|
@@ -598,14 +678,14 @@ When user has job-related emails (LinkedIn, Indeed, recruiters) and wants to eva
|
|
|
598
678
|
| "Delete all from [sender]" | Bulk sender cleanup | `--sender "X" --dry-run` → confirm → `--ids` |
|
|
599
679
|
| "Delete [sender]'s emails" | Bulk sender cleanup | Two-step pattern with `--sender` filter |
|
|
600
680
|
| "Delete the security emails" | Subject-based cleanup | `--match "security" --dry-run` → confirm → `--ids` |
|
|
601
|
-
| "What senders have the most emails?" | Inbox analysis | `
|
|
602
|
-
| "Show my email stats" | Activity summary | `
|
|
603
|
-
| "What should I clean up?" | Pattern analysis | `
|
|
604
|
-
| "What links are in this email?" | Extract URLs | `
|
|
605
|
-
| "Find my old emails" / "Clean up old stuff" | Stale email review | `
|
|
681
|
+
| "What senders have the most emails?" | Inbox analysis | `inboxd analyze --group-by sender` |
|
|
682
|
+
| "Show my email stats" | Activity summary | `inboxd stats` |
|
|
683
|
+
| "What should I clean up?" | Pattern analysis | `inboxd cleanup-suggest` |
|
|
684
|
+
| "What links are in this email?" | Extract URLs | `inboxd read --id <id> --links` |
|
|
685
|
+
| "Find my old emails" / "Clean up old stuff" | Stale email review | `inboxd analyze --older-than 30d` |
|
|
606
686
|
| "I keep getting these" | Recurring annoyance | Suggest unsubscribe/filter, then delete batch |
|
|
607
687
|
| "Check [specific account]" | Single-account focus | Skip other accounts entirely |
|
|
608
|
-
| "Undo" / "Restore" | Recover deleted emails | `
|
|
688
|
+
| "Undo" / "Restore" | Recover deleted emails | `inboxd restore --last N` |
|
|
609
689
|
| "What are these companies?" | Research job/opportunity emails | Fetch websites, assess legitimacy |
|
|
610
690
|
| "Research these job opportunities" | Job alert evaluation | Job Research workflow (see below) |
|
|
611
691
|
|
|
@@ -620,11 +700,11 @@ When user has job-related emails (LinkedIn, Indeed, recruiters) and wants to eva
|
|
|
620
700
|
1. **NEVER auto-delete** - Always confirm before deletion, but adapt confirmation style to batch size
|
|
621
701
|
2. **NEVER delete Action Required emails** - Surface them, let user decide
|
|
622
702
|
3. **NEVER delete without --confirm flag** - Command will hang otherwise
|
|
623
|
-
4. **Always remind about undo** - After every deletion, mention `
|
|
703
|
+
4. **Always remind about undo** - After every deletion, mention `inboxd restore --last N`
|
|
624
704
|
|
|
625
705
|
### State Change Safety
|
|
626
706
|
5. **Confirm before mark-read** - Marking as read can hide important emails. Confirm batch operations (3+ emails)
|
|
627
|
-
6. **Remind about mark-unread undo** - After mark-read, mention: "To undo: `
|
|
707
|
+
6. **Remind about mark-unread undo** - After mark-read, mention: "To undo: `inboxd mark-unread --ids \"id1,id2\"`"
|
|
628
708
|
7. **Confirm before archive** - Archiving removes emails from inbox view. Always use `--confirm` flag
|
|
629
709
|
8. **Never batch mark-read silently** - Show what will be marked read before executing
|
|
630
710
|
|
|
@@ -632,13 +712,14 @@ When user has job-related emails (LinkedIn, Indeed, recruiters) and wants to eva
|
|
|
632
712
|
9. **Preserve by default** - When in doubt about classification, keep the email
|
|
633
713
|
10. **Multi-Account Safety** - Always use `--account <name>` for `delete`, `mark-read`, `mark-unread`, and `archive` commands
|
|
634
714
|
11. **Respect user preferences** - If they say "don't list everything", remember and adapt
|
|
715
|
+
12. **Proposal required for batch >5** - For deletions of 6+ emails, MUST present structured proposal per Batch Deletion Proposal Protocol. User must explicitly approve before executing `inboxd delete`
|
|
635
716
|
|
|
636
717
|
### Undo Commands Reference
|
|
637
718
|
| Action | Undo Command |
|
|
638
719
|
|--------|--------------|
|
|
639
|
-
| Deleted emails | `
|
|
640
|
-
| Marked as read | `
|
|
641
|
-
| Archived | `
|
|
720
|
+
| Deleted emails | `inboxd restore --last N` |
|
|
721
|
+
| Marked as read | `inboxd mark-unread --ids "id1,id2,..."` |
|
|
722
|
+
| Archived | `inboxd unarchive --last N` |
|
|
642
723
|
|
|
643
724
|
---
|
|
644
725
|
|
|
@@ -647,13 +728,13 @@ When user has job-related emails (LinkedIn, Indeed, recruiters) and wants to eva
|
|
|
647
728
|
> [!IMPORTANT]
|
|
648
729
|
> **ALWAYS use this pattern for filter-based deletions.** Filters are for DISCOVERY. IDs are for EXECUTION.
|
|
649
730
|
|
|
650
|
-
This pattern prevents accidental mass deletion. When user says "delete LinkedIn emails", never run `
|
|
731
|
+
This pattern prevents accidental mass deletion. When user says "delete LinkedIn emails", never run `inboxd delete --sender "linkedin" --confirm` directly—it could delete hundreds of emails.
|
|
651
732
|
|
|
652
733
|
### The Pattern
|
|
653
734
|
|
|
654
735
|
1. **Discover** - Find what matches the filter
|
|
655
736
|
```bash
|
|
656
|
-
|
|
737
|
+
inboxd delete --sender "linkedin" --dry-run
|
|
657
738
|
```
|
|
658
739
|
Output shows emails that would be deleted, plus IDs for programmatic use.
|
|
659
740
|
|
|
@@ -670,7 +751,7 @@ This pattern prevents accidental mass deletion. When user says "delete LinkedIn
|
|
|
670
751
|
|
|
671
752
|
3. **Execute** - Delete with explicit IDs (from dry-run output)
|
|
672
753
|
```bash
|
|
673
|
-
|
|
754
|
+
inboxd delete --ids "id1,id2,id3,id4,id5" --confirm
|
|
674
755
|
```
|
|
675
756
|
|
|
676
757
|
### When to Use Each Approach
|
|
@@ -694,20 +775,20 @@ This pattern prevents accidental mass deletion. When user says "delete LinkedIn
|
|
|
694
775
|
|
|
695
776
|
❌ **Bad agent behavior:**
|
|
696
777
|
```bash
|
|
697
|
-
|
|
778
|
+
inboxd delete --sender "linkedin" --confirm # Deletes ALL LinkedIn emails!
|
|
698
779
|
```
|
|
699
780
|
|
|
700
781
|
✅ **Good agent behavior:**
|
|
701
782
|
```bash
|
|
702
783
|
# Step 1: Find LinkedIn emails
|
|
703
|
-
|
|
784
|
+
inboxd analyze --count 20
|
|
704
785
|
# Sees: 3 LinkedIn emails - job alert, connection request, message
|
|
705
786
|
|
|
706
787
|
# Step 2: Identify the specific one by subject
|
|
707
788
|
# (job alert has subject containing "jobs for you")
|
|
708
789
|
|
|
709
790
|
# Step 3: Delete precisely
|
|
710
|
-
|
|
791
|
+
inboxd delete --ids "18e9abc" --confirm # Just the job alert
|
|
711
792
|
```
|
|
712
793
|
|
|
713
794
|
### Ambiguity Handling
|
|
@@ -726,6 +807,54 @@ Reply with the number or describe which one.
|
|
|
726
807
|
|
|
727
808
|
---
|
|
728
809
|
|
|
810
|
+
## Batch Deletion Proposal Protocol
|
|
811
|
+
|
|
812
|
+
> [!IMPORTANT]
|
|
813
|
+
> For batch deletions of 6+ emails, agents MUST present a structured proposal before executing.
|
|
814
|
+
|
|
815
|
+
### Proposal Thresholds
|
|
816
|
+
|
|
817
|
+
| Batch Size | Required Format |
|
|
818
|
+
|------------|-----------------|
|
|
819
|
+
| 1-5 | List each (sender + subject), inline confirmation OK |
|
|
820
|
+
| 6-20 | Categorized summary + 2-3 examples per category |
|
|
821
|
+
| 21-50 | Category counts + representative sample (5 total) |
|
|
822
|
+
| 51+ | MUST split into batches of 50 max |
|
|
823
|
+
|
|
824
|
+
### Required Proposal Structure
|
|
825
|
+
|
|
826
|
+
For batches of 6+ emails, present this format:
|
|
827
|
+
|
|
828
|
+
```markdown
|
|
829
|
+
## Deletion Proposal: [account] ([N] emails)
|
|
830
|
+
|
|
831
|
+
### Summary
|
|
832
|
+
- Category 1: N emails
|
|
833
|
+
- Category 2: N emails
|
|
834
|
+
|
|
835
|
+
### Representative Sample (5 of N)
|
|
836
|
+
| Sender | Subject | Age |
|
|
837
|
+
|--------|---------|-----|
|
|
838
|
+
| linkedin.com | 15 new jobs for you | 3d |
|
|
839
|
+
| substack.com | Weekly newsletter | 5d |
|
|
840
|
+
| ... | ... | ... |
|
|
841
|
+
|
|
842
|
+
### Risk Assessment
|
|
843
|
+
- High-value matches: N (domains you interact with regularly)
|
|
844
|
+
- Confidence: High/Medium
|
|
845
|
+
|
|
846
|
+
Confirm deletion? (Say "yes" or "list all" for full details)
|
|
847
|
+
```
|
|
848
|
+
|
|
849
|
+
### Why This Matters
|
|
850
|
+
|
|
851
|
+
- Prevents "deleted 200 emails" surprises
|
|
852
|
+
- User can spot false positives in sample
|
|
853
|
+
- "list all" escape hatch for cautious users
|
|
854
|
+
- Age column helps identify stale vs. recent
|
|
855
|
+
|
|
856
|
+
---
|
|
857
|
+
|
|
729
858
|
## Interaction Model
|
|
730
859
|
|
|
731
860
|
> [!IMPORTANT]
|
|
@@ -751,7 +880,7 @@ I've classified your emails. Here's the breakdown:
|
|
|
751
880
|
- 8 LinkedIn alerts (deleted)
|
|
752
881
|
- 27 remaining
|
|
753
882
|
|
|
754
|
-
Done! To undo deletions:
|
|
883
|
+
Done! To undo deletions: inboxd restore --last 8
|
|
755
884
|
```
|
|
756
885
|
|
|
757
886
|
**Good (plan-first approach):**
|
|
@@ -819,7 +948,7 @@ If the user encounters a bug, friction point, or suggests a feature:
|
|
|
819
948
|
| Listing 50 emails individually | Overwhelming, wastes time | Summarize by category for large batches |
|
|
820
949
|
| Suggesting deletion of "Re:" emails | Often important replies | Classify as Action Required |
|
|
821
950
|
| Batching >20 emails without summary | Hard to verify what's being deleted | Show category breakdown |
|
|
822
|
-
| Skipping pre-flight check | Tool may not be installed | Always run `
|
|
951
|
+
| Skipping pre-flight check | Tool may not be installed | Always run `inboxd --version` first |
|
|
823
952
|
| Forgetting `--account` flag | Ambiguity errors with multi-account | Always specify account |
|
|
824
953
|
| Being passive after actions | User has to drive every step | Proactively suggest next step |
|
|
825
954
|
| Executing mark-read on batch without confirmation | User loses unread status on important emails | Confirm 3+ emails, always mention undo |
|
|
@@ -845,10 +974,10 @@ If the user encounters a bug, friction point, or suggests a feature:
|
|
|
845
974
|
|
|
846
975
|
| Problem | Solution |
|
|
847
976
|
|---------|----------|
|
|
848
|
-
| `command not found:
|
|
849
|
-
| "No accounts configured" | Run: `
|
|
850
|
-
| Token expired / auth errors | Delete token and re-auth: `rm ~/.config/inboxd/token-<account>.json &&
|
|
851
|
-
| Permission errors on delete | Re-authenticate: `
|
|
977
|
+
| `command not found: inboxd` | Run: `npm install -g inboxd` |
|
|
978
|
+
| "No accounts configured" | Run: `inboxd setup` |
|
|
979
|
+
| Token expired / auth errors | Delete token and re-auth: `rm ~/.config/inboxd/token-<account>.json && inboxd auth -a <account>` |
|
|
980
|
+
| Permission errors on delete | Re-authenticate: `inboxd logout -a <account> && inboxd auth -a <account>` |
|
|
852
981
|
|
|
853
982
|
---
|
|
854
983
|
|
package/CLAUDE.md
CHANGED
|
@@ -7,11 +7,11 @@ CLI tool for Gmail monitoring with multi-account support and macOS notifications
|
|
|
7
7
|
```bash
|
|
8
8
|
npm test # Run tests
|
|
9
9
|
npm run test:watch # Watch mode
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
inboxd setup # First-time setup wizard
|
|
11
|
+
inboxd auth -a <name> # Add account
|
|
12
|
+
inboxd summary # Check all inboxes
|
|
13
|
+
inboxd check -q # Background check
|
|
14
|
+
inboxd install-service # Install background service (macOS/Linux)
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
## Architecture
|
|
@@ -68,13 +68,13 @@ All user data lives in `~/.config/inboxd/`:
|
|
|
68
68
|
|
|
69
69
|
## Key Behaviors
|
|
70
70
|
|
|
71
|
-
- `
|
|
72
|
-
- `
|
|
73
|
-
- `
|
|
74
|
-
- `
|
|
75
|
-
- `
|
|
76
|
-
- `
|
|
77
|
-
- `
|
|
71
|
+
- `inboxd setup` guides first-time users through credentials and auth
|
|
72
|
+
- `inboxd check` marks emails as seen after notifying
|
|
73
|
+
- `inboxd delete` logs to `deletion-log.json` before trashing
|
|
74
|
+
- `inboxd restore` moves from Trash to Inbox, removes log entry
|
|
75
|
+
- `inboxd archive` logs to `archive-log.json` before archiving
|
|
76
|
+
- `inboxd unarchive` moves archived emails back to Inbox, removes log entry
|
|
77
|
+
- `inboxd send/reply` prompts for interactive confirmation (or use `--confirm` to skip)
|
|
78
78
|
- `install-service` creates and enables launchd (macOS) or systemd (Linux) service
|
|
79
79
|
|
|
80
80
|
## OAuth Notes
|
|
@@ -121,11 +121,11 @@ Traditional CLIs are for humans. Agent-ready CLIs add:
|
|
|
121
121
|
The skill can be installed globally for all Claude Code sessions:
|
|
122
122
|
|
|
123
123
|
```bash
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
inboxd install-skill # Install to ~/.claude/skills/
|
|
125
|
+
inboxd install-skill --uninstall # Remove
|
|
126
126
|
```
|
|
127
127
|
|
|
128
|
-
The `
|
|
128
|
+
The `inboxd setup` wizard also offers to install the skill automatically.
|
|
129
129
|
|
|
130
130
|
### Skill Location & Update Detection
|
|
131
131
|
|
|
@@ -136,7 +136,7 @@ The `inbox setup` wizard also offers to install the skill automatically.
|
|
|
136
136
|
|
|
137
137
|
The skill uses content-hash detection (no version field). Updates are detected automatically:
|
|
138
138
|
- On `npm install`: Auto-updates if skill already installed
|
|
139
|
-
- Manual: Run `
|
|
139
|
+
- Manual: Run `inboxd install-skill` to update
|
|
140
140
|
|
|
141
141
|
Safety features:
|
|
142
142
|
- `source: inboxd` marker identifies ownership (won't overwrite user's own skills)
|
|
@@ -159,31 +159,33 @@ scripts/postinstall.js # npm postinstall hint about install-skill
|
|
|
159
159
|
### Key Commands for AI Use
|
|
160
160
|
| Command | Purpose |
|
|
161
161
|
|---------|---------|
|
|
162
|
-
| `
|
|
163
|
-
| `
|
|
164
|
-
| `
|
|
165
|
-
| `
|
|
166
|
-
| `
|
|
167
|
-
| `
|
|
168
|
-
| `
|
|
169
|
-
| `
|
|
170
|
-
| `
|
|
171
|
-
| `
|
|
172
|
-
| `
|
|
173
|
-
| `
|
|
174
|
-
| `
|
|
175
|
-
| `
|
|
176
|
-
| `
|
|
177
|
-
| `
|
|
178
|
-
| `
|
|
179
|
-
| `
|
|
180
|
-
| `
|
|
181
|
-
| `
|
|
182
|
-
| `
|
|
183
|
-
| `
|
|
184
|
-
| `
|
|
185
|
-
| `
|
|
186
|
-
| `
|
|
162
|
+
| `inboxd summary --json` | Quick status check (unread counts) |
|
|
163
|
+
| `inboxd analyze --count 50` | Get email data as JSON for classification |
|
|
164
|
+
| `inboxd analyze --group-by sender` | Group emails by sender domain |
|
|
165
|
+
| `inboxd analyze --older-than 30d` | Find emails older than 30 days (server-side filtering) |
|
|
166
|
+
| `inboxd delete --ids "id1,id2" --confirm` | Delete specific emails by ID |
|
|
167
|
+
| `inboxd delete --sender "pattern" --dry-run` | Preview deletion by sender filter |
|
|
168
|
+
| `inboxd delete --match "pattern" --dry-run` | Preview deletion by subject filter |
|
|
169
|
+
| `inboxd restore --last N` | Undo last N deletions |
|
|
170
|
+
| `inboxd read --id <id>` | Read full email content |
|
|
171
|
+
| `inboxd read --id <id> --links` | Extract links from email |
|
|
172
|
+
| `inboxd search -q <query>` | Search using Gmail query syntax (default 100 results) |
|
|
173
|
+
| `inboxd search -q <query> --count` | Quick count without fetching details |
|
|
174
|
+
| `inboxd search -q <query> --all --max 200` | Fetch all matches with pagination |
|
|
175
|
+
| `inboxd send -t <to> -s <subj> -b <body> --confirm` | Send email (requires --confirm) |
|
|
176
|
+
| `inboxd reply --id <id> -b <body> --confirm` | Reply to email (requires --confirm) |
|
|
177
|
+
| `inboxd mark-read --ids "id1,id2"` | Mark emails as read |
|
|
178
|
+
| `inboxd mark-unread --ids "id1,id2"` | Mark emails as unread (undo mark-read) |
|
|
179
|
+
| `inboxd archive --ids "id1,id2" --confirm` | Archive emails (remove from inbox) |
|
|
180
|
+
| `inboxd unarchive --last N` | Undo last N archives |
|
|
181
|
+
| `inboxd stats` | Show email activity dashboard (deletions, sent) |
|
|
182
|
+
| `inboxd stats --json` | Get stats as JSON |
|
|
183
|
+
| `inboxd cleanup-suggest` | Get smart cleanup suggestions based on patterns |
|
|
184
|
+
| `inboxd accounts --json` | List accounts as JSON |
|
|
185
|
+
| `inboxd deletion-log --json` | Get deletion log as JSON |
|
|
186
|
+
| `inboxd delete --dry-run --json` | Preview deletion as JSON |
|
|
187
|
+
| `inboxd install-skill` | Install/update the Claude Code skill |
|
|
188
|
+
| `inboxd install-service --uninstall` | Remove background service |
|
|
187
189
|
|
|
188
190
|
### Smart Filtering Options
|
|
189
191
|
| Option | Description |
|