code wiki / _hdl_build / nx_gap_scan.nx
nx_gap_scan.nx source
↩ module page · 35 lines · 1754 B
1// nx_gap_scan.nx -- the team scans its OWN capability set for gaps (operator: "see if there are any
2// other gaps"). Each capability area is one of: STRONG (proven/triangulated -> no gap), WEAK (owned but
3// below S-class -- a parity/proxy improvement gap), LLM (needs the LLM rung -- a sovereignty gap backed
4// by the provider), MISSING (not built -- a build gap). The scanner tallies and names the MOST URGENT
5// gap (MISSING > LLM > WEAK), so "what to build next" is deterministic, not ad-hoc. Composes the
6// LLM-gap registry + the Teacher's rungs. license_tier: ORIGINAL
7
8import "nx_syscalls.nx"
9
10const GAP_STRONG: i64 = 0 // proven + triangulated -> no gap
11const GAP_WEAK: i64 = 1 // owned but below S-class (parity / weak proxy) -> improve
12const GAP_LLM: i64 = 2 // needs the LLM rung (provider-backed, not sovereign) -> sovereignty gap
13const GAP_MISSING: i64 = 3 // not built at all -> build gap (most urgent)
14
15func gap_is_gap(status: i64) -> i64 { if status == GAP_STRONG { return 0 } return 1 }
16
17// urgency = the status code itself (MISSING 3 > LLM 2 > WEAK 1 > STRONG 0).
18func gap_count(statuses: *i64, n: i64, kind: i64) -> i64 {
19 var c: i64 = 0; var i: i64 = 0
20 while i < n { if statuses[i] == kind { c = c + 1 } i = i + 1 }
21 return c
22}
23
24func gap_total(statuses: *i64, n: i64) -> i64 {
25 var c: i64 = 0; var i: i64 = 0
26 while i < n { if gap_is_gap(statuses[i]) == 1 { c = c + 1 } i = i + 1 }
27 return c
28}
29
30// index of the most-urgent gap (highest status; ties -> first). -1 if no gaps.
31func gap_most_urgent(statuses: *i64, n: i64) -> i64 {
32 var best: i64 = 0 - 1; var bestu: i64 = 0; var i: i64 = 0
33 while i < n { if statuses[i] > bestu { bestu = statuses[i]; best = i } i = i + 1 }
34 return best
35}