code wiki / _hdl_build / nx_vizsla_bills.nx
nx_vizsla_bills.nx
buildroot/runtime/_hdl_build/nx_vizsla_bills.nx
about
nx_vizsla_bills.nx -- NISHI VIZSLA: the recurring BILLS / payables tracker.
Operator directive 2026-06-14: "manage all our bills". V1 budget tracks
money HISTORY; this tracks the recurring OBLIGATIONS -- what is due, when, how
much, and whether THIS month is paid -- so a bill is never silently missed.
Inherits the CID-ledger / civil-date substrate from V4 (nx_vizsla_relate).
THEORY AS DATA (bills.txt): payees, amounts, due-days, autopay are all file
content (law 11/25) -- adding/retuning a bill is an edit, never a recompile.
Commands (argv[1]):
load <bill_log> <prefix> [segid] PAID rows -> canonical records -> CID
keys "bill:nxc1-..." on seg_store
(additive, idempotent by construction).
status <prefix> <bills> <today> per bill: next due date + is THIS month
paid -> PAID / UPCOMING / DUE / OVERDUE,
+ owed_cents for everything unpaid.
today via argv = deterministic.
File formats (line records, # comments):
bills: CONF soon_days <n>
BILL <id> <payee> <amount_cents> <due_day> MONTHLY <AUTO|MANUAL>
(due_day 1..28; only MONTHLY this rung -- other cadences fail loud)
bill_log: PAID <date> <bill-id> <amount_cents> <note> (date YYYY-MM-DD)
"Paid this month" = a PAID record for that bill dated in today's calendar
month. due_this_month = (today.year, today.month, due_day). state:
PAID (paid this month) -> next due = next month
else days_until = due_this_month - today:
days_until < 0 -> OVERDUE
0 <= days_until <= soon -> DUE
days_until > soon -> UPCOMING
owed_cents = sum of every UNPAID bill's amount (due+overdue+upcoming) = what
you still owe this month. autopay shown (AUTO = no action) but money still
counts as owed until recorded paid.
Determinism: stdout has no clocks (today via argv). Loud-fail: missing files,
cadence != MONTHLY, autopay not AUTO/MANUAL, malformed dates/days = exit 1.
EXCEED (honest, feature-class): consumer bill apps silo reminders from the
money ledger; here bills + budget + the relationship/notes brief share ONE
additive tamper-evident substrate and surface together in the daily digest.
dependencies 3 imports · 0 importers
imports: nx_syscalls.nxnx_canon_cid.nxnx_seg_store.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 49 | const K_MAGIC_1970: i64 = 1970 |
| 50 | const K_MAGIC_146097: i64 = 146097 |
| 51 | const K_MAGIC_719468: i64 = 719468 |
| 52 | const K_MAGIC_4096: i64 = 4096 |
| 53 | const K_MAGIC_2048: i64 = 2048 |
| 54 | const K_MAGIC_65536: i64 = 65536 |
functions
| 56 | func bl_slen(s: *u8) -> i64 |
| 62 | func bl_p(s: *u8) -> i64 |
| 67 | func bl_eq(a: *u8, b: *u8) -> i64 |
| 78 | func bl_dup(s: *u8) -> *u8 |
| 86 | func bl_find(list: *i64, n: i64, s: *u8) -> i64 |
| 95 | func bl_atoi(s: *u8) -> i64 |
| 106 | func bl_isws(c: i64) -> i64 called by 1: bl_tok |
| 113 | func bl_tok(b: *u8, off: i64, lend: i64, dst: *u8, cap: i64) -> i64 |
| 135 | func bl_cat(dst: *u8, off: i64, s: *u8) -> i64 |
| 141 | func bl_catn(dst: *u8, off: i64, v: i64) -> i64 |
| 154 | func bl_cat2(dst: *u8, off: i64, v: i64) -> i64 |
| 160 | func bl_kmemeq(b: *u8, off: i64, n: i64, s: *u8) -> i64 |
| 170 | func bl_field(rec: *u8, rl: i64, want: *u8, out: *u8, cap: i64) -> i64 |
| 197 | func bl_isbill(b: *u8, koff: i64, kl: i64) -> i64 |
| 203 | func bl_datedays(s: *u8) -> i64 |
| 245 | func bl_ym(s: *u8) -> i64 |
| 271 | func bl_builddate(y: i64, m: i64, d: i64, out: *u8) -> i64 |
| 282 | func bl_log(lpath: *u8, tag: *u8, rep: *u8, o: i64) -> i64 called by 2: bl_cmd_loadbl_cmd_status calls 7: sys_openat_appendsys_mmapbl_catbl_catnsys_now_realtime_secsys_write+1 |
| 298 | func bl_prefixlog(prefix: *u8, out: *u8) -> i64 |
| 308 | func bl_load_bills(cpath: *u8) -> *i64 |
| 370 | func bl_cmd_load(argc: i64, argv: *i64) -> i64 |
| 479 | func bl_paid_match(pid: *i64, pym: *i64, npaid: i64, billid: *u8, ym: i64) -> i64 |
| 489 | func bl_cmd_status(argc: i64, argv: *i64) -> i64 |
| 616 | func main(argc: i64, argv: *i64) -> i64 |