nx_claim_core.nx
buildroot/runtime/nx_claim_core.nx
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
imports: nx_watch.nxnx_model_lane_core.nx
imported by: nx_claim_check.nxnx_claim_check_gate.nx
structs
| none |
consts
| 23 | const CC_MAGIC_999999999: i64 = 999999999 |
| 25 | const CC_STORE: *u8 = "knowledge/store/leash" |
| 26 | const CC_LOCK: *u8 = "knowledge/status/leash.lock" |
| 27 | const CC_NS: *u8 = "leash" |
| 28 | const CC_GRANT: i64 = 0 |
| 29 | const CC_DENY: i64 = 3 |
| 30 | const CC_ROWCAP: i64 = 512 |
| 31 | const CC_IDSCAP: i64 = 262144 |
| 32 | const CC_NAMECAP: i64 = 96 |
| 33 | const CC_SCOPECAP: i64 = 256 |
| 34 | const CC_CLAIM_PID: i64 = 1 |
| 35 | const CC_CH_PIPE: i64 = 124 |
| 36 | const CC_CH_NL: i64 = 10 |
| 37 | const CC_CH_SEMI: i64 = 59 |
| 38 | const CC_CH_COMMA: i64 = 44 |
| 39 | const CC_CH_STAR: i64 = 42 |
| 40 | const CC_CH_NUL: i64 = 0 |
functions
| 42 | func cc_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 45 | func cc_name(sess8: *u8, out: *u8) -> i64 |
| 57 | func cc_key(name: *u8, out: *u8) -> i64 |
| 67 | func cc_field(row: *u8, n: i64, k: i64, out: *u8, cap: i64) -> i64 |
| 83 | func cc_field_int(row: *u8, n: i64, k: i64) -> i64 |
| 99 | func cc_ids_add(name: *u8) -> i64 |
| 139 | func cc_live_verdict(age_ms: i64, ttl_ms: i64, word: *u8) -> i64 |
| 148 | func cc_scope_hit(scope: *u8, path: *u8) -> i64 |
| 171 | func cc_purpose_scope(purpose: *u8, out: *u8, cap: i64) -> i64 |
| 195 | func cc_register(sess8: *u8, ws: *u8, scope: *u8, ttl_ms: i64) -> i64 |
| 241 | func cc_beat(sess8: *u8) -> i64 |
| 248 | func cc_release(sess8: *u8) -> i64 |
| 256 | func cc_take_foreign(ids: *u8, i: i64, e: i64, self: *u8, name: *u8) -> i64 |
| 271 | func cc_check(self8: *u8, pathv: *i64, pathn: i64) -> i64 |
| 336 | func cc_walk(self8: *u8) -> i64 |