inboxd 1.0.5 → 1.0.7

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.
@@ -0,0 +1,300 @@
1
+ ---
2
+ name: inbox-assistant
3
+ description: Manage Gmail inbox with AI-powered triage, cleanup, and restore. Use when the user mentions inbox, email triage, clean inbox, email cleanup, check email, email summary, delete emails, manage inbox, or wants to organize their email.
4
+ ---
5
+
6
+ # Inbox Assistant
7
+
8
+ **Why?** Email overload is real—most inboxes are cluttered with newsletters, promotions, and notifications that bury important messages. This skill applies expert classification to surface what matters and safely clean the rest.
9
+
10
+ Comprehensive Gmail inbox management using the `inboxd` CLI tool. Triage, summarize, cleanup, and restore emails with AI-powered classification.
11
+
12
+ ## Quick Start
13
+
14
+ | Task | Command |
15
+ |------|---------|
16
+ | Check status | `inbox summary --json` |
17
+ | Full triage | `inbox analyze --count 50` → classify → present |
18
+ | Delete emails | `inbox delete --ids "id1,id2" --confirm` |
19
+ | Undo deletion | `inbox restore --last N` |
20
+
21
+ ## Package Information
22
+
23
+ | | |
24
+ |---|---|
25
+ | **Package** | `inboxd` |
26
+ | **Install** | `npm install -g inboxd` |
27
+ | **Setup** | `inbox setup` (interactive wizard) |
28
+ | **Documentation** | https://github.com/dparedesi/inboxd |
29
+ | **npm** | https://www.npmjs.com/package/inboxd |
30
+
31
+ ## Pre-flight Check
32
+
33
+ Before any inbox operation, always verify the setup:
34
+
35
+ ```bash
36
+ # 1. Check if inboxd is installed
37
+ inbox --version
38
+
39
+ # 2. Check if accounts are configured
40
+ inbox accounts
41
+ ```
42
+
43
+ ### If Not Installed
44
+
45
+ > [!TIP]
46
+ > Guide the user through installation—it takes about 5 minutes.
47
+
48
+ ```
49
+ inboxd is not installed. To install:
50
+
51
+ 1. Run: npm install -g inboxd
52
+ 2. Run: inbox setup
53
+ 3. Follow the wizard to configure your Gmail account
54
+
55
+ The setup requires creating OAuth credentials in Google Cloud Console.
56
+ ```
57
+
58
+ ### If No Accounts Configured
59
+ ```
60
+ No Gmail accounts configured. Run: inbox setup
61
+
62
+ This will guide you through:
63
+ 1. Creating OAuth credentials in Google Cloud Console
64
+ 2. Authenticating your Gmail account
65
+ ```
66
+
67
+ ### Optional: Automatic Background Monitoring
68
+
69
+ Users can enable automatic inbox checking with macOS notifications:
70
+
71
+ ```bash
72
+ inbox install-service # Check every 5 minutes
73
+ inbox install-service --interval 10 # Check every 10 minutes
74
+ ```
75
+
76
+ This installs and starts a background service that:
77
+ - Checks for new emails automatically
78
+ - Sends macOS notifications when new emails arrive
79
+ - Starts on login
80
+
81
+ To stop: `launchctl unload ~/Library/LaunchAgents/com.danielparedes.inboxd.plist`
82
+
83
+ > [!NOTE]
84
+ > This is macOS-only. Linux users can set up a cron job instead.
85
+
86
+ ## Command Reference
87
+
88
+ ### Status & Reading
89
+
90
+ | Command | Description | Output |
91
+ |---------|-------------|--------|
92
+ | `inbox summary --json` | Quick inbox overview | `{accounts: [{name, email, unreadCount}], totalUnread}` |
93
+ | `inbox analyze --count 50` | Get email data for analysis | JSON array of email objects |
94
+ | `inbox analyze --count 50 --all` | Include read emails | JSON array (read + unread) |
95
+ | `inbox accounts` | List configured accounts | Account names and emails |
96
+
97
+ ### Actions
98
+
99
+ | Command | Description |
100
+ |---------|-------------|
101
+ | `inbox delete --ids "id1,id2,id3" --confirm` | Move emails to trash |
102
+ | `inbox restore --last N` | Restore last N deleted emails |
103
+ | `inbox restore --ids "id1,id2"` | Restore specific emails |
104
+ | `inbox deletion-log` | View recent deletions |
105
+
106
+ ### Email Object Shape
107
+ ```json
108
+ {
109
+ "id": "18e9abc123",
110
+ "threadId": "18e9abc123",
111
+ "from": "Sender Name <sender@example.com>",
112
+ "subject": "Email Subject Line",
113
+ "snippet": "Preview of the email content...",
114
+ "date": "Fri, 03 Jan 2026 10:30:00 -0800",
115
+ "account": "personal",
116
+ "labelIds": ["UNREAD", "INBOX", "CATEGORY_PROMOTIONS"]
117
+ }
118
+ ```
119
+
120
+ ## Workflow
121
+
122
+ ### 1. Check Inbox Status
123
+ ```bash
124
+ inbox summary --json
125
+ ```
126
+ Report the total unread count and per-account breakdown.
127
+
128
+ ### 2. Fetch Emails for Analysis
129
+ ```bash
130
+ inbox analyze --count 50
131
+ ```
132
+ Parse the JSON output and classify each email.
133
+
134
+ ### 3. Classify Emails
135
+
136
+ Categorize each email into one of these categories:
137
+
138
+ #### Important
139
+ - From known contacts or domains the user has corresponded with
140
+ - Contains urgent keywords: "urgent", "asap", "action required", "deadline"
141
+ - Direct replies to user's emails (Re: in subject)
142
+ - From the user's organization domain
143
+
144
+ #### Newsletters
145
+ - From contains: newsletter, digest, weekly, noreply, news@
146
+ - Subject contains: issue #, edition, roundup, weekly, digest
147
+ - Has CATEGORY_PROMOTIONS or CATEGORY_UPDATES label
148
+
149
+ #### Promotions
150
+ - From contains: marketing, promo, sales, deals, offers, shop
151
+ - Subject contains: % off, sale, discount, limited time, exclusive, deal, save
152
+ - Has CATEGORY_PROMOTIONS label
153
+
154
+ #### Notifications
155
+ - From contains: notify, alert, noreply, automated, no-reply
156
+ - Subject contains: notification, alert, update, reminder, receipt, confirmation
157
+ - Snippet is short (<50 chars) and appears templated (generic text like "You have a new notification" or "Your order has shipped")
158
+ - Has CATEGORY_UPDATES label
159
+
160
+ #### Low-Priority / Spam-like
161
+ - Repeated sender (>3 emails from same sender in batch)
162
+ - Generic/clickbait subjects
163
+ - No personalization in snippet
164
+ - Unknown sender with promotional tone
165
+
166
+ ### 4. Present Summary
167
+
168
+ Show the user a categorized breakdown:
169
+ ```
170
+ ## Inbox Analysis
171
+
172
+ **Total Unread:** 47 emails across 2 accounts
173
+
174
+ ### By Category:
175
+ - Important: 5 emails
176
+ - Newsletters: 12 emails
177
+ - Promotions: 18 emails
178
+ - Notifications: 8 emails
179
+ - Low-Priority: 4 emails
180
+
181
+ ### Recommended for Cleanup:
182
+ I found 22 emails that could be deleted:
183
+ - 12 newsletters (older than 3 days)
184
+ - 8 promotional emails
185
+ - 2 duplicate notifications
186
+
187
+ Would you like me to show the list before deleting?
188
+ ```
189
+
190
+ ### 5. Show Deletion Candidates
191
+
192
+ > [!CAUTION]
193
+ > Always show the full list before any deletion. Never skip this step.
194
+
195
+ ```
196
+ ## Emails Recommended for Deletion
197
+
198
+ ### Newsletters (12)
199
+ 1. "TechCrunch Daily" - Issue #423: AI News...
200
+ 2. "Morning Brew" - Your Daily Digest...
201
+ ...
202
+
203
+ ### Promotions (8)
204
+ 1. "Amazon" - 50% off electronics...
205
+ 2. "Best Buy" - Limited time deals...
206
+ ...
207
+
208
+ Delete these 20 emails? (y/n)
209
+ ```
210
+
211
+ ### 6. Execute Deletion
212
+
213
+ Only after explicit user confirmation:
214
+ ```bash
215
+ inbox delete --ids "id1,id2,id3,..." --confirm
216
+ ```
217
+
218
+ ### 7. Confirm & Remind About Undo
219
+
220
+ After deletion:
221
+ ```
222
+ Deleted 20 emails successfully.
223
+
224
+ To undo, run: inbox restore --last 20
225
+ Deletion log: inbox deletion-log
226
+ ```
227
+
228
+ ## Safety Rules
229
+
230
+ > [!CAUTION]
231
+ > These rules are non-negotiable. Violating them risks deleting important emails.
232
+
233
+ 1. **NEVER auto-delete** - Always show what will be deleted and wait for explicit confirmation
234
+ 2. **NEVER delete "Important" emails** - Do not even suggest deleting emails classified as Important
235
+ 3. **Show sender + subject** - User must see exactly what will be deleted
236
+ 4. **Batch limit: 20** - For large cleanups, suggest multiple passes
237
+ 5. **Always remind about undo** - After every deletion, mention `inbox restore --last N`
238
+ 6. **Preserve by default** - When in doubt about classification, keep the email
239
+
240
+ ## Common Mistakes to Avoid
241
+
242
+ | Mistake | Why It's Wrong | Correct Approach |
243
+ |---------|----------------|------------------|
244
+ | Deleting without showing the list first | User can't verify what's being deleted | Always show full list, wait for "yes" |
245
+ | Suggesting deletion of "Re:" emails | These are often important replies | Classify as Important, never suggest deletion |
246
+ | Batching >20 emails at once | Harder to undo, overwhelming to review | Suggest multiple passes |
247
+ | Skipping pre-flight check | Tool may not be installed | Always run `inbox --version` first |
248
+ | Forgetting the `--confirm` flag | Command will hang waiting for input | Always include `--confirm` for non-interactive |
249
+
250
+ ## Example Interactions
251
+
252
+ ### "Clean up my inbox"
253
+ 1. Run `inbox summary --json` to check status
254
+ 2. Run `inbox analyze --count 50` to get emails
255
+ 3. Classify and present summary
256
+ 4. Show deletion candidates (excluding Important)
257
+ 5. Wait for explicit confirmation
258
+ 6. Execute and remind about undo
259
+
260
+ ### "What's in my inbox?"
261
+ 1. Run `inbox summary --json`
262
+ 2. Report counts per account
263
+ 3. Offer full triage if count is high
264
+
265
+ ### "Undo last deletion"
266
+ 1. Run `inbox restore --last 1`
267
+ 2. Confirm restoration
268
+
269
+ ## Multi-Account Support
270
+
271
+ > [!TIP]
272
+ > When user has multiple accounts, always show which account each email belongs to.
273
+
274
+ - Group recommendations by account
275
+ - Allow user to specify account: "clean up my work inbox"
276
+ - Use `--account <name>` flag when needed
277
+
278
+ ## Troubleshooting
279
+
280
+ | Problem | Solution |
281
+ |---------|----------|
282
+ | `command not found: inbox` | Run: `npm install -g inboxd` |
283
+ | "No accounts configured" | Run: `inbox setup` |
284
+ | Token expired / auth errors | Delete token and re-auth: `rm ~/.config/inboxd/token-<account>.json && inbox auth -a <account>` |
285
+ | Permission errors on delete | Re-authenticate: `inbox logout -a <account> && inbox auth -a <account>` |
286
+
287
+ ## Testing
288
+
289
+ ### Evaluation Scenarios
290
+
291
+ | Scenario | Expected Behavior | Failure Indicator |
292
+ |----------|-------------------|-------------------|
293
+ | User says "clean my inbox" | Run summary → analyze → classify → present → wait for confirmation | Auto-deletes without confirmation |
294
+ | inboxd not installed | Detect missing tool, guide installation | Proceeds to run commands that fail |
295
+ | User says "delete all emails" | Show list first, ask for confirmation | Deletes without showing list |
296
+ | User says "undo" | Run `inbox restore --last N` | Fails to restore or wrong count |
297
+
298
+ ### Model Coverage
299
+ - Tested with: Sonnet, Opus
300
+ - Pre-flight check critical for all models to avoid tool errors
package/CLAUDE.md CHANGED
@@ -64,7 +64,7 @@ All user data lives in `~/.config/inboxd/`:
64
64
  - `inbox check` marks emails as seen after notifying
