DEV Community

Cover image for  Refund Sloth 🦥: Local AI Agents That Get Your Money Back While You Nap
Aman Kumar
Aman Kumar

Posted on

 Refund Sloth 🦥: Local AI Agents That Get Your Money Back While You Nap

Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady Submission 🦥

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady

What I Built

Somewhere between 48% and 79% of us have paid for a free trial we forgot to cancel. The average person loses $187–$540 a year to forgotten trials, missed return windows and subscriptions they stopped using. We think we spend about $86 a month on subscriptions; it's closer to $219. And 44% of people keep a subscription simply because cancelling is a chore.

That's the most sloth-shaped problem I know: the money is recoverable, but only if you do boring admin before a deadline.

Refund Sloth 🦥 does the boring part. You drop receipts, order emails and your bank statement into one folder (or let it read your mailbox) and go to sleep. At 2 AM a team of six local AI agents wakes up:

  • 🔭 Scout finds new files through the official filesystem MCP server, locked to the inbox.
  • 📖 Reader reads receipt photos with a vision model, and PDFs and emails with a text model, into strict JSON.
  • 🦅 Deadline Hawk works out return-by, trial-end, warranty and renewal dates and creates calendar reminders.
  • 🧾 Auditor finds recurring charges in your bank CSV and flags 🧟 zombie, 👯 duplicate and 📈 price-hiked subscriptions.
  • 👻 Ghostwriter drafts the cancellation and return emails.
  • 🦥 Sloth Boss reviews everything with tool calls and writes your morning brief.

In the morning you get a notification:

🦥 3 deadlines this week · $86.96/mo you can cut · 10 drafts ready
Most urgent: ⏳ Peacock Premium free trial ends 2026-10-23 ($7.99 at stake).

You open the dashboard, click Approve & copy, paste, send. Or click Cancel now ↗ to jump straight to the store's cancel page. Total effort: about 30 seconds. The sloth never sends or pays anything itself: a human stays in the loop, always.

Even lazier extras:

  • 📬 Connect mail (optional): give it a Gmail, iCloud or Outlook app password and it fetches order, trial and renewal emails by itself. The mailbox is opened read-only, and the password is stored encrypted on your machine (macOS Keychain / Windows DPAPI).
  • 🚨 Urgent popup: anything ending in the next 2 days gets its own desktop notification and a red banner at the top of the dashboard.
  • ↗️ Cancel now: every trial, subscription and return has a button that opens the store's cancel or return page. No more hunting for the hidden cancel link.
  • 🖥️ Runs on macOS and Windows.

Who gets to be lazier? Anyone with a stack of receipts in a drawer, a "free" trial they meant to cancel, and a gym membership they've been "about to use again" since March.

Demo

Refund Sloth demo: landing page, dashboard tabs, agent log and mail connect

Today: the urgent banner, the morning brief, and money saved vs. money at risk.
Today tab

Subscriptions: zombies, duplicates and price hikes, each with a Cancel link.
Subscriptions tab

Action queue: ready-to-send emails. Nothing leaves without your click.
Action queue

All data in the demo is fake (generated fixtures). No real receipts or bank statements were harmed.

Code

GitHub logo amangithub01 / refund-sloth

🦥 Local AI agents that get your money back while you nap. Open-weight models (Ollama) + MCP, no API keys, no cloud.

🦥 Refund Sloth

Local AI agents that get your money back while you nap. Drop receipts, order emails and bank statements into a folder. Overnight, a team of open-weight models running on your laptop finds forgotten free trials, closing return windows, expiring warranties and zombie subscriptions, then drafts the cancellation and return emails for you. In the morning you click Approve.

No API keys. No cloud. $0 per run. Works with Wi-Fi off.

🌐 Try the live demo: refund-sloth.vercel.app. It shows the dashboard with sample data, runs entirely in your browser, and needs no install. The real agents and mail sync run only on your own machine (see Setup).

🎬 Demo

Refund Sloth demo: landing page, laptop orbit, dashboard tabs, agent log, mail connect

▶️ Full-quality video: docs/media/refund-sloth-demo.mp4 (26 s, demo data, fake "today" = 2026-10-21)

📸 Screenshots

Landing Scroll: the laptop orbit
Landing page Everything the sloth found, orbiting the laptop
Today: urgent banner + morning brief Deadlines
Today Deadlines
Subscriptions: zombies, duplicates, price hikes Action queue: drafts you approve
…

How I Built It

Every model runs locally through Ollama. No API keys anywhere in the project.

Agent Open-weight model Why
Reader (images) qwen2.5vl:7b small, fast vision model; reads crumpled receipt photos
Reader (text), Hawk, Auditor, Ghostwriter, Boss qwen3.5:35b strong JSON output and tool calling; runs well on an M3 Max
Lite profile qwen3:8b + qwen2.5vl:3b for laptops with 8–16 GB of RAM

