code wiki / (root) / nx_purchase.nx

nx_purchase.nx

buildroot/runtime/nx_purchase.nx

3017 B51 linesdepth 4pulls 5 transitivereach 14 importersview sourcekind library
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_money.nx nx_debt_payoff.nx nx_adhd.nx nx_purchase.nx nx_browser_buyguard.nx nx_finance_web.nx nx_intake_handler_gate.nx nx_purchase_gate.nx

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

19func pur_affordable(price: i64, available: i64) -> i64
called by 1: main
27func pur_interest_saved(balance: i64, apr: i64, payment: i64, price: i64) -> i64
40func pur_true_cost(price: i64, interest_saved: i64) -> i64
called by 3: bgw_scanfw_rendermain calls 1: mny_add
45func pur_hours(price: i64, hourly_wage_cents: i64) -> i64 { return adhd_hours_cost(price, hourly_wage_cents) }
called by 3: bgw_scanmainmain calls 1: adhd_hours_cost
46func pur_pct_of_goal(price: i64, goal: i64) -> i64 { return adhd_pct_of_goal(price, goal) }
called by 1: main calls 1: adhd_pct_of_goal
49func pur_recommend(price: i64, discretionary: i64, pause_threshold: i64, remaining_budget: i64) -> i64
called by 2: bgw_scanmain calls 1: adhd_spend_decision