npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

fairbooks-expense-policy

v0.2.0

Published

Fairbooks Expense Policy: an MCP agent that compares expense report lines and receipt text to your written expense policy (limits, per diem by location and date, dated mileage rates), cites the policy section for every finding, flags possible duplicates a

Readme

Fairbooks Expense Policy (fairbooks-expense-policy)

Compares expense reports and receipts to your written policy, cites the policy section for every finding and recommends approve or reject. Reimbursing is one human click; paying is blocked.

Part of Fairbooks Machine domain agents: one agent, one process, nothing outside its lane. Built on fairbooks-core. MIT, Node ≥ 20, runs on your machine, no account or API key needed.

What it does

Give Fairbooks Expense Policy an expense export (report_id, line_id, employee, date, submitted_on, category, merchant, amount, currency, receipt, purpose, attendees, nights, miles, preapproved_by), your policy written as JSON rules with a source naming the policy document and its sections, and optionally a folder of receipts. For each line it checks:

  • receipts required over your threshold, receipt files that are missing, and text receipts whose total or date does not match the line;
  • limits per item, per person (meals, with attendees required), per night (lodging) or per day, per-diem rates by location and date (exact location first, then a "*" row), and mileage against your rate or a dated rate table (mileage_rates);
  • disallowed and unknown categories, missing business purpose, pre-approval over your amount, late submission, other currencies;
  • possible duplicates (same employee, merchant, amount and date) and receipts attached twice.

Every finding names the policy section it comes from. Lines are approve, approve capped (paid up to the limit), needs info or reject; each report gets a recommendation and a recommended amount. Receipt text is read for totals and dates only and never returned, and card-like numbers in purposes are masked. It also:

  • normalises receipt text you already have (US, European decimal comma, month-name dates, "amount due" and "grand total" styles) into merchant, total, date, currency, tax and tip. It does no OCR; give it text from your own scanner;
  • finds possible duplicate claims within the export and against earlier reports (history): the same receipt file, identical receipt text under another file name, two receipts with the same merchant, total and date, and fuzzy matches (same employee, similar merchant, amount within 1%, dates within 3 days by default). Each pair has a score and reasons;
  • ranks reports in the order a reviewer should look at them. The score adds stated weights per finding (override them with risk_weights in the policy), duplicates against earlier reports and the amount claimed, and every point has its reason;
  • writes an evidence pack: evidence-pack.html (self-contained, no scripts), audit-queue.csv and evidence-manifest.json with the sha256 of every input and output. The manifest hash goes into the audit log as output_sha256.

With approval it pre-stages a reimbursement batch (staged-reimbursements.csv and batch.json) for the reports a person can approve.

Exports it reads

Table inputs can be CSV, TSV, semicolon- or pipe-separated text, Excel .xlsx, JSON or JSONL. A file already in this agent's own columns is read as it is. The exports below are recognised by their column names and mapped onto those columns; dates become YYYY-MM-DD, amounts plain decimals (both decimal marks), and yes/no columns yes/no. Each result lists, under sources, which export was recognised, which columns were mapped, and any rows skipped or dates that could be read two ways.

Expense lines (arguments expenses, history)

| System | Export | Layout checked against vendor docs | |---|---|---| | Ramp | Transactions > Export (CSV) | support.ramp.com "Exporting your data to CSV" on 2026-11-15 | | Expensify | Default CSV export of expenses | no |

Columns named differently? Run npx fairbooks-expense-policy inspect <file> to see how a file is read (column names and shapes only, never values), then name your columns in fairbooks-sources.json in the root:

{ "files": { "exports/users.csv": { "columns": { "email": "Work E-mail" }, "date_order": "dmy" } } }

Where a layout says "checked", its column names were compared with the vendor's documentation on that date. The other layouts were written from knowledge of the export and were not checked. None was tested against a live account. If a real export does not match, the result says which columns were missing; please report it.

Receipts from other markets

Receipt text in yen and won (no decimals), yuan, reais and euros is read: totals under 合計, 合计, 합계, Total TTC, Zu zahlen, Total a pagar or Totale; subtotal, tax and tip labels in nine languages; dates such as 2026年11月14日, 令和8年11月14日, 2026년 11월 14일 and 14 novembre 2026; 03/11/2026 read day first when the receipt is not in US or Canadian dollars. Cash handed over (お預り) and item counts (3点) are never taken as the total. Fairbooks Expense Policy still does no OCR and says nothing about any country's tax rules.