MCP is the backbone. I wrote five small MCP servers in TypeScript over stdio:

  • ledger (SQLite)
  • docs (PDF, image, EML, MBOX and CSV parsing)
  • calendar (.ics files with alarms)
  • notify (desktop notifications and the brief)
  • mail (read-only IMAP)

Alongside them runs the official @modelcontextprotocol/server-filesystem, rooted at the inbox with only its read-only tools exposed. A small harness (McpHub) starts every server, turns their tools into Ollama tool definitions and runs the agent loops. The full architecture diagram is in the README.

Hybrid by design: rules for math, models for mess. The biggest lesson: don't let an LLM do arithmetic on your money.

  • Plain code: hashing and dedup, all deadline math (document date, then policies.json, then a clearly marked AI guess), recurring-charge detection, the zombie, duplicate and price-hike flags, and every number in the brief. All unit-tested.
  • LLMs: reading messy documents, guessing return policies for unknown stores, naming bank descriptors (APPLE.COM/BILL 866-712-7753 CA → "Apple Music"), writing emails, and the Boss's review.

Structured output that doesn't break. Every LLM call uses a zod schema, converted to JSON Schema and passed to Ollama's format, then validated. On failure it retries with the validation error. Low-confidence extractions go to a "🔎 Needs a look" list instead of being silently wrong.

A lesson from the local models: prompt-only email formatting was ignored (one-line bodies, greeting the wrong company). Moving layout into deterministic post-processing fixed all of it. Small models are great at content; let code handle form.

Eval. sloth eval runs the full pipeline on fake fixtures: receipt photos, PDF invoices, order emails, an mbox, a 13-month bank CSV, and a meme that must be ignored.

Metric Score
Field accuracy (merchant / amount / date) 96.7% (29/30)
Deadline accuracy (type + date ±1 day) 100% (14/14)
Subscription recall / flag accuracy 100% / 100%
False positives 0 (the meme is correctly ignored)
Time ~3 minutes for the whole batch, fully local (M3 Max, 48 GB)

Stack: TypeScript, Node 24 (built-in node:sqlite), MCP TypeScript SDK, Ollama JS, zod, imapflow, Express 5 + SSE (a live agent log), React 19 + Vite + Tailwind v4, Vitest (39 tests).

Why Does Open Innovation Matter?

For this project it isn't a nice-to-have. It's the only way the project can exist.

  • Privacy. To find a forgotten trial you need someone's bank statement, receipts and order emails: their whole financial life. With a closed API, that's a nightly upload of your bank CSV to someone else's server. With open weights it never leaves the laptop. sloth doctor even fails if Ollama isn't on localhost, and the dashboard API only listens on 127.0.0.1.
  • Works offline. Nothing in the pipeline needs the internet; try it with Wi-Fi off. A 2 AM job shouldn't depend on a connection or an API being up.
  • $0 per run, forever. It runs every night. A closed API would charge per token, every night, to save me money. Ironic.
  • Swappable. Each agent's model is one line in a config. I switch between a 35B model and an 8B "lite" profile, and a single profile uses one multimodal model for everything. No vendor lock-in, and no deprecation can break my nightly job.
  • Tunable. There's a Modelfile that bakes in the Reader prompt, and because the weights are open you could fine-tune Reader on your own receipts.
  • No OAuth app for your inbox. Mail sync is plain read-only IMAP to your own provider. No cloud project, no client secret, no third party reading your mail.
  • Open standards. Because of MCP, the tools (ledger, docs, calendar, mail) work with any other MCP client, and the agents use the official filesystem server instead of me reinventing file access.

Where open worked better than closed:

  • JSON-schema-constrained decoding through Ollama's format.
  • keep_alive to keep models warm across a batch.
  • The freedom to run a tiny vision model just for photos while a bigger one does the reasoning, on hardware I already own.

My Agent Session

I built Refund Sloth with GitHub Copilot CLI as my pair programmer. It helped with:

  • planning the agent pipeline;
  • writing the MCP servers, the tests and the eval;
  • iterating on the UI with headless-Chrome screenshots;
  • recording the demo video.

Every non-obvious decision (why rules do the math, why read-only IMAP instead of OAuth, why "Cancel now" is a link and not auto-cancel) is logged in DECISIONS.md.

The Lazy Payoff

On the demo data (a realistic year of transactions), Refund Sloth found:

  • $2,424 at risk in the next 30 days: a $1,299 laptop return closing in 4 days, $348 headphones in 6, $249 AirPods in 8, and a trial that bills in 2.
  • $86.96 a month (~$1,043 a year) you can cut: a gym nobody visits ($24.99), an unused AI tool ($20), the most expensive of four streaming services ($17.99), and the extra music and cloud plans ($11.99 each).
  • 10 ready-to-send emails and 15 calendar reminders, none of which I had to write.

Doing this by hand (digging through emails, checking each store's return policy, reading a bank statement line by line, writing polite-but-firm emails) is easily 1–2 hours a month. Now it's about 30 seconds of clicking Approve. 🦥

Prize Categories

  • Best Use of GitHub Copilot: built end to end with the GitHub Copilot CLI.

Top comments (0)