← back to the bench
shippedsoftware · Apr → Jul 2026

metriX

A personal finance app that tells you what's about to happen, instead of showing you another pie chart

tl;dr

Most budgeting apps only show you what already happened, so I wanted to build one that tells you what's about to happen. metriX connects to Australian bank accounts through open banking, categorises transactions with a cost-aware pipeline, detects subscriptions and income, forecasts your cashflow day by day, and has a tool-using agent you can simply ask things like "can I afford $200 on dinner tonight?"

Proactive, not another dashboard

Instead of another pie chart, I wanted metriX to warn you about things before they happen: your AGL bill just went up 64%, you'll dip below your buffer on the 23rd, or your dining spend is on track to blow its cap. All the budgeting tools I had come across were either incapable of doing this or remarkably bad at it, so I decided to build a tool myself.

To make the system trustworthy, I decided to apply some of the lessons I learned from nestLeap, letting deterministic engines handle the maths, while the LLM only orchestrates and narrates. Forecasting, recurring-payment detection and alerts are all pure, unit-tested functions. The agent calls them as tools and is explicitly told never to make up numbers.

try it →

a demo account, roughly as it looks

Good morning, Sam

fake demo data · day 18/30
this monthOn track
$5,169 flexible · ~$431/day for 12 days left
$3,772 spent · $59 upcoming recurring · of $9,000 income
projected balance · next 30 days
today $4,288$200 bufferend ≈ $9,215
ask metriX
can I afford on ?
⚙ can_i_afford(amount: 80, category: "dining")
It's a stretch.You'd have $32 left, and at your current pace you'd land around $643 by month-end.
budgets this month
categorisation · alias → pg_trgm fuzzy → Gemini batch → review
WOOLWORTHS 1234 NEWTOWNWoolworths · groceries · 1.00
WOOLWORTHS 5521 ENMOREWoolworths · groceries · 0.71
TOBYS ESTATE COFFEE CHIPPENDALEToby's Estate · dining · 0.93
SQ *MR WONG SYDNEYMr Wong · dining · 0.88
PAYPAL *NOTIONLABSNotion · other · 0.84
VISA DEBIT PURCHASE 0042 7781? · other · 0.41

A mock with fake data (the real app has a one-click demo account too). The can_i_afford verdict uses the same rules as the agent's tool: no if you'd go over, stretch if less than 15% would be left or the month-end projection busts the cap.

Reducing LLM Costs & Latency

Calling an LLM on every single transaction is slow and expensive, so metriX uses a cascade instead. First, it tries an exact match against saved merchant aliases, then a fuzzy trigram match in Postgres (similarity ≥ 0.6). Only what's left goes to Gemini, in batches of 20 descriptions per call with a strict JSON schema. Anything under 0.8 confidence lands in a review queue, and every correction becomes a permanent alias. In practice, this means the LLM only ever sees each unique merchant string once.

One rule in the prompt turned out to matter more than all the others: categorise by substance, not billing pattern. A gym is health, and Netflix is entertainment. There's no "subscriptions" category, because recurring is a behaviour, not a category, so I ended up migrating it out of the schema entirely.

The KFC problem

Detecting recurring payments sounds easy at first: just find charges at regular intervals. But if you eat at KFC a lot, some of those visits will end up ~30 days apart by pure coincidence, and suddenly KFC is a monthly subscription. This happened a lot during early testing and defeated the entire point of the system.

To get around this, the detector first finds chains of charges that fit a cadence window (weekly is 6–8 days, monthly 27–34, and so on), and then makes them pass three gates: there can only be a few other visits to that merchant inside the chain's span, the chain has to make up at least 60% of all visits there, and the dates have to line up on the calendar (for example, the same day of the month ±3). Real subscriptions pass easily, but KFC doesn't. It should be noted that these thresholds worked well during my testing, but may well need to be adjusted in a mass-deployed product.

Small things I'm happy with

  • Anomalies use median + MAD instead of mean + standard deviation, so one huge purchase doesn't hide the next one. Severity is measured in dollars, though: a 5×MAD coffee is a $20 outlier, while a 3×MAD power bill is $600, which actually matters.
  • Month-end projections don't extrapolate subscriptions. A naive linear projection sees one Netflix charge in the middle of the month and assumes there'll be a second one. Mine separates committed recurring spend from variable spend.
  • The cashflow forecast starts from your spendable balance and simulates each day: recurring income and bills on their due dates, plus a flat baseline equal to the median of the last 30 days of variable spend (zero days included).
  • Gemini 3's thought signatures. Thinking models need every function call's thoughtSignature echoed back on the next turn, but the SDK's convenience getter strips it. So the agent loop walks the raw response parts, stores the signatures and re-attaches them when it rebuilds the history.
lib/recurring/detect.ts
function isValidRecurringChain(
  chain: DetectInput[],
  cadence: Cadence,
  group: DetectInput[],
): boolean {
  // 1a. In-span density.
  const firstDate = chain[0].transactionDate;
  const lastDate = chain[chain.length - 1].transactionDate;
  const inSpan = group.filter(
    (t) => t.transactionDate >= firstDate && t.transactionDate <= lastDate,
  ).length;
  const extras = inSpan - chain.length;
  // chain=2 → 0 extras, chain=3 → 1, chain=4+ → 2 (one missed leg's worth of slack).
  const maxExtras = chain.length === 2 ? 0 : chain.length === 3 ? 1 : 2;
  if (extras > maxExtras) return false;

  // 1b. Global density. [...] Real subscriptions have ratio ≈ 1.0;
  // frequent vendors are well below 0.6.
  if (chain.length / group.length < 0.6) return false;

  // 2. Tightness — depends on cadence.
  if (!hasTightCalendarAlignment(chain, cadence)) return false;
  // ...

The three gates. KFC fails at 1b.