FinSafe Doesn't Predict Your Future. It Bounds It.

A personal finance decision engine that answers Buy Now or Wait from the 10th percentile of your own transaction history, not from a forecast.

7 min read · Python, Java, TypeScript • View on GitHub • More from Ankitkumar99422

A wide editorial illustration of a kitchen table with an open household ledger. On the left, a stack of bills and rent slips is pinned down by heavy iron washers. On the right, a stack of paychecks sits, with one check lifting off the table like a balloon on a taut string while the others stay pinned. It visualizes FinSafe's core asymmetry: bills are assumed to stay, income is assumed to possibly float away.
The thesis of the whole engine in one image. Bills are weighted down; a paycheck might float off.
Key Takeaways

The 10th Percentile Is the Whole Idea

Most budgeting apps sell a forecast. They take your income and your spending, project them forward, and draw a line into next month. FinSafe refuses that move. It does not estimate what your balance will probably be. It computes a floor, the point below which your money usually does not fall, and it asks whether a purchase survives that number.

Concretely, the engine looks at your last 60 days of transactions, works out your rolling 30-day spending, and takes the 10th percentile of that distribution. That number is the bad case. Not a stress test, not a multiplier, not a scenario you can tune. An empirical quantile of your own behavior.

A forecast is a number you can argue with. A floor is a number you cannot. That distinction is the whole design.

What FinSafe Actually Answers

The system takes a financial profile (current balance, income, recurring bills, EMIs, savings goals) plus a planned purchase, and returns one of four verdicts.

The context is Indian rupees. The code carries INR assumptions in its formatting and thresholds, which tells you who this was built for: an individual consumer deciding whether a single purchase is safe, not an analyst modeling a portfolio.

How the Forecast Works

Everything rests on forecast_cashflow(). It takes transactions, the current balance, today's date, and a 30-day horizon, and returns two projections: a typical one and a bad one.

Before any math runs, a gate checks your history. If you have fewer than 60 days of transactions, the function raises an error and the system declines rather than guessing. This is the part most finance apps skip. A quantile of three data points is not a quantile.

Salary is projected at the minimum of your last three deposits. Rent is projected at the maximum of your last three withdrawals. Both rules lean the same direction: assume the least income and the most obligation.

Irregular spending, everything that is not salary or rent, gets aggregated into daily net amounts and rolled into a 30-day sum. The median of those sums is the typical case. The 10th percentile is the bad case.

The FinSafe pipeline: a 60-day gate, three spending branches with an asymmetric overdue rule, a rolling 30-day window, and an empirical quantile that sets the floor. Drag the quantile slider to feel how much of the verdict hangs on that one choice.

Because the bad case is drawn from your own history, its quality depends entirely on how much history you have. That is why the 60-day gate exists. It is not a product decision. It is a statistical one.

A tight close-up illustration of a single hand holding a steel ruler across a printed histogram of daily spending. The ruler rests at a horizontal line near the left tail of the distribution, at roughly the tenth percentile. Bars to the left of the line are shaded with dense crosshatching, the bad-case region; bars to the right are open white. A small pencil mark beside the line reads 10%. It makes the empirical quantile literal: FinSafe reads the floor from the tail of your own spending, not from an assumption.
The bad case is not a scenario you pick. It is the tail of your own spending, read off at the 10th percentile.

Assume Bills Come. Don't Assume Income Arrives.

The sharpest detail in the codebase is a rule most tools would never write. When a recurring payment is overdue, FinSafe treats income and obligations differently. The rules, condensed:

MIN_HISTORY_DAYS = 60
N_RECENT = 3
BAD_CASE_QUANTILE = 0.10
GRACE_DAYS = 3

# salary: assume the least income arrives
salary_amount_rule = "min"

# rent: assume the most obligation lands
rent_amount_rule = "max"

if overdue:
    if category == "salary":
        treatment = "excluded"   # income might not arrive
    else:
        treatment = "included"   # the bill is still owed

An overdue salary is stripped out of the projection entirely and flagged as excluded. The system assumes a paycheck that did not arrive might not arrive at all.

An overdue rent payment is the opposite. It stays in fixed expenses, flagged as included. The system assumes the bill is still owed whether or not you have paid it.

The principle underneath: assume bills still come, don't assume income arrives. It is asymmetric on purpose, and it is the single most opinionated line in the project.

Two Decision Engines, One README

Here is where the README and the code part ways. The README describes a clean flow: Spring Boot receives a request, calls a Python service at /internal/v1/analyze, Python runs the math and the model, and Claude writes the plain-language explanation.

The code shows something else. The Java PurchaseService computes a candidate verdict locally. The Python make_decision() runs a separate pipeline with its own thresholds. And no Claude or Anthropic client appears anywhere in the provided source. templates.py, the explanation layer, is deterministic string formatting, not a language model.

Some files were truncated, so the full call path cannot be confirmed. Treat the table below as what the code shows, not as a verdict on intent.

README saysCode showsConfidence
Spring Boot calls Python at /internal/v1/analyzeJava PurchaseService computes a verdict locally; a RestTemplate is declared but no call is visibleUnverified (file truncated)
Python produces the decisionPython make_decision() runs a separate pipeline with different thresholdsVerified in provided source
Claude writes the explanationtemplates.py does deterministic string formatting; no LLM client presentVerified in provided source

Where It Sits

Against a typical budgeting app, FinSafe inverts almost every default.

FinSafeTypical budgeting app
Future balanceEmpirical 10th percentile of your historyForward forecast from income and spending
Missed incomeExcluded from the projectionBlended into expected income
Missed billsIncluded as still owedBlended into expected spending
Minimum data60 days of transactions, or it declinesNone
ExplanationTemplate textChart

FinSafe is also a crowded name. Separate projects called FinSafe cover DeFi collateral monitoring, transaction and login risk scoring, card spending limits, and AI agent security. None of them is verified as related to this repository. The shared name is a coincidence, not a lineage.