receipt-email

receipt-email is a command for Claude Code from peerjakobsen/smartspender. It costs 19 tokens per session (1,750 once invoked), scanned A, original, MIT.

An email-and-bank matching command that scans Gmail for receipts and invoices, downloads their attachments, extracts the details, and compares them with bank transactions.

In plain words
What is it for?
Use it to scan a chosen period of Gmail, collect receipt and invoice attachments, and match them against transactions in an existing transactions.csv file.
Why use it?
It reduces the manual work of finding purchase records in email and checking whether they match payments in your bank data.

Command for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the smartspender plugin — 13 skills, 19 commands shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/peerjakobsen/smartspender/receipt-email
Clone the repo
git clone --depth 1 https://github.com/peerjakobsen/smartspender

Made for: Claude Code.

Or install smartspender, the plugin that ships this one along with the rest of its 13 skills, 19 commands.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for receipt-email

README.md
[![agentmods](https://agentmods.dev/badge/commands/peerjakobsen/smartspender/receipt-email.svg)](https://agentmods.dev/commands/peerjakobsen/smartspender/receipt-email)
Your own site
<a href="https://agentmods.dev/commands/peerjakobsen/smartspender/receipt-email"><img src="https://agentmods.dev/badge/commands/peerjakobsen/smartspender/receipt-email.svg" alt="Measured on agentmods" height="20"></a>
Per session 19 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,750 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00019 $0.01750
Opus 5 $0.00010 $0.00875
Sonnet 5 $0.00004 $0.00350
Haiku 4.5 $0.00002 $0.00175

Measured 6d ago against content hash 85a092ca97d2, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

receipt-email scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/receipt-email.md · 131 lines

How it starts

The opening of the file, as written. The whole thing — 131 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/smartspender:receipt email

Trigger

  • /smartspender:receipt email
  • /smartspender:receipt email 30 (scan last 30 days)
  • "Scan mine emails for kvitteringer"
  • "Hent fakturaer fra email"

Arguments

Argument Required Values Default
action yes email -
days no positive integer last_email_scan or 90

Prerequisites

  • Gmail MCP server configured and accessible
  • At least one bank sync completed (transactions.csv exists) for matching to work

Workflow

  1. Check Gmail MCP availability. If not available, respond: "Gmail MCP er ikke konfigureret. Tilfoej Gmail MCP-serveren til dit Cowork-miljoe for at kunne scanne emails."
  2. Determine scan date range:
    • If days argument provided: scan from (today - days) to today
    • If last_email_scan exists in settings.csv: scan from that timestamp to today
    • Otherwise: scan last 90 days
  3. Load email scanning rules: skills/email-receipt-scanning/SKILL.md
  4. Search Gmail using the primary search query with the calculated date range
  5. If primary query returns fewer than 3 results, also run supplementary queries
  6. Filter results using the include/exclude heuristics from email-receipt-scanning skill
  7. If no emails found, respond: "Ingen kvitterings- eller fakturaemails fundet i den valgte periode."
  8. Present found emails to user:
    Jeg fandt {n} emails med kvitteringer eller fakturaer:
    
    1. {date} — {sender} — "{subject}" {attachment_info}
    2. {date} — {sender} — "{subject}" {attachment_info}
    3. {date} — {sender} — "{subject}" {attachment_info}
    ...
    
    Vil du importere alle, vaelge enkelte, eller annullere? (alle/vaelg/annuller)
    
  9. [USER ACTION]: User chooses "alle", "vaelg" (then picks numbers), or "annuller"
  10. If user cancels, respond: "Email-scanning annulleret." and stop.
  11. Load document-parsing skill: skills/document-parsing/SKILL.md
  12. Load extraction and vendor detection rules from skills/document-parsing/SKILL.md
  13. Load schema: skills/data-schemas/SKILL.md
  14. Load matching rules: skills/transaction-matching/SKILL.md
  15. For each selected email, process in sequence: a. Detect content type (PDF attachment, inline HTML, or both — prefer PDF) b. If PDF: download attachment c. Detect vendor from email sender domain (per email-receipt-scanning skill sender mapping) or fall through to invoice-parsing skill vendor detection d. Check for vendor-specific parser: invoice-knowledge/{vendor-id}/PARSER.md e. Extract receipt metadata and line items using vendor parser or general rules f. Search transactions.csv for matching transactions (amount +-1%, date +-1 day) g. Score candidates per transaction-matching confidence rules h. If exactly 1 match with confidence >= 0.8: auto-link i. If ambiguous: mark as ambiguous (batch mode — don't interrupt for each email) j. Check for duplicate in receipts.csv (date + merchant + total_amount) k. If duplicate: skip this email and note as "allerede registreret" l. Generate receipt_id and item_ids m. If PDF: save to receipts/{receipt_id}.pdf, set file_reference to this path n. If inline HTML only: set file_reference to email:{message_id} o. Set source: email on the receipt row p. Append receipt row to receipts.csv q. Determine the monthly file from the receipt date: receipt-items-{YYYY-MM}.csv r. If the monthly file does not exist, create it with the header row s. Append item rows to receipt-items-{YYYY-MM}.csv t. Log to action-log.csv
  16. Update last_email_scan in settings.csv to current datetime. If settings.csv does not exist, create it with key,value header and the last_email_scan row.
  17. Output batch summary

Read the full file on GitHub · 131 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 131 lines · 19 tokens per session scan A 85a092ca97d2

Subscribe to this mod's changes

receipt-email is a command published in the GitHub repository peerjakobsen/smartspender (5 stars, last pushed 7mo ago), licensed MIT. It adds 19 tokens to every session and 1,750 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.