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