receipt-learn

receipt-learn is a command for coding agents from peerjakobsen/smartspender. It costs 12 tokens per session (1,215 once invoked), scanned A, original, MIT.

A command that learns vendor-specific invoice extraction rules from corrections made during receipt processing.

In plain words
What is it for?
It helps update extraction rules for a vendor's PDF invoices, including merchant details, dates, amounts, categories, and line items.
Why use it?
It records verified corrections instead of requiring the same fixes each time that vendor's invoice is processed.

Command

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-learn
Clone the repo
git clone --depth 1 https://github.com/peerjakobsen/smartspender

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-learn

README.md
[![agentmods](https://agentmods.dev/badge/commands/peerjakobsen/smartspender/receipt-learn.svg)](https://agentmods.dev/commands/peerjakobsen/smartspender/receipt-learn)
Your own site
<a href="https://agentmods.dev/commands/peerjakobsen/smartspender/receipt-learn"><img src="https://agentmods.dev/badge/commands/peerjakobsen/smartspender/receipt-learn.svg" alt="Measured on agentmods" height="20"></a>
Per session 12 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,215 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 $0.00012 $0.01215
Opus 5 $0.00006 $0.00607
Sonnet 5 $0.00002 $0.00243
Haiku 4.5 $0.00001 $0.00121

Measured 4d ago against content hash dac97f75d5f3, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

receipt-learn 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 4d 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-learn.md · 119 lines

How it starts

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

/smartspender:receipt learn

Trigger

  • /smartspender:receipt learn
  • "Gem udtraeksregler"
  • "Laer denne faktura"

Arguments

Argument Required Values Default
action yes learn -

Prerequisites

  • A receipt or invoice has been processed in the current conversation
  • User has verified and/or corrected the extraction results
  • The processed receipt was a PDF invoice (not a grocery receipt or card slip)

Workflow

  1. Check if the current conversation contains a receipt/invoice processing session with extraction results. If not, respond: "Jeg kan ikke finde en behandlet faktura i denne samtale. Behandl venligst en faktura med /smartspender:receipt upload foerst."
  2. Identify the vendor from the conversation context:
    • Use the extracted merchant name from the receipt processing
    • Normalize to vendor-id (lowercase, no spaces, no A/S suffix)
  3. Analyze the conversation for corrections the user made:
    • Changed merchant name
    • Changed date or billing period
    • Changed total amount
    • Changed line item names, categories, or subcategories
    • Added missing line items
    • Removed incorrect line items
    • Changed extraction approach (e.g., "the total is on page 2, not page 1")
  4. Summarize the learned rules and present to user for confirmation:
    Jeg har identificeret foelgende regler for {Vendor Name} fakturaer:
    
    Leverandoer: {vendor name} (ID: {vendor-id})
    Fakturetype: {type, e.g., Telecom, Forsyning}
    
    Udtraeksregler:
    - {rule 1, e.g., "Fakturadato findes efter 'Dato:' paa side 1"}
    - {rule 2, e.g., "Total findes efter 'I alt inkl. moms'"}
    - {rule 3, e.g., "Linjer kategoriseres som Abonnementer > Mobilabonnement"}
    
    Rettelser fra denne session:
    - {correction 1, e.g., "'Ekstra data' skal vaere Mobilabonnement, ikke Internet"}
    
    Skal jeg gemme disse regler? (ja/nej)
    
  5. [USER ACTION]: User confirms or provides additional corrections
  6. If user says no: respond "Reglerne blev ikke gemt." and stop.
  7. Check if invoice-knowledge/{vendor-id}/PARSER.md already exists:
    • EXISTS: Update the existing file:
      • Add new entries to the Learned Corrections table with today's date
      • Update extraction rules if the user's corrections change the approach
      • Update Last Updated date
    • DOES NOT EXIST: Create a new parser:
      • Create directory invoice-knowledge/{vendor-id}/
      • Copy structure from invoice-knowledge/_template.md
      • Fill in Vendor Info from conversation context
      • Fill in Extraction Rules from the processed invoice structure
      • Fill in Line Items from the extracted (and corrected) items
      • Add any corrections to the Learned Corrections table
      • Set Last Updated to today
  8. Write the file to invoice-knowledge/{vendor-id}/PARSER.md
  9. Output confirmation:
    Regler for {Vendor Name} er gemt i invoice-knowledge/{vendor-id}/PARSER.md.
    
    {If new}: Ny leverandoer-parser oprettet med {n} udtraeksregler.
    {If updated}: Eksisterende parser opdateret med {n} nye rettelser.
    
    Naeste gang du behandler en faktura fra {Vendor Name}, vil disse regler
    automatisk blive brugt til mere praecis udtraekning.
    

Read the full file on GitHub · 119 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. 4d ago First seen · 119 lines · 12 tokens per session scan A dac97f75d5f3

Subscribe to this mod's changes

receipt-learn is a command published in the GitHub repository peerjakobsen/smartspender (5 stars, last pushed 7mo ago), licensed MIT. It adds 12 tokens to every session and 1,215 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.