code wiki / _hdl_build / nx_team_chain.nx
nx_team_chain.nx source
↩ module page · 57 lines · 3261 B
1// nx_team_chain.nx -- the FULL LOOP, EXECUTED: research-grounded backlog -> PM assignments -> Warden
2// one-command builds -> admitted capabilities, as ONE chain run. The last hand-driven hop was the
3// translation from a PM assignment to an executable spec; this closes it: each BUILD assignment row
4// carries its CLASSIFIER TRAITS + the RESEARCHED NUMBERS (params traced from corroborated facts --
5// rule 4: no assumption reaches a build), so the chain needs no translator. Non-builds stay honest:
6// BLOCKED routes to design, PURSUE raises the research hand -- never fabricated into builds.
7// RACI: PM classifies+gates the plan (assign_gen), WARDEN routes each build (warden_build), Builder
8// authors, Engineer verifies -- this organ only SEQUENCES the chain (the Conductor's verb).
9// Spec row layout (CN_STRIDE i64s per assignment):
10// [0]=trait_a [1]=trait_b (classifier features; -1 = unused) [2..7]=params (meaning per pattern)
11// LAWS: struct-free, integer-only, flat ifs, <=6 args per func. license_tier: ORIGINAL
12import "nx_assign_gen.nx"
13import "nx_warden_build.nx"
14
15const CN_STRIDE: i64 = 8
16
17// build ONE assignment from its spec row: traits -> feature vector, params -> the emitter, then the
18// Warden's one-command build. out[0]=pattern out[1]=authored out[2]=test_pass. Returns the stage.
19func cn_build_one(spec: *i64, row: i64, name: *u8, out: *i64) -> i64 {
20 let base: i64 = row * CN_STRIDE
21 let f: *i64 = plc_new_features()
22 if spec[base] >= 0 { f[spec[base]] = 1 }
23 if spec[base + 1] >= 0 { f[spec[base + 1]] = 1 }
24 let p: *i64 = (spec as i64 + (base + 2) * 8) as *i64
25 return wb_build(f, name, p, out)
26}
27
28// durable chain line (append-only; one line per assignment per run)
29func cn_report(name: *u8, kind: i64, stage: i64, testpass: i64) -> i64 {
30 let fd: i64 = sys_openat_append("knowledge/status/team_chain.log" as *u8, 0x1a4)
31 if fd < 0 { return 0 }
32 wb_w(fd, "TEAMCHAIN item=" as *u8); wb_w(fd, name)
33 if kind == AG_BUILD { wb_w(fd, " kind=BUILD stage=" as *u8); wb_wn(fd, stage); wb_w(fd, " test_pass=" as *u8); wb_wn(fd, testpass) }
34 if kind == AG_BLOCKED { wb_w(fd, " kind=BLOCKED(needs-design)" as *u8) }
35 if kind == AG_PURSUE { wb_w(fd, " kind=PURSUE(research-hand-raised)" as *u8) }
36 if stage == BP_ADMITTED { wb_w(fd, " verdict=ADMITTED-HANDS-OFF" as *u8) }
37 wb_w(fd, "\n" as *u8)
38 sys_close(fd)
39 return 1
40}
41
42// the chain summary line: how much of the GENERATED plan the team executed hands-off this run
43func cn_summary(n_items: i64, n_build: i64, n_admitted: i64, grounded_permil: i64) -> i64 {
44 let fd: i64 = sys_openat_append("knowledge/status/team_chain.log" as *u8, 0x1a4)
45 if fd < 0 { return 0 }
46 wb_w(fd, "TEAMCHAIN-RUN items=" as *u8); wb_wn(fd, n_items)
47 wb_w(fd, " builds=" as *u8); wb_wn(fd, n_build)
48 wb_w(fd, " admitted=" as *u8); wb_wn(fd, n_admitted)
49 wb_w(fd, " grounded_permil=" as *u8); wb_wn(fd, grounded_permil)
50 var v: i64 = 0
51 if n_build > 0 { if n_admitted == n_build { v = 1 } }
52 if v == 1 { wb_w(fd, " verdict=ALL-BUILDS-ADMITTED" as *u8) }
53 if v == 0 { wb_w(fd, " verdict=ATTENTION" as *u8) }
54 wb_w(fd, " epoch=" as *u8); wb_wn(fd, sys_now_realtime_sec()); wb_w(fd, "\n" as *u8)
55 sys_close(fd)
56 return v
57}