code wiki / (root) / nx_claim_core.nx

nx_claim_core.nx

buildroot/runtime/nx_claim_core.nx

15014 B384 linesdepth 5pulls 7 transitivereach 2 importersview sourcekind librarytopic claim
docsdependenciesstructsconstsfunctions

about

nx_claim_core.nx -- SESSION CLAIMS over the deploy-leash store (coordination rung 1, operator 2026-07-16: "i have concurrent workstreams so coordinate and get our coordination up to state of the art"). A CLAIM is a leash row named claude_<sess8> whose purpose field carries the workstream + a file-scope csv: "ws=<slug>;scope=<prefix>,<prefix>,...". Because claims ARE leash rows in knowledge/store/leash, they inherit the whole supervision fabric for free: cadence_loop walks them, a crashed session stops beating -> ABANDONED -> reclaimed BY CONSTRUCTION (the 2026-07-16 crash lesson: 7 sessions died holding an uncoordinated tree). Liveness is RENEWAL-BASED like the leash (pid is registered as 1 = init: verdict rides ONLY on beat age vs ttl -- a Claude session has no stable pid of its own). Verbs (see nx_claim_check.nx CLI): claim / beat / release / check <paths> / walk. check = the PRE-COMMIT tooth: exit CC_DENY when a staged path sits inside ANOTHER live session's scope (the holder is NAMED); grant otherwise. Overlap = prefix match, csv scopes, trailing '*' tolerated. Pure cores (cc_live_verdict, cc_scope_hit) are gate-locked. REUSE (compose, do not reinvent): row shape + d:<name>/d:ids layout = nx_deploy_leash (field helpers replicated cc_* to keep this importable next to it -- leash has a main); store = sov_put/sov_get_copy (nx_sov_ledger via nx_model_lane_core); clock = nx_watch nw_mark/nw_read ("leash" namespace, same as deployments). flock idiom = dl_add_id's. license_tier: ORIGINAL

dependencies 2 imports · 2 importers

nx_watch.nx nx_model_lane_core.nx nx_claim_core.nx nx_claim_check.nx nx_claim_check_gate.nx

imports: nx_watch.nxnx_model_lane_core.nx

imported by: nx_claim_check.nxnx_claim_check_gate.nx

structs

none

consts

23const CC_MAGIC_999999999: i64 = 999999999
25const CC_STORE: *u8 = "knowledge/store/leash"
26const CC_LOCK: *u8 = "knowledge/status/leash.lock"
27const CC_NS: *u8 = "leash"
28const CC_GRANT: i64 = 0
29const CC_DENY: i64 = 3
30const CC_ROWCAP: i64 = 512
31const CC_IDSCAP: i64 = 262144
32const CC_NAMECAP: i64 = 96
33const CC_SCOPECAP: i64 = 256
34const CC_CLAIM_PID: i64 = 1
35const CC_CH_PIPE: i64 = 124
36const CC_CH_NL: i64 = 10
37const CC_CH_SEMI: i64 = 59
38const CC_CH_COMMA: i64 = 44
39const CC_CH_STAR: i64 = 42
40const CC_CH_NUL: i64 = 0

functions

42func cc_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
45func cc_name(sess8: *u8, out: *u8) -> i64
57func cc_key(name: *u8, out: *u8) -> i64
67func cc_field(row: *u8, n: i64, k: i64, out: *u8, cap: i64) -> i64
called by 3: maincc_checkcc_walk
83func cc_field_int(row: *u8, n: i64, k: i64) -> i64
called by 2: cc_checkcc_walk
99func cc_ids_add(name: *u8) -> i64
139func cc_live_verdict(age_ms: i64, ttl_ms: i64, word: *u8) -> i64
called by 3: maincc_checkcc_walk calls 1: std_streq
148func cc_scope_hit(scope: *u8, path: *u8) -> i64
called by 2: maincc_check calls 1: cc_slen
171func cc_purpose_scope(purpose: *u8, out: *u8, cap: i64) -> i64
called by 2: maincc_check calls 1: cc_slen
195func cc_register(sess8: *u8, ws: *u8, scope: *u8, ttl_ms: i64) -> i64
241func cc_beat(sess8: *u8) -> i64
called by 1: main calls 2: cc_namenw_mark
248func cc_release(sess8: *u8) -> i64
called by 2: mainmain calls 2: cc_namenw_mark
256func cc_take_foreign(ids: *u8, i: i64, e: i64, self: *u8, name: *u8) -> i64
called by 2: cc_checkcc_walk calls 1: std_streq
271func cc_check(self8: *u8, pathv: *i64, pathn: i64) -> i64
336func cc_walk(self8: *u8) -> i64