How Magpie Audits Your Ledger for Hidden Leaks
Many financial tracking apps tell you what you spent. They show you a bar chart of your groceries or a pie chart of your dining out. But very few help you answer the active question: “Where is my money leaking right now, and how do I fix it?”
Magpie solves this by deploying a background agent (your money assistant, Magpie) that watches your transactions for you. In this post, we’ll explain how Magpie’s audit engine runs, how it scans transactions, and how it translates ledger tables into actionable findings.
The 5-Minute Cron Loop
Every five minutes, a serverless cron job hits the /api/cron/audit endpoint. This doesn’t run a heavy, expensive LLM prompt over your entire history (which would cost hundreds of dollars a month). Instead, the audit runs in three optimized stages:
graph TD
A[Cron trigger every 5 min] --> B[Fast SQL heuristics check]
B -->|Potential issues found| C[Pass targeted rows to Magpie LLM]
C --> D[Surface clear findings & recommendations]
B -->|No anomalies| E[Sleep]
Stage 1: Fast SQL Filtering
The Postgres database executes fast, indexed queries to identify candidates for auditing:
- Merchants whose transaction frequency has suddenly dropped or stopped (potential orphaned subscriptions).
- Recurring merchant amounts that changed by more than 2% month-over-month.
- Transaction items marked as “Uncategorized” that match semantic tax-deductible descriptions.
Stage 2: Target LLM Audit
Once a candidate (e.g., a recurring subscription showing a price change) is flagged by SQL, Magpie spins up a narrow LLM prompt. It feeds the model only the transaction history of that specific merchant. The agent asks:
- Is this a known subscription service?
- Has the price increased?
- What is the exact delta?
Stage 3: The Findings Feed
If the agent confirms a leak, it writes a new record to the money_found table in the SQLite/Postgres database. You receive an alert card directly in your dashboard:
Money Found: Netflix Inc. Magpie flagged a price increase on your Netflix Premium subscription from $19.99 to $22.99/mo (+$3.00/mo). Active since March 1st. [Dismiss] [Acknowledge Move]
Asking Magpie Directly
In addition to background audits, you can query Magpie directly through the Ask panel. Since Magpie indexes your schema, it can translate natural language questions into accurate SQL queries:
- Query: “How’s my saving rate this month compared to last?”
- SQL executed under the hood:
SELECT
(income - expenses) / income * 100 as saving_rate
FROM cash_flow
WHERE month_date IN (CURRENT_MONTH, PRIOR_MONTH);
By combining automated background checks with conversational SQL querying, Magpie turns your transaction history from a passive archive into an active tool for optimization.
Let Magpie find the money this article is talking about.
Drop in 90 days of statements and Magpie will sort every transaction and flag what is deductible, dormant, or leaking, each with the dollar amount and the transaction behind it.