This skill should be used when the user wants to find receipt emails and forward them to Expensify for expense tracking. It searches Gmail for receipts, invoices, and payment confirmations, then forwards them to [email protected]. Trigger phrases include "forward receipts", "expense receipts", "send receipts to expensify", or "process expense emails".
Forward receipt emails from Gmail to Expensify for automatic expense tracking.
mcp__google_workspace__* tools| Setting | Value |
|---|---|
| Expensify Email | [email protected] |
| User Email | Prompt user if not known from context |
| State File | ~/.claude/commands/expense-receipt-forwarder/.state.json |
The skill tracks its last successful run to avoid processing duplicate receipts.
State file location: ~/.claude/commands/expense-receipt-forwarder/.state.json
State file format:
{
"last_run": "2026-01-27",
"last_run_account": "[email protected]",
"forwarded_message_ids": ["id1", "id2", ...]
}
At the start of each run, read the state file if it exists:
cat ~/.claude/commands/expense-receipt-forwarder/.state.json
If the file exists and contains a valid last_run date, use that as the default start date instead of "last 7 days".
If the file doesn't exist or is invalid, fall back to last 7 days.
After a successful run (user confirmed and receipts were forwarded), update the state file:
last_run to today's datelast_run_account to the Gmail account usedforwarded_message_ids array (keep last 500 to prevent unbounded growth)Example prompt:
"Last run was on Jan 20, 2026. Search for receipts since then in [email protected]? (Or specify a different date range)"
Use mcp__google_workspace__search_gmail_messages to find potential receipts.
Important: Gmail's after: operator is exclusive (does not include the specified date). To include the last_run date in results, subtract one day from the date when building the query. For example, if last_run is "2026-01-30", use after:2026/01/29.
Execute these searches in sequence, collecting unique message IDs:
Search queries to run (use day before last_run for YYYY/MM/DD):
1. "subject:(receipt OR invoice OR confirmation OR payment) after:YYYY/MM/DD"
2. "from:(receipt OR billing OR invoice OR noreply OR no-reply) subject:(order OR payment OR purchase) after:YYYY/MM/DD"
3. "subject:(payment confirmed OR order confirmed OR purchase confirmed OR payment received OR payment success) after:YYYY/MM/DD"
De-duplication: Skip any message IDs that appear in forwarded_message_ids from the state file.
Use mcp__google_workspace__get_gmail_messages_content_batch to retrieve email details.
Important: When fetching messages, note any attachments returned in the response. Each message may include an attachments array with:
attachment_id: The ID needed to download the attachmentfilename: The attachment filenamemime_type: The file type (e.g., "application/pdf", "image/png")size: File size in bytesFor each email, determine if it's a legitimate personal expense receipt by checking for:
CRITICAL EXCLUSIONS - Always skip these:
Company Payment Notifications (payments TO vendors, not receipts FROM vendors):
Detection: Receipt FROM vendor vs Payment TO vendor:
Other exclusions:
FIRST: Apply exclusion filters from Step 3. Skip any emails matching exclusion criteria.
Then classify remaining emails by certainty level:
High certainty (auto-forward without asking):
Low certainty (ask user first):
Auto-skip (don't even ask):
Critical: Receipts often have PDF or image attachments that contain the actual receipt. These MUST be included when forwarding.
Use mcp__google_workspace__forward_gmail_message to forward receipts. This tool automatically preserves all attachments (PDFs, images, etc.) from the original email.
High-certainty receipts: Forward automatically and display a summary table as you forward:
| Date | From | Subject | Amount | Attachments | Status |
|------|------|---------|--------|-------------|--------|
| ... | ... | ... | ... | 1 PDF | ✓ Forwarded |
Low-certainty receipts: Present to user for confirmation before forwarding:
| Date | From | Subject | Amount (if found) | Attachments | Forward? |
|------|------|---------|-------------------|-------------|----------|
| ... | ... | ... | ... | 2 files | ? |
For each receipt to forward, use:
mcp__google_workspace__forward_gmail_message(
user_google_email: "[email protected]",
message_id: "[message_id_from_search]",
to: "[email protected]"
)
Benefits of forward_gmail_message:
After successfully forwarding receipts, mark them as read to keep the inbox clean.
Use mcp__google_workspace__batch_modify_gmail_message_labels to remove the "UNREAD" label from all successfully forwarded messages:
Parameters:
- user_google_email: The Gmail account email
- message_ids: List of message IDs that were successfully forwarded
- remove_label_ids: ["UNREAD"]
This batch operation marks all forwarded receipts as read in a single API call, improving efficiency.
After successful forwarding and marking as read (Step 5b):
## Receipt Forwarding Complete
**Forwarded**: X emails (Y with attachments)
**Marked as read**: X emails
**Skipped**: Y emails (not receipts or user declined)
**State updated**: Next run will search from [today's date]
### Forwarded Receipts:
1. [Date] - [Merchant] - [Amount] - [X attachments]
2. ...
### Skipped:
1. [Reason] - [Subject]
These senders commonly send legitimate personal receipts:
forward_gmail_message automatically handles attachment downloading and inclusion