code wiki / _hdl_build / nx_opportunity_loop.nx
nx_opportunity_loop.nx source
↩ module page · 49 lines · 2525 B
1// nx_opportunity_loop.nx -- the team's SELF-RUNNING opportunity-evaluation loop, made explicit so its
2// state is a fact (operator: "where are we on the self running loop evaluating opportunities"). The
3// cycle, with the organ that owns each stage:
4// SCAN (Market Researcher: capability -> opportunity) -> EVALUATE (value x feasibility; Critic/Examiner/
5// Referee judge) -> PRIORITIZE (layered-backlog frontier x growth-target = the next move) -> EXECUTE
6// (Builder authors / Engineer builds) -> JUDGE (Referee, objective) -> BANK (self-model; Teacher M0->M4)
7// -> loop. Every stage is TEAM-owned EXCEPT EXECUTE when a brand-NEW module must be authored (the
8// novel-module LLM-gap) -- so the loop runs AUTONOMOUSLY on existing search spaces and is Claude-gated
9// only when inventing a new primitive. license_tier: ORIGINAL Composes nx_market + nx_layered_backlog
10// + nx_self_sufficiency + nx_referee + nx_team_scorecard.
11
12import "nx_syscalls.nx"
13
14const OL_SCAN: i64 = 1
15const OL_EVAL: i64 = 2
16const OL_PRIO: i64 = 3
17const OL_EXEC: i64 = 4
18const OL_JUDGE:i64 = 5
19const OL_BANK: i64 = 6
20const OL_NSTAGE: i64 = 6
21
22const OL_TEAM: i64 = 1
23const OL_CLAUDE: i64 = 2
24
25// who owns a stage? all the team, except EXECUTE when a new module must be authored (novel-module gap).
26func ol_stage_owner(stage: i64, novel_module_needed: i64) -> i64 {
27 if stage == OL_EXEC { if novel_module_needed == 1 { return OL_CLAUDE } }
28 return OL_TEAM
29}
30
31// how many of the 6 stages are team-owned for this opportunity.
32func ol_autonomous_stages(novel_module_needed: i64) -> i64 {
33 var c: i64 = 0; var s: i64 = 1
34 while s <= OL_NSTAGE { if ol_stage_owner(s, novel_module_needed) == OL_TEAM { c = c + 1 } s = s + 1 }
35 return c
36}
37
38// the loop runs UNSUPERVISED for this opportunity iff no new module is needed (the search space exists).
39func ol_runs_autonomously(novel_module_needed: i64) -> i64 { if novel_module_needed == 0 { return 1 } return 0 }
40
41// opportunity score = value x feasibility; a NON-feasible opportunity scores 0 (only deliverable ones).
42func ol_score(value: i64, feasibility: i64) -> i64 { if feasibility <= 0 { return 0 } return value * feasibility }
43
44// the Market Researcher's PICK: the highest-scoring opportunity (the loop's current top move).
45func ol_pick_top(values: *i64, feas: *i64, n: i64) -> i64 {
46 var best: i64 = 0 - 1; var bs: i64 = 0 - 1; var i: i64 = 0
47 while i < n { let sc: i64 = ol_score(values[i], feas[i]); if sc > bs { bs = sc; best = i } i = i + 1 }
48 return best
49}