Install

npm install -g fairbooks-expense-policy
fairbooks-expense-policy demo        # runs on the bundled fictional sample data

As an MCP server

Claude Code

claude mcp add fairbooks-expense-policy -- npx -y [email protected] mcp --root /path/to/your/exports

Cursor / Claude Desktop / VS Code / Windsurf

{ "mcpServers": { "fairbooks-expense-policy": { "command": "npx", "args": ["-y", "[email protected]", "mcp", "--root", "/path/to/your/exports"] } } }

--root is the only folder the tools can read or write. Paths outside it are refused.

Tools

| Tool | Policy | What it does | |---|---|---| | expenses_review | allow | Findings per line with policy sections; recommendation and amount per report | | expenses_read_receipts | allow | Merchant, total, date, currency, tax, tip and content hash per text receipt (text never returned) | | expenses_find_duplicates | allow | Possible duplicate pairs, also against earlier reports, with scores and reasons | | expenses_audit_queue | allow | Reports in review order with an explainable score | | expenses_write_report | allow | Write expense-review.md and line-findings.csv to fairbooks-out/expenses | | expenses_write_evidence_pack | allow | Write evidence-pack.html, audit-queue.csv and evidence-manifest.json (hashed) | | expenses_stage_reimbursement | ask (Auto-eligible) | Pre-stage staged-reimbursements.csv + batch.json (nothing paid) | | expenses_request_reimbursement | ask · one-click | After a named human approves, record the batch (bound to its hash) for whoever pays | | pay_reimbursement | block | Listed so agents see the refusal. Fairbooks Expense Policy never pays. | | ledger_post_expense | block | Listed so agents see the refusal. Fairbooks Expense Policy never posts to a ledger. |

Any other tool name is blocked. MCP hosts also get the prompt review_expense_reports, which walks a model through the whole review and stops for the human click. fairbooks_info shows the pinned model, mode, caps and every decision.

Modes

  • Review (--mode review): read and report only.
  • Assist (default): the policy above. ask returns an approval_id; a person approves once with fairbooks-expense-policy approve <id> --as "Your Name".
  • Auto (--mode auto --auto <tool,...>): off by default, opt-in per action, with step/spend caps (--max-steps, --max-spend) and a kill switch (fairbooks-expense-policy kill).

expenses_stage_reimbursement can go on Auto, so Auto only pre-stages. Reimbursing is move_money: it stays one-click even in Auto, and --auto expenses_request_reimbursement is refused. The approval is tied to the batch hash and the staged CSV is re-hashed first. Paying and posting stay blocked.

Go-live, revoking access, deleting personal data, moving money, legally binding sends and production deploys always need a person's click, in every Fairbooks pack.

CLI

fairbooks-expense-policy tools
fairbooks-expense-policy call expenses_review '{"expenses":"expenses.csv","policy":"policy.json","receipts":"receipts"}'
fairbooks-expense-policy eval          # private evals on the bundled fixtures
fairbooks-expense-policy validate-config policy policy.json   # typos fail with JSON pointers

The policy file is checked against a JSON Schema before every run: unknown keys ("recipt_required_over"), wrong types and a missing source fail with the JSON pointer of the problem.

Every call is written to .fairbooks/audit.jsonl (hash-chained JSONL; arguments stored as a hash). Read it with fairbooks-audit-evidence or npx -y -p fairbooks-core fairbooks-verify-log .fairbooks/audit.jsonl.

What it is not

  • Not fraud detection. A possible duplicate or a high review score is a question for a person, not a finding of wrongdoing.
  • Not OCR. Receipt reading works on text and recognises common layouts; an unusual receipt may give no total or the wrong one, so a person checks.
  • Per-diem and mileage rates are the ones you write into the policy. Fairbooks Expense Policy ships no official rate tables.
  • It applies the rules you write down. It does not read your policy document for you, and it is not tax or legal advice.
  • Not an expense platform or card program. It reads exports and receipts you give it and pays no one.
  • Not fully autonomous: anything risky waits for a named person.

Data

Everything runs locally on files you choose. No network calls, no telemetry. The bundled fixtures are fictional.

License

MIT © 2026 Kurt Francisco. Source: https://github.com/fpavia111-creator/fairbooks-agents/tree/master/packages/fairbooks-expense-policy