From c1950b731ac046b3793f6faa98b9e2b429c984fb Mon Sep 17 00:00:00 2001 From: Bill Ballou Date: Wed, 15 Apr 2026 08:16:11 -0400 Subject: [PATCH] Add invoice PDF download guidance to attachment workflow Prefer downloading PDFs from URLs in email body (Stripe links, etc.) over extracting base64 attachments from Fastmail, which can truncate on large results exceeding the token save limit. --- SKILL.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/SKILL.md b/SKILL.md index 8a29816..679c9b9 100644 --- a/SKILL.md +++ b/SKILL.md @@ -153,6 +153,20 @@ After entering bills: ## Uploading Attachments +### Downloading Invoice PDFs from Email + +When emails contain PDF attachments, the Fastmail `include_attachments: true` parameter can cause the result to exceed the token save limit (~25K tokens), truncating the base64 data and making extraction impossible. + +**Preferred approach — download from URL first:** +Many vendor emails (Stripe/Anthropic, Hetzner, etc.) include direct PDF download links in the email body. Extract the URL from `textBody` and download with `curl -sL -o ""`. This is faster and more reliable than attachment extraction. + +**Fallback — extract from attachment:** +Only use `include_attachments: true` if no download URL is available. If the saved result file is truncated (check with `tail -c 200`), the attachment cannot be recovered from that fetch — do not retry parsing. + +**File naming convention:** `{Vendor}_{YYYY-MM-DD}_{InvoiceNumber}.pdf` saved to `invoices/`. + +### Upload to Grist + ```bash # Get session token, then: bash scripts/upload-attachment.sh invoice.pdf Bills {id} $TOKEN Invoice