nx_purchase.nx
buildroot/runtime/nx_purchase.nx
about
nx_purchase.nx -- R4 of THE NISHI SITUATION-MANAGEMENT arc: the PURCHASE-DECISION / OPPORTUNITY-COST
engine that powers the Nishi browser's "before you buy" check (operator: "showing what you have vs what
it will cost and help with the opportunity costs"). Grounded in REAL economics, not invented (corpus:
knowledge/fetched/spend_*.raw -- opportunity cost, time value of money, hyperbolic discounting/present
bias [why showing the future cost works], impulse/nudge/cooling-off).
THE KEY INSIGHT (opportunity cost, exact): if you carry high-interest debt, a $X purchase is not $X --
it is $X you did NOT put toward that debt, so it costs you $X PLUS the interest you forgo saving. The
engine computes that EXACTLY by two nx_debt amortization runs (R4-gated): interest(balance) minus
interest(balance - X). It also shows "what you have" (affordability from your available cash) and the
concrete reframes that counter present bias: hours-of-your-life and %-of-your-goal. Composes nx_money +
nx_debt + nx_adhd. No floats, no hardware writes, ADVISORY only (autonomy). license_tier: ORIGINAL
dependencies 4 imports · 4 importers
imports: nx_syscalls.nxnx_money.nxnx_debt_payoff.nxnx_adhd.nx
imported by: nx_browser_buyguard.nxnx_finance_web.nxnx_intake_handler_gate.nxnx_purchase_gate.nx
structs
| none |
consts
| none |
functions
| 19 | func pur_affordable(price: i64, available: i64) -> i64 called by 1: main |
| 27 | func pur_interest_saved(balance: i64, apr: i64, payment: i64, price: i64) -> i64 |
| 40 | func pur_true_cost(price: i64, interest_saved: i64) -> i64 |
| 45 | func pur_hours(price: i64, hourly_wage_cents: i64) -> i64 { return adhd_hours_cost(price, hourly_wage_cents) } |
| 46 | func pur_pct_of_goal(price: i64, goal: i64) -> i64 { return adhd_pct_of_goal(price, goal) } |
| 49 | func pur_recommend(price: i64, discretionary: i64, pause_threshold: i64, remaining_budget: i64) -> i64 |