code wiki / _hdl_build / nx_caretaker.nx
nx_caretaker.nx
buildroot/runtime/_hdl_build/nx_caretaker.nx
about
nx_caretaker.nx -- the CARETAKER / GARDENER organ: as sprawl is identified (duplicates from the
Genealogist, superseded capabilities), the Caretaker keeps the ECOSYSTEM in BALANCE -- pruning
like a great gardener so the WHOLE improves, NEVER wiping functionality. It is a SEPARATE organ
(single responsibility) but NEVER acts alone -- three partners gate every prune (checks & balances):
ENGINEER -- removal SAFETY: if a piece is LOAD-BEARING (others depend on it), removing it would
kill the ecosystem, so KEEP. The Engineer must prove the ecosystem survives without it.
GARDENER -- (the Caretaker) only prunes sprawl whose FUNCTION is COVERED by a survivor; it
removes REDUNDANCY, never a capability (rule #25: improve the whole, don't strip features).
COUNCIL -- governs ADDITIVE-ONLY (rule #13): a prune is a SOFT-RETIRE (deprecate / is_current=0,
fully reversible), NEVER a hard delete. History is sacred.
So removal strengthens the whole ONLY when it is redundant AND safe AND reversible AND governed.
Recommendation: separate organ, deeply wired in partnership -- pruning alone is too dangerous.
license_tier: ORIGINAL Refs: additive-only (rule 13); never-strip-features (rule 25); single-responsibility (rule 9).
dependencies 1 imports · 3 importers
imports: nx_syscalls.nx
imported by: nx_caretaker2_test.nxnx_caretaker_test.nxnx_nightly_maintenance.nx
structs
| none |
consts
| 18 | const CARE_ACTIVE: i64 = 0 // in use, not sprawl |
| 19 | const CARE_DUPLICATE: i64 = 1 // Genealogist flagged a (artifact,objective) duplicate |
| 20 | const CARE_SUPERSEDED: i64 = 2 // a better capability replaced it (e.g. PSNR-only fidelity) |
| 23 | const CARE_KEEP: i64 = 0 // active + needed |
| 24 | const CARE_KEEP_LOADBEARING: i64 = 1 // sprawl BUT load-bearing -> KEEP (ecosystem would die) |
| 25 | const CARE_KEEP_UNCOVERED: i64 = 2 // sprawl BUT its function isn't covered -> KEEP (would lose capability) |
| 26 | const CARE_SOFT_RETIRE: i64 = 3 // redundant + safe + covered + governed -> soft-retire (reversible) |
functions
| 29 | func care_disposition(status: i64, load_bearing: i64, covered: i64) -> i64 |
| 37 | func care_ecosystem_survives(load_bearing: i64) -> i64 { if load_bearing == 1 { return 0 } return 1 } called by 1: main |
| 40 | func care_is_additive(disposition: i64) -> i64 { if disposition == CARE_SOFT_RETIRE { return 1 } return 1 } // we never emit a hard-delete disposition |
| 43 | func care_sprawl(n: i64, status: *i64) -> i64 { var c: i64 = 0; var i: i64 = 0; while i < n { if status[i] != CARE_ACTIVE { c = c + 1 } i = i + 1 } return c } |
| 47 | func care_functionality(n: i64, status: *i64, load_bearing: *i64, covered: *i64) -> i64 |
| 58 | func care_improves_whole(sprawl_before: i64, sprawl_after: i64, func_before: i64, func_after: i64) -> i64 called by 1: main |
| 67 | func care_plan(n: i64, status: *i64, load_bearing: *i64, covered: *i64, out: *i64) -> i64 |
| 79 | func care_health(functionality: i64, sprawl: i64) -> i64 called by 1: main |
| 87 | func care_restore(disposition: i64) -> i64 { if disposition == CARE_SOFT_RETIRE { return CARE_KEEP } return disposition } called by 1: main |