code wiki / _hdl_build / nx_ecosystem_maturity_rollup.nx
nx_ecosystem_maturity_rollup.nx source
↩ module page · 78 lines · 5239 B
1// nx_ecosystem_maturity_rollup.nx -- THE unifier CLI, SOVEREIGN edition: one re-runnable command that
2// measures the whole ecosystem's maturity (depth x breadth) from the NATIVE seg_store (knowledge/store/
3// ecomat -- no TSV) + the live autonomy ledger, prints the picture, writes a durable ledger line, and
4// exits GREEN/RED by the liar-kill. "Where are we?" = one command, sourced from the sovereign store.
5// argv[1]=store_prefix argv[2]=autonomy_log argv[3]=out_log. license_tier: ORIGINAL
6import "nx_ecomat_lib.nx"
7const K_MAGIC_86400: i64 = 86400
8
9func main(argc: i64, argv: *i64) -> i64 {
10 if argc>=2 {if el_streq(argv[1] as *u8,"requirements-v1")==1 {
11 if argc!=5 {return 2}
12 return em_requirements_run(argv[2] as *u8,em_req_capacity(argv[3] as *u8),em_req_capacity(argv[4] as *u8))
13 }}
14 var store: *u8 = ECOMAT_STORE
15 var autolog: *u8 = "knowledge/status/autonomy_meter.log" as *u8
16 var outlog: *u8 = "knowledge/status/ecosystem_maturity.log" as *u8
17 if argc >= 2 { store = argv[1] as *u8 }
18 if argc >= 3 { autolog = argv[2] as *u8 }
19 if argc >= 4 { outlog = argv[3] as *u8 }
20 _p("=== NISHI ECOSYSTEM MATURITY ROLLUP -- sovereign seg_store, measured never asserted ===\n" as *u8)
21 let out: *i64 = sys_mmap(256)
22 let verdict: i64 = em_rollup_store(store, autolog, out, 1)
23 if out[2] == 0 { _p("\n store EMPTY -- run nx_ecomat_seed first (authors knowledge/store/ecomat)\n" as *u8); sys_exit(1); return 1 }
24 let lfd: i64 = sys_openat_append(outlog, 0x1a4)
25 if lfd >= 0 {
26 _fp(lfd, "ECOMAT epoch=" as *u8); _fn(lfd, sys_now_realtime_sec())
27 _fp(lfd, " domains=" as *u8); _fn(lfd, out[2])
28 _fp(lfd, " overall_permil=" as *u8); _fn(lfd, out[0])
29 _fp(lfd, " sum_cur=" as *u8); _fn(lfd, out[6])
30 _fp(lfd, " sum_bar=" as *u8); _fn(lfd, out[7])
31 _fp(lfd, " sclass_plus=" as *u8); _fn(lfd, out[3])
32 _fp(lfd, " absent=" as *u8); _fn(lfd, out[4])
33 _fp(lfd, " autonomy_permil=" as *u8); _fn(lfd, out[5])
34 // The durable row must carry the age too: a reader of this log three weeks from now needs to
35 // know whether the figure was live WHEN IT WAS WRITTEN, not just what it was.
36 _fp(lfd, " autonomy_age_s=" as *u8); _fn(lfd, out[12])
37 _fp(lfd, " autonomy_stale=" as *u8); _fn(lfd, out[13])
38 _fp(lfd, " liar_kill=" as *u8); _fn(lfd, out[1])
39 _fp(lfd, " triangulated=" as *u8); _fn(lfd, out[8])
40 _fp(lfd, " conflict=" as *u8); _fn(lfd, out[9])
41 _fp(lfd, " single=" as *u8); _fn(lfd, out[10])
42 _fp(lfd, " dangling=" as *u8); _fn(lfd, out[11])
43 _fp(lfd, " src=seg_store verdict=" as *u8)
44 if verdict == 0 { _fp(lfd, "GREEN" as *u8) } else { _fp(lfd, "RED" as *u8) }
45 _fp(lfd, "\n" as *u8)
46 sys_close(lfd)
47 }
48 _p("\n OVERALL maturity toward S-class (depth x breadth) = " as *u8); _fn(1, out[0])
49 _p(" permil (" as *u8); _fn(1, out[6]); _p("/" as *u8); _fn(1, out[7]); _p(" levels across " as *u8); _fn(1, out[2]); _p(" domains)\n" as *u8)
50 // Say LIVE only when it is live. out[13]=1 means the autonomy ledger is older than
51 // ECOMAT_AUTO_STALE_S, and out[12] is its age in seconds.
52 if out[13] == 1 {
53 _p(" autonomy = " as *u8); _fn(1, out[5]); _p(" permil ⚠STALE (ledger last written " as *u8)
54 _fn(1, out[12] / K_MAGIC_86400); _p("d ago -- run nx_autonomy_meter; this is NOT a live figure)" as *u8)
55 _p(" | S-class reached in " as *u8); _fn(1, out[3])
56 }
57 if out[13] != 1 {
58 _p(" live autonomy = " as *u8); _fn(1, out[5]); _p(" permil | S-class reached in " as *u8); _fn(1, out[3])
59 }
60 _p(" domains | ABSENT in " as *u8); _fn(1, out[4]); _p(" domains\n" as *u8)
61 // PUBLISH THE DENOMINATOR BESIDE THE SCORE (2026-08-22). The meter declares axes_known/PARTIAL; every
62 // consumer dropped it and printed a 3-axis average as a whole-system figure. Same class as the age
63 // fix above: fixing the writer did not fix the reader.
64 if out[15] == 1 {
65 _p(" ^ autonomy is PARTIAL: averaged over " as *u8); _fn(1, out[14])
66 _p(" of 4 axes. One axis had NO data, so the 4-axis figure is UNKNOWN --\n" as *u8)
67 _p(" NOT this number rescaled: an unscored axis is not a measured zero. Run nx_autonomy_meter\n" as *u8)
68 _p(" and read a<N>=-1 to see which axis is blind.\n" as *u8)
69 }
70 let stored_n: i64 = out[2] - out[8] - out[10] - out[9] - out[11]
71 _p(" VALIDATION (triangulated = 2+ INDEPENDENT sources that converge): triangulated " as *u8); _fn(1, out[8])
72 _p(" / single-source " as *u8); _fn(1, out[10]); _p(" / stored " as *u8); _fn(1, stored_n); _p(" / DANGLING " as *u8); _fn(1, out[11]); _p(" / CONFLICTS " as *u8); _fn(1, out[9]); _p("\n" as *u8)
73 if out[11] > 0 { _p(" ^ DANGLING = evidence pointer declared but its log is missing/unreadable -> grade is the UNVERIFIED stored assertion (regenerate the gate log to validate)\n" as *u8) }
74 _p(" source: knowledge/store/ecomat (sovereign seg_store, no TSV) durable: ecosystem_maturity.log verdict=" as *u8)
75 if verdict == 0 { _p("GREEN\n" as *u8) } else { _p("RED (liar-kill fired)\n" as *u8) }
76 sys_exit(verdict)
77 return verdict
78}