65
65
  - `inbox delete` logs to `deletion-log.json` before trashing
66
66
  - `inbox restore` moves from Trash to Inbox, removes log entry
67
- - `install-service` generates launchd plist dynamically (macOS only, warns on other platforms)
67
+ - `install-service` creates and automatically enables launchd service (macOS only, warns on other platforms)
68
68
 
69
69
  ## OAuth Notes
70
70
 
@@ -80,3 +80,37 @@ All user data lives in `~/.config/inboxd/`:
80
80
  4. The `publish.yml` workflow will automatically test and publish to npm
81
81
  - Note: `src/cli.js` dynamically imports version from `package.json` to ensure consistency
82
82
 
83
+ ## AI Agent Integration
84
+
85
+ This package includes a Claude Code skill for AI-powered inbox management.
86
+
87
+ ### Skill Location
88
+ `.claude/skills/inbox-assistant/SKILL.md`
89
+
90
+ ### What the Skill Provides
91
+ - **Triage**: Classify emails (Important, Newsletters, Promotions, Notifications, Low-Priority)
92
+ - **Cleanup**: Identify and delete low-value emails with user confirmation
93
+ - **Restore**: Undo accidental deletions
94
+ - **Safety**: Never auto-deletes, batch limits, always shows what will be deleted
95
+
96
+ ### Key Commands for AI Use
97
+ | Command | Purpose |
98
+ |---------|---------|
99
+ | `inbox summary --json` | Quick status check (unread counts) |
100
+ | `inbox analyze --count 50` | Get email data as JSON for classification |
101
+ | `inbox delete --ids "id1,id2" --confirm` | Delete with confirmation flag |
102
+ | `inbox restore --last N` | Undo last N deletions |
103
+
104
+ ### Email Object Shape (from `analyze`)
105
+ ```json
106
+ {
107
+ "id": "18e9abc123",
108
+ "from": "Sender <email@example.com>",
109
+ "subject": "Email Subject",
110
+ "snippet": "Preview text...",
111
+ "date": "Fri, 03 Jan 2026 10:30:00 -0800",
112
+ "account": "personal",
113
+ "labelIds": ["UNREAD", "CATEGORY_PROMOTIONS"]
114
+ }
115
+ ```
116
+
package/README.md CHANGED
@@ -102,14 +102,14 @@ All configuration is stored in `~/.config/inboxd/`:
102
102
  Install as a macOS launchd service to check for new emails periodically:
