@ghostpaw/email 0.3.0 → 0.4.1
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/README.md +72 -0
- package/SKILL.md +89 -241
- package/dist/cli.js +10034 -8076
- package/dist/database-Rfe-wn1C.d.cts +20 -0
- package/dist/database-Rfe-wn1C.d.ts +20 -0
- package/dist/index.cjs +37 -19
- package/dist/index.d.cts +2 -20
- package/dist/index.d.ts +2 -20
- package/dist/index.js +34 -16
- package/dist/mcp-server.js +6415 -0
- package/dist/mcp.cjs +6344 -0
- package/dist/mcp.d.cts +89 -0
- package/dist/mcp.d.ts +89 -0
- package/dist/mcp.js +6314 -0
- package/package.json +43 -11
- package/skills/email/SKILL.md +131 -0
- package/skills/email/references/attachment-workflow.md +25 -0
- package/skills/email/references/cli.md +283 -0
- package/skills/email/references/compose-and-send.md +30 -0
- package/skills/email/references/connect-and-sync.md +29 -0
- package/skills/email/references/organize-bulk.md +33 -0
- package/skills/email/references/read-and-reply.md +29 -0
- package/skills/email/references/recover-from-disruption.md +29 -0
- package/skills/email/references/search-and-act.md +33 -0
- package/skills/email/references/triage-inbox.md +30 -0
package/README.md
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
[](LICENSE)
|
|
6
6
|
[](package.json)
|
|
7
7
|
[](https://www.typescriptlang.org)
|
|
8
|
+
[](https://registry.modelcontextprotocol.io/v0.1/servers/io.github.GhostPawJS%2Femail/versions/latest)
|
|
8
9
|
|
|
9
10
|
A standalone email engine for Node.js, built on SQLite.
|
|
10
11
|
|
|
@@ -16,6 +17,77 @@ code, LLM agents operating through a structured `soul` / `tools` / `skills`
|
|
|
16
17
|
runtime, and agent operators who want a ready-to-use `email` CLI binary
|
|
17
18
|
without writing any wiring code.
|
|
18
19
|
|
|
20
|
+
## MCP server
|
|
21
|
+
|
|
22
|
+
Every client below starts the same stdio server: `npx -y @ghostpaw/email mcp`.
|
|
23
|
+
Cached messages live in `~/.ghostpaw/email.db` unless the `GHOSTPAW_EMAIL_DB`
|
|
24
|
+
environment variable (absolute path) or `--db <path>` says otherwise.
|
|
25
|
+
|
|
26
|
+
**Claude Code**
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
claude mcp add ghostpaw-email -- npx -y @ghostpaw/email mcp
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
or as a plugin, which also installs the skill:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
/plugin marketplace add GhostPawJS/email
|
|
36
|
+
/plugin install ghostpaw-email@ghostpaw-email
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**Email CLI** (`~/.email/config.toml`)
|
|
40
|
+
|
|
41
|
+
```toml
|
|
42
|
+
[mcp_servers.ghostpaw-email]
|
|
43
|
+
command = "npx"
|
|
44
|
+
args = ["-y", "@ghostpaw/email", "mcp"]
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Cursor** (`.cursor/mcp.json`), **Claude Desktop** (`claude_desktop_config.json`)
|
|
48
|
+
or a project `.mcp.json`:
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"mcpServers": {
|
|
53
|
+
"ghostpaw-email": {
|
|
54
|
+
"command": "npx",
|
|
55
|
+
"args": ["-y", "@ghostpaw/email", "mcp"]
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Claude Desktop users can also install `server.mcpb` from the
|
|
62
|
+
[latest GitHub release](https://github.com/GhostPawJS/email/releases/latest).
|
|
63
|
+
A Dockerfile is included for container hosts:
|
|
64
|
+
`docker build -t ghostpaw-email . && docker run -i --rm -v email:/data ghostpaw-email`.
|
|
65
|
+
|
|
66
|
+
The server speaks MCP 2026-07-28 (stateless, `server/discover`) and the
|
|
67
|
+
initialize-based revisions 2025-11-25, 2025-06-18, 2025-03-26 and 2024-11-05.
|
|
68
|
+
|
|
69
|
+
Network operations use the existing CLI account configuration (`email account add`) or
|
|
70
|
+
`EMAIL_IMAP_HOST`, `EMAIL_SMTP_HOST`, `EMAIL_USER` and `EMAIL_PASS` (or
|
|
71
|
+
`EMAIL_ACCESS_TOKEN`). Discovery and cached reads need no account or credentials.
|
|
72
|
+
The surface database defaults to `~/.ghostpaw/email.db`; point `--db` at an
|
|
73
|
+
existing account cache to read it. Each network call opens and closes its IMAP
|
|
74
|
+
session. Connection commands do not retain a session between calls.
|
|
75
|
+
|
|
76
|
+
## Tool CLI
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
npx -y @ghostpaw/email tools
|
|
80
|
+
npx -y @ghostpaw/email call mail_read '{"view":"folders"}' --db :memory:
|
|
81
|
+
npx -y @ghostpaw/email call mail_search '{"query":"invoice"}'
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Both `email` and `ghostpaw-email` run the same CLI. Existing account, read,
|
|
85
|
+
search, compose, organize and sync commands remain available. The full guide
|
|
86
|
+
is preserved in [skills/email/references/cli.md](skills/email/references/cli.md).
|
|
87
|
+
|
|
88
|
+
Agent Skill: `SKILL.md` and `skills/email/` ship in the package; print the skill
|
|
89
|
+
with `npx -y @ghostpaw/email skill`.
|
|
90
|
+
|
|
19
91
|
## Install
|
|
20
92
|
|
|
21
93
|
```bash
|
package/SKILL.md
CHANGED
|
@@ -1,283 +1,131 @@
|
|
|
1
|
-
# SKILL.md — `email` CLI as an Agent Tool Surface
|
|
2
|
-
|
|
3
|
-
The `email` binary is a local-first email CLI built on top of `@ghostpaw/email`. It exposes five
|
|
4
|
-
intent-shaped commands that map directly to the library's tool layer. Agents invoke it as a
|
|
5
|
-
subprocess via bash; no MCP server or standing process is needed.
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Prerequisites
|
|
10
|
-
|
|
11
|
-
- Node.js ≥ 24
|
|
12
|
-
- Install once:
|
|
13
|
-
```bash
|
|
14
|
-
npm install -g @ghostpaw/email # global install, `email` in PATH
|
|
15
|
-
npx @ghostpaw/email account add ... # or zero-install via npx
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
---
|
|
19
|
-
|
|
20
|
-
## Account Setup
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
email account add \
|
|
24
|
-
--name work \
|
|
25
|
-
--imap-host imap.fastmail.com --imap-port 993 \
|
|
26
|
-
--smtp-host smtp.fastmail.com --smtp-port 587 \
|
|
27
|
-
--user me@fastmail.com --pass "app-password"
|
|
28
|
-
|
|
29
|
-
email account list # see all accounts
|
|
30
|
-
email account set-default --name work
|
|
31
|
-
email account show # shows config (password redacted)
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
### Environment variables (no config file needed — useful in CI)
|
|
35
|
-
|
|
36
|
-
| Variable | Purpose |
|
|
37
|
-
|---|---|
|
|
38
|
-
| `EMAIL_ACCOUNT` | Select account by slug |
|
|
39
|
-
| `EMAIL_IMAP_HOST` | IMAP hostname |
|
|
40
|
-
| `EMAIL_IMAP_PORT` | IMAP port (default: 993) |
|
|
41
|
-
| `EMAIL_IMAP_TLS` | `"false"` to disable TLS |
|
|
42
|
-
| `EMAIL_SMTP_HOST` | SMTP hostname |
|
|
43
|
-
| `EMAIL_SMTP_PORT` | SMTP port (default: 587) |
|
|
44
|
-
| `EMAIL_SMTP_TLS` | `"false"` to disable TLS |
|
|
45
|
-
| `EMAIL_USER` | Auth username |
|
|
46
|
-
| `EMAIL_PASS` | Password auth |
|
|
47
|
-
| `EMAIL_ACCESS_TOKEN` | OAuth2 access token |
|
|
48
|
-
| `EMAIL_REFRESH_TOKEN` | OAuth2 refresh token |
|
|
49
|
-
| `EMAIL_CONFIG_DIR` | Override config directory (full path) |
|
|
50
|
-
| `EMAIL_DATA_DIR` | Override SQLite data directory (full path) |
|
|
51
|
-
| `NO_COLOR` | Disable ANSI color output |
|
|
52
|
-
|
|
53
1
|
---
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
```json
|
|
60
|
-
{
|
|
61
|
-
"outcome": "success",
|
|
62
|
-
"summary": "42 message(s) in INBOX.",
|
|
63
|
-
"entities": [
|
|
64
|
-
{ "kind": "message", "id": "1921", "title": "Re: Q2 roadmap" }
|
|
65
|
-
],
|
|
66
|
-
"nextSteps": [
|
|
67
|
-
"Use view: \"message\" with folder and uid to read a specific message."
|
|
68
|
-
]
|
|
69
|
-
}
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
`outcome` values:
|
|
73
|
-
- `"success"` — operation completed
|
|
74
|
-
- `"no_op"` — nothing to do (not an error)
|
|
75
|
-
- `"needs_clarification"` — more information required; check `nextSteps`
|
|
76
|
-
- `"error"` — operation failed; check `summary` for details and `nextSteps` for guidance
|
|
77
|
-
|
|
78
|
-
**On error, `--json` output still goes to stdout** (not stderr) so downstream parsers can always
|
|
79
|
-
parse stdout unconditionally.
|
|
80
|
-
|
|
81
|
-
---
|
|
82
|
-
|
|
83
|
-
## Exit Codes
|
|
84
|
-
|
|
85
|
-
| Code | When |
|
|
86
|
-
|---|---|
|
|
87
|
-
| `0` | `success` or `no_op` |
|
|
88
|
-
| `1` | Missing required flag, invalid value, body required |
|
|
89
|
-
| `2` | No config, malformed config, unknown account, no default account |
|
|
90
|
-
| `3` | Authentication failure |
|
|
91
|
-
| `4` | Network / connection failure |
|
|
92
|
-
| `5` | Tool returned `outcome: "error"` |
|
|
93
|
-
| `6` | Tool returned `outcome: "needs_clarification"` |
|
|
94
|
-
| `127` | Unexpected / unhandled error |
|
|
95
|
-
|
|
2
|
+
name: email
|
|
3
|
+
description: "Read, search, compose, organize and synchronize email with a local SQLite cache. Use when managing email or searching cached messages."
|
|
4
|
+
license: "MIT"
|
|
5
|
+
compatibility: "Node.js 24 or newer. MCP stdio or email CLI."
|
|
96
6
|
---
|
|
97
7
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
### `email read [view]`
|
|
8
|
+
# email
|
|
101
9
|
|
|
102
|
-
Read
|
|
10
|
+
Read and search cached email offline. Configure live accounts with email account add before network operations. Inspect messages before replying or changing folders. Confirm recipients and content before sending; trash and folder deletion can remove mail. Credentials use the existing email CLI account configuration or EMAIL_* environment variables.
|
|
103
11
|
|
|
104
|
-
|
|
105
|
-
email read --json # queue view, INBOX
|
|
106
|
-
email read folders --json # list all folders
|
|
107
|
-
email read queue --folder Sent --limit 20 --json
|
|
108
|
-
email read queue --unread-only --json
|
|
109
|
-
email read thread --thread-id <id> --json
|
|
110
|
-
email read message --folder INBOX --uid 1921 --json
|
|
111
|
-
email read attachment --folder INBOX --uid 1921 --json # list attachments
|
|
112
|
-
email read eml --folder INBOX --uid 1921 # raw EML bytes to stdout
|
|
113
|
-
```
|
|
12
|
+
## Calling tools
|
|
114
13
|
|
|
115
|
-
|
|
116
|
-
under a `"data"` key.
|
|
14
|
+
MCP: connect to ghostpaw-email, then call a tool by name with its JSON arguments.
|
|
117
15
|
|
|
118
|
-
|
|
119
|
-
email read eml --folder INBOX --uid 42 > message.eml
|
|
120
|
-
email read eml --folder INBOX --uid 42 --json | jq -r '.data' | base64 -d > message.eml
|
|
121
|
-
```
|
|
16
|
+
CLI: `ghostpaw-email call <tool> '<JSON object>'` or `ghostpaw-email <tool> --parameter value` (without a global install: `npx -y @ghostpaw/email <tool> ...`).
|
|
122
17
|
|
|
123
|
-
|
|
18
|
+
Inspect schemas with `ghostpaw-email describe <tool>`. Use `--db <path>` to select a database.
|
|
124
19
|
|
|
125
|
-
|
|
20
|
+
## mail_read
|
|
126
21
|
|
|
127
|
-
|
|
128
|
-
email search "invoice" --json
|
|
129
|
-
email search "from:boss@work.com subject:quarterly" --json
|
|
130
|
-
email search "budget 2026" --folder Archive --limit 10 --json
|
|
131
|
-
email search "urgent" --mode remote --json
|
|
132
|
-
email search "report" --since 2026-01-01 --before 2026-04-01 --json
|
|
133
|
-
email search "contract" --has-attachments --json
|
|
134
|
-
```
|
|
22
|
+
Read mailbox state: folder list, message queue, thread view, single message body, attachment metadata, or raw EML export.
|
|
135
23
|
|
|
136
|
-
|
|
24
|
+
Use when: Inspect folders, cached messages, threads, attachments or raw message content.
|
|
137
25
|
|
|
138
|
-
|
|
26
|
+
Not for: Use mail_search to find messages by query or mail_organize to change them.
|
|
139
27
|
|
|
140
|
-
|
|
141
|
-
# Send
|
|
142
|
-
email compose send --to alice@example.com --subject "Hello" --body "Hi there" --json
|
|
143
|
-
echo "Meeting at 3pm?" | email compose send --to alice@example.com --subject "Quick question"
|
|
28
|
+
Writes: writes_state.
|
|
144
29
|
|
|
145
|
-
|
|
146
|
-
|
|
30
|
+
| Parameter | Type | Required | Values / description |
|
|
31
|
+
| --- | --- | --- | --- |
|
|
32
|
+
| view | string | yes | folders, queue, thread, message, attachment, eml. What to read. |
|
|
33
|
+
| folder | string | no | Folder path (required for queue/message/attachment/eml). |
|
|
34
|
+
| uid | integer | no | Message UID (required for message/attachment/eml). |
|
|
35
|
+
| threadId | string | no | Thread ID (required for thread view). |
|
|
36
|
+
| partPath | string | no | Part path for a specific attachment (optional for attachment view). |
|
|
37
|
+
| limit | integer | no | Maximum messages to return (queue view). |
|
|
38
|
+
| unreadOnly | boolean | no | Filter to unread messages only (queue view). |
|
|
39
|
+
| refresh | boolean | no | Fetch live folder list from server before returning (folders/queue view). |
|
|
147
40
|
|
|
148
|
-
|
|
149
|
-
email compose reply --folder INBOX --uid 1921 --body "Thanks all" --reply-all --json
|
|
41
|
+
## mail_search
|
|
150
42
|
|
|
151
|
-
|
|
152
|
-
email compose forward --folder INBOX --uid 1921 --to bob@example.com --body "FYI" --json
|
|
43
|
+
Search for messages locally via FTS or remotely via IMAP SEARCH. Returns matching message references.
|
|
153
44
|
|
|
154
|
-
|
|
155
|
-
email compose send --to a@b.com --subject "Report" --body "See attached" \
|
|
156
|
-
--attach /path/to/report.pdf,/path/to/data.csv --json
|
|
45
|
+
Use when: Find messages by a local full-text query or a remote IMAP search.
|
|
157
46
|
|
|
158
|
-
|
|
159
|
-
email compose draft --save --to a@b.com --subject "Draft" --body "WIP" --json
|
|
160
|
-
email compose draft --send-draft 42 --json
|
|
161
|
-
```
|
|
47
|
+
Not for: Use mail_read when the folder and message UID are already known.
|
|
162
48
|
|
|
163
|
-
|
|
49
|
+
Writes: writes_state.
|
|
164
50
|
|
|
165
|
-
|
|
51
|
+
| Parameter | Type | Required | Values / description |
|
|
52
|
+
| --- | --- | --- | --- |
|
|
53
|
+
| query | string | yes | Free-text search query or FTS5 expression. |
|
|
54
|
+
| folder | string | no | Restrict search to a specific folder. |
|
|
55
|
+
| mode | string | no | local, remote. local (default) or remote IMAP SEARCH. |
|
|
56
|
+
| since | string | no | ISO date string — only messages after this date. |
|
|
57
|
+
| before | string | no | ISO date string — only messages before this date. |
|
|
58
|
+
| hasAttachments | boolean | no | Filter to messages with attachments. |
|
|
59
|
+
| unreadOnly | boolean | no | Filter to unread messages. |
|
|
60
|
+
| limit | integer | no | Maximum number of results. |
|
|
166
61
|
|
|
167
|
-
|
|
168
|
-
email organize mark-read --folder INBOX --uids 1,2,3 --json
|
|
169
|
-
email organize star --folder INBOX --uids 42 --json
|
|
170
|
-
email organize archive --folder INBOX --uids 1921,1922 --json
|
|
171
|
-
email organize trash --folder INBOX --uids 1800 --json
|
|
172
|
-
email organize move --folder INBOX --uids 100 --destination Archive --json
|
|
173
|
-
email organize set-labels --folder INBOX --uids 42 --labels "work,priority" --json
|
|
174
|
-
email organize create-folder --path "Projects/2026" --json
|
|
175
|
-
email organize rename-folder --old-path "Projects" --new-path "Work/Projects" --json
|
|
176
|
-
email organize delete-folder --path "OldFolder" --json
|
|
177
|
-
```
|
|
62
|
+
## mail_compose
|
|
178
63
|
|
|
179
|
-
|
|
64
|
+
Compose and send email: send new message, reply, forward, save/update/send a draft.
|
|
180
65
|
|
|
181
|
-
|
|
66
|
+
Use when: Send, reply, forward, or save and manage a draft after its content is agreed.
|
|
182
67
|
|
|
183
|
-
|
|
184
|
-
email sync --json # sync all folders (default)
|
|
185
|
-
email sync sync --folders INBOX,Sent --json
|
|
186
|
-
email sync sync --bodies all --json # fetch all bodies
|
|
187
|
-
email sync refresh-folders --json
|
|
188
|
-
email sync connect --json
|
|
189
|
-
email sync disconnect --json
|
|
190
|
-
email sync watch --json # syncs then exits; continuous watching needs the library
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
---
|
|
68
|
+
Not for: Use mail_read to inspect an existing message without sending or saving content.
|
|
194
69
|
|
|
195
|
-
|
|
70
|
+
Writes: writes_state.
|
|
196
71
|
|
|
197
|
-
|
|
72
|
+
| Parameter | Type | Required | Values / description |
|
|
73
|
+
| --- | --- | --- | --- |
|
|
74
|
+
| action | string | yes | send, reply, forward, save_draft, update_draft, send_draft. |
|
|
75
|
+
| folder | string | no | Source folder (required for reply/forward). |
|
|
76
|
+
| uid | integer | no | Source message UID (required for reply/forward/update_draft/send_draft). |
|
|
77
|
+
| input | object | no | ComposeInput / ReplyInput / ForwardInput payload. |
|
|
198
78
|
|
|
199
|
-
|
|
200
|
-
# Get unread messages
|
|
201
|
-
UNREAD=$(email read queue --unread-only --json)
|
|
202
|
-
echo "$UNREAD" | jq '.entities[].id'
|
|
79
|
+
## mail_organize
|
|
203
80
|
|
|
204
|
-
|
|
205
|
-
email organize archive --folder INBOX --uids 1,2,3 --json
|
|
206
|
-
```
|
|
81
|
+
Organize messages: mark read/unread/starred/answered, copy, move, archive, trash, junk, label, or manage folders.
|
|
207
82
|
|
|
208
|
-
|
|
83
|
+
Use when: Change message flags, labels, destinations or folder organization.
|
|
209
84
|
|
|
210
|
-
|
|
211
|
-
# Read a specific message
|
|
212
|
-
MSG=$(email read message --folder INBOX --uid 1921 --json)
|
|
213
|
-
echo "$MSG" | jq '.summary'
|
|
85
|
+
Not for: Use mail_read or mail_search when only inspection is requested.
|
|
214
86
|
|
|
215
|
-
|
|
216
|
-
echo "Thanks, will do." | email compose reply --folder INBOX --uid 1921 --json
|
|
217
|
-
```
|
|
87
|
+
Writes: writes_state.
|
|
218
88
|
|
|
219
|
-
|
|
89
|
+
| Parameter | Type | Required | Values / description |
|
|
90
|
+
| --- | --- | --- | --- |
|
|
91
|
+
| action | string | yes | mark_read, mark_unread, star, unstar, mark_answered, copy, move, archive, trash, junk, not_junk, set_labels, add_labels, remove_labels, create_folder, rename_folder, delete_folder, subscribe_folder, unsubscribe_folder. |
|
|
92
|
+
| folder | string | no | Source folder (required for message actions). |
|
|
93
|
+
| uids | array | no | Message UIDs to act on. |
|
|
94
|
+
| destination | string | no | Destination folder (required for copy/move). |
|
|
95
|
+
| labels | array | no | Labels to set/add/remove. |
|
|
96
|
+
| path | string | no | Folder path (required for folder actions). |
|
|
97
|
+
| oldPath | string | no | Old folder path (required for rename_folder). |
|
|
98
|
+
| newPath | string | no | New folder path (required for rename_folder). |
|
|
220
99
|
|
|
221
|
-
|
|
222
|
-
# Find all invoices from last month
|
|
223
|
-
RESULTS=$(email search "invoice" --since 2026-02-01 --before 2026-03-01 --json)
|
|
224
|
-
UIDS=$(echo "$RESULTS" | jq -r '.entities[].id' | tr '\n' ',' | sed 's/,$//')
|
|
100
|
+
## mail_sync
|
|
225
101
|
|
|
226
|
-
|
|
227
|
-
email organize move --folder INBOX --uids "$UIDS" --destination Archive --json
|
|
228
|
-
```
|
|
102
|
+
Manage the IMAP connection lifecycle and sync local state: connect, disconnect, reconnect, sync folders, or refresh the folder list.
|
|
229
103
|
|
|
230
|
-
|
|
104
|
+
Use when: Connect, disconnect, reconnect, refresh folders or synchronize the cache.
|
|
231
105
|
|
|
232
|
-
|
|
233
|
-
email sync --json
|
|
234
|
-
email read queue --limit 20 --json
|
|
235
|
-
```
|
|
106
|
+
Not for: Use mail_read for cached content or the network watch stream for continuous monitoring.
|
|
236
107
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
```bash
|
|
240
|
-
# List attachments
|
|
241
|
-
ATTS=$(email read attachment --folder INBOX --uid 1921 --json)
|
|
242
|
-
PART=$(echo "$ATTS" | jq -r '.entities[0].id')
|
|
243
|
-
|
|
244
|
-
# Download raw bytes
|
|
245
|
-
email read attachment --folder INBOX --uid 1921 --part-path "$PART" > attachment.pdf
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
---
|
|
108
|
+
Writes: writes_state.
|
|
249
109
|
|
|
250
|
-
|
|
110
|
+
| Parameter | Type | Required | Values / description |
|
|
111
|
+
| --- | --- | --- | --- |
|
|
112
|
+
| action | string | yes | connect, disconnect, reconnect, sync, refresh_folders, watch. |
|
|
113
|
+
| folders | array | no | Folders to sync or watch (optional — defaults to all subscribed folders). |
|
|
114
|
+
| bodies | string | no | none, missing, all. Body fetch strategy for sync (default: missing). |
|
|
251
115
|
|
|
252
|
-
|
|
253
|
-
- **Do not retry auth errors** (exit 3) — they require credential changes.
|
|
254
|
-
- **On `needs_clarification`** (exit 6) — read `nextSteps` and ask the user for more information.
|
|
255
|
-
- **On `error`** (exit 5) — the tool's `summary` and `nextSteps` contain actionable guidance.
|
|
256
|
-
- **Network errors** (exit 4) — retry after a brief pause; check host/port if it persists.
|
|
116
|
+
## Workflow guides
|
|
257
117
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
email read eml --folder INBOX --uid 42 | mail -s "fwd" target@example.com
|
|
268
|
-
|
|
269
|
-
# JSON pipeline
|
|
270
|
-
email read queue --json | jq '.entities[] | select(.title | test("invoice"; "i")) | .id'
|
|
271
|
-
|
|
272
|
-
# Quiet mode — only exit code matters
|
|
273
|
-
email organize archive --folder INBOX --uids 42 --quiet && echo "archived"
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
---
|
|
118
|
+
- [triage-inbox](skills/email/references/triage-inbox.md): Process a full inbox from scratch: sync to get latest state, read message queue, selectively fetch bodies for decisions, then bulk-organize by priority.
|
|
119
|
+
- [read-and-reply](skills/email/references/read-and-reply.md): Read a message with full thread context, then compose and send a properly-threaded reply with quoted attribution.
|
|
120
|
+
- [connect-and-sync](skills/email/references/connect-and-sync.md): Establish or restore an IMAP connection, refresh the folder list, and pull new messages — handling first-run vs incremental scenarios.
|
|
121
|
+
- [search-and-act](skills/email/references/search-and-act.md): Find messages matching criteria (local FTS first, remote IMAP SEARCH as fallback), verify targets, then act — organize, reply, or present.
|
|
122
|
+
- [compose-and-send](skills/email/references/compose-and-send.md): Full draft lifecycle — save, review, update, then send — plus direct send, reply, and forward with proper threading and forwarded-header blocks.
|
|
123
|
+
- [organize-bulk](skills/email/references/organize-bulk.md): Bulk organize messages across folders — flagging, moving, archiving, labelling — and manage the folder hierarchy as part of the flow.
|
|
124
|
+
- [attachment-workflow](skills/email/references/attachment-workflow.md): Discover, inspect, and fetch email attachments on demand; embed attachments in outbound messages; and export or import full .eml files.
|
|
125
|
+
- [recover-from-disruption](skills/email/references/recover-from-disruption.md): Detect and recover from connection loss or IMAP/SMTP failures — reconnect with back-off, re-sync to reconcile state, and handle auth vs transient errors distinctly.
|
|
126
|
+
- [cli](skills/email/references/cli.md): Complete existing email CLI guide.
|
|
277
127
|
|
|
278
|
-
##
|
|
128
|
+
## Principles
|
|
279
129
|
|
|
280
|
-
-
|
|
281
|
-
-
|
|
282
|
-
use `Mailbox.network.watch()` from the library directly.
|
|
283
|
-
- **No interactive prompts.** All input comes from flags or stdin.
|
|
130
|
+
- Inspect before changing messages.
|
|
131
|
+
- Confirm recipients and content before sending.
|