inbox-triage: harden prompt with pagination, explicit commands, and tighter classification
This commit is contained in:
@@ -26,29 +26,32 @@ Workflow:
|
||||
- Do not create new workflows that route mail to `Archive`.
|
||||
- Existing messages already in `Archive` may remain there unchanged.
|
||||
4. Determine source folder:
|
||||
- If `$ARGUMENTS` contains a folder name, use that as source.
|
||||
- If `$ARGUMENTS` is a single known folder name (matches a folder from step 1), use that as source.
|
||||
- Otherwise use `INBOX`.
|
||||
5. Build a run scope safely:
|
||||
- List with fixed page size `20`: `himalaya envelope list -f "<source>" -p 1 -s 20`.
|
||||
- Enumerate IDs in returned order.
|
||||
- List with fixed page size `20` and JSON output: `himalaya envelope list -f "<source>" -p 1 -s 20 --output json`.
|
||||
- Start at page `1`. Enumerate IDs in returned order.
|
||||
- Process each ID fully before touching the next ID.
|
||||
- After each single-ID action, relist page `1` with `-s 20` and continue with the next unprocessed ID.
|
||||
- After each single-ID action that moves or deletes a message, relist the current page with `-s 20 --output json` and continue with the next unprocessed ID.
|
||||
- Keep an in-memory reviewed set for this run to avoid reprocessing IDs already handled or intentionally left untouched.
|
||||
- Stop when a fresh page-1 listing contains no unprocessed IDs.
|
||||
- When all IDs on the current page are in the reviewed set, advance to the next page.
|
||||
- Stop when a page returns fewer results than the page size (end of folder) and all its IDs are in the reviewed set.
|
||||
6. For each single envelope ID, do all checks before any move/delete:
|
||||
- Read the message: `himalaya message read -f "<source>" <id>`.
|
||||
- If needed for classification, inspect attachments with `himalaya attachment download -f "<source>" <id>`.
|
||||
- If attachments are downloaded, inspect them and remove temporary local files after use.
|
||||
- If needed for classification, inspect attachments: `himalaya attachment download -f "<source>" <id> --dir /tmp/himalaya-triage`.
|
||||
- If attachments are downloaded, inspect them and `rm` the downloaded files from `/tmp/himalaya-triage` after use.
|
||||
- Move: `himalaya message move -f "<source>" <id> "<destination>"`.
|
||||
- Delete: `himalaya message delete -f "<source>" <id>`.
|
||||
7. Classification precedence (higher rule wins on conflict):
|
||||
- Human communication from an actual person: do not delete, do not move, leave untouched.
|
||||
- Human communication — a message with freeform natural-language content written by a human, not templated or autogenerated. When in doubt whether a message is human or automated, leave it untouched.
|
||||
- Clearly ephemeral automated/system message (alerts, bot/status updates, OTP/2FA, password reset codes, login codes) with no archival value: move to `Deleted Messages`.
|
||||
- Payment transaction correspondence (actual charge/payment confirmations, receipts, failed-payment notices, provider payment events such as Klarna/PayPal/Stripe): move to `Payments`.
|
||||
- Subscription renewal notifications (auto-renew reminders, "will renew soon", price-change notices without a concrete transaction) are operational alerts, not payment records: move to `Deleted Messages`.
|
||||
- "Kontoauszug verfügbar/ist online" notifications are availability alerts, not payment records: move to `Deleted Messages`.
|
||||
- Orders/invoices/business records: move to `Orders and Invoices`.
|
||||
- Shipping-only notifications: do not move to `Orders and Invoices` unless there is actual invoice/receipt/order-document value.
|
||||
- Shipping/tracking notifications (dispatch confirmations, carrier updates, delivery ETAs) without invoice or order-document value: move to `Deleted Messages`.
|
||||
- Marketing/newsletters: move to `Newsletters and Marketing`.
|
||||
- Delivery/submission confirmations: move to `Outgoing Shipments` when appropriate.
|
||||
- Delivery/submission confirmations for items you shipped outbound: move to `Outgoing Shipments`.
|
||||
- Long-term but uncategorized messages: create a concise new folder and move there.
|
||||
8. Folder creation rule:
|
||||
- Create a new folder only if no existing folder fits and the message should be kept.
|
||||
|
||||
Reference in New Issue
Block a user