103
103
 
104
104
  ```bash
105
- # Install with default 5-minute interval
105
+ # Install and start with default 5-minute interval
106
106
  inbox install-service
107
107
 
108
108
  # Or customize the interval
109
109
  inbox install-service --interval 10
110
110
  ```
111
111
 
112
- Manage the service:
112
+ The service starts automatically after installation. Manage it with:
113
113
 
114
114
  ```bash
115
115
  # Check status
@@ -141,6 +141,40 @@ Or use the `analyze` command for structured output:
141
141
  inbox analyze --count 20
142
142
  ```
143
143
 
144
+ ## AI Agent Integration
145
+
146
+ This package includes a Claude Code skill for AI-powered inbox management. The skill provides expert-level email triage, cleanup recommendations, and safe deletion workflows.
147
+
148
+ ### Using with Claude Code
149
+
150
+ 1. Copy the skill to your Claude Code skills directory:
151
+ ```bash
152
+ cp -r node_modules/inboxd/.claude/skills/inbox-assistant ~/.claude/skills/
153
+ ```
154
+
155
+ 2. Invoke with `/inbox-assistant` or just ask Claude to manage your inbox.
156
+
157
+ ### What the Skill Does
158
+
159
+ | Capability | Description |
160
+ |------------|-------------|
161
+ | **Triage** | Classifies emails into Important, Newsletters, Promotions, Notifications, Low-Priority |
162
+ | **Cleanup** | Identifies deletable emails and presents them for confirmation |
163
+ | **Restore** | Provides undo capability for accidental deletions |
164
+ | **Safety** | Never auto-deletes, enforces batch limits, always shows before deleting |
165
+
166
+ ### CLI vs MCP
167
+
168
+ Unlike an MCP server that exposes raw Gmail API primitives, `inboxd` provides **opinionated commands** with built-in safety:
169
+
170
+ | inboxd CLI | Raw Gmail MCP |
171
+ |------------|---------------|
172
+ | `inbox delete` logs before trashing | Just trashes |
173
+ | `inbox restore` removes from log | Just untrashes |
174
+ | `inbox analyze` formats for AI consumption | Raw API response |
175
+
176
+ The skill layer adds expert workflow guidance on top of these commands.
177
+
144
178
  ## Uninstalling
145
179
 
146
180
  To remove the package:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inboxd",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "CLI assistant for Gmail monitoring with multi-account support and AI-ready JSON output",
5
5
  "main": "src/cli.js",
6
6
  "bin": {
package/src/cli.js CHANGED
@@ -785,13 +785,35 @@ async function main() {
785
785
  }
786
786
 
787
787
  fs.writeFileSync(plistPath, plistContent);
788
- console.log(chalk.green(`\nService configuration generated at: ${plistPath}`));
789
- console.log(chalk.white('To enable the background service, run:'));
790
- console.log(chalk.cyan(` launchctl unload ${plistPath} 2>/dev/null`));
791
- console.log(chalk.cyan(` launchctl load ${plistPath}`));
792
- console.log('');
788
+
789
+ // Automatically load the service
790
+ const { execSync } = require('child_process');
791
+
792
+ // Unload any existing service (ignore errors if not loaded)
793
+ try {
794
+ execSync(`launchctl unload "${plistPath}" 2>/dev/null`, { stdio: 'ignore' });
795
+ } catch {
796
+ // Ignore - service may not be loaded yet
797
+ }
798
+
799
+ // Load the new service
800
+ execSync(`launchctl load "${plistPath}"`);
801
+
802
+ console.log(chalk.green(`\n✓ Background service installed and running!`));
803
+ console.log(chalk.gray(` Config: ${plistPath}`));
804
+ console.log(chalk.gray(` Interval: every ${interval} minutes`));
805
+ console.log(chalk.gray(` Logs: /tmp/inboxd.log\n`));
806
+ console.log(chalk.white('The service will:'));
807
+ console.log(chalk.gray(' • Check your inbox automatically'));
808
+ console.log(chalk.gray(' • Send notifications for new emails'));
809
+ console.log(chalk.gray(' • Start on login\n'));
810
+ console.log(chalk.white('To stop the service:'));
811
+ console.log(chalk.cyan(` launchctl unload "${plistPath}"\n`));
793
812
  } catch (error) {
794
- console.error(chalk.red('Error creating service file:'), error.message);
813
+ console.error(chalk.red('Error installing service:'), error.message);
814
+ console.log(chalk.yellow('\nThe config file was created but could not be loaded.'));
815
+ console.log(chalk.white('Try running manually:'));
816
+ console.log(chalk.cyan(` launchctl load "${plistPath}"\n`));
795
817
  }
796
818
  });
797
819