diff --git a/Makefile b/Makefile index eb2a1ed2d..7c62f49d6 100644 --- a/Makefile +++ b/Makefile @@ -554,6 +554,24 @@ r15-receipt: test-r15-receipt: tests/r15_receipt_test.sh +# R16-G2 code-search gate (spec/r16-orchestrator-retirement.md). Host-only C tool, +# seconds, no network. Scans the five repos (paths from R16_REPO_OMEGA, +# R16_REPO_SOVEREIGN_CORE, R16_REPO_AEGIS_RUNTIME, R16_REPO_AIENOS, +# R16_REPO_PHYSICS; defaults: this tree and ~/workspace/r16-survey/) and +# joins every loop-shaped site with spec/r16-orchestrator-retirement-map.md. +# Exit 0 only when every site is classified A-F, no omega class-A site is +# still under a production name, and all five repos were scanned. +R16_INVENTORY = $(OUT_DIR)/r16_loop_inventory +$(R16_INVENTORY): tools/r16_loop_inventory.c | $(OUT_DIR) + $(CC) $(CFLAGS) -o $@ tools/r16_loop_inventory.c + +.PHONY: r16-inventory test-r16-inventory +r16-inventory: $(R16_INVENTORY) + $(R16_INVENTORY) --map spec/r16-orchestrator-retirement-map.md --json $(OUT_DIR)/r16-inventory.json + +test-r16-inventory: $(R16_INVENTORY) + sh tests/r16_inventory/run.sh $(R16_INVENTORY) + # OMEGA_ACTION_GRAPH_IR: goals compile to typed action graphs that run as # resident reactions by readiness alone. rx_graph.o is built alone first and diff --git a/docs/r16-operator-brief.md b/docs/r16-operator-brief.md new file mode 100644 index 000000000..a93bb440a --- /dev/null +++ b/docs/r16-operator-brief.md @@ -0,0 +1,606 @@ +# R16 operator brief (Part II, verbatim) + +Source: operator prompt "FINISH ADR 0016 — R15 PERFORMANCE PROOF, THEN R16 +ORCHESTRATOR RETIREMENT", Part II, decoded 2026-09-28 from the Codex session log +`~/.codex/sessions/2026/09/27/rollout-2026-09-27T21-37-13-01a0e5df-a2e0-7100-852c-53a7e4ce2b34.jsonl`. +It was not in any repository before this commit. Text below is unedited. +The binding acceptance criteria are in `spec/r16-orchestrator-retirement.md`. + +```text +PART II — R16 RETIRE CENTRAL ORCHESTRATION +============================================================ + +BEGIN ONLY AFTER: + +R15_REACTION_PERFORMANCE_PASS + +is merged and candidate-bound. + +First perform an organization-wide CODE audit. + +At minimum inspect: + +aien-dev/omega +aien-dev/aien-sovereign-core +aien-dev/aegis-runtime +aien-dev/aienos +aien-dev/physics + +Search for: + +run_until_complete +for/while semantic step loops +max_steps +max_turns +manual faculty invocation +polling for semantic readiness +central switch statements choosing subsystem order +synchronous AIEN → Omega calls +synchronous Omega → AEGIS calls +heartbeat task dispatch +duplicate schedulers +duplicate world ownership +duplicate authority ownership +service/RPC boundaries now replaced by shared reactions + +Produce: + +spec/r16-orchestrator-retirement-map.md + +Classify every central loop as exactly one of: + +A. RETIRE +Production semantic sequencing now replaced by reactions. + +B. KEEP — MAINTENANCE CONTROL +Explicit deterministic operator or maintenance mechanism. + +C. KEEP — RECOVERY +Needed for boot/recovery/repair. + +D. KEEP — REFERENCE ORACLE +Non-authoritative comparison/test path. + +E. KEEP — PHYSICAL SCHEDULER +Schedules physical resources/work, not faculty semantics. + +F. KEEP — EXTERNAL PROTOCOL LOOP +Network/socket/event-loop mechanics that do not decide semantic faculty order. + +Do not delete a loop merely because it is a loop. + +The forbidden thing is CENTRAL SEMANTIC ORCHESTRATION. + +============================================================ +R16 TARGET 1 — aien-sovereign-core +============================================================ + +Current known path: + +crates/aien-runtime/src/spine.rs + +contains: + +AienRuntimeSpine::run_until_complete() + +which loops: + +for _ in 0..max_steps { + self.step(backend).await +} + +This is the clearest known legacy semantic orchestrator. + +Determine whether the new resident reaction path now provides equivalent or +stronger production behavior. + +If yes: + +remove this path from production semantic authority. + +Possible acceptable end states include: + +- move behind an explicit legacy/reference build feature; +- restrict to tests/benchmark oracle; +- preserve an operator-only deterministic compatibility mode; +- remove entirely if nothing legitimately needs it. + +Do not choose the mechanism based on aesthetics. + +Production AIEN must no longer require a caller to repeatedly call `step()` to +decide semantic progress. + +If `step()` remains because a physical inference backend needs a primitive +advance operation, clearly separate: + +PHYSICAL ENGINE STEP + +from + +SEMANTIC SYSTEM SCHEDULING. + +A physical engine step may remain. + +A master semantic loop deciding when the system thinks/realizes/authorizes may +not. + +============================================================ +R16 TARGET 2 — aegis-runtime +============================================================ + +Current live code contains: + +src/agent.rs +AgentEngine::execute_task() + +for turn in 1..=max_turns { + model + tool + model + tool +} + +and: + +src/heartbeat.rs +start_loop() +pulse_once() + +which periodically scans SQLite pending tasks and dispatches actions. + +The resident R8 AEGIS faculty is already a different authority model. + +Audit whether these legacy components remain needed for: + +- compatibility; +- operator maintenance; +- reference testing; +- old standalone tool-agent mode. + +If they remain, explicitly mark them LEGACY/NON-AUTHORITATIVE and ensure the +production resident architecture does not depend on them for policy or +semantic progression. + +Do not rename the old runtime and pretend it became the resident faculty. + +============================================================ +R16 TARGET 3 — DUPLICATE OWNERSHIP +============================================================ + +Find places where old subsystems still independently own: + +- scheduler; +- world state; +- authority state; +- semantic task queues; +- model of generation; +- resource pool; +- causal state. + +Where the reaction architecture is authoritative, eliminate or demote duplicate +production ownership. + +There should not be: + +AIEN scheduler +Omega scheduler +AEGIS scheduler + +independently deciding semantic order. + +There may still be physical worker pools. + +============================================================ +R16 PRODUCTION LAW +============================================================ + +After R16, the normal semantic progression must be: + +state publication + ↓ +dependency readiness + ↓ +resource admission + ↓ +authority validation + ↓ +reaction execution + ↓ +atomic publication + ↓ +new readiness + +No production function may encode: + +call AIEN +wait +call Omega +wait +call AEGIS +wait +dispatch GPU +wait + +as the authoritative path. + +============================================================ +DO NOT REMOVE THESE +============================================================ + +Per ADR 0016, retain: + +- known-good fallback; +- recovery path; +- deterministic maintenance controls; +- trusted capability root; +- generation mechanism; +- evidence. + +Also preserve: + +- R9 crash recovery; +- R10 verifier; +- R12 seat-loss handling; +- R14 recovery paths; +- operator emergency controls; +- benchmark reference paths where needed. + +Do not optimize the architecture by deleting the evidence that proved it. + +============================================================ +R16 AUTHORITATIVE-PATH TEST +============================================================ + +Create an explicit test proving that the production golden path works with +legacy semantic orchestrators unavailable. + +For example: + +build/run configuration where: + +AienRuntimeSpine::run_until_complete +legacy AEGIS AgentEngine loop +legacy AEGIS heartbeat task dispatcher + +are unavailable as semantic authorities. + +Then run: + +R13 living system +R14 recovery subset/full qualification as appropriate + +The organism must still: + +receive goal +AIEN reacts +Omega reacts +authority works +GPU works +evidence returns +generation promotes +recovery works + +If disabling a legacy orchestrator breaks the new production path, R16 is not +done. + +============================================================ +R16 NEGATIVE TEST +============================================================ + +Also prove the reverse: + +legacy/reference paths cannot mutate authoritative resident state except +through the same normal capability/publication boundaries. + +A legacy oracle must not be able to: + +- write authoritative AIEN belief directly; +- select Omega realization directly; +- mint authority; +- promote generation; +- bypass Effect/authority boundaries; +- manually advance world generation. + +============================================================ +R16 API / BUILD SURFACE +============================================================ + +Make the distinction visible in code. + +Avoid ambiguous APIs where a future developer can accidentally re-enable the +old architecture. + +Use explicit naming/features/modules such as: + +legacy_oracle +maintenance +recovery +reference + +where appropriate. + +Do not leave: + +run_until_complete() + +as the obvious default production entry point if it is no longer authoritative. + +Document the supported production entry point. + +============================================================ +R16 DEAD-CODE / DEPENDENCY AUDIT +============================================================ + +After retiring orchestration: + +- remove unreachable central scheduling code where safe; +- remove service glue used only by retired sequencing; +- remove duplicate queues where safe; +- remove duplicate state ownership; +- remove stale dependencies. + +But do this only where evidence proves replacement. + +Do not perform a giant unrelated cleanup. + +============================================================ +R16 CORRECTNESS REGRESSION +============================================================ + +R16 must rerun EVERY R gate. + +At minimum: + +R1 +R2 +R3 +R4 +R5 +R6 +R7 +R8 +R9 +R10 +R11 +R12 host +R12 silicon +R13 host +R13 silicon +R14 host +R14 silicon +R15 physical performance qualification + +R15 numbers do not have to be byte-identical after code removal, but the +pre-registered R15 acceptance policy must still pass. + +If performance changes materially, record a new R15-compatible measurement +bundle in the R16 qualification. + +============================================================ +R16 CODE SEARCH GATE +============================================================ + +Create a machine-readable inventory of all remaining central loops matching +patterns such as: + +run_until_complete +max_steps +max_turns +manual step loops +heartbeat semantic task dispatch +faculty service sequencing + +For each surviving match, attach classification: + +maintenance +recovery +reference +physical scheduler +external protocol + +No unclassified production semantic orchestrator may remain. + +Gate fails if one remains. + +============================================================ +R16 RECEIPT +============================================================ + +Create: + +spec/r16-orchestrator-retirement.md + +evidence/R16/.json + +Suggested schema: + +AIEN_RX_R16_ORCHESTRATOR_RETIRED_V1 + +Include: + +candidate_commit +run_commit +candidate_bound +tree_dirty +silicon_observed + +R1–R15 rerun results + +retirement inventory: +repo +path +symbol +old role +new role +classification +authoritative = true/false + +production entry point + +legacy orchestrators disabled test + +legacy cannot bypass authority test + +remaining central-loop count +remaining unclassified semantic-loop count = 0 + +known-good fallback present = true +recovery present = true +maintenance controls present = true +trusted capability root present = true +generation mechanism present = true +evidence present = true + +R15 acceptance still passing = true + +gate: +R16_ORCHESTRATOR_RETIRED = PASS + +============================================================ +R16 QUALIFICATION DISCIPLINE +============================================================ + +1. complete retirement map first; +2. commit map/spec; +3. make minimal code changes; +4. add explicit authoritative-path tests; +5. commit candidate; +6. clean tree; +7. run entire R1–R15 ladder; +8. run physical GB10 qualification; +9. verify R15 acceptance remains satisfied; +10. candidate == run commit; +11. generate receipt; +12. commit evidence unchanged; +13. open PR; +14. merge with merge commit. + +============================================================ +FINAL ADR 0016 COMPLETION CHECK +============================================================ + +After R16 merge, perform one fresh clean checkout of the merged tree. + +From that checkout verify: + +R1 PASS +R2 PASS +R3 PASS +R4 PASS +R5 PASS +R6 PASS +R7 PASS +R8 PASS +R9 PASS +R10 PASS +R11 PASS +R12 PASS +R13 PASS +R14 PASS +R15 PASS +R16 PASS + +Then inspect production code again. + +The final architecture must truthfully be describable as: + +AIEN is a persistent resident computational system in which cognition, +realization, authority, resource arbitration, CPU/GPU execution, evidence, +recovery and durable promotion operate over one generation-addressed object +world. + +Work progresses because dependencies become ready, not because a master loop +chooses which faculty goes next. + +============================================================ +DO NOT OVERCLAIM +============================================================ + +Completion of R16 means: + +ADR 0016 / Resident Reaction Architecture migration COMPLETE. + +It does NOT mean the entire AIEN 42-phase master plan is complete. + +Do not claim: + +- full Skill Network completion; +- complete J-Space productization; +- complete Fabric deployment; +- complete whole-product Effect Broker path; +- full Cortex product integration; +- full RSI product integration; +- final install/update UX; +- Phase 41 whole-AIEN golden path; +- Phase 42 final release qualification; + +unless separately proven by their own current evidence. + +============================================================ +FINAL REPORT TO OPERATOR +============================================================ + +When both gates are merged, report: + +R15: +- implementation commit +- evidence commit +- receipt SHA +- raw evidence location +- exact hardware +- benchmark methodology +- legacy vs resident table +- every mandatory ADR metric +- statistically supported wins +- regressions/tradeoffs +- energy method +- acceptance criteria and result + +R16: +- implementation commit +- evidence commit +- receipt SHA +- every retired orchestrator +- every surviving loop and its classification +- production entry point +- proof that legacy loops are unnecessary for the resident golden path +- proof legacy paths cannot bypass authority +- full R1–R16 rerun +- remaining limitations + +Finish with exactly one architectural status statement: + +ADR 0016 RESIDENT REACTION MIGRATION: +COMPLETE + +Only say that if both: + +R15_REACTION_PERFORMANCE_PASS +and +R16_ORCHESTRATOR_RETIRED + +are genuinely proven. + +============================================================ +FIRST ACTION NOW +============================================================ + +Fetch current main in every relevant repository. + +Do not trust README claims. + +Inspect actual code. + +Produce the R15 benchmark/instrumentation map. + +Commit the R15 methodology BEFORE looking at final qualification results. + +Then execute R15. + +If and only if R15 passes, proceed immediately to R16 and finish the +migration. + +Do not stop merely because one benchmark looks impressive. +Do not stop merely because old code was marked deprecated. +Finish both gates with candidate-bound evidence. +``` diff --git a/evidence/R16/inventory.json b/evidence/R16/inventory.json new file mode 100644 index 000000000..ff02c084e --- /dev/null +++ b/evidence/R16/inventory.json @@ -0,0 +1,295 @@ +{ + "schema": "AIEN_R16_LOOP_INVENTORY_V1", + "map": "spec/r16-orchestrator-retirement-map.md", + "repos": [ + {"name": "omega", "path": ".", "head": "f17131b4c8be53e622de2064780b77dc7e9f7da1", "map_sha": "193a7e7123456d6bee7e16918ea9dd19821a845f", "status": "SCANNED", "sites_by_class": {"A": 1, "B": 18, "C": 2, "D": 74, "E": 12, "F": 2, "N": 15, "?": 0}, "term_hits": {"poll": 34, "sleep": 69, "wait": 215, "recv": 3, "heartbeat": 24, "tick": 61, "dispatch": 52, "schedule": 95, "orchestrate": 10, "turn": 0, "step": 609, "pulse": 17, "yield": 19, "run_until_complete": 2, "max_steps": 35, "max_turns": 0}}, + {"name": "aien-sovereign-core", "path": "/home/drakestapleton/workspace/r16-survey/aien-sovereign-core", "head": "63fe7a782a57445c299b11d4dbcb7db3a03af5f6", "map_sha": "63fe7a782a57445c299b11d4dbcb7db3a03af5f6", "status": "SCANNED", "sites_by_class": {"A": 14, "B": 5, "C": 0, "D": 40, "E": 11, "F": 18, "N": 2, "?": 0}, "term_hits": {"poll": 0, "sleep": 27, "wait": 18, "recv": 21, "heartbeat": 15, "tick": 4, "dispatch": 51, "schedule": 173, "orchestrate": 0, "turn": 60, "step": 389, "pulse": 30, "yield": 3, "run_until_complete": 7, "max_steps": 7, "max_turns": 0}}, + {"name": "aegis-runtime", "path": "/home/drakestapleton/workspace/r16-survey/aegis-runtime", "head": "2bbce76b056d39dfdf6c2417d4ffc7919a76749c", "map_sha": "2bbce76b056d39dfdf6c2417d4ffc7919a76749c", "status": "SCANNED", "sites_by_class": {"A": 18, "B": 0, "C": 0, "D": 1, "E": 0, "F": 0, "N": 1, "?": 0}, "term_hits": {"poll": 0, "sleep": 0, "wait": 0, "recv": 2, "heartbeat": 71, "tick": 26, "dispatch": 16, "schedule": 0, "orchestrate": 8, "turn": 69, "step": 70, "pulse": 27, "yield": 0, "run_until_complete": 0, "max_steps": 3, "max_turns": 13}}, + {"name": "aienos", "path": "/home/drakestapleton/workspace/r16-survey/aienos", "head": "8706fb8bdfe8a5c4ffc6f16ad96af5ab5e6922a4", "map_sha": "8706fb8bdfe8a5c4ffc6f16ad96af5ab5e6922a4", "status": "SCANNED", "sites_by_class": {"A": 0, "B": 0, "C": 0, "D": 12, "E": 8, "F": 1, "N": 11, "?": 0}, "term_hits": {"poll": 13, "sleep": 0, "wait": 29, "recv": 17, "heartbeat": 0, "tick": 32, "dispatch": 25, "schedule": 110, "orchestrate": 0, "turn": 0, "step": 90, "pulse": 0, "yield": 4, "run_until_complete": 0, "max_steps": 0, "max_turns": 0}}, + {"name": "physics", "path": "/home/drakestapleton/workspace/r16-survey/physics", "head": "fecbedb1b9cea9e4de0fa3c88fe795934fb361f9", "map_sha": "fecbedb1b9cea9e4de0fa3c88fe795934fb361f9", "status": "SCANNED", "sites_by_class": {"A": 0, "B": 1, "C": 0, "D": 2, "E": 1, "F": 0, "N": 1, "?": 0}, "term_hits": {"poll": 0, "sleep": 3, "wait": 13, "recv": 0, "heartbeat": 0, "tick": 0, "dispatch": 0, "schedule": 2, "orchestrate": 0, "turn": 0, "step": 0, "pulse": 0, "yield": 0, "run_until_complete": 0, "max_steps": 0, "max_turns": 0}} + ], + "sites": [ + {"repo": "omega", "path": "research/m15/spbm/sample.c", "lines": "79", "symbol": "main", "trigger": "for:body:nanosleep", "row": "OM-001", "class": "D", "authoritative": "false", "evidence": "for (unsigned int seq=0;seq<=seconds*10;seq++) {"}, + {"repo": "omega", "path": "research/m15/spbm/sample.c", "lines": "85", "symbol": "main", "trigger": "do:body:nanosleep", "row": "OM-002", "class": "D", "authoritative": "false", "evidence": "do { rc=clock_nanosleep(CLOCK_MONOTONIC,TIMER_ABSTIME,&when,NULL); } while(rc==EINTR);"}, + {"repo": "omega", "path": "src/crumbline/cl_search.c", "lines": "97", "symbol": "equiv_seen", "trigger": "for:unbounded", "row": "OM-003", "class": "N", "authoritative": "false", "evidence": "for (;;) {"}, + {"repo": "omega", "path": "src/language/omega_lex.c", "lines": "120", "symbol": "omega_language_lex", "trigger": "while:unbounded", "row": "OM-004", "class": "N", "authoritative": "false", "evidence": "while (1) {"}, + {"repo": "omega", "path": "src/language/omega_lower.c", "lines": "320", "symbol": "omega_language_lower_program", "trigger": "while:unbounded", "row": "OM-005", "class": "N", "authoritative": "false", "evidence": "while (1) {"}, + {"repo": "omega", "path": "src/language/omega_parse.c", "lines": "263", "symbol": "parse_clause", "trigger": "while:unbounded", "row": "OM-006", "class": "N", "authoritative": "false", "evidence": "while (1) {"}, + {"repo": "omega", "path": "src/omega_accelerator_world.c", "lines": "21", "symbol": "allocate_handle_epoch", "trigger": "for:unbounded", "row": "OM-007", "class": "N", "authoritative": "false", "evidence": "for (;;) {"}, + {"repo": "omega", "path": "src/omega_accelerator_world.c", "lines": "733", "symbol": "omega_world_drain", "trigger": "for:body:dispatch", "row": "OM-008", "class": "C", "authoritative": "true", "evidence": "for (uint32_t i = 0; i < world->in_flight_count; i++) {"}, + {"repo": "omega", "path": "src/omega_world_gates.c", "lines": "234", "symbol": "test_m19_gate3_channel_reuse", "trigger": "for:body:dispatch", "row": "OM-009", "class": "D", "authoritative": "false", "evidence": "for (uint32_t step = 0; step < 4 && ok; step++) {"}, + {"repo": "omega", "path": "src/omega_world_gates.c", "lines": "664", "symbol": "test_m19_gate7_queue_wrap", "trigger": "while:body:dispatch", "row": "OM-010", "class": "D", "authoritative": "false", "evidence": "while (submitted < stress_count) {"}, + {"repo": "omega", "path": "src/omega_world_gates.c", "lines": "668", "symbol": "test_m19_gate7_queue_wrap", "trigger": "for:body:dispatch", "row": "OM-011", "class": "D", "authoritative": "false", "evidence": "for (uint32_t k = 0; k < batch; k++) {"}, + {"repo": "omega", "path": "src/omega_world_gates.c", "lines": "685", "symbol": "test_m19_gate7_queue_wrap", "trigger": "while:body:dispatch", "row": "OM-012", "class": "D", "authoritative": "false", "evidence": "while (*world.completion.cpu_marker < dispatch_id) {"}, + {"repo": "omega", "path": "src/omega_world_gates.c", "lines": "1153", "symbol": "test_m19_gate8_1000_op", "trigger": "for:body:dispatch", "row": "OM-013", "class": "D", "authoritative": "false", "evidence": "for (uint32_t cycle = 0; cycle < 250; cycle++) {"}, + {"repo": "omega", "path": "src/omega_world_gates.c", "lines": "1593", "symbol": "test_m19_gate13_memory_bound", "trigger": "for:body:dispatch", "row": "OM-014", "class": "D", "authoritative": "false", "evidence": "for (int i = 0; i < 10; i++) {"}, + {"repo": "omega", "path": "src/omega_world_gates.c", "lines": "1597", "symbol": "test_m19_gate13_memory_bound", "trigger": "for:body:dispatch", "row": "OM-015", "class": "D", "authoritative": "false", "evidence": "for (int i = 0; i < 200; i++) {"}, + {"repo": "omega", "path": "src/runtime/rx_caproot.c", "lines": "63", "symbol": "take_boot_gen", "trigger": "for:unbounded", "row": "OM-016", "class": "N", "authoritative": "false", "evidence": "for (;;) {"}, + {"repo": "omega", "path": "src/runtime/rx_caproot.c", "lines": "572", "symbol": "rx_caproot_inspect", "trigger": "for:unbounded", "row": "OM-017", "class": "N", "authoritative": "false", "evidence": "for (;;) {"}, + {"repo": "omega", "path": "src/runtime/rx_caproot.c", "lines": "594", "symbol": "rx_caproot_validate", "trigger": "for:unbounded", "row": "OM-018", "class": "N", "authoritative": "false", "evidence": "for (;;) {"}, + {"repo": "omega", "path": "src/runtime/rx_coherent.c", "lines": "835", "symbol": "rx_resident_seat_step", "trigger": "for:unbounded", "row": "OM-019", "class": "E", "authoritative": "true", "evidence": "for (;;) {"}, + {"repo": "omega", "path": "src/runtime/rx_contract.c", "lines": "1200", "symbol": "rc_from_json", "trigger": "for:unbounded", "row": "OM-020", "class": "N", "authoritative": "false", "evidence": "for (;;) {"}, + {"repo": "omega", "path": "src/runtime/rx_generation.c", "lines": "412", "symbol": "file_matches", "trigger": "for:unbounded", "row": "OM-021", "class": "N", "authoritative": "false", "evidence": "for (;;) {"}, + {"repo": "omega", "path": "src/runtime/rx_generation.c", "lines": "1226", "symbol": "exec_main", "trigger": "for:unbounded", "row": "OM-022", "class": "E", "authoritative": "true", "evidence": "for (;;) {"}, + {"repo": "omega", "path": "src/runtime/rx_graph.c", "lines": "919", "symbol": "rx_graph_optimize", "trigger": "for:unbounded", "row": "OM-023", "class": "N", "authoritative": "false", "evidence": "for (;;) {"}, + {"repo": "omega", "path": "src/runtime/rx_omega.c", "lines": "478", "symbol": "sandbox_run", "trigger": "while:body:poll", "row": "OM-024", "class": "F", "authoritative": "true", "evidence": "while (got < sizeof(*rep)) {"}, + {"repo": "omega", "path": "src/runtime/rx_plan_arrange.c", "lines": "45", "symbol": "pla_goal_read", "trigger": "named:max_steps", "row": "OM-025", "class": "E", "authoritative": "true", "evidence": "g->max_steps = gf[2];"}, + {"repo": "omega", "path": "src/runtime/rx_plan_arrange.c", "lines": "240", "symbol": "heur", "trigger": "for:unbounded", "row": "OM-026", "class": "N", "authoritative": "false", "evidence": "for (;;) {"}, + {"repo": "omega", "path": "src/runtime/rx_plan_arrange.c", "lines": "277", "symbol": "heap_pop", "trigger": "for:unbounded", "row": "OM-027", "class": "N", "authoritative": "false", "evidence": "for (;;) {"}, + {"repo": "omega", "path": "src/runtime/rx_plan_arrange.h", "lines": "41", "symbol": "-", "trigger": "named:max_steps", "row": "OM-028", "class": "E", "authoritative": "true", "evidence": "uint64_t seq, kind, max_steps, energy;"}, + {"repo": "omega", "path": "src/runtime/rx_resident_gpu.c", "lines": "709", "symbol": "wait_marker_or_abort", "trigger": "for:body:usleep", "row": "OM-029", "class": "E", "authoritative": "true", "evidence": "for (int i = 0; i < timeout_ms * 20; i++) {"}, + {"repo": "omega", "path": "src/runtime/rx_resident_gpu.c", "lines": "862", "symbol": "wait_heartbeat", "trigger": "for:body:usleep", "row": "OM-030", "class": "E", "authoritative": "true", "evidence": "for (int i = 0; i < 2000; i++) {"}, + {"repo": "omega", "path": "src/runtime/rx_resident_gpu.c", "lines": "899", "symbol": "lease_main", "trigger": "while:body:usleep", "row": "OM-031", "class": "E", "authoritative": "true", "evidence": "while (s->lease_run) {"}, + {"repo": "omega", "path": "src/runtime/rx_resident_gpu.c", "lines": "957", "symbol": "rx_gpu_seat_kill", "trigger": "for:body:usleep", "row": "OM-032", "class": "C", "authoritative": "true", "evidence": "for (int i = 0; i < 2000 && !s->marker_ok; i++) usleep(1000);"}, + {"repo": "omega", "path": "src/runtime/rx_seq_reference.c", "lines": "52", "symbol": "rx_seq_pulse", "trigger": "for:body:poll", "row": "OM-033", "class": "D", "authoritative": "false", "evidence": "for (uint32_t i = 0; i < plan->n && rc == RX_OK; i++) {"}, + {"repo": "omega", "path": "src/runtime/rx_seq_reference.c", "lines": "79", "symbol": "rx_seq_pulse", "trigger": "while:body:yield", "row": "OM-034", "class": "D", "authoritative": "false", "evidence": "while (r->state != RX_DORMANT) {"}, + {"repo": "omega", "path": "src/runtime/rx_seq_reference.c", "lines": "101", "symbol": "-", "trigger": "named:run_until_complete", "row": "OM-035", "class": "D", "authoritative": "false", "evidence": "int rx_seq_run_until_complete(RxWorld *w, const RxSeqPlan *plan, uint32_t max_pulses,"}, + {"repo": "omega", "path": "src/runtime/rx_seq_reference.c", "lines": "105", "symbol": "rx_seq_run_until_complete", "trigger": "for:body:pulse", "row": "OM-036", "class": "D", "authoritative": "false", "evidence": "for (; p < max_pulses; p++) {"}, + {"repo": "omega", "path": "src/runtime/rx_seq_reference.h", "lines": "56", "symbol": "-", "trigger": "named:run_until_complete", "row": "OM-037", "class": "D", "authoritative": "false", "evidence": "int rx_seq_run_until_complete(RxWorld *w, const RxSeqPlan *plan, uint32_t max_pulses,"}, + {"repo": "omega", "path": "src/runtime/rx_world.c", "lines": "420", "symbol": "try_admit", "trigger": "for:unbounded", "row": "OM-038", "class": "E", "authoritative": "true", "evidence": "for (;;) {"}, + {"repo": "omega", "path": "src/runtime/rx_world.c", "lines": "556", "symbol": "drain_deferred", "trigger": "for:unbounded", "row": "OM-039", "class": "E", "authoritative": "true", "evidence": "for (;;) {"}, + {"repo": "omega", "path": "src/runtime/rx_world.c", "lines": "914", "symbol": "release_parked", "trigger": "for:body:yield", "row": "OM-040", "class": "E", "authoritative": "true", "evidence": "for (uint32_t i = 0; i < w->n_reactions; i++) {"}, + {"repo": "omega", "path": "src/runtime/rx_world.c", "lines": "927", "symbol": "tick_parked", "trigger": "for:body:yield", "row": "OM-041", "class": "E", "authoritative": "true", "evidence": "for (uint32_t i = 0; i < w->n_reactions; i++) {"}, + {"repo": "omega", "path": "src/runtime/rx_world.c", "lines": "1297", "symbol": "worker_main", "trigger": "for:unbounded", "row": "OM-042", "class": "E", "authoritative": "true", "evidence": "for (;;) {"}, + {"repo": "omega", "path": "src/visor/visor_console.c", "lines": "462", "symbol": "run_loop", "trigger": "for:unbounded", "row": "OM-043", "class": "B", "authoritative": "false", "evidence": "for (;;) {"}, + {"repo": "omega", "path": "src/visor/visor_evidence.c", "lines": "127", "symbol": "j_value", "trigger": "for:unbounded", "row": "OM-044", "class": "N", "authoritative": "false", "evidence": "for (;;) {"}, + {"repo": "omega", "path": "src/visor/visor_parse_command.c", "lines": "135", "symbol": "visor_parse_command", "trigger": "for:unbounded", "row": "OM-045", "class": "N", "authoritative": "false", "evidence": "for (;;) {"}, + {"repo": "omega", "path": "tests/runtime/r15_gpu_load.c", "lines": "105", "symbol": "main", "trigger": "while:body:nanosleep", "row": "OM-046", "class": "D", "authoritative": "false", "evidence": "while (now_ns() < end) {"}, + {"repo": "omega", "path": "tests/runtime/r15_gpu_load.c", "lines": "115", "symbol": "main", "trigger": "for:unbounded", "row": "OM-047", "class": "D", "authoritative": "false", "evidence": "for (;;) {"}, + {"repo": "omega", "path": "tests/runtime/r15_measure.c", "lines": "239", "symbol": "sampler_main", "trigger": "while:body:nanosleep", "row": "OM-048", "class": "D", "authoritative": "false", "evidence": "while (!__atomic_load_n(&e->stop, __ATOMIC_ACQUIRE)) {"}, + {"repo": "omega", "path": "tests/runtime/rx_branch_reuse.c", "lines": "321", "symbol": "energy_by_repetition", "trigger": "for:unbounded", "row": "OM-049", "class": "D", "authoritative": "false", "evidence": "for (;;) {"}, + {"repo": "omega", "path": "tests/runtime/rx_cog_engines.c", "lines": "268", "symbol": "plan_sample", "trigger": "for:unbounded", "row": "OM-050", "class": "D", "authoritative": "false", "evidence": "for (;;) {"}, + {"repo": "omega", "path": "tests/runtime/rx_cog_engines.c", "lines": "312", "symbol": "heap_pop", "trigger": "for:unbounded", "row": "OM-051", "class": "D", "authoritative": "false", "evidence": "for (;;) {"}, + {"repo": "omega", "path": "tests/runtime/rx_heartbeat_test.c", "lines": "623", "symbol": "t_concurrent_publication", "trigger": "for:body:tick", "row": "OM-052", "class": "D", "authoritative": "false", "evidence": "for (int i = 0; i < 8; i++) {"}, + {"repo": "omega", "path": "tests/runtime/rx_heartbeat_test.c", "lines": "1341", "symbol": "fn_hold", "trigger": "while:body:sleep", "row": "OM-053", "class": "D", "authoritative": "false", "evidence": "while (g_hold) sleep_ms(1);"}, + {"repo": "omega", "path": "tests/runtime/rx_heartbeat_test.c", "lines": "1385", "symbol": "t_resource_admission", "trigger": "for:body:sleep", "row": "OM-054", "class": "D", "authoritative": "false", "evidence": "for (int n = 0; n < 200; n++) {"}, + {"repo": "omega", "path": "tests/runtime/rx_heartbeat_test.c", "lines": "1564", "symbol": "t_priority_ladder", "trigger": "for:body:tick", "row": "OM-055", "class": "D", "authoritative": "false", "evidence": "for (uint32_t p = 0; p < RX_PRIORITY_CLASSES; p++) {"}, + {"repo": "omega", "path": "tests/runtime/rx_plan_reuse.c", "lines": "145", "symbol": "-", "trigger": "named:max_steps", "row": "OM-056", "class": "D", "authoritative": "false", "evidence": "uint64_t world_gen, cog_gen, max_steps;"}, + {"repo": "omega", "path": "tests/runtime/rx_plan_reuse.c", "lines": "284", "symbol": "env_build", "trigger": "named:max_steps", "row": "OM-057", "class": "D", "authoritative": "false", "evidence": "uint64_t gl[RX_MAX_FIELDS] = { 1000u + sp->seed, PLA_GOAL_ARRANGE, sp->max_steps, 1000, pl_ref_pack(fr) };"}, + {"repo": "omega", "path": "tests/runtime/rx_plan_reuse.c", "lines": "709", "symbol": "adversarial_case", "trigger": "named:max_steps", "row": "OM-058", "class": "D", "authoritative": "false", "evidence": "if (p == PERT_GOAL) sp.max_steps = stored ? stored->n_steps - 1 : 1;"}, + {"repo": "omega", "path": "tests/runtime/rx_r10_omega.c", "lines": "166", "symbol": "request", "trigger": "while:body:sleep", "row": "OM-059", "class": "D", "authoritative": "false", "evidence": "while (fld(e, e->f.o.result, 0) != seq) {"}, + {"repo": "omega", "path": "tests/runtime/rx_r11_aien.c", "lines": "717", "symbol": "request", "trigger": "while:body:sleep", "row": "OM-060", "class": "D", "authoritative": "false", "evidence": "while (fld(e, e->f.o.result, 0) != seq) {"}, + {"repo": "omega", "path": "tests/runtime/rx_r12_resident.c", "lines": "35", "symbol": "CHECK", "trigger": "do:body:sleep", "row": "OM-061", "class": "D", "authoritative": "false", "evidence": "#define CHECK(cond, ...) do { \\"}, + {"repo": "omega", "path": "tests/runtime/rx_r12_resident.c", "lines": "167", "symbol": "wait_seat", "trigger": "for:body:sleep", "row": "OM-062", "class": "D", "authoritative": "false", "evidence": "for (int i = 0; i < 2000; i++) {"}, + {"repo": "omega", "path": "tests/runtime/rx_r12_silicon.c", "lines": "204", "symbol": "wait_claimed", "trigger": "for:body:sleep", "row": "OM-063", "class": "D", "authoritative": "false", "evidence": "for (int i = 0; i < 3000; i++) {"}, + {"repo": "omega", "path": "tests/runtime/rx_r12_silicon.c", "lines": "217", "symbol": "wait_chip", "trigger": "for:body:sleep", "row": "OM-064", "class": "D", "authoritative": "false", "evidence": "for (int i = 0; i < 3000; i++) {"}, + {"repo": "omega", "path": "tests/runtime/rx_r12_silicon.c", "lines": "226", "symbol": "poll_accept", "trigger": "for:body:sleep", "row": "OM-065", "class": "D", "authoritative": "false", "evidence": "for (int i = 0; i < 3000; i++) {"}, + {"repo": "omega", "path": "tests/runtime/rx_r12_silicon.c", "lines": "363", "symbol": "acceptor_main", "trigger": "while:body:nanosleep", "row": "OM-066", "class": "D", "authoritative": "false", "evidence": "while (!atomic_load(&a->stop)) {"}, + {"repo": "omega", "path": "tests/runtime/rx_r12_silicon.c", "lines": "392", "symbol": "loader_main", "trigger": "for:body:nanosleep", "row": "OM-067", "class": "D", "authoritative": "false", "evidence": "for (uint64_t n = 0; !atomic_load(&l->stop); n++) {"}, + {"repo": "omega", "path": "tests/runtime/rx_r12_silicon.c", "lines": "770", "symbol": "main", "trigger": "for:body:sleep", "row": "OM-068", "class": "D", "authoritative": "false", "evidence": "for (int i = 0; i < 3000 && !moved; i++) {"}, + {"repo": "omega", "path": "tests/runtime/rx_r12_silicon.c", "lines": "802", "symbol": "main", "trigger": "for:body:sleep", "row": "OM-069", "class": "D", "authoritative": "false", "evidence": "for (int i = 0; i < 3000 && !held; i++) {"}, + {"repo": "omega", "path": "tests/runtime/rx_r12_silicon.c", "lines": "900", "symbol": "main", "trigger": "for:body:nanosleep", "row": "OM-070", "class": "D", "authoritative": "false", "evidence": "for (int i = 0; i < rounds && !g_fail; i++) {"}, + {"repo": "omega", "path": "tests/runtime/rx_r14_recovery.c", "lines": "2159", "symbol": "f_reporter", "trigger": "for:unbounded", "row": "OM-071", "class": "D", "authoritative": "false", "evidence": "for (;;) {"}, + {"repo": "omega", "path": "tests/runtime/rx_r14_recovery.c", "lines": "2297", "symbol": "run_child", "trigger": "for:unbounded", "row": "OM-072", "class": "D", "authoritative": "false", "evidence": "for (;;) {"}, + {"repo": "omega", "path": "tests/runtime/rx_r15_g7.c", "lines": "84", "symbol": "disk_hook", "trigger": "while:body:nanosleep", "row": "OM-073", "class": "D", "authoritative": "false", "evidence": "while (now_ns() - t0 < 2000000000ull) {"}, + {"repo": "omega", "path": "tests/runtime/rx_r15_instr.c", "lines": "375", "symbol": "main", "trigger": "for:body:scheduler", "row": "OM-074", "class": "D", "authoritative": "false", "evidence": "for (size_t i = 0; i < sizeof fanouts / sizeof fanouts[0]; i++)"}, + {"repo": "omega", "path": "tests/runtime/rx_r15_perf.c", "lines": "48", "symbol": "sleep_ns", "trigger": "while:body:nanosleep", "row": "OM-075", "class": "D", "authoritative": "false", "evidence": "while (nanosleep(&ts, &ts) != 0) {}"}, + {"repo": "omega", "path": "tests/runtime/rx_r15_perf.c", "lines": "119", "symbol": "thermal_wait", "trigger": "while:body:sleep", "row": "OM-076", "class": "D", "authoritative": "false", "evidence": "while ((hot = max_temp_mc()) > 55000 && r15_now_ns() - t0 < 120000000000ull) sleep_ns(1000000000ull);"}, + {"repo": "omega", "path": "tests/runtime/rx_r15_perf.c", "lines": "149", "symbol": "sampler_main", "trigger": "while:body:nanosleep", "row": "OM-077", "class": "D", "authoritative": "false", "evidence": "while (!s->stop) {"}, + {"repo": "omega", "path": "tests/runtime/rx_r15_perf.c", "lines": "752", "symbol": "l1_orch", "trigger": "while:body:pulse", "row": "OM-078", "class": "D", "authoritative": "false", "evidence": "while (!atomic_load(&e->stop)) {"}, + {"repo": "omega", "path": "tests/runtime/rx_r15_perf.c", "lines": "1142", "symbol": "l1_rig", "trigger": "for:body:sleep", "row": "OM-079", "class": "D", "authoritative": "false", "evidence": "for (int b = 0; b < 30 && ok; b++) {"}, + {"repo": "omega", "path": "tests/runtime/rx_r15_perf.c", "lines": "1272", "symbol": "run_l2", "trigger": "for:body:heartbeat", "row": "OM-080", "class": "D", "authoritative": "false", "evidence": "for (uint32_t i = 0; i < CLAIMS && ok; i++) {"}, + {"repo": "omega", "path": "tests/runtime/rx_r15_rig.c", "lines": "137", "symbol": "transport_main", "trigger": "while:body:yield", "row": "OM-081", "class": "D", "authoritative": "false", "evidence": "while (!atomic_load(&r->transport_stop)) {"}, + {"repo": "omega", "path": "tests/runtime/rx_r15_rig.c", "lines": "214", "symbol": "orchestrator_main", "trigger": "while:body:pulse", "row": "OM-082", "class": "D", "authoritative": "false", "evidence": "while (!atomic_load(&r->orch_stop)) {"}, + {"repo": "omega", "path": "tests/runtime/rx_sem_incremental.c", "lines": "992", "symbol": "replay", "trigger": "for:body:tick", "row": "OM-083", "class": "D", "authoritative": "false", "evidence": "for (int tick = 0; tick < TRACE_TICKS; tick++) {"}, + {"repo": "omega", "path": "tests/runtime/rx_sem_incremental.c", "lines": "993", "symbol": "replay", "trigger": "for:body:tick", "row": "OM-084", "class": "D", "authoritative": "false", "evidence": "for (int i = 0; i < N_NOISE; i++) put(&x, x.noise[i], (uint32_t)(tick % 4), splitmix(&rng));"}, + {"repo": "omega", "path": "tests/runtime/rx_sem_incremental.c", "lines": "1027", "symbol": "replay", "trigger": "for:body:tick", "row": "OM-085", "class": "D", "authoritative": "false", "evidence": "for (int c = 0; c < JSPACE_WIDTH; c++) {"}, + {"repo": "omega", "path": "tests/runtime/rx_sem_incremental.c", "lines": "1153", "symbol": "sleep_ns", "trigger": "while:body:nanosleep", "row": "OM-086", "class": "D", "authoritative": "false", "evidence": "while (nanosleep(&ts, &ts) != 0) {}"}, + {"repo": "omega", "path": "tests/runtime/rx_sp_workloads.c", "lines": "392", "symbol": "sp_build", "trigger": "for:body:schedule", "row": "OM-087", "class": "D", "authoritative": "false", "evidence": "for (uint64_t x = 1; x <= S && !rc; x++) {"}, + {"repo": "omega", "path": "tools/crumbline_learner.c", "lines": "188", "symbol": "serve", "trigger": "for:unbounded+recv", "row": "OM-088", "class": "F", "authoritative": "false", "evidence": "for (;;) {"}, + {"repo": "omega", "path": "tools/omegatool.c", "lines": "3745", "symbol": "legacy_oracle_demonstrate_living_matvec", "trigger": "cli-mode", "row": "OM-103", "class": "A", "authoritative": "false", "evidence": "if (strcmp(argv[1], \"--demonstrate-living-matvec\") == 0) {"}, + {"repo": "omega", "path": "tools/omegatool.c", "lines": "3758", "symbol": "main", "trigger": "cli-mode", "row": "OM-089", "class": "B", "authoritative": "false", "evidence": "if (strcmp(argv[1], \"--run-gates\") == 0) {"}, + {"repo": "omega", "path": "tools/omegatool.c", "lines": "3762", "symbol": "main", "trigger": "cli-mode", "row": "OM-090", "class": "B", "authoritative": "false", "evidence": "if (strcmp(argv[1], \"--run-m5-gates\") == 0) {"}, + {"repo": "omega", "path": "tools/omegatool.c", "lines": "3766", "symbol": "main", "trigger": "cli-mode", "row": "OM-091", "class": "B", "authoritative": "false", "evidence": "if (strcmp(argv[1], \"--run-m6-gates\") == 0) {"}, + {"repo": "omega", "path": "tools/omegatool.c", "lines": "3770", "symbol": "main", "trigger": "cli-mode", "row": "OM-092", "class": "D", "authoritative": "false", "evidence": "if (strcmp(argv[1], \"--demonstrate-self-host\") == 0) {"}, + {"repo": "omega", "path": "tools/omegatool.c", "lines": "3775", "symbol": "main", "trigger": "cli-mode", "row": "OM-093", "class": "B", "authoritative": "false", "evidence": "if (strcmp(argv[1], \"--run-m7-gates\") == 0) {"}, + {"repo": "omega", "path": "tools/omegatool.c", "lines": "3779", "symbol": "main", "trigger": "cli-mode", "row": "OM-094", "class": "D", "authoritative": "false", "evidence": "if (strcmp(argv[1], \"--demonstrate-verify\") == 0) {"}, + {"repo": "omega", "path": "tools/omegatool.c", "lines": "3784", "symbol": "main", "trigger": "cli-mode", "row": "OM-095", "class": "B", "authoritative": "false", "evidence": "if (strcmp(argv[1], \"--run-m8-gates\") == 0) {"}, + {"repo": "omega", "path": "tools/omegatool.c", "lines": "3788", "symbol": "main", "trigger": "cli-mode", "row": "OM-096", "class": "D", "authoritative": "false", "evidence": "if (strcmp(argv[1], \"--demonstrate-program\") == 0) {"}, + {"repo": "omega", "path": "tools/omegatool.c", "lines": "3793", "symbol": "main", "trigger": "cli-mode", "row": "OM-097", "class": "B", "authoritative": "false", "evidence": "if (strcmp(argv[1], \"--run-m9-gates\") == 0) {"}, + {"repo": "omega", "path": "tools/omegatool.c", "lines": "3797", "symbol": "main", "trigger": "cli-mode", "row": "OM-098", "class": "B", "authoritative": "false", "evidence": "if (strcmp(argv[1], \"--run-m10-gates\") == 0) {"}, + {"repo": "omega", "path": "tools/omegatool.c", "lines": "3801", "symbol": "main", "trigger": "cli-mode", "row": "OM-099", "class": "D", "authoritative": "false", "evidence": "if (strcmp(argv[1], \"--demonstrate-library\") == 0) {"}, + {"repo": "omega", "path": "tools/omegatool.c", "lines": "3806", "symbol": "main", "trigger": "cli-mode", "row": "OM-100", "class": "B", "authoritative": "false", "evidence": "if (strcmp(argv[1], \"--run-m11-gates\") == 0) {"}, + {"repo": "omega", "path": "tools/omegatool.c", "lines": "3810", "symbol": "main", "trigger": "cli-mode", "row": "OM-101", "class": "D", "authoritative": "false", "evidence": "if (strcmp(argv[1], \"--demonstrate-discovery\") == 0) {"}, + {"repo": "omega", "path": "tools/omegatool.c", "lines": "3815", "symbol": "main", "trigger": "cli-mode", "row": "OM-102", "class": "B", "authoritative": "false", "evidence": "if (strcmp(argv[1], \"--run-m12-gates\") == 0) {"}, + {"repo": "omega", "path": "tools/omegatool.c", "lines": "3823", "symbol": "main", "trigger": "cli-mode", "row": "OM-104", "class": "B", "authoritative": "false", "evidence": "if (strcmp(argv[1], \"--run-m13-gates\") == 0) {"}, + {"repo": "omega", "path": "tools/omegatool.c", "lines": "3827", "symbol": "main", "trigger": "cli-mode", "row": "OM-105", "class": "D", "authoritative": "false", "evidence": "if (strcmp(argv[1], \"--demonstrate-machine\") == 0) {"}, + {"repo": "omega", "path": "tools/omegatool.c", "lines": "3832", "symbol": "main", "trigger": "cli-mode", "row": "OM-106", "class": "B", "authoritative": "false", "evidence": "if (strcmp(argv[1], \"--run-m14-gates\") == 0) {"}, + {"repo": "omega", "path": "tools/omegatool.c", "lines": "3836", "symbol": "main", "trigger": "cli-mode", "row": "OM-107", "class": "D", "authoritative": "false", "evidence": "if (strcmp(argv[1], \"--demonstrate-realization-synthesis\") == 0) {"}, + {"repo": "omega", "path": "tools/omegatool.c", "lines": "3841", "symbol": "main", "trigger": "cli-mode", "row": "OM-108", "class": "B", "authoritative": "false", "evidence": "if (strcmp(argv[1], \"--run-m15-gates\") == 0) {"}, + {"repo": "omega", "path": "tools/omegatool.c", "lines": "3845", "symbol": "main", "trigger": "cli-mode", "row": "OM-109", "class": "D", "authoritative": "false", "evidence": "if (strcmp(argv[1], \"--demonstrate-accelerator\") == 0) {"}, + {"repo": "omega", "path": "tools/omegatool.c", "lines": "3850", "symbol": "main", "trigger": "cli-mode", "row": "OM-110", "class": "B", "authoritative": "false", "evidence": "if (strcmp(argv[1], \"--run-world-lifecycle-gates\") == 0) {"}, + {"repo": "omega", "path": "tools/omegatool.c", "lines": "3853", "symbol": "main", "trigger": "cli-mode", "row": "OM-111", "class": "B", "authoritative": "false", "evidence": "if (strcmp(argv[1], \"--run-m19r-soak\") == 0) {"}, + {"repo": "omega", "path": "tools/omegatool.c", "lines": "3856", "symbol": "main", "trigger": "cli-mode", "row": "OM-112", "class": "B", "authoritative": "false", "evidence": "if (strcmp(argv[1], \"--run-m19-gates\") == 0) {"}, + {"repo": "omega", "path": "tools/omegatool.c", "lines": "3865", "symbol": "main", "trigger": "cli-mode", "row": "OM-113", "class": "D", "authoritative": "false", "evidence": "if (strcmp(argv[1], \"--demonstrate-accelerator-world\") == 0) {"}, + {"repo": "omega", "path": "tools/omegatool.c", "lines": "3870", "symbol": "main", "trigger": "cli-mode", "row": "OM-114", "class": "B", "authoritative": "false", "evidence": "if (strcmp(argv[1], \"--run-m18-gates\") == 0) {"}, + {"repo": "omega", "path": "tools/omegatool.c", "lines": "3874", "symbol": "main", "trigger": "cli-mode", "row": "OM-115", "class": "D", "authoritative": "false", "evidence": "if (strcmp(argv[1], \"--demonstrate-blackwell-matmul\") == 0) {"}, + {"repo": "omega", "path": "tools/omegatool.c", "lines": "3879", "symbol": "main", "trigger": "cli-mode", "row": "OM-116", "class": "B", "authoritative": "false", "evidence": "if (strcmp(argv[1], \"--run-m17-gates\") == 0) {"}, + {"repo": "omega", "path": "tools/omegatool.c", "lines": "3883", "symbol": "main", "trigger": "cli-mode", "row": "OM-117", "class": "D", "authoritative": "false", "evidence": "if (strcmp(argv[1], \"--demonstrate-blackwell-codegen\") == 0) {"}, + {"repo": "omega", "path": "tools/omegatool.c", "lines": "3887", "symbol": "main", "trigger": "cli-mode", "row": "OM-118", "class": "D", "authoritative": "false", "evidence": "if (strcmp(argv[1], \"--demonstrate-blackwell-vector\") == 0) {"}, + {"repo": "omega", "path": "tools/omegatool.c", "lines": "3892", "symbol": "main", "trigger": "cli-mode", "row": "OM-119", "class": "D", "authoritative": "false", "evidence": "if (strcmp(argv[1], \"--demonstrate-synthesis\") == 0) {"}, + {"repo": "omega", "path": "tools/omegatool.c", "lines": "3897", "symbol": "main", "trigger": "cli-mode", "row": "OM-120", "class": "D", "authoritative": "false", "evidence": "if (strcmp(argv[1], \"--demonstrate-realization\") == 0) {"}, + {"repo": "omega", "path": "tools/omegatool.c", "lines": "3902", "symbol": "main", "trigger": "cli-mode", "row": "OM-121", "class": "D", "authoritative": "false", "evidence": "if (strcmp(argv[1], \"--demonstrate-arithmetic\") == 0) {"}, + {"repo": "omega", "path": "tools/omegatool.c", "lines": "3907", "symbol": "main", "trigger": "cli-mode", "row": "OM-122", "class": "D", "authoritative": "false", "evidence": "if (strcmp(argv[1], \"--demonstrate-physics\") == 0) {"}, + {"repo": "omega", "path": "tools/r15_reduce.c", "lines": "82,102", "symbol": "jparse", "trigger": "for:unbounded", "row": "OM-123", "class": "D", "authoritative": "false", "evidence": "for (;;) {"}, + {"repo": "omega", "path": "tools/r15_reduce.c", "lines": "325", "symbol": "read_file", "trigger": "while:unbounded", "row": "OM-124", "class": "D", "authoritative": "false", "evidence": "while (1) {"}, + {"repo": "aien-sovereign-core", "path": "benchmarks/crates/bench_apples_to_apples/src/engine_max.rs", "lines": "55", "symbol": "start", "trigger": "while:body:sleep", "row": "SC-001", "class": "D", "authoritative": "false", "evidence": "while start.elapsed() < timeout {"}, + {"repo": "aien-sovereign-core", "path": "benchmarks/crates/bench_apples_to_apples/src/telemetry.rs", "lines": "96", "symbol": "start", "trigger": "while:body:tick", "row": "SC-002", "class": "D", "authoritative": "false", "evidence": "while !stop_clone.load(Ordering::Relaxed) {"}, + {"repo": "aien-sovereign-core", "path": "benchmarks/crates/bench_apples_to_apples/src/telemetry.rs", "lines": "168", "symbol": "enforce_thermal_cooldown", "trigger": "while:body:sleep", "row": "SC-003", "class": "D", "authoritative": "false", "evidence": "while start.elapsed() < max_wait {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-cli/src/commands.rs", "lines": "1216", "symbol": "handle_start_command", "trigger": "for:body:sleep", "row": "SC-004", "class": "B", "authoritative": "false", "evidence": "for _ in 0..60 {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-cli/src/hooks.rs", "lines": "43", "symbol": "run_pre_turn", "trigger": "for:body:turn", "row": "SC-005", "class": "A", "authoritative": "false", "evidence": "for h in &self.hooks {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-cli/src/hooks.rs", "lines": "50", "symbol": "run_post_turn", "trigger": "for:body:turn", "row": "SC-006", "class": "A", "authoritative": "false", "evidence": "for h in &self.hooks {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-cli/src/main.rs", "lines": "278", "symbol": "main", "trigger": "loop:unbounded+turn", "row": "SC-007", "class": "F", "authoritative": "false", "evidence": "loop {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-cli/src/main.rs", "lines": "306", "symbol": "main", "trigger": "while:body:turn", "row": "SC-008", "class": "A", "authoritative": "false", "evidence": "while max_tool_steps > 0 {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-cli/src/main.rs", "lines": "332", "symbol": "main", "trigger": "for:body:dispatch", "row": "SC-009", "class": "A", "authoritative": "false", "evidence": "for (tool_name, tool_args) in tool_calls {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-cli/src/main.rs", "lines": "401", "symbol": "run_single_prompt", "trigger": "while:body:turn", "row": "SC-010", "class": "A", "authoritative": "false", "evidence": "while max_tool_steps > 0 {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-cli/src/main.rs", "lines": "416", "symbol": "run_single_prompt", "trigger": "for:body:dispatch", "row": "SC-011", "class": "A", "authoritative": "false", "evidence": "for (tool_name, tool_args) in tool_calls {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-cli/src/main.rs", "lines": "476", "symbol": "run_autonomous_goal", "trigger": "for:body:turn", "row": "SC-012", "class": "A", "authoritative": "false", "evidence": "for m in &goal.milestones {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-cli/src/main.rs", "lines": "520", "symbol": "run_autonomous_goal", "trigger": "while:body:turn", "row": "SC-013", "class": "A", "authoritative": "false", "evidence": "while max_tool_steps > 0 {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-cli/src/main.rs", "lines": "539", "symbol": "run_autonomous_goal", "trigger": "for:body:dispatch", "row": "SC-014", "class": "A", "authoritative": "false", "evidence": "for (tool_name, tool_args) in tool_calls {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-cli/src/subagents.rs", "lines": "148", "symbol": "execute_subagent", "trigger": "named:max_steps", "row": "SC-015", "class": "A", "authoritative": "false", "evidence": "let mut max_steps = 10;"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-cli/src/subagents.rs", "lines": "152", "symbol": "execute_subagent", "trigger": "while:body:turn", "row": "SC-016", "class": "A", "authoritative": "false", "evidence": "while max_steps > 0 {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-cli/src/subagents.rs", "lines": "153", "symbol": "execute_subagent", "trigger": "named:max_steps", "row": "SC-017", "class": "A", "authoritative": "false", "evidence": "max_steps -= 1;"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-cli/src/subagents.rs", "lines": "176", "symbol": "execute_subagent", "trigger": "for:body:dispatch", "row": "SC-018", "class": "A", "authoritative": "false", "evidence": "for (tool_name, tool_args) in &tool_calls {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-cli/tests/test_cli_runtime_ipc.rs", "lines": "40", "symbol": "test_cli_runtime_ipc_lifecycle", "trigger": "for:body:sleep", "row": "SC-019", "class": "D", "authoritative": "false", "evidence": "for _ in 0..50 {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-inference-runtime/tests/runtime_tests.rs", "lines": "18", "symbol": "test_embedded_inference_service_reference_weights", "trigger": "while:body:recv", "row": "SC-020", "class": "D", "authoritative": "false", "evidence": "while let Some(evt) = rx.recv().await {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-proof/src/board.rs", "lines": "163", "symbol": "tee", "trigger": "loop:unbounded", "row": "SC-021", "class": "D", "authoritative": "false", "evidence": "loop {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-proof/src/board.rs", "lines": "244", "symbol": "acquire_cpu_slot", "trigger": "loop:unbounded+sleep", "row": "SC-022", "class": "E", "authoritative": "false", "evidence": "loop {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-proof/src/board.rs", "lines": "424", "symbol": "wait_for_memory", "trigger": "while:body:sleep", "row": "SC-023", "class": "E", "authoritative": "false", "evidence": "while let Some(free) = mem_available() {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-proof/src/lib.rs", "lines": "33", "symbol": "temp_dir", "trigger": "loop:unbounded", "row": "SC-024", "class": "D", "authoritative": "false", "evidence": "loop {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-proof/src/lock.rs", "lines": "29", "symbol": "acquire", "trigger": "loop:unbounded", "row": "SC-025", "class": "D", "authoritative": "false", "evidence": "loop {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-proof/tests/store_qualification_adversarial.rs", "lines": "14", "symbol": "temp_store", "trigger": "loop:unbounded", "row": "SC-026", "class": "D", "authoritative": "false", "evidence": "loop {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-runtime/src/client.rs", "lines": "175", "symbol": "stream_turn", "trigger": "loop:unbounded+turn", "row": "SC-027", "class": "F", "authoritative": "false", "evidence": "loop {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-runtime/src/server.rs", "lines": "106", "symbol": "run", "trigger": "while:body:scheduler", "row": "SC-028", "class": "E", "authoritative": "false", "evidence": "while is_running_worker.load(Ordering::Relaxed) {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-runtime/src/server.rs", "lines": "129", "symbol": "run", "trigger": "loop:unbounded", "row": "SC-029", "class": "F", "authoritative": "false", "evidence": "loop {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-runtime/src/server.rs", "lines": "252", "symbol": "stream_turn", "trigger": "loop:unbounded+recv", "row": "SC-030", "class": "F", "authoritative": "false", "evidence": "loop {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-runtime/src/server.rs", "lines": "307", "symbol": "handle_connection", "trigger": "while:body:turn", "row": "SC-031", "class": "F", "authoritative": "false", "evidence": "while let Ok(n) = buf_reader.read_line(&mut line).await {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-runtime/src/spine.rs", "lines": "112", "symbol": "run_until_complete", "trigger": "named:run_until_complete", "row": "SC-032", "class": "E", "authoritative": "false", "evidence": "pub async fn run_until_complete("}, + {"repo": "aien-sovereign-core", "path": "crates/aien-runtime/src/spine.rs", "lines": "115", "symbol": "run_until_complete", "trigger": "named:max_steps", "row": "SC-033", "class": "E", "authoritative": "false", "evidence": "max_steps: usize,"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-runtime/src/spine.rs", "lines": "118", "symbol": "run_until_complete", "trigger": "for:body:scheduler", "row": "SC-034", "class": "E", "authoritative": "false", "evidence": "for _ in 0..max_steps {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-runtime/src/spine.rs", "lines": "200", "symbol": "launch_swarm", "trigger": "for:body:scheduler", "row": "SC-035", "class": "E", "authoritative": "false", "evidence": "for &child_seq in &swarm.branch_sequences {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-runtime/tests/runtime_500_branch_benchmark.rs", "lines": "80", "symbol": "test_runtime_spine_500_branch_benchmark", "trigger": "while:body:scheduler", "row": "SC-036", "class": "D", "authoritative": "false", "evidence": "while (spine.scheduler.running_count() > 0 || spine.scheduler.waiting_count() > 0)"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-runtime/tests/runtime_end_to_end_tests.rs", "lines": "136", "symbol": "test_end_to_end_ticket_submission_and_channel_streaming_cpu", "trigger": "named:run_until_complete", "row": "SC-037", "class": "D", "authoritative": "false", "evidence": "let metrics = spine.run_until_complete(&mut backend, 20).await.unwrap();"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-runtime/tests/runtime_end_to_end_tests.rs", "lines": "143", "symbol": "test_end_to_end_ticket_submission_and_channel_streaming_cpu", "trigger": "while:body:recv", "row": "SC-038", "class": "D", "authoritative": "false", "evidence": "while let Ok(event) = rx.try_recv() {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-runtime/tests/runtime_end_to_end_tests.rs", "lines": "266", "symbol": "test_end_to_end_subagent_branching_with_independent_sinks", "trigger": "named:run_until_complete", "row": "SC-039", "class": "D", "authoritative": "false", "evidence": "let _ = spine.run_until_complete(&mut backend, 30).await.unwrap();"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-runtime/tests/runtime_end_to_end_tests.rs", "lines": "270", "symbol": "test_end_to_end_subagent_branching_with_independent_sinks", "trigger": "while:body:recv", "row": "SC-040", "class": "D", "authoritative": "false", "evidence": "while let Ok(event) = rx_parent.try_recv() {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-runtime/tests/runtime_end_to_end_tests.rs", "lines": "282", "symbol": "test_end_to_end_subagent_branching_with_independent_sinks", "trigger": "while:body:recv", "row": "SC-041", "class": "D", "authoritative": "false", "evidence": "while let Ok(event) = rx_child1.try_recv() {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-runtime/tests/runtime_end_to_end_tests.rs", "lines": "294", "symbol": "test_end_to_end_subagent_branching_with_independent_sinks", "trigger": "while:body:recv", "row": "SC-042", "class": "D", "authoritative": "false", "evidence": "while let Ok(event) = rx_child2.try_recv() {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-runtime/tests/runtime_end_to_end_tests.rs", "lines": "387", "symbol": "test_end_to_end_blackwell_hardware_execution_if_available", "trigger": "named:run_until_complete", "row": "SC-043", "class": "D", "authoritative": "false", "evidence": "let _ = spine.run_until_complete(&mut backend, 15).await.unwrap();"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-runtime/tests/runtime_end_to_end_tests.rs", "lines": "390", "symbol": "test_end_to_end_blackwell_hardware_execution_if_available", "trigger": "while:body:recv", "row": "SC-044", "class": "D", "authoritative": "false", "evidence": "while let Ok(event) = rx.try_recv() {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-runtime/tests/runtime_end_to_end_tests.rs", "lines": "496", "symbol": "release_golden_path_records_whether_gb10_ran", "trigger": "named:run_until_complete", "row": "SC-045", "class": "D", "authoritative": "false", "evidence": "let _ = spine.run_until_complete(&mut backend, 20).await.unwrap();"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-runtime/tests/runtime_end_to_end_tests.rs", "lines": "498", "symbol": "release_golden_path_records_whether_gb10_ran", "trigger": "while:body:recv", "row": "SC-046", "class": "D", "authoritative": "false", "evidence": "while let Ok(event) = rx.try_recv() {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-runtime/tests/runtime_end_to_end_tests.rs", "lines": "504", "symbol": "release_golden_path_records_whether_gb10_ran", "trigger": "while:body:recv", "row": "SC-047", "class": "D", "authoritative": "false", "evidence": "while let Ok(event) = child_rx.try_recv() {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-runtime/tests/runtime_ipc_test.rs", "lines": "40", "symbol": "test_runtime_server_client_ipc_lifecycle", "trigger": "for:body:sleep", "row": "SC-048", "class": "D", "authoritative": "false", "evidence": "for _ in 0..50 {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-runtime/tests/runtime_ipc_test.rs", "lines": "74", "symbol": "test_runtime_server_client_ipc_lifecycle", "trigger": "for:body:sleep", "row": "SC-049", "class": "D", "authoritative": "false", "evidence": "for _ in 0..100 {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-runtime/tests/runtime_socket_permissions_test.rs", "lines": "35", "symbol": "runtime_socket_is_owner_only", "trigger": "for:body:sleep", "row": "SC-050", "class": "D", "authoritative": "false", "evidence": "for _ in 0..250 {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-runtime/tests/runtime_spine_integration.rs", "lines": "161", "symbol": "test_swarm_launch_and_step_execution", "trigger": "while:body:scheduler", "row": "SC-051", "class": "D", "authoritative": "false", "evidence": "while (spine.scheduler.running_count() > 0 || spine.scheduler.waiting_count() > 0) && steps < 50"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-runtime/tests/swarm_completion_test.rs", "lines": "47", "symbol": "swarm_natural_completion_reclaims_everything", "trigger": "named:run_until_complete", "row": "SC-052", "class": "D", "authoritative": "false", "evidence": ".run_until_complete(&mut backend, 200)"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-runtime/tests/swarm_inspect_scoping_test.rs", "lines": "90", "symbol": "inspect_swarm_is_scoped_to_the_requested_swarm", "trigger": "named:run_until_complete", "row": "SC-053", "class": "D", "authoritative": "false", "evidence": ".run_until_complete(&mut backend, 200)"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-scheduler/src/bin/bench_inference_stack.rs", "lines": "216", "symbol": "bench_scheduler_step_overhead", "trigger": "for:body:scheduler", "row": "SC-054", "class": "D", "authoritative": "false", "evidence": "for &concurrency in &concurrency_levels {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-scheduler/src/bin/bench_inference_stack.rs", "lines": "217", "symbol": "bench_scheduler_step_overhead", "trigger": "for:body:scheduler", "row": "SC-055", "class": "D", "authoritative": "false", "evidence": "for i in 0..concurrency {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-scheduler/src/bin/bench_inference_stack.rs", "lines": "301", "symbol": "bench_continuous_batching_scheduler_throughput", "trigger": "for:body:scheduler", "row": "SC-056", "class": "D", "authoritative": "false", "evidence": "for &concurrency in &concurrency_tiers {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-scheduler/src/bin/bench_inference_stack.rs", "lines": "314", "symbol": "bench_continuous_batching_scheduler_throughput", "trigger": "for:body:scheduler", "row": "SC-057", "class": "D", "authoritative": "false", "evidence": "for i in 0..concurrency {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-scheduler/src/bin/bench_inference_stack.rs", "lines": "336", "symbol": "bench_continuous_batching_scheduler_throughput", "trigger": "while:body:scheduler", "row": "SC-058", "class": "D", "authoritative": "false", "evidence": "while scheduler.running_count() > 0 || scheduler.waiting_count() > 0 {"}, + {"repo": "aien-sovereign-core", "path": "crates/aien-scheduler/src/bin/bench_inference_stack.rs", "lines": "384", "symbol": "bench_context_window_scaling", "trigger": "for:body:scheduler", "row": "SC-059", "class": "D", "authoritative": "false", "evidence": "for &ctx_len in &context_lengths {"}, + {"repo": "aien-sovereign-core", "path": "crates/cortex-rs/src/db.rs", "lines": "54", "symbol": "new", "trigger": "while:body:recv", "row": "SC-060", "class": "E", "authoritative": "false", "evidence": "while let Ok(task) = rx.recv() {"}, + {"repo": "aien-sovereign-core", "path": "crates/cortex-rs/src/db.rs", "lines": "56", "symbol": "new", "trigger": "while:body:recv", "row": "SC-061", "class": "E", "authoritative": "false", "evidence": "while let Ok(next) = rx.try_recv() {"}, + {"repo": "aien-sovereign-core", "path": "crates/cortex-rs/src/db.rs", "lines": "2406", "symbol": "test_sqlite_wal_persistence_under_concurrency", "trigger": "for:body:sleep", "row": "SC-062", "class": "D", "authoritative": "false", "evidence": "for _ in 0..4 {"}, + {"repo": "aien-sovereign-core", "path": "crates/cortex-rs/src/db.rs", "lines": "2409", "symbol": "test_sqlite_wal_persistence_under_concurrency", "trigger": "for:body:sleep", "row": "SC-063", "class": "D", "authoritative": "false", "evidence": "for _ in 0..15 {"}, + {"repo": "aien-sovereign-core", "path": "crates/cortex-rs/src/db.rs", "lines": "2944", "symbol": "test_episodic_concurrency_and_writer_throughput", "trigger": "for:body:sleep", "row": "SC-064", "class": "D", "authoritative": "false", "evidence": "for _ in 0..4 {"}, + {"repo": "aien-sovereign-core", "path": "crates/cortex-rs/src/db.rs", "lines": "2947", "symbol": "test_episodic_concurrency_and_writer_throughput", "trigger": "for:body:sleep", "row": "SC-065", "class": "D", "authoritative": "false", "evidence": "for _ in 0..25 {"}, + {"repo": "aien-sovereign-core", "path": "crates/crumbs/src/bin/crumbs-probe-learner.rs", "lines": "29", "symbol": "main", "trigger": "loop:unbounded", "row": "SC-066", "class": "F", "authoritative": "false", "evidence": "loop {"}, + {"repo": "aien-sovereign-core", "path": "crates/crumbs/src/gen/mechanisms.rs", "lines": "768", "symbol": "nibble_permute", "trigger": "loop:unbounded", "row": "SC-067", "class": "N", "authoritative": "false", "evidence": "loop {"}, + {"repo": "aien-sovereign-core", "path": "crates/crumbs/src/gen/rng.rs", "lines": "50", "symbol": "below", "trigger": "loop:unbounded", "row": "SC-068", "class": "N", "authoritative": "false", "evidence": "loop {"}, + {"repo": "aien-sovereign-core", "path": "crates/crumbs/src/program.rs", "lines": "19", "symbol": "-", "trigger": "named:max_steps", "row": "SC-069", "class": "E", "authoritative": "false", "evidence": "pub const MAX_STEPS: usize = 64;"}, + {"repo": "aien-sovereign-core", "path": "crates/crumbs/src/program.rs", "lines": "140", "symbol": "decode", "trigger": "named:max_steps", "row": "SC-070", "class": "E", "authoritative": "false", "evidence": "if n > MAX_STEPS {"}, + {"repo": "aien-sovereign-core", "path": "crates/crumbs/src/protocol.rs", "lines": "311", "symbol": "run_crumb", "trigger": "loop:unbounded", "row": "SC-071", "class": "F", "authoritative": "false", "evidence": "loop {"}, + {"repo": "aien-sovereign-core", "path": "crates/spark-adapters/src/bin/spark_distill.rs", "lines": "305", "symbol": "run_cli", "trigger": "loop:unbounded", "row": "SC-072", "class": "F", "authoritative": "false", "evidence": "loop {"}, + {"repo": "aien-sovereign-core", "path": "crates/spark-adapters/tests/challenger_m1_concurrency_bounds.rs", "lines": "129", "symbol": "test_challenge1_concurrency_50_threads_mixed_read_write_invalidation", "trigger": "for:body:sleep", "row": "SC-073", "class": "D", "authoritative": "false", "evidence": "for thread_idx in 0..num_threads {"}, + {"repo": "aien-sovereign-core", "path": "crates/spark-adapters/tests/challenger_m1_concurrency_bounds.rs", "lines": "136", "symbol": "test_challenge1_concurrency_50_threads_mixed_read_write_invalidation", "trigger": "for:body:sleep", "row": "SC-074", "class": "D", "authoritative": "false", "evidence": "for i in 0..iterations {"}, + {"repo": "aien-sovereign-core", "path": "crates/spark-adapters/tests/challenger_m1_concurrency_bounds.rs", "lines": "406", "symbol": "test_challenge4_cortex_dynamic_auth_and_zero_disk_touches", "trigger": "loop:unbounded", "row": "SC-075", "class": "D", "authoritative": "false", "evidence": "loop {"}, + {"repo": "aien-sovereign-core", "path": "crates/spark-cockpit-rs/src/main.rs", "lines": "954", "symbol": "main", "trigger": "loop:unbounded+sleep", "row": "SC-076", "class": "B", "authoritative": "false", "evidence": "loop {"}, + {"repo": "aien-sovereign-core", "path": "crates/spark-cockpit-rs/src/main.rs", "lines": "1317", "symbol": "handle_terminal_socket", "trigger": "loop:unbounded", "row": "SC-077", "class": "F", "authoritative": "false", "evidence": "loop {"}, + {"repo": "aien-sovereign-core", "path": "crates/spark-cockpit-rs/src/main.rs", "lines": "1331", "symbol": "handle_terminal_socket", "trigger": "while:body:recv", "row": "SC-078", "class": "F", "authoritative": "false", "evidence": "while let Some(bytes) = pty_in_rx.blocking_recv() {"}, + {"repo": "aien-sovereign-core", "path": "crates/spark-cockpit-rs/src/main.rs", "lines": "1341", "symbol": "handle_terminal_socket", "trigger": "while:body:recv", "row": "SC-079", "class": "F", "authoritative": "false", "evidence": "while let Some(data) = pty_rx.recv().await {"}, + {"repo": "aien-sovereign-core", "path": "crates/spark-cockpit-rs/src/main.rs", "lines": "2440", "symbol": "handle_chat_stream", "trigger": "while:body:yield", "row": "SC-080", "class": "F", "authoritative": "false", "evidence": "while let Some(chunk_result) = byte_stream.next().await {"}, + {"repo": "aien-sovereign-core", "path": "crates/spark-cockpit-rs/src/main.rs", "lines": "2445", "symbol": "handle_chat_stream", "trigger": "while:body:yield", "row": "SC-081", "class": "F", "authoritative": "false", "evidence": "while let Some(pos) = line_buffer.find('\\n') {"}, + {"repo": "aien-sovereign-core", "path": "crates/spark-debugger/src/daemon.rs", "lines": "21", "symbol": "run_watchdog_daemon", "trigger": "loop:unbounded+sleep", "row": "SC-082", "class": "B", "authoritative": "false", "evidence": "loop {"}, + {"repo": "aien-sovereign-core", "path": "crates/spark-discord-hub/src/gateway.rs", "lines": "42,111", "symbol": "run", "trigger": "loop:unbounded+recv", "row": "SC-083", "class": "F", "authoritative": "false", "evidence": "loop {"}, + {"repo": "aien-sovereign-core", "path": "crates/spark-discord-hub/src/gateway.rs", "lines": "53", "symbol": "run", "trigger": "while:body:recv", "row": "SC-084", "class": "F", "authoritative": "false", "evidence": "while let Some(msg) = outbound_rx.recv().await {"}, + {"repo": "aien-sovereign-core", "path": "crates/spark-discord-hub/src/gateway.rs", "lines": "64", "symbol": "run", "trigger": "while:body:heartbeat", "row": "SC-085", "class": "F", "authoritative": "false", "evidence": "while let Some(msg_result) = read.next().await {"}, + {"repo": "aien-sovereign-core", "path": "crates/spark-dream/src/main.rs", "lines": "91", "symbol": "main", "trigger": "loop:unbounded+tick", "row": "SC-086", "class": "A", "authoritative": "false", "evidence": "loop {"}, + {"repo": "aien-sovereign-core", "path": "crates/spark-mail-rs/src/smtp_server.rs", "lines": "19", "symbol": "run_smtp_server", "trigger": "loop:unbounded", "row": "SC-087", "class": "F", "authoritative": "false", "evidence": "loop {"}, + {"repo": "aien-sovereign-core", "path": "crates/spark-mail-rs/src/smtp_server.rs", "lines": "56,85", "symbol": "handle_smtp_session", "trigger": "loop:unbounded", "row": "SC-088", "class": "F", "authoritative": "false", "evidence": "loop {"}, + {"repo": "aien-sovereign-core", "path": "crates/spark-supervisor/src/supervisor.rs", "lines": "80", "symbol": "run_daemon", "trigger": "loop:unbounded+sleep", "row": "SC-089", "class": "B", "authoritative": "false", "evidence": "loop {"}, + {"repo": "aien-sovereign-core", "path": "crates/spark-supervisor/src/supervisor.rs", "lines": "129", "symbol": "supervise_loop", "trigger": "loop:unbounded+recv", "row": "SC-090", "class": "B", "authoritative": "false", "evidence": "loop {"}, + {"repo": "aegis-runtime", "path": "src/agent.rs", "lines": "99", "symbol": "execute_task", "trigger": "named:max_turns", "row": "AR-001", "class": "A", "authoritative": "false", "evidence": "max_turns: usize,"}, + {"repo": "aegis-runtime", "path": "src/agent.rs", "lines": "130", "symbol": "execute_task", "trigger": "for:body:turn", "row": "AR-002", "class": "A", "authoritative": "false", "evidence": "for turn in 1..=max_turns {"}, + {"repo": "aegis-runtime", "path": "src/agent.rs", "lines": "132", "symbol": "execute_task", "trigger": "named:max_turns", "row": "AR-003", "class": "A", "authoritative": "false", "evidence": "info!(\"Agent loop turn {}/{}\", turn, max_turns);"}, + {"repo": "aegis-runtime", "path": "src/agent.rs", "lines": "236", "symbol": "execute_task", "trigger": "named:max_turns", "row": "AR-004", "class": "A", "authoritative": "false", "evidence": "max_turns"}, + {"repo": "aegis-runtime", "path": "src/gateway.rs", "lines": "127", "symbol": "chat_handler", "trigger": "named:max_turns", "row": "AR-005", "class": "A", "authoritative": "false", "evidence": "pub max_turns: Option,"}, + {"repo": "aegis-runtime", "path": "src/gateway.rs", "lines": "145", "symbol": "agent_run_handler", "trigger": "named:max_turns", "row": "AR-006", "class": "A", "authoritative": "false", "evidence": "let max_turns = payload.max_turns.unwrap_or(8);"}, + {"repo": "aegis-runtime", "path": "src/gateway.rs", "lines": "148", "symbol": "agent_run_handler", "trigger": "named:max_turns", "row": "AR-007", "class": "A", "authoritative": "false", "evidence": ".execute_task(&payload.prompt, payload.system.as_deref(), max_turns)"}, + {"repo": "aegis-runtime", "path": "src/gateway.rs", "lines": "498", "symbol": "handle_socket", "trigger": "loop:unbounded+pulse", "row": "AR-008", "class": "A", "authoritative": "false", "evidence": "loop {"}, + {"repo": "aegis-runtime", "path": "src/gateway.rs", "lines": "546", "symbol": "handle_socket", "trigger": "named:max_turns", "row": "AR-009", "class": "A", "authoritative": "false", "evidence": "let max_turns = parsed.get(\"max_turns\").and_then(|v| v.as_u64()).unwrap_or(8) as usize;"}, + {"repo": "aegis-runtime", "path": "src/gateway.rs", "lines": "547", "symbol": "handle_socket", "trigger": "named:max_turns", "row": "AR-010", "class": "A", "authoritative": "false", "evidence": "let res = state.agent.execute_task(prompt, None, max_turns).await;"}, + {"repo": "aegis-runtime", "path": "src/heartbeat.rs", "lines": "102", "symbol": "pulse_once", "trigger": "for:body:dispatch", "row": "AR-011", "class": "A", "authoritative": "false", "evidence": "for task in pending_tasks {"}, + {"repo": "aegis-runtime", "path": "src/heartbeat.rs", "lines": "228", "symbol": "start_loop", "trigger": "loop:unbounded+tick", "row": "AR-012", "class": "A", "authoritative": "false", "evidence": "loop {"}, + {"repo": "aegis-runtime", "path": "src/main.rs", "lines": "86", "symbol": "-", "trigger": "named:max_turns", "row": "AR-013", "class": "A", "authoritative": "false", "evidence": "max_turns: usize,"}, + {"repo": "aegis-runtime", "path": "src/main.rs", "lines": "251", "symbol": "main", "trigger": "loop:unbounded+tick", "row": "AR-014", "class": "A", "authoritative": "false", "evidence": "loop {"}, + {"repo": "aegis-runtime", "path": "src/main.rs", "lines": "293", "symbol": "main", "trigger": "named:max_turns", "row": "AR-015", "class": "A", "authoritative": "false", "evidence": "max_turns,"}, + {"repo": "aegis-runtime", "path": "src/main.rs", "lines": "311", "symbol": "main", "trigger": "named:max_turns", "row": "AR-016", "class": "A", "authoritative": "false", "evidence": "match agent.execute_task(&prompt, None, max_turns).await {"}, + {"repo": "aegis-runtime", "path": "src/orchestration/budget.rs", "lines": "5", "symbol": "-", "trigger": "named:max_steps", "row": "AR-017", "class": "A", "authoritative": "false", "evidence": "pub max_steps: u32,"}, + {"repo": "aegis-runtime", "path": "src/orchestration/budget.rs", "lines": "14", "symbol": "default", "trigger": "named:max_steps", "row": "AR-018", "class": "A", "authoritative": "false", "evidence": "max_steps: 25,"}, + {"repo": "aegis-runtime", "path": "src/persistence/legacy.rs", "lines": "135", "symbol": "list_recent_turns", "trigger": "for:body:turns", "row": "AR-019", "class": "N", "authoritative": "false", "evidence": "for r in rows {"}, + {"repo": "aegis-runtime", "path": "tests/stage2_primitives_tests.rs", "lines": "103", "symbol": "test_orchestration_run_and_budget", "trigger": "named:max_steps", "row": "AR-020", "class": "D", "authoritative": "false", "evidence": "max_steps: 10,"}, + {"repo": "aienos", "path": "crates/aienos-boot/src/handoff.rs", "lines": "128", "symbol": "alloc", "trigger": "loop:unbounded", "row": "AO-001", "class": "N", "authoritative": "false", "evidence": "loop {"}, + {"repo": "aienos", "path": "crates/aienos-boot/src/rollback_mock.rs", "lines": "295", "symbol": "run_candidate", "trigger": "loop:unbounded", "row": "AO-002", "class": "D", "authoritative": "false", "evidence": "loop {"}, + {"repo": "aienos", "path": "crates/aienos-boot/src/usb_keyboard.rs", "lines": "393", "symbol": "run", "trigger": "while:body:poll", "row": "AO-003", "class": "E", "authoritative": "true", "evidence": "while !exit && counter_ticks().wrapping_sub(start) < deadline && !keyboard.is_halted() {"}, + {"repo": "aienos", "path": "crates/aienos-capability/src/lib.rs", "lines": "106", "symbol": "take_boot_gen", "trigger": "loop:unbounded", "row": "AO-004", "class": "N", "authoritative": "false", "evidence": "loop {"}, + {"repo": "aienos", "path": "crates/aienos-capability/src/lib.rs", "lines": "336", "symbol": "chain_ok", "trigger": "loop:unbounded", "row": "AO-005", "class": "N", "authoritative": "false", "evidence": "loop {"}, + {"repo": "aienos", "path": "crates/aienos-capability/src/lib.rs", "lines": "358", "symbol": "ancestor_hops", "trigger": "loop:unbounded", "row": "AO-006", "class": "N", "authoritative": "false", "evidence": "loop {"}, + {"repo": "aienos", "path": "crates/aienos-capability/src/lib.rs", "lines": "501", "symbol": "cascade_revoke", "trigger": "loop:unbounded", "row": "AO-007", "class": "N", "authoritative": "false", "evidence": "loop {"}, + {"repo": "aienos", "path": "crates/aienos-evidence/src/capture.rs", "lines": "126", "symbol": "file_sha256", "trigger": "loop:unbounded", "row": "AO-008", "class": "N", "authoritative": "false", "evidence": "loop {"}, + {"repo": "aienos", "path": "crates/aienos-evidence/src/http.rs", "lines": "124", "symbol": "send", "trigger": "loop:unbounded", "row": "AO-009", "class": "F", "authoritative": "true", "evidence": "loop {"}, + {"repo": "aienos", "path": "crates/aienos-kernel/src/arch/aarch64.rs", "lines": "409", "symbol": "halt", "trigger": "loop:unbounded", "row": "AO-010", "class": "E", "authoritative": "true", "evidence": "loop {"}, + {"repo": "aienos", "path": "crates/aienos-kernel/src/arch/aarch64.rs", "lines": "494", "symbol": "write_u64", "trigger": "loop:unbounded", "row": "AO-011", "class": "N", "authoritative": "false", "evidence": "loop {"}, + {"repo": "aienos", "path": "crates/aienos-kernel/src/arch/aarch64.rs", "lines": "519", "symbol": "read_byte", "trigger": "loop:unbounded", "row": "AO-012", "class": "E", "authoritative": "true", "evidence": "loop {"}, + {"repo": "aienos", "path": "crates/aienos-kernel/src/artifact_loader_tests.rs", "lines": "605", "symbol": "sealed_address_space_is_wx_with_read_only_code_alias", "trigger": "for:body:scheduler", "row": "AO-013", "class": "D", "authoritative": "false", "evidence": "for map in MAPS {"}, + {"repo": "aienos", "path": "crates/aienos-kernel/src/artifact_loader_tests.rs", "lines": "952", "symbol": "full_scheduler_fails_closed_at_admission", "trigger": "for:body:scheduler", "row": "AO-014", "class": "D", "authoritative": "false", "evidence": "for id in 0..LOADED_TASK_SLOTS as u32 {"}, + {"repo": "aienos", "path": "crates/aienos-kernel/src/gic.rs", "lines": "83", "symbol": "wake", "trigger": "for:body:poll", "row": "AO-015", "class": "E", "authoritative": "true", "evidence": "for _ in 0..poll_limit {"}, + {"repo": "aienos", "path": "crates/aienos-kernel/src/infer/tokenizer.rs", "lines": "151", "symbol": "encode_bytes", "trigger": "loop:unbounded", "row": "AO-016", "class": "N", "authoritative": "false", "evidence": "loop {"}, + {"repo": "aienos", "path": "crates/aienos-kernel/src/scheduler.rs", "lines": "287", "symbol": "equal_priority_tasks_share_n_ticks_fairly", "trigger": "for:body:tick", "row": "AO-017", "class": "D", "authoritative": "false", "evidence": "for _ in 0..20 {"}, + {"repo": "aienos", "path": "crates/aienos-kernel/src/scheduler.rs", "lines": "310", "symbol": "background_runs_within_configured_interval_under_latency_load", "trigger": "for:body:tick", "row": "AO-018", "class": "D", "authoritative": "false", "evidence": "for _ in 0..INTERVAL {"}, + {"repo": "aienos", "path": "crates/aienos-kernel/src/scheduler.rs", "lines": "324", "symbol": "latency_keeps_large_majority_of_ticks_with_background_budget", "trigger": "for:body:tick", "row": "AO-019", "class": "D", "authoritative": "false", "evidence": "for _ in 0..TICKS {"}, + {"repo": "aienos", "path": "crates/aienos-kernel/src/scheduler.rs", "lines": "375", "symbol": "removed_tasks_free_their_slot_and_leave_the_queue", "trigger": "for:body:tick", "row": "AO-020", "class": "D", "authoritative": "false", "evidence": "for _ in 0..4 {"}, + {"repo": "aienos", "path": "crates/aienos-kernel/src/thread.rs", "lines": "310", "symbol": "yield_now", "trigger": "for:body:tick", "row": "AO-021", "class": "E", "authoritative": "true", "evidence": "for _ in 0..MAX {"}, + {"repo": "aienos", "path": "crates/aienos-kernel/src/thread.rs", "lines": "340", "symbol": "park", "trigger": "loop:unbounded+yield", "row": "AO-022", "class": "E", "authoritative": "true", "evidence": "loop {"}, + {"repo": "aienos", "path": "crates/aienos-kernel/src/thread.rs", "lines": "389", "symbol": "worker_a", "trigger": "loop:unbounded", "row": "AO-023", "class": "D", "authoritative": "false", "evidence": "loop {"}, + {"repo": "aienos", "path": "crates/aienos-kernel/src/thread.rs", "lines": "396", "symbol": "worker_b", "trigger": "loop:unbounded", "row": "AO-024", "class": "D", "authoritative": "false", "evidence": "loop {"}, + {"repo": "aienos", "path": "crates/aienos-kernel/src/thread.rs", "lines": "532", "symbol": "worker", "trigger": "for:body:yield", "row": "AO-025", "class": "D", "authoritative": "false", "evidence": "for _ in 0..5 {"}, + {"repo": "aienos", "path": "crates/aienos-kernel/src/thread.rs", "lines": "547", "symbol": "worker", "trigger": "while:body:yield", "row": "AO-026", "class": "D", "authoritative": "false", "evidence": "while RUNNABLE.iter().any(|r| *r) {"}, + {"repo": "aienos", "path": "crates/aienos-kernel/src/usb/xhci/controller.rs", "lines": "583", "symbol": "wait_event", "trigger": "loop:unbounded", "row": "AO-027", "class": "E", "authoritative": "true", "evidence": "loop {"}, + {"repo": "aienos", "path": "crates/aienos-kernel/src/usb/xhci/ring.rs", "lines": "201", "symbol": "take", "trigger": "loop:unbounded", "row": "AO-028", "class": "E", "authoritative": "true", "evidence": "loop {"}, + {"repo": "aienos", "path": "crates/aienos-kernel/tests/nvme_completion.rs", "lines": "606", "symbol": "completion_queue_phase_flips_at_depth_eight", "trigger": "for:body:poll", "row": "AO-029", "class": "D", "authoritative": "false", "evidence": "for _ in 0..8 {"}, + {"repo": "aienos", "path": "native/capability/aienos_capability.c", "lines": "65", "symbol": "take_boot_gen", "trigger": "for:unbounded", "row": "AO-030", "class": "N", "authoritative": "false", "evidence": "for (;;) {"}, + {"repo": "aienos", "path": "native/capability/aienos_capability.c", "lines": "174", "symbol": "chain_ok", "trigger": "for:unbounded", "row": "AO-031", "class": "N", "authoritative": "false", "evidence": "for (;;) {"}, + {"repo": "aienos", "path": "native/capability/aienos_capability.c", "lines": "190", "symbol": "ancestor_hops", "trigger": "for:unbounded", "row": "AO-032", "class": "N", "authoritative": "false", "evidence": "for (;;) {"}, + {"repo": "physics", "path": "m15/tools/m15tool.c", "lines": "638", "symbol": "main", "trigger": "cli-mode", "row": "PH-001", "class": "D", "authoritative": "false", "evidence": "if (argc >= 2 && strcmp(argv[1], \"--demonstrate-accelerator\") == 0) {"}, + {"repo": "physics", "path": "m15/tools/m15tool.c", "lines": "647", "symbol": "main", "trigger": "cli-mode", "row": "PH-002", "class": "B", "authoritative": "false", "evidence": "bool run_all = (argc >= 2 && strcmp(argv[1], \"--run-m15-gates\") == 0);"}, + {"repo": "physics", "path": "m16/m16_native.c", "lines": "102", "symbol": "m16_native_wait_marker_ge", "trigger": "while:body:usleep", "row": "PH-003", "class": "E", "authoritative": "true", "evidence": "while (now_ns() < end) {"}, + {"repo": "physics", "path": "m3/tools/m3tool.c", "lines": "50", "symbol": "read_file", "trigger": "for:unbounded", "row": "PH-004", "class": "D", "authoritative": "false", "evidence": "for (;;) {"}, + {"repo": "physics", "path": "nvrm/nvrm.c", "lines": "194", "symbol": "acquire_va_slot", "trigger": "for:unbounded", "row": "PH-005", "class": "N", "authoritative": "false", "evidence": "for (;;) {"} + ], + "manual_rows": 3, + "sites_total": 271, + "unclassified": 0, + "question_rows": 0, + "bad_class": 0, + "a_reachable": 0, + "stale_rows": 0, + "map_errors": 0, + "skipped_repos": 0, + "class_n_sites": 30, + "result": "PASS" +} diff --git a/spec/r16-orchestrator-retirement-map.md b/spec/r16-orchestrator-retirement-map.md new file mode 100644 index 000000000..d02dcb2cd --- /dev/null +++ b/spec/r16-orchestrator-retirement-map.md @@ -0,0 +1,479 @@ +# R16 orchestrator retirement map (R16-G1) + +Status: INVENTORY. Written under `spec/r16-orchestrator-retirement.md` §4, after that +spec's commit and before any retirement code. No rows were changed after the +inventory tool (`tools/r16_loop_inventory.c`, R16-G2) was run against them except to +fill classes. Scope decisions: spec §3.1 (Q1 = A, Q2 = A, decided by Drake 2026-09-28). + +The machine-readable part of this file is the two marked tables. The tool reads only +those. Everything else is explanation. + +## 1. Repositories scanned + +Each at its `origin/main` commit on 2026-09-29. omega was scanned in the R16 worktree +at branch commit `d6c8630` (= omega main `193a7e7` plus the R16 spec only, before this map and tool; no code +differences). The tool prints a WARN when a scanned tree differs from this table, +which is expected for omega on the R16 candidate. + + +| repo | sha | +|---|---| +| omega | 193a7e7123456d6bee7e16918ea9dd19821a845f | +| aien-sovereign-core | 63fe7a782a57445c299b11d4dbcb7db3a03af5f6 | +| aegis-runtime | 2bbce76b056d39dfdf6c2417d4ffc7919a76749c | +| aienos | 8706fb8bdfe8a5c4ffc6f16ad96af5ab5e6922a4 | +| physics | fecbedb1b9cea9e4de0fa3c88fe795934fb361f9 | + + +## 2. Method (what counts as a loop site) + +Output of `r16_loop_inventory --patterns`: + +``` +R16 loop inventory patterns (tools/r16_loop_inventory.c) +files: git ls-files '*.c' '*.h' '*.rs' (tracked only); excluded path prefixes: vendor/ third_party/ tests/r16_inventory/ (vendor/ and third_party/ also at any depth) +comments and string/char literal contents blanked before matching +loop heads: C while( for( do{ ; Rust while, for..in, loop{ ; C do-while tails not double-counted +unbounded: while(1) while(true) while(!0) for(;;) Rust loop{} Rust while true +body words (identifier words, split at _ digits and case): sleep usleep nanosleep msleep poll recv heartbeat tick dispatch schedule scheduler orchestrate orchestrator turn turns pulse yield epoll +flagged loop = unbounded OR a body word in condition or body +named terms (any code line; case/underscore-insensitive; run_until_complete anywhere in an identifier, max_steps and max_turns only as the whole identifier; hit counts use substring): run_until_complete max_steps max_turns +cli-mode (C): a code line testing argv[ against a "--demonstrate-..." or "--run-..." literal +manual rows (line cell starts with "manual"): evidence line must still exist in the file + (symbol not verified); same class rules apply +join key: repo + path + enclosing symbol + whitespace-collapsed source line +class-A reachability (omega only, naming proxy; G3 checks the link map): path or symbol must contain legacy_oracle or reference +class N (not a central loop): data/control-flow idiom; reason must name allowed idiom; body must not contain wait words +``` + +Notes: +- Only C and Rust files are in the gate's file-type scope. Assembly (physics `m3/*.s`, + the historical capability/effect-broker oracle), shell and Mojo are not scanned; + none of them is on the omega production path. +- `vendor/` and `third_party/` are copies of outside libraries (aienos `vendor/` + holds syn, serde, uefi, etc.), not our code. `tests/r16_inventory/` in omega holds + the tool's own planted-loop fixtures. +- "Unbounded" loops are included on purpose: a planted `while (1)` must fail the gate + even if its body has no wait word. This also pulls in data idioms (CAS retries, hash + probes, parsers, list walks); those rows are classified as class N under clarification C1. +- A plain bounded data loop (`for (i = 0; i < n; i++)` with no wait or hand-off word) + is not a site. A bounded loop that polls, sleeps, receives, dispatches, schedules or + takes turns is. +- Straight-line sequencers that no loop pattern can see are listed as manual rows (§4): + the tool checks their source line still exists and applies the class rules to them. + omegatool's hand-sequenced modes are caught by the `cli-mode` pattern (a C line + testing `argv[` against `"--demonstrate-…"` or `"--run-…"`). + +## 3. Search-term hit counts (spec §4) + +Word hits in code (comments and strings removed; identifier words split at `_` and +case changes). These are mentions, not loops; every loop they sit in is a row below. +Counted by the tool on the R16 branch tree (omega main `193a7e7` plus spec, map and +tool) and the four other repos at the SHAs above. + +| term (spec §4) | pattern word(s) | omega | sovereign-core | aegis-runtime | aienos | physics | +|---|---|---|---|---|---|---| +| run_until_complete | run_until_complete | 2 | 7 | 0 | 0 | 0 | +| max_steps | max_steps (substring count; gated only as a whole identifier) | 35 | 7 | 3 | 0 | 0 | +| max_turns | max_turns | 0 | 0 | 13 | 0 | 0 | +| for/while semantic step loops | step, steps (counted, not a gate word: names plan steps and data arrays everywhere; step loops are caught as unbounded, by max_steps, or by a wait word) | 609 | 389 | 70 | 90 | 0 | +| polling for semantic readiness | poll | 34 | 0 | 0 | 13 | 0 | +| (waiting) | sleep, usleep, nanosleep, msleep | 69 | 27 | 0 | 0 | 3 | +| (waiting) | wait (counted, not a gate word: too common in condvar code) | 210 | 18 | 0 | 29 | 13 | +| heartbeat task dispatch | heartbeat | 24 | 15 | 71 | 0 | 0 | +| heartbeat task dispatch | tick | 61 | 4 | 26 | 32 | 0 | +| heartbeat task dispatch | pulse | 17 | 30 | 27 | 0 | 0 | +| central dispatch / manual faculty invocation | dispatch | 52 | 51 | 16 | 25 | 0 | +| duplicate schedulers | schedule, scheduler, sched | 95 | 173 | 0 | 110 | 2 | +| orchestration | orchestrate, orchestrator, orchestration | 10 | 0 | 8 | 0 | 0 | +| turn loops | turn, turns | 0 | 60 | 69 | 0 | 0 | +| message hand-off | recv | 3 | 21 | 2 | 17 | 0 | +| cooperative hand-off | yield | 19 | 3 | 0 | 4 | 0 | + +Loop sites found (rows in §4): see the per-class counts in §6. + +Terms that are not greppable (synchronous AIEN→Omega / Omega→AEGIS calls, duplicate +world / authority / queue / generation / resource-pool / causal-state ownership, +RPC boundaries replaced by reactions) are answered structurally in §5. + +## 4. Loop rows + +Columns (spec §4): id, repo, path, line (at the recorded SHA; several lines when the +same source line repeats in one function), symbol (enclosing function, `-` at file +scope), old role, new role, class (A–F, or `?` with the question in the reason), +authoritative (after R16, for the reaction production path; `false` for every A and D +row), reason, evidence (the flagged source line, whitespace-collapsed; this plus repo, +path and symbol is the join key the tool uses). + +Class-A rows in the Rust repositories are retired by non-use (spec §3.1 Q2 = A): the +code stays, labelled LEGACY / NOT-IN-CHARGE, and R16-G3 proves omega never links or +execs it. Test, benchmark and example code is class D by path (it is not built into +any production binary); in-file Rust `#[cfg(test)]` modules likewise. + + +| id | repo | path | line | symbol | old role | new role | class | authoritative | reason | evidence | +|---|---|---|---|---|---|---|---|---|---|---| +| OM-001 | omega | `research/m15/spbm/sample.c` | 79 | `main` | M15 PMU research sampler | research measurement tool | D | false | research sampling loop; not built into any production binary | `for (unsigned int seq=0;seq<=seconds*10;seq++) {` | +| OM-002 | omega | `research/m15/spbm/sample.c` | 85 | `main` | M15 PMU research sampler | research measurement tool | D | false | EINTR retry of clock_nanosleep inside the research sampler | `do { rc=clock_nanosleep(CLOCK_MONOTONIC,TIMER_ABSTIME,&when,NULL); } while(rc==EINTR);` | +| OM-003 | omega | `src/crumbline/cl_search.c` | 97 | `equiv_seen` | hash-set probe | - | N | false | N: probe: hash-set probe walk without wait or hand-off | `for (;;) {` | +| OM-004 | omega | `src/language/omega_lex.c` | 120 | `omega_language_lex` | lexer token loop | - | N | false | N: parse: lexer token loop without wait or hand-off | `while (1) {` | +| OM-005 | omega | `src/language/omega_lower.c` | 320 | `omega_language_lower_program` | lowering walk | - | N | false | N: walk: AST lowering walk without wait or hand-off | `while (1) {` | +| OM-006 | omega | `src/language/omega_parse.c` | 263 | `parse_clause` | clause parse loop | - | N | false | N: parse: clause parse loop without wait or hand-off | `while (1) {` | +| OM-007 | omega | `src/omega_accelerator_world.c` | 21 | `allocate_handle_epoch` | handle-epoch CAS retry | - | N | false | N: CAS retry: atomic handle-epoch allocation retry without wait or hand-off | `for (;;) {` | +| OM-008 | omega | `src/omega_accelerator_world.c` | 733 | `omega_world_drain` | M19 world drain of in-flight submissions | known-good fallback (M19 world) | C | true | M19 accelerator world is the protected known-good fallback (spec §4 starting verdict C); retires GPFIFO entries, decides no faculty order | `for (uint32_t i = 0; i < world->in_flight_count; i++) {` | +| OM-009 | omega | `src/omega_world_gates.c` | 234 | `test_m19_gate3_channel_reuse` | M19 gate 3 body | M19 qualification gate (regression oracle) | D | false | gate test body run by --run-m19-gates; migration map: regression oracle | `for (uint32_t step = 0; step < 4 && ok; step++) {` | +| OM-010 | omega | `src/omega_world_gates.c` | 664 | `test_m19_gate7_queue_wrap` | M19 gate 7 body | M19 qualification gate (regression oracle) | D | false | gate test body run by --run-m19-gates | `while (submitted < stress_count) {` | +| OM-011 | omega | `src/omega_world_gates.c` | 668 | `test_m19_gate7_queue_wrap` | M19 gate 7 body | M19 qualification gate (regression oracle) | D | false | gate test body run by --run-m19-gates | `for (uint32_t k = 0; k < batch; k++) {` | +| OM-012 | omega | `src/omega_world_gates.c` | 685 | `test_m19_gate7_queue_wrap` | M19 gate 7 completion wait | M19 qualification gate (regression oracle) | D | false | gate test waits on a completion marker; test path only | `while (*world.completion.cpu_marker < dispatch_id) {` | +| OM-013 | omega | `src/omega_world_gates.c` | 1153 | `test_m19_gate8_1000_op` | M19 gate 8 body | M19 qualification gate (regression oracle) | D | false | gate test body run by --run-m19-gates | `for (uint32_t cycle = 0; cycle < 250; cycle++) {` | +| OM-014 | omega | `src/omega_world_gates.c` | 1593 | `test_m19_gate13_memory_bound` | M19 gate 13 body | M19 qualification gate (regression oracle) | D | false | gate test body run by --run-m19-gates | `for (int i = 0; i < 10; i++) {` | +| OM-015 | omega | `src/omega_world_gates.c` | 1597 | `test_m19_gate13_memory_bound` | M19 gate 13 body | M19 qualification gate (regression oracle) | D | false | gate test body run by --run-m19-gates | `for (int i = 0; i < 200; i++) {` | +| OM-016 | omega | `src/runtime/rx_caproot.c` | 63 | `take_boot_gen` | boot-generation CAS retry | - | N | false | N: CAS retry: boot generation allocation retry without wait or hand-off | `for (;;) {` | +| OM-017 | omega | `src/runtime/rx_caproot.c` | 572 | `rx_caproot_inspect` | seqlock read retry | - | N | false | N: seqlock retry: seqlock read retry without wait or hand-off | `for (;;) {` | +| OM-018 | omega | `src/runtime/rx_caproot.c` | 594 | `rx_caproot_validate` | seqlock read retry | - | N | false | N: seqlock retry: seqlock validation retry without wait or hand-off | `for (;;) {` | +| OM-019 | omega | `src/runtime/rx_coherent.c` | 835 | `rx_resident_seat_step` | resident seat drains CPU-to-GPU ring | resident seat ring consumer | E | true | moves descriptors off a hardware-shared ring until empty; schedules GPU work, not faculty order | `for (;;) {` | +| OM-020 | omega | `src/runtime/rx_contract.c` | 1200 | `rc_from_json` | JSON object parse | - | N | false | N: parse: JSON object parser without wait or hand-off | `for (;;) {` | +| OM-021 | omega | `src/runtime/rx_generation.c` | 412 | `file_matches` | file read loop | - | N | false | N: read: file content read loop without wait or hand-off | `for (;;) {` | +| OM-022 | omega | `src/runtime/rx_generation.c` | 1226 | `exec_main` | generation job worker | generation mechanism job worker (protected) | E | true | condvar worker runs pending generation jobs in sequence order; physical job execution for the protected generation mechanism, picks no faculty | `for (;;) {` | +| OM-023 | omega | `src/runtime/rx_graph.c` | 919 | `rx_graph_optimize` | optimizer fixpoint | - | N | false | N: arithmetic: graph optimization fixpoint rewrite without wait or hand-off | `for (;;) {` | +| OM-024 | omega | `src/runtime/rx_omega.c` | 478 | `sandbox_run` | sandbox report read | sandboxed realization pipe protocol | F | true | poll()-with-deadline read of a sandboxed child's report; I/O mechanics, decides no faculty order | `while (got < sizeof(*rep)) {` | +| OM-025 | omega | `src/runtime/rx_plan_arrange.c` | 45 | `pla_goal_read` | goal max_steps field read | plan-length resource bound inside one reaction | E | true | max_steps is a plan-length bound read from the goal (spec §4: listed, D or E); bounds search work inside the plan-arrange reaction, no step loop | `g->max_steps = gf[2];` | +| OM-026 | omega | `src/runtime/rx_plan_arrange.c` | 240 | `heur` | heuristic path walk | - | N | false | N: walk: heuristic path search walk without wait or hand-off | `for (;;) {` | +| OM-027 | omega | `src/runtime/rx_plan_arrange.c` | 277 | `heap_pop` | heap sift-down | - | N | false | N: sift: binary heap sift-down without wait or hand-off | `for (;;) {` | +| OM-028 | omega | `src/runtime/rx_plan_arrange.h` | 41 | `-` | goal max_steps field | plan-length resource bound | E | true | struct field for the plan-length bound (spec §4: D or E); no loop | `uint64_t seq, kind, max_steps, energy;` | +| OM-029 | omega | `src/runtime/rx_resident_gpu.c` | 709 | `wait_marker_or_abort` | wait for GPU marker or abort | GPU seat completion wait | E | true | bounded usleep poll on a GPU completion marker; hardware scheduling | `for (int i = 0; i < timeout_ms * 20; i++) {` | +| OM-030 | omega | `src/runtime/rx_resident_gpu.c` | 862 | `wait_heartbeat` | wait for seat heartbeat | GPU seat liveness wait | E | true | bounded usleep poll on the resident seat heartbeat word; hardware liveness, not task dispatch | `for (int i = 0; i < 2000; i++) {` | +| OM-031 | omega | `src/runtime/rx_resident_gpu.c` | 899 | `lease_main` | seat lease writer | GPU seat lease (03d2820) | E | true | writes the seat lease word every tick so the seat quits if the host dies; physical resource lease | `while (s->lease_run) {` | +| OM-032 | omega | `src/runtime/rx_resident_gpu.c` | 957 | `rx_gpu_seat_kill` | seat kill waits for quit | GPU seat stop / recovery | C | true | operator/recovery stop path of the resident seat (R12 seat-loss, rule 7); protected | `for (int i = 0; i < 2000 && !s->marker_ok; i++) usleep(1000);` | +| OM-033 | omega | `src/runtime/rx_seq_reference.c` | 52 | `rx_seq_pulse` | SEQ pulse | SEQ reference oracle | D | false | rx_seq_reference is the REFERENCE ORACLE ONLY central-loop control for R15 (spec §4 starting verdict D) | `for (uint32_t i = 0; i < plan->n && rc == RX_OK; i++) {` | +| OM-034 | omega | `src/runtime/rx_seq_reference.c` | 79 | `rx_seq_pulse` | SEQ pulse wait | SEQ reference oracle | D | false | reference oracle; waits for a reaction to go dormant in the SEQ control | `while (r->state != RX_DORMANT) {` | +| OM-035 | omega | `src/runtime/rx_seq_reference.c` | 101 | `-` | SEQ run_until_complete | SEQ reference oracle | D | false | reference oracle definition; name already carries reference | `int rx_seq_run_until_complete(RxWorld *w, const RxSeqPlan *plan, uint32_t max_pulses,` | +| OM-036 | omega | `src/runtime/rx_seq_reference.c` | 105 | `rx_seq_run_until_complete` | SEQ run_until_complete loop | SEQ reference oracle | D | false | the central loop the reaction world is benchmarked against (R15); reference only | `for (; p < max_pulses; p++) {` | +| OM-037 | omega | `src/runtime/rx_seq_reference.h` | 56 | `-` | SEQ run_until_complete decl | SEQ reference oracle | D | false | reference oracle declaration | `int rx_seq_run_until_complete(RxWorld *w, const RxSeqPlan *plan, uint32_t max_pulses,` | +| OM-038 | omega | `src/runtime/rx_world.c` | 416 | `try_admit` | reaction admission | reaction world admission | E | true | admits ready reactions against resource budgets until none fit; the reaction runtime's physical scheduler | `for (;;) {` | +| OM-039 | omega | `src/runtime/rx_world.c` | 552 | `drain_deferred` | deferred drain | reaction world deferred queue | E | true | drains deferred wakeups with a quota; reaction runtime mechanics | `for (;;) {` | +| OM-040 | omega | `src/runtime/rx_world.c` | 910 | `release_parked` | release parked reactions | reaction world yield handling | E | true | unparks reactions whose yield budget ran out; worker scheduling, no faculty order | `for (uint32_t i = 0; i < w->n_reactions; i++) {` | +| OM-041 | omega | `src/runtime/rx_world.c` | 923 | `tick_parked` | tick parked reactions | reaction world yield handling | E | true | decrements yield budgets of parked reactions; worker scheduling | `for (uint32_t i = 0; i < w->n_reactions; i++) {` | +| OM-042 | omega | `src/runtime/rx_world.c` | 1293 | `worker_main` | reaction worker thread | reaction world worker | E | true | worker thread pops ready reactions and runs them; the production scheduler that replaced central sequencing | `for (;;) {` | +| OM-043 | omega | `src/visor/visor_console.c` | 462 | `run_loop` | Visor REPL / script line loop | operator console (Omega Visor V1) | B | false | reads one operator line, runs that one command, waits for the next; the operator decides every step, the loop decides no faculty order (merged #69 after the spec; see §5) | `for (;;) {` | +| OM-044 | omega | `src/visor/visor_evidence.c` | 127 | `j_value` | JSON value parse | - | N | false | N: parse: JSON value recursive parser without wait or hand-off | `for (;;) {` | +| OM-045 | omega | `src/visor/visor_parse_command.c` | 135 | `visor_parse_command` | command tokenizer | - | N | false | N: token: command tokenizer without wait or hand-off | `for (;;) {` | +| OM-046 | omega | `tests/runtime/r15_gpu_load.c` | 105 | `main` | test/benchmark loop (while:body:nanosleep) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `while (now_ns() < end) {` | +| OM-047 | omega | `tests/runtime/r15_gpu_load.c` | 115 | `main` | test/benchmark loop (for:unbounded) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for (;;) {` | +| OM-048 | omega | `tests/runtime/r15_measure.c` | 239 | `sampler_main` | test/benchmark loop (while:body:nanosleep) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `while (!__atomic_load_n(&e->stop, __ATOMIC_ACQUIRE)) {` | +| OM-049 | omega | `tests/runtime/rx_branch_reuse.c` | 321 | `energy_by_repetition` | test/benchmark loop (for:unbounded) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for (;;) {` | +| OM-050 | omega | `tests/runtime/rx_cog_engines.c` | 268 | `plan_sample` | test/benchmark loop (for:unbounded) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for (;;) {` | +| OM-051 | omega | `tests/runtime/rx_cog_engines.c` | 312 | `heap_pop` | test/benchmark loop (for:unbounded) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for (;;) {` | +| OM-052 | omega | `tests/runtime/rx_heartbeat_test.c` | 623 | `t_concurrent_publication` | test/benchmark loop (for:body:tick) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for (int i = 0; i < 8; i++) {` | +| OM-053 | omega | `tests/runtime/rx_heartbeat_test.c` | 1304 | `fn_hold` | test/benchmark loop (while:body:sleep) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `while (g_hold) sleep_ms(1);` | +| OM-054 | omega | `tests/runtime/rx_heartbeat_test.c` | 1348 | `t_resource_admission` | test/benchmark loop (for:body:sleep) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for (int n = 0; n < 200; n++) {` | +| OM-055 | omega | `tests/runtime/rx_heartbeat_test.c` | 1527 | `t_priority_ladder` | test/benchmark loop (for:body:tick) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for (uint32_t p = 0; p < RX_PRIORITY_CLASSES; p++) {` | +| OM-056 | omega | `tests/runtime/rx_plan_reuse.c` | 145 | `-` | test/benchmark loop (named:max_steps) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `uint64_t world_gen, cog_gen, max_steps;` | +| OM-057 | omega | `tests/runtime/rx_plan_reuse.c` | 284 | `env_build` | test/benchmark loop (named:max_steps) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `uint64_t gl[RX_MAX_FIELDS] = { 1000u + sp->seed, PLA_GOAL_ARRANGE, sp->max_steps, 1000, pl_ref_pack(fr) };` | +| OM-058 | omega | `tests/runtime/rx_plan_reuse.c` | 709 | `adversarial_case` | test/benchmark loop (named:max_steps) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `if (p == PERT_GOAL) sp.max_steps = stored ? stored->n_steps - 1 : 1;` | +| OM-059 | omega | `tests/runtime/rx_r10_omega.c` | 166 | `request` | test/benchmark loop (while:body:sleep) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `while (fld(e, e->f.o.result, 0) != seq) {` | +| OM-060 | omega | `tests/runtime/rx_r11_aien.c` | 717 | `request` | test/benchmark loop (while:body:sleep) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `while (fld(e, e->f.o.result, 0) != seq) {` | +| OM-061 | omega | `tests/runtime/rx_r12_resident.c` | 35 | `CHECK` | test/benchmark loop (do:body:sleep) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `#define CHECK(cond, ...) do { \` | +| OM-062 | omega | `tests/runtime/rx_r12_resident.c` | 167 | `wait_seat` | test/benchmark loop (for:body:sleep) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for (int i = 0; i < 2000; i++) {` | +| OM-063 | omega | `tests/runtime/rx_r12_silicon.c` | 204 | `wait_claimed` | test/benchmark loop (for:body:sleep) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for (int i = 0; i < 3000; i++) {` | +| OM-064 | omega | `tests/runtime/rx_r12_silicon.c` | 217 | `wait_chip` | test/benchmark loop (for:body:sleep) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for (int i = 0; i < 3000; i++) {` | +| OM-065 | omega | `tests/runtime/rx_r12_silicon.c` | 226 | `poll_accept` | test/benchmark loop (for:body:sleep) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for (int i = 0; i < 3000; i++) {` | +| OM-066 | omega | `tests/runtime/rx_r12_silicon.c` | 363 | `acceptor_main` | test/benchmark loop (while:body:nanosleep) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `while (!atomic_load(&a->stop)) {` | +| OM-067 | omega | `tests/runtime/rx_r12_silicon.c` | 392 | `loader_main` | test/benchmark loop (for:body:nanosleep) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for (uint64_t n = 0; !atomic_load(&l->stop); n++) {` | +| OM-068 | omega | `tests/runtime/rx_r12_silicon.c` | 770 | `main` | test/benchmark loop (for:body:sleep) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for (int i = 0; i < 3000 && !moved; i++) {` | +| OM-069 | omega | `tests/runtime/rx_r12_silicon.c` | 802 | `main` | test/benchmark loop (for:body:sleep) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for (int i = 0; i < 3000 && !held; i++) {` | +| OM-070 | omega | `tests/runtime/rx_r12_silicon.c` | 900 | `main` | test/benchmark loop (for:body:nanosleep) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for (int i = 0; i < rounds && !g_fail; i++) {` | +| OM-071 | omega | `tests/runtime/rx_r14_recovery.c` | 2159 | `f_reporter` | test/benchmark loop (for:unbounded) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for (;;) {` | +| OM-072 | omega | `tests/runtime/rx_r14_recovery.c` | 2297 | `run_child` | test/benchmark loop (for:unbounded) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for (;;) {` | +| OM-073 | omega | `tests/runtime/rx_r15_g7.c` | 84 | `disk_hook` | test/benchmark loop (while:body:nanosleep) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `while (now_ns() - t0 < 2000000000ull) {` | +| OM-074 | omega | `tests/runtime/rx_r15_instr.c` | 375 | `main` | test/benchmark loop (for:body:scheduler) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for (size_t i = 0; i < sizeof fanouts / sizeof fanouts[0]; i++)` | +| OM-075 | omega | `tests/runtime/rx_r15_perf.c` | 48 | `sleep_ns` | test/benchmark loop (while:body:nanosleep) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `while (nanosleep(&ts, &ts) != 0) {}` | +| OM-076 | omega | `tests/runtime/rx_r15_perf.c` | 119 | `thermal_wait` | test/benchmark loop (while:body:sleep) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `while ((hot = max_temp_mc()) > 55000 && r15_now_ns() - t0 < 120000000000ull) sleep_ns(1000000000ull);` | +| OM-077 | omega | `tests/runtime/rx_r15_perf.c` | 149 | `sampler_main` | test/benchmark loop (while:body:nanosleep) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `while (!s->stop) {` | +| OM-078 | omega | `tests/runtime/rx_r15_perf.c` | 752 | `l1_orch` | test/benchmark loop (while:body:pulse) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `while (!atomic_load(&e->stop)) {` | +| OM-079 | omega | `tests/runtime/rx_r15_perf.c` | 1142 | `l1_rig` | test/benchmark loop (for:body:sleep) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for (int b = 0; b < 30 && ok; b++) {` | +| OM-080 | omega | `tests/runtime/rx_r15_perf.c` | 1272 | `run_l2` | test/benchmark loop (for:body:heartbeat) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for (uint32_t i = 0; i < CLAIMS && ok; i++) {` | +| OM-081 | omega | `tests/runtime/rx_r15_rig.c` | 137 | `transport_main` | test/benchmark loop (while:body:yield) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `while (!atomic_load(&r->transport_stop)) {` | +| OM-082 | omega | `tests/runtime/rx_r15_rig.c` | 214 | `orchestrator_main` | test/benchmark loop (while:body:pulse) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `while (!atomic_load(&r->orch_stop)) {` | +| OM-083 | omega | `tests/runtime/rx_sem_incremental.c` | 992 | `replay` | test/benchmark loop (for:body:tick) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for (int tick = 0; tick < TRACE_TICKS; tick++) {` | +| OM-084 | omega | `tests/runtime/rx_sem_incremental.c` | 993 | `replay` | test/benchmark loop (for:body:tick) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for (int i = 0; i < N_NOISE; i++) put(&x, x.noise[i], (uint32_t)(tick % 4), splitmix(&rng));` | +| OM-085 | omega | `tests/runtime/rx_sem_incremental.c` | 1027 | `replay` | test/benchmark loop (for:body:tick) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for (int c = 0; c < JSPACE_WIDTH; c++) {` | +| OM-086 | omega | `tests/runtime/rx_sem_incremental.c` | 1153 | `sleep_ns` | test/benchmark loop (while:body:nanosleep) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `while (nanosleep(&ts, &ts) != 0) {}` | +| OM-087 | omega | `tests/runtime/rx_sp_workloads.c` | 392 | `sp_build` | test/benchmark loop (for:body:schedule) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for (uint64_t x = 1; x <= S && !rc; x++) {` | +| OM-088 | omega | `tools/crumbline_learner.c` | 188 | `serve` | learner frame server | Crumbline learner stdin/stdout protocol | F | false | reads framed requests from the curriculum driver; protocol loop, decides no faculty order | `for (;;) {` | +| OM-089 | omega | `tools/omegatool.c` | 3749 | `main` | deterministic gate runner | maintenance control | B | false | spec 4 starting verdict: --run-*-gates = B (deterministic maintenance / qualification control) | `if (strcmp(argv[1], "--run-gates") == 0) {` | +| OM-090 | omega | `tools/omegatool.c` | 3753 | `main` | deterministic gate runner | maintenance control | B | false | spec 4 starting verdict: --run-*-gates = B (deterministic maintenance / qualification control) | `if (strcmp(argv[1], "--run-m5-gates") == 0) {` | +| OM-091 | omega | `tools/omegatool.c` | 3757 | `main` | deterministic gate runner | maintenance control | B | false | spec 4 starting verdict: --run-*-gates = B (deterministic maintenance / qualification control) | `if (strcmp(argv[1], "--run-m6-gates") == 0) {` | +| OM-092 | omega | `tools/omegatool.c` | 3761 | `main` | hand-sequenced milestone demonstration | reference oracle (legacy orchestrated runtime) | D | false | historical milestone demonstration; migration map: omegatool = Oracle; not a production entry point. G5 still needs an explicit legacy name (W5) | `if (strcmp(argv[1], "--demonstrate-self-host") == 0) {` | +| OM-093 | omega | `tools/omegatool.c` | 3766 | `main` | deterministic gate runner | maintenance control | B | false | spec 4 starting verdict: --run-*-gates = B (deterministic maintenance / qualification control) | `if (strcmp(argv[1], "--run-m7-gates") == 0) {` | +| OM-094 | omega | `tools/omegatool.c` | 3770 | `main` | hand-sequenced milestone demonstration | reference oracle (legacy orchestrated runtime) | D | false | historical milestone demonstration; migration map: omegatool = Oracle; not a production entry point. G5 still needs an explicit legacy name (W5) | `if (strcmp(argv[1], "--demonstrate-verify") == 0) {` | +| OM-095 | omega | `tools/omegatool.c` | 3775 | `main` | deterministic gate runner | maintenance control | B | false | spec 4 starting verdict: --run-*-gates = B (deterministic maintenance / qualification control) | `if (strcmp(argv[1], "--run-m8-gates") == 0) {` | +| OM-096 | omega | `tools/omegatool.c` | 3779 | `main` | hand-sequenced milestone demonstration | reference oracle (legacy orchestrated runtime) | D | false | historical milestone demonstration; migration map: omegatool = Oracle; not a production entry point. G5 still needs an explicit legacy name (W5) | `if (strcmp(argv[1], "--demonstrate-program") == 0) {` | +| OM-097 | omega | `tools/omegatool.c` | 3784 | `main` | deterministic gate runner | maintenance control | B | false | spec 4 starting verdict: --run-*-gates = B (deterministic maintenance / qualification control) | `if (strcmp(argv[1], "--run-m9-gates") == 0) {` | +| OM-098 | omega | `tools/omegatool.c` | 3788 | `main` | deterministic gate runner | maintenance control | B | false | spec 4 starting verdict: --run-*-gates = B (deterministic maintenance / qualification control) | `if (strcmp(argv[1], "--run-m10-gates") == 0) {` | +| OM-099 | omega | `tools/omegatool.c` | 3792 | `main` | hand-sequenced milestone demonstration | reference oracle (legacy orchestrated runtime) | D | false | historical milestone demonstration; migration map: omegatool = Oracle; not a production entry point. G5 still needs an explicit legacy name (W5) | `if (strcmp(argv[1], "--demonstrate-library") == 0) {` | +| OM-100 | omega | `tools/omegatool.c` | 3797 | `main` | deterministic gate runner | maintenance control | B | false | spec 4 starting verdict: --run-*-gates = B (deterministic maintenance / qualification control) | `if (strcmp(argv[1], "--run-m11-gates") == 0) {` | +| OM-101 | omega | `tools/omegatool.c` | 3801 | `main` | hand-sequenced milestone demonstration | reference oracle (legacy orchestrated runtime) | D | false | historical milestone demonstration; migration map: omegatool = Oracle; not a production entry point. G5 still needs an explicit legacy name (W5) | `if (strcmp(argv[1], "--demonstrate-discovery") == 0) {` | +| OM-102 | omega | `tools/omegatool.c` | 3806 | `main` | deterministic gate runner | maintenance control | B | false | spec 4 starting verdict: --run-*-gates = B (deterministic maintenance / qualification control) | `if (strcmp(argv[1], "--run-m12-gates") == 0) {` | +| OM-103 | omega | `tools/omegatool.c` | 3745 | `legacy_oracle_demonstrate_living_matvec` | hand-sequenced living matvec demonstration (spec -> machine -> kernel -> benchmark -> select) | retire: moved behind legacy_oracle name (W5) | A | false | spec 3.1 / 4: omegatool --demonstrate-living-matvec is the omega hand-sequenced tool path replaced by the R13 living system; retired behind legacy_oracle (W5) | `if (strcmp(argv[1], "--demonstrate-living-matvec") == 0) {` | +| OM-104 | omega | `tools/omegatool.c` | 3815 | `main` | deterministic gate runner | maintenance control | B | false | spec 4 starting verdict: --run-*-gates = B (deterministic maintenance / qualification control) | `if (strcmp(argv[1], "--run-m13-gates") == 0) {` | +| OM-105 | omega | `tools/omegatool.c` | 3819 | `main` | hand-sequenced milestone demonstration | reference oracle (legacy orchestrated runtime) | D | false | historical milestone demonstration; migration map: omegatool = Oracle; not a production entry point. G5 still needs an explicit legacy name (W5) | `if (strcmp(argv[1], "--demonstrate-machine") == 0) {` | +| OM-106 | omega | `tools/omegatool.c` | 3824 | `main` | deterministic gate runner | maintenance control | B | false | spec 4 starting verdict: --run-*-gates = B (deterministic maintenance / qualification control) | `if (strcmp(argv[1], "--run-m14-gates") == 0) {` | +| OM-107 | omega | `tools/omegatool.c` | 3828 | `main` | hand-sequenced milestone demonstration | reference oracle (legacy orchestrated runtime) | D | false | historical milestone demonstration; migration map: omegatool = Oracle; not a production entry point. G5 still needs an explicit legacy name (W5) | `if (strcmp(argv[1], "--demonstrate-realization-synthesis") == 0) {` | +| OM-108 | omega | `tools/omegatool.c` | 3833 | `main` | deterministic gate runner | maintenance control | B | false | spec 4 starting verdict: --run-*-gates = B (deterministic maintenance / qualification control) | `if (strcmp(argv[1], "--run-m15-gates") == 0) {` | +| OM-109 | omega | `tools/omegatool.c` | 3837 | `main` | hand-sequenced milestone demonstration | reference oracle (legacy orchestrated runtime) | D | false | historical milestone demonstration; migration map: omegatool = Oracle; not a production entry point. G5 still needs an explicit legacy name (W5) | `if (strcmp(argv[1], "--demonstrate-accelerator") == 0) {` | +| OM-110 | omega | `tools/omegatool.c` | 3842 | `main` | deterministic gate runner | maintenance control | B | false | spec 4 starting verdict: --run-*-gates = B (deterministic maintenance / qualification control) | `if (strcmp(argv[1], "--run-world-lifecycle-gates") == 0) {` | +| OM-111 | omega | `tools/omegatool.c` | 3845 | `main` | deterministic gate runner | maintenance control | B | false | spec 4 starting verdict: --run-*-gates = B (deterministic maintenance / qualification control) | `if (strcmp(argv[1], "--run-m19r-soak") == 0) {` | +| OM-112 | omega | `tools/omegatool.c` | 3848 | `main` | deterministic gate runner | maintenance control | B | false | spec 4 starting verdict: --run-*-gates = B (deterministic maintenance / qualification control) | `if (strcmp(argv[1], "--run-m19-gates") == 0) {` | +| OM-113 | omega | `tools/omegatool.c` | 3857 | `main` | hand-sequenced milestone demonstration | reference oracle (legacy orchestrated runtime) | D | false | historical milestone demonstration; migration map: omegatool = Oracle; not a production entry point. G5 still needs an explicit legacy name (W5) | `if (strcmp(argv[1], "--demonstrate-accelerator-world") == 0) {` | +| OM-114 | omega | `tools/omegatool.c` | 3862 | `main` | deterministic gate runner | maintenance control | B | false | spec 4 starting verdict: --run-*-gates = B (deterministic maintenance / qualification control) | `if (strcmp(argv[1], "--run-m18-gates") == 0) {` | +| OM-115 | omega | `tools/omegatool.c` | 3866 | `main` | hand-sequenced milestone demonstration | reference oracle (legacy orchestrated runtime) | D | false | historical milestone demonstration; migration map: omegatool = Oracle; not a production entry point. G5 still needs an explicit legacy name (W5) | `if (strcmp(argv[1], "--demonstrate-blackwell-matmul") == 0) {` | +| OM-116 | omega | `tools/omegatool.c` | 3871 | `main` | deterministic gate runner | maintenance control | B | false | spec 4 starting verdict: --run-*-gates = B (deterministic maintenance / qualification control) | `if (strcmp(argv[1], "--run-m17-gates") == 0) {` | +| OM-117 | omega | `tools/omegatool.c` | 3875 | `main` | hand-sequenced milestone demonstration | reference oracle (legacy orchestrated runtime) | D | false | historical milestone demonstration; migration map: omegatool = Oracle; not a production entry point. G5 still needs an explicit legacy name (W5) | `if (strcmp(argv[1], "--demonstrate-blackwell-codegen") == 0) {` | +| OM-118 | omega | `tools/omegatool.c` | 3879 | `main` | hand-sequenced milestone demonstration | reference oracle (legacy orchestrated runtime) | D | false | historical milestone demonstration; migration map: omegatool = Oracle; not a production entry point. G5 still needs an explicit legacy name (W5) | `if (strcmp(argv[1], "--demonstrate-blackwell-vector") == 0) {` | +| OM-119 | omega | `tools/omegatool.c` | 3884 | `main` | hand-sequenced milestone demonstration | reference oracle (legacy orchestrated runtime) | D | false | historical milestone demonstration; migration map: omegatool = Oracle; not a production entry point. G5 still needs an explicit legacy name (W5) | `if (strcmp(argv[1], "--demonstrate-synthesis") == 0) {` | +| OM-120 | omega | `tools/omegatool.c` | 3889 | `main` | hand-sequenced milestone demonstration | reference oracle (legacy orchestrated runtime) | D | false | historical milestone demonstration; migration map: omegatool = Oracle; not a production entry point. G5 still needs an explicit legacy name (W5) | `if (strcmp(argv[1], "--demonstrate-realization") == 0) {` | +| OM-121 | omega | `tools/omegatool.c` | 3894 | `main` | hand-sequenced milestone demonstration | reference oracle (legacy orchestrated runtime) | D | false | historical milestone demonstration; migration map: omegatool = Oracle; not a production entry point. G5 still needs an explicit legacy name (W5) | `if (strcmp(argv[1], "--demonstrate-arithmetic") == 0) {` | +| OM-122 | omega | `tools/omegatool.c` | 3899 | `main` | hand-sequenced milestone demonstration | reference oracle (legacy orchestrated runtime) | D | false | historical milestone demonstration; migration map: omegatool = Oracle; not a production entry point. G5 still needs an explicit legacy name (W5) | `if (strcmp(argv[1], "--demonstrate-physics") == 0) {` | +| OM-123 | omega | `tools/r15_reduce.c` | 82,102 | `jparse` | JSON parse in R15 reducer | R15 evidence reducer | D | false | evidence reduction tool, not on the production path | `for (;;) {` | +| OM-124 | omega | `tools/r15_reduce.c` | 325 | `read_file` | file read in R15 reducer | R15 evidence reducer | D | false | evidence reduction tool, not on the production path | `while (1) {` | +| OM-125 | omega | `src/runtime/rx_argus.c` | 435 | `merge` | ARGUS event stream merge | - | N | false | N: merge: event stream merge pass across producer rings without wait or hand-off | `for (;;) {` | +| OM-126 | omega | `src/runtime/rx_argus.c` | 498 | `consumer_main` | ARGUS telemetry consumer thread | resident telemetry consumer | E | true | background consumer thread merges and drains telemetry event rings; physical telemetry worker, decides no faculty order | `while (!atomic_load_explicit(&g.stop, memory_order_acquire)) {` | +| OM-127 | omega | `tests/runtime/rx_empirical_optimizer.c` | 264 | `cpu_busy` | test/benchmark loop (for:body:nanosleep) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for (int s = 0; s < 2; s++) {` | +| OM-128 | omega | `tests/runtime/rx_empirical_optimizer.c` | 874 | `judge` | test/benchmark loop (for:body:dispatch) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for (uint32_t k = 0; k < RX_CM_CORES; k++)` | +| OM-129 | omega | `tests/runtime/rx_empirical_optimizer.c` | 875 | `judge` | test/benchmark loop (for:body:dispatch) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for (uint32_t i = 0; i < g_val.n[k]; i++) {` | +| OM-130 | omega | `tests/runtime/rx_empirical_optimizer.c` | 1143 | `heldout` | test/benchmark loop (for:body:dispatch) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for (uint32_t i = 0; i < n; i++) {` | +| OM-131 | omega | `tests/runtime/rx_empirical_optimizer.c` | 1282 | `judge_gate` | test/benchmark loop (for:body:dispatch) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for (uint32_t k = 0; k < RX_CM_CORES; k++) {` | +| OM-132 | omega | `tests/runtime/rx_empirical_optimizer.c` | 1284 | `judge_gate` | test/benchmark loop (for:body:dispatch) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for (uint32_t d = 0; d < N_DIST; d++) {` | +| OM-133 | omega | `tests/runtime/rx_empirical_optimizer.c` | 1401 | `write_receipt` | test/benchmark loop (for:body:dispatch) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for (uint32_t k = 0; k < RX_CM_CORES; k++) {` | +| OM-134 | omega | `tests/runtime/rx_empirical_optimizer.c` | 1405 | `write_receipt` | test/benchmark loop (for:body:dispatch) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for (uint32_t d = 0; d < N_DIST; d++) {` | +| OM-135 | omega | `tests/runtime/rx_empirical_optimizer.c` | 1520 | `main` | test/benchmark loop (for:body:dispatch) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for (uint32_t k = 0; k < RX_CM_CORES; k++) {` | +| OM-136 | omega | `tests/runtime/rx_empirical_optimizer.c` | 1538 | `main` | test/benchmark loop (for:body:dispatch) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for (uint32_t d = 0; d < N_DIST; d++) {` | +| SC-001 | aien-sovereign-core | `benchmarks/crates/bench_apples_to_apples/src/engine_max.rs` | 55 | `start` | test/benchmark loop (while:body:sleep) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `while start.elapsed() < timeout {` | +| SC-002 | aien-sovereign-core | `benchmarks/crates/bench_apples_to_apples/src/telemetry.rs` | 96 | `start` | test/benchmark loop (while:body:tick) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `while !stop_clone.load(Ordering::Relaxed) {` | +| SC-003 | aien-sovereign-core | `benchmarks/crates/bench_apples_to_apples/src/telemetry.rs` | 168 | `enforce_thermal_cooldown` | test/benchmark loop (while:body:sleep) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `while start.elapsed() < max_wait {` | +| SC-004 | aien-sovereign-core | `crates/aien-cli/src/commands.rs` | 1216 | `handle_start_command` | start command waits for runtime socket | operator start command | B | false | operator 'start' waits up to 60 s for the runtime daemon socket; process readiness, not semantic readiness. LEGACY / NOT-IN-CHARGE (Q2=A) | `for _ in 0..60 {` | +| SC-005 | aien-sovereign-core | `crates/aien-cli/src/hooks.rs` | 43 | `run_pre_turn` | pre-turn hooks | - | A | false | retired by non-use: legacy terminal operator CLI, superseded by orchestrator interface | `for h in &self.hooks {` | +| SC-006 | aien-sovereign-core | `crates/aien-cli/src/hooks.rs` | 50 | `run_post_turn` | post-turn hooks | - | A | false | retired by non-use: legacy terminal operator CLI, superseded by orchestrator interface | `for h in &self.hooks {` | +| SC-007 | aien-sovereign-core | `crates/aien-cli/src/main.rs` | 278 | `main` | interactive REPL input loop | terminal I/O loop | F | false | reads operator lines and hands them on; terminal protocol mechanics (the tool-turn loops inside it are separate rows). LEGACY / NOT-IN-CHARGE | `loop {` | +| SC-008 | aien-sovereign-core | `crates/aien-cli/src/main.rs` | 306 | `main` | LLM tool-turn loop | - | A | false | retired by non-use: legacy terminal operator CLI, superseded by orchestrator interface | `while max_tool_steps > 0 {` | +| SC-009 | aien-sovereign-core | `crates/aien-cli/src/main.rs` | 332 | `main` | tool-call dispatch | - | A | false | retired by non-use: legacy terminal operator CLI, superseded by orchestrator interface | `for (tool_name, tool_args) in tool_calls {` | +| SC-010 | aien-sovereign-core | `crates/aien-cli/src/main.rs` | 401 | `run_single_prompt` | LLM tool-turn loop (single prompt) | - | A | false | retired by non-use: legacy terminal operator CLI, superseded by orchestrator interface | `while max_tool_steps > 0 {` | +| SC-011 | aien-sovereign-core | `crates/aien-cli/src/main.rs` | 416 | `run_single_prompt` | tool-call dispatch | - | A | false | retired by non-use: legacy terminal operator CLI, superseded by orchestrator interface | `for (tool_name, tool_args) in tool_calls {` | +| SC-012 | aien-sovereign-core | `crates/aien-cli/src/main.rs` | 476 | `run_autonomous_goal` | autonomous goal milestone loop | - | A | false | retired by non-use: legacy terminal operator CLI, superseded by orchestrator interface | `for m in &goal.milestones {` | +| SC-013 | aien-sovereign-core | `crates/aien-cli/src/main.rs` | 520 | `run_autonomous_goal` | LLM tool-turn loop (autonomous goal) | - | A | false | retired by non-use: legacy terminal operator CLI, superseded by orchestrator interface | `while max_tool_steps > 0 {` | +| SC-014 | aien-sovereign-core | `crates/aien-cli/src/main.rs` | 539 | `run_autonomous_goal` | tool-call dispatch | - | A | false | retired by non-use: legacy terminal operator CLI, superseded by orchestrator interface | `for (tool_name, tool_args) in tool_calls {` | +| SC-015 | aien-sovereign-core | `crates/aien-cli/src/subagents.rs` | 148 | `execute_subagent` | subagent max_steps | - | A | false | retired by non-use: legacy terminal operator CLI, superseded by orchestrator interface | `let mut max_steps = 10;` | +| SC-016 | aien-sovereign-core | `crates/aien-cli/src/subagents.rs` | 152 | `execute_subagent` | subagent tool-turn loop | - | A | false | retired by non-use: legacy terminal operator CLI, superseded by orchestrator interface | `while max_steps > 0 {` | +| SC-017 | aien-sovereign-core | `crates/aien-cli/src/subagents.rs` | 153 | `execute_subagent` | subagent max_steps decrement | - | A | false | retired by non-use: legacy terminal operator CLI, superseded by orchestrator interface | `max_steps -= 1;` | +| SC-018 | aien-sovereign-core | `crates/aien-cli/src/subagents.rs` | 176 | `execute_subagent` | subagent tool-call dispatch | - | A | false | retired by non-use: legacy terminal operator CLI, superseded by orchestrator interface | `for (tool_name, tool_args) in &tool_calls {` | +| SC-019 | aien-sovereign-core | `crates/aien-cli/tests/test_cli_runtime_ipc.rs` | 40 | `test_cli_runtime_ipc_lifecycle` | test/benchmark loop (for:body:sleep) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for _ in 0..50 {` | +| SC-020 | aien-sovereign-core | `crates/aien-inference-runtime/tests/runtime_tests.rs` | 18 | `test_embedded_inference_service_reference_weights` | test/benchmark loop (while:body:recv) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `while let Some(evt) = rx.recv().await {` | +| SC-021 | aien-sovereign-core | `crates/aien-proof/src/board.rs` | 163 | `tee` | test-board log tee | aien-proof test board tooling | D | false | copies a child's output to the board log; test infrastructure only | `loop {` | +| SC-022 | aien-sovereign-core | `crates/aien-proof/src/board.rs` | 244 | `acquire_cpu_slot` | test-board CPU slot wait | test-board CPU admission | E | false | waits for a free CPU slot before a test job runs; physical resource admission for test runs | `loop {` | +| SC-023 | aien-sovereign-core | `crates/aien-proof/src/board.rs` | 424 | `wait_for_memory` | test-board memory wait | test-board memory admission | E | false | waits for free memory before a test job; physical resource admission | `while let Some(free) = mem_available() {` | +| SC-024 | aien-sovereign-core | `crates/aien-proof/src/lib.rs` | 33 | `temp_dir` | unique temp dir retry | aien-proof test tooling | D | false | test infrastructure helper | `loop {` | +| SC-025 | aien-sovereign-core | `crates/aien-proof/src/lock.rs` | 29 | `acquire` | flock EINTR retry | aien-proof test tooling | D | false | test-board file lock; test infrastructure | `loop {` | +| SC-026 | aien-sovereign-core | `crates/aien-proof/tests/store_qualification_adversarial.rs` | 14 | `temp_store` | test/benchmark loop (loop:unbounded) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `loop {` | +| SC-027 | aien-sovereign-core | `crates/aien-runtime/src/client.rs` | 175 | `stream_turn` | client reads streamed turn events | runtime IPC client stream | F | false | socket stream reader; protocol mechanics. LEGACY / NOT-IN-CHARGE | `loop {` | +| SC-028 | aien-sovereign-core | `crates/aien-runtime/src/server.rs` | 106 | `run` | spine worker calls step() while work exists | LLM request serving driver | E | false | drives AienRuntimeSpine::step, one batched forward pass per call. Spec §3.1: LLM request serving, not replaced; retirement deferred to the planned C rewrite of sovereign-core. NOT RETIRED by R16 | `while is_running_worker.load(Ordering::Relaxed) {` | +| SC-029 | aien-sovereign-core | `crates/aien-runtime/src/server.rs` | 129 | `run` | socket accept loop | runtime IPC server | F | false | Unix-socket accept loop; protocol mechanics. LEGACY / NOT-IN-CHARGE | `loop {` | +| SC-030 | aien-sovereign-core | `crates/aien-runtime/src/server.rs` | 252 | `stream_turn` | stream turn events to client | runtime IPC server | F | false | forwards events on a socket; protocol mechanics | `loop {` | +| SC-031 | aien-sovereign-core | `crates/aien-runtime/src/server.rs` | 307 | `handle_connection` | per-connection request reader | runtime IPC server | F | false | line-protocol reader; protocol mechanics | `while let Ok(n) = buf_reader.read_line(&mut line).await {` | +| SC-032 | aien-sovereign-core | `crates/aien-runtime/src/spine.rs` | 112 | `run_until_complete` | run_until_complete definition | LLM request serving (not replaced) | E | false | spec §3.1 Q1=A: each step is one batched LLM forward pass; LLM request serving, not replaced; retirement deferred to the planned C rewrite of sovereign-core. NOT RETIRED by R16 | `pub async fn run_until_complete(` | +| SC-033 | aien-sovereign-core | `crates/aien-runtime/src/spine.rs` | 115 | `run_until_complete` | run_until_complete max_steps bound | LLM request serving (not replaced) | E | false | spec §3.1 Q1=A: bound on engine steps of LLM request serving, not replaced; retirement deferred to the planned C rewrite of sovereign-core | `max_steps: usize,` | +| SC-034 | aien-sovereign-core | `crates/aien-runtime/src/spine.rs` | 118 | `run_until_complete` | run_until_complete step loop | LLM request serving (not replaced) | E | false | spec §3.1 Q1=A: LLM request serving, not replaced; retirement deferred to the planned C rewrite of sovereign-core. NOT RETIRED by R16 | `for _ in 0..max_steps {` | +| SC-035 | aien-sovereign-core | `crates/aien-runtime/src/spine.rs` | 200 | `launch_swarm` | swarm branch enqueue | token scheduler admission | E | false | enqueues branch sequences into the token scheduler; part of the spine (spec §3.1) | `for &child_seq in &swarm.branch_sequences {` | +| SC-036 | aien-sovereign-core | `crates/aien-runtime/tests/runtime_500_branch_benchmark.rs` | 80 | `test_runtime_spine_500_branch_benchmark` | test/benchmark loop (while:body:scheduler) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `while (spine.scheduler.running_count() > 0 \|\| spine.scheduler.waiting_count() > 0)` | +| SC-037 | aien-sovereign-core | `crates/aien-runtime/tests/runtime_end_to_end_tests.rs` | 136 | `test_end_to_end_ticket_submission_and_channel_streaming_cpu` | test/benchmark loop (named:run_until_complete) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `let metrics = spine.run_until_complete(&mut backend, 20).await.unwrap();` | +| SC-038 | aien-sovereign-core | `crates/aien-runtime/tests/runtime_end_to_end_tests.rs` | 143 | `test_end_to_end_ticket_submission_and_channel_streaming_cpu` | test/benchmark loop (while:body:recv) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `while let Ok(event) = rx.try_recv() {` | +| SC-039 | aien-sovereign-core | `crates/aien-runtime/tests/runtime_end_to_end_tests.rs` | 266 | `test_end_to_end_subagent_branching_with_independent_sinks` | test/benchmark loop (named:run_until_complete) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `let _ = spine.run_until_complete(&mut backend, 30).await.unwrap();` | +| SC-040 | aien-sovereign-core | `crates/aien-runtime/tests/runtime_end_to_end_tests.rs` | 270 | `test_end_to_end_subagent_branching_with_independent_sinks` | test/benchmark loop (while:body:recv) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `while let Ok(event) = rx_parent.try_recv() {` | +| SC-041 | aien-sovereign-core | `crates/aien-runtime/tests/runtime_end_to_end_tests.rs` | 282 | `test_end_to_end_subagent_branching_with_independent_sinks` | test/benchmark loop (while:body:recv) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `while let Ok(event) = rx_child1.try_recv() {` | +| SC-042 | aien-sovereign-core | `crates/aien-runtime/tests/runtime_end_to_end_tests.rs` | 294 | `test_end_to_end_subagent_branching_with_independent_sinks` | test/benchmark loop (while:body:recv) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `while let Ok(event) = rx_child2.try_recv() {` | +| SC-043 | aien-sovereign-core | `crates/aien-runtime/tests/runtime_end_to_end_tests.rs` | 387 | `test_end_to_end_blackwell_hardware_execution_if_available` | test/benchmark loop (named:run_until_complete) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `let _ = spine.run_until_complete(&mut backend, 15).await.unwrap();` | +| SC-044 | aien-sovereign-core | `crates/aien-runtime/tests/runtime_end_to_end_tests.rs` | 390 | `test_end_to_end_blackwell_hardware_execution_if_available` | test/benchmark loop (while:body:recv) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `while let Ok(event) = rx.try_recv() {` | +| SC-045 | aien-sovereign-core | `crates/aien-runtime/tests/runtime_end_to_end_tests.rs` | 496 | `release_golden_path_records_whether_gb10_ran` | test/benchmark loop (named:run_until_complete) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `let _ = spine.run_until_complete(&mut backend, 20).await.unwrap();` | +| SC-046 | aien-sovereign-core | `crates/aien-runtime/tests/runtime_end_to_end_tests.rs` | 498 | `release_golden_path_records_whether_gb10_ran` | test/benchmark loop (while:body:recv) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `while let Ok(event) = rx.try_recv() {` | +| SC-047 | aien-sovereign-core | `crates/aien-runtime/tests/runtime_end_to_end_tests.rs` | 504 | `release_golden_path_records_whether_gb10_ran` | test/benchmark loop (while:body:recv) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `while let Ok(event) = child_rx.try_recv() {` | +| SC-048 | aien-sovereign-core | `crates/aien-runtime/tests/runtime_ipc_test.rs` | 40 | `test_runtime_server_client_ipc_lifecycle` | test/benchmark loop (for:body:sleep) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for _ in 0..50 {` | +| SC-049 | aien-sovereign-core | `crates/aien-runtime/tests/runtime_ipc_test.rs` | 74 | `test_runtime_server_client_ipc_lifecycle` | test/benchmark loop (for:body:sleep) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for _ in 0..100 {` | +| SC-050 | aien-sovereign-core | `crates/aien-runtime/tests/runtime_socket_permissions_test.rs` | 35 | `runtime_socket_is_owner_only` | test/benchmark loop (for:body:sleep) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for _ in 0..250 {` | +| SC-051 | aien-sovereign-core | `crates/aien-runtime/tests/runtime_spine_integration.rs` | 161 | `test_swarm_launch_and_step_execution` | test/benchmark loop (while:body:scheduler) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `while (spine.scheduler.running_count() > 0 \|\| spine.scheduler.waiting_count() > 0) && steps < 50` | +| SC-052 | aien-sovereign-core | `crates/aien-runtime/tests/swarm_completion_test.rs` | 47 | `swarm_natural_completion_reclaims_everything` | test/benchmark loop (named:run_until_complete) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `.run_until_complete(&mut backend, 200)` | +| SC-053 | aien-sovereign-core | `crates/aien-runtime/tests/swarm_inspect_scoping_test.rs` | 90 | `inspect_swarm_is_scoped_to_the_requested_swarm` | test/benchmark loop (named:run_until_complete) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `.run_until_complete(&mut backend, 200)` | +| SC-054 | aien-sovereign-core | `crates/aien-scheduler/src/bin/bench_inference_stack.rs` | 216 | `bench_scheduler_step_overhead` | test/benchmark loop (for:body:scheduler) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for &concurrency in &concurrency_levels {` | +| SC-055 | aien-sovereign-core | `crates/aien-scheduler/src/bin/bench_inference_stack.rs` | 217 | `bench_scheduler_step_overhead` | test/benchmark loop (for:body:scheduler) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for i in 0..concurrency {` | +| SC-056 | aien-sovereign-core | `crates/aien-scheduler/src/bin/bench_inference_stack.rs` | 301 | `bench_continuous_batching_scheduler_throughput` | test/benchmark loop (for:body:scheduler) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for &concurrency in &concurrency_tiers {` | +| SC-057 | aien-sovereign-core | `crates/aien-scheduler/src/bin/bench_inference_stack.rs` | 314 | `bench_continuous_batching_scheduler_throughput` | test/benchmark loop (for:body:scheduler) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for i in 0..concurrency {` | +| SC-058 | aien-sovereign-core | `crates/aien-scheduler/src/bin/bench_inference_stack.rs` | 336 | `bench_continuous_batching_scheduler_throughput` | test/benchmark loop (while:body:scheduler) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `while scheduler.running_count() > 0 \|\| scheduler.waiting_count() > 0 {` | +| SC-059 | aien-sovereign-core | `crates/aien-scheduler/src/bin/bench_inference_stack.rs` | 384 | `bench_context_window_scaling` | test/benchmark loop (for:body:scheduler) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for &ctx_len in &context_lengths {` | +| SC-060 | aien-sovereign-core | `crates/cortex-rs/src/db.rs` | 54 | `new` | cortex SQLite writer thread | batched disk writer | E | false | single writer thread drains a write queue; physical I/O batching, no faculty order. LEGACY / NOT-IN-CHARGE | `while let Ok(task) = rx.recv() {` | +| SC-061 | aien-sovereign-core | `crates/cortex-rs/src/db.rs` | 56 | `new` | cortex writer batch drain | batched disk writer | E | false | drains queued writes in one batch; physical I/O batching | `while let Ok(next) = rx.try_recv() {` | +| SC-062 | aien-sovereign-core | `crates/cortex-rs/src/db.rs` | 2406 | `test_sqlite_wal_persistence_under_concurrency` | test/benchmark loop (for:body:sleep) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for _ in 0..4 {` | +| SC-063 | aien-sovereign-core | `crates/cortex-rs/src/db.rs` | 2409 | `test_sqlite_wal_persistence_under_concurrency` | test/benchmark loop (for:body:sleep) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for _ in 0..15 {` | +| SC-064 | aien-sovereign-core | `crates/cortex-rs/src/db.rs` | 2944 | `test_episodic_concurrency_and_writer_throughput` | test/benchmark loop (for:body:sleep) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for _ in 0..4 {` | +| SC-065 | aien-sovereign-core | `crates/cortex-rs/src/db.rs` | 2947 | `test_episodic_concurrency_and_writer_throughput` | test/benchmark loop (for:body:sleep) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for _ in 0..25 {` | +| SC-066 | aien-sovereign-core | `crates/crumbs/src/bin/crumbs-probe-learner.rs` | 29 | `main` | probe learner frame relay | Crumbline probe protocol | F | false | reads frames and records them; protocol mechanics | `loop {` | +| SC-067 | aien-sovereign-core | `crates/crumbs/src/gen/mechanisms.rs` | 768 | `nibble_permute` | permutation rejection sampling | - | N | false | N: sample: permutation rejection sampling without wait or hand-off | `loop {` | +| SC-068 | aien-sovereign-core | `crates/crumbs/src/gen/rng.rs` | 50 | `below` | rejection sampling | - | N | false | N: sample: bounded RNG rejection sampling without wait or hand-off | `loop {` | +| SC-069 | aien-sovereign-core | `crates/crumbs/src/program.rs` | 19 | `-` | crumb program MAX_STEPS | program-length resource bound | E | false | length limit of a crumb program (same kind as rx_plan_arrange max_steps, spec §4 D or E); no loop | `pub const MAX_STEPS: usize = 64;` | +| SC-070 | aien-sovereign-core | `crates/crumbs/src/program.rs` | 140 | `decode` | decode length check | program-length resource bound | E | false | decoder rejects programs longer than MAX_STEPS; no loop | `if n > MAX_STEPS {` | +| SC-071 | aien-sovereign-core | `crates/crumbs/src/protocol.rs` | 311 | `run_crumb` | crumb learner frame protocol | Crumbline learner protocol | F | false | reads framed replies from the learner process; protocol mechanics | `loop {` | +| SC-072 | aien-sovereign-core | `crates/spark-adapters/src/bin/spark_distill.rs` | 305 | `run_cli` | distill CLI input loop | terminal I/O loop | F | false | interactive prompt loop of an offline tool; decides no faculty order. LEGACY / NOT-IN-CHARGE | `loop {` | +| SC-073 | aien-sovereign-core | `crates/spark-adapters/tests/challenger_m1_concurrency_bounds.rs` | 129 | `test_challenge1_concurrency_50_threads_mixed_read_write_invalidation` | test/benchmark loop (for:body:sleep) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for thread_idx in 0..num_threads {` | +| SC-074 | aien-sovereign-core | `crates/spark-adapters/tests/challenger_m1_concurrency_bounds.rs` | 136 | `test_challenge1_concurrency_50_threads_mixed_read_write_invalidation` | test/benchmark loop (for:body:sleep) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for i in 0..iterations {` | +| SC-075 | aien-sovereign-core | `crates/spark-adapters/tests/challenger_m1_concurrency_bounds.rs` | 406 | `test_challenge4_cortex_dynamic_auth_and_zero_disk_touches` | test/benchmark loop (loop:unbounded) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `loop {` | +| SC-076 | aien-sovereign-core | `crates/spark-cockpit-rs/src/main.rs` | 954 | `main` | forge lease reaper every 30 s | maintenance: expired-lease reclaim | B | false | periodic reclamation of expired forge task leases; deterministic maintenance, dispatches no work. LEGACY / NOT-IN-CHARGE | `loop {` | +| SC-077 | aien-sovereign-core | `crates/spark-cockpit-rs/src/main.rs` | 1317 | `handle_terminal_socket` | terminal websocket | web terminal protocol | F | false | websocket/PTY relay; protocol mechanics | `loop {` | +| SC-078 | aien-sovereign-core | `crates/spark-cockpit-rs/src/main.rs` | 1331 | `handle_terminal_socket` | PTY input relay | web terminal protocol | F | false | channel-to-PTY relay; protocol mechanics | `while let Some(bytes) = pty_in_rx.blocking_recv() {` | +| SC-079 | aien-sovereign-core | `crates/spark-cockpit-rs/src/main.rs` | 1341 | `handle_terminal_socket` | PTY output relay | web terminal protocol | F | false | PTY-to-socket relay; protocol mechanics | `while let Some(data) = pty_rx.recv().await {` | +| SC-080 | aien-sovereign-core | `crates/spark-cockpit-rs/src/main.rs` | 2440 | `handle_chat_stream` | chat stream chunk reader | HTTP stream protocol | F | false | reads streamed HTTP chunks; protocol mechanics | `while let Some(chunk_result) = byte_stream.next().await {` | +| SC-081 | aien-sovereign-core | `crates/spark-cockpit-rs/src/main.rs` | 2445 | `handle_chat_stream` | chat stream line splitter | HTTP stream protocol | F | false | splits buffered stream into lines; protocol mechanics | `while let Some(pos) = line_buffer.find('\n') {` | +| SC-082 | aien-sovereign-core | `crates/spark-debugger/src/daemon.rs` | 21 | `run_watchdog_daemon` | service health watchdog | maintenance: health audit | B | false | periodic reachability audit of services with alerting; operator maintenance. LEGACY / NOT-IN-CHARGE (AI services off 2026-09-28) | `loop {` | +| SC-083 | aien-sovereign-core | `crates/spark-discord-hub/src/gateway.rs` | 42,111 | `run` | Discord gateway reconnect loop | Discord gateway protocol | F | false | websocket session loop; external protocol | `loop {` | +| SC-084 | aien-sovereign-core | `crates/spark-discord-hub/src/gateway.rs` | 53 | `run` | Discord outbound sender | Discord gateway protocol | F | false | forwards queued messages to the socket; external protocol | `while let Some(msg) = outbound_rx.recv().await {` | +| SC-085 | aien-sovereign-core | `crates/spark-discord-hub/src/gateway.rs` | 64 | `run` | Discord inbound reader | Discord gateway protocol | F | false | reads gateway events incl. protocol heartbeats; external protocol | `while let Some(msg_result) = read.next().await {` | +| SC-086 | aien-sovereign-core | `crates/spark-dream/src/main.rs` | 91 | `main` | idle-time dream cycle timer | - | A | false | retired by non-use: legacy idle-time consolidation service, disabled since 2026-09-28 | `loop {` | +| SC-087 | aien-sovereign-core | `crates/spark-mail-rs/src/smtp_server.rs` | 19 | `run_smtp_server` | SMTP accept loop | SMTP server | F | false | TCP accept loop; external protocol | `loop {` | +| SC-088 | aien-sovereign-core | `crates/spark-mail-rs/src/smtp_server.rs` | 56,85 | `handle_smtp_session` | SMTP session loop | SMTP server | F | false | SMTP command loop; external protocol | `loop {` | +| SC-089 | aien-sovereign-core | `crates/spark-supervisor/src/supervisor.rs` | 80 | `run_daemon` | supervisor signal wait | maintenance: service supervisor | B | false | waits for termination signal and stops managed services; operator control. LEGACY / NOT-IN-CHARGE | `loop {` | +| SC-090 | aien-sovereign-core | `crates/spark-supervisor/src/supervisor.rs` | 129 | `supervise_loop` | child restart loop | maintenance: service supervisor | B | false | restarts a managed process when it exits; process supervision, not faculty order | `loop {` | +| AR-001 | aegis-runtime | `src/agent.rs` | 99 | `execute_task` | execute_task max_turns parameter | retired by non-use | A | false | AgentEngine::execute_task tool-turn loop bound; migration map 'Oracle -> retire'; spec §3.1 class A, retired by non-use (Q2=A, no Rust edit). LEGACY / NOT-IN-CHARGE | `max_turns: usize,` | +| AR-002 | aegis-runtime | `src/agent.rs` | 130 | `execute_task` | LLM agent tool-turn loop | retired by non-use | A | false | migration map agent.rs:130 tool-turn loop; spec §3.1 class A, retired by non-use; omega links/execs nothing from aegis-runtime. LEGACY / NOT-IN-CHARGE | `for turn in 1..=max_turns {` | +| AR-003 | aegis-runtime | `src/agent.rs` | 132 | `execute_task` | tool-turn loop log line | retired by non-use | A | false | inside the agent.rs:130 loop. LEGACY / NOT-IN-CHARGE | `info!("Agent loop turn {}/{}", turn, max_turns);` | +| AR-004 | aegis-runtime | `src/agent.rs` | 236 | `execute_task` | max_turns exhausted result | retired by non-use | A | false | end of the agent.rs:130 loop. LEGACY / NOT-IN-CHARGE | `max_turns` | +| AR-005 | aegis-runtime | `src/gateway.rs` | 127 | `chat_handler` | chat request max_turns field | retired by non-use | A | false | HTTP entry into the agent loop. LEGACY / NOT-IN-CHARGE | `pub max_turns: Option,` | +| AR-006 | aegis-runtime | `src/gateway.rs` | 145 | `agent_run_handler` | agent_run handler max_turns | retired by non-use | A | false | HTTP entry into the agent loop. LEGACY / NOT-IN-CHARGE | `let max_turns = payload.max_turns.unwrap_or(8);` | +| AR-007 | aegis-runtime | `src/gateway.rs` | 148 | `agent_run_handler` | agent_run handler calls execute_task | retired by non-use | A | false | HTTP entry into the agent loop. LEGACY / NOT-IN-CHARGE | `.execute_task(&payload.prompt, payload.system.as_deref(), max_turns)` | +| AR-008 | aegis-runtime | `src/gateway.rs` | 498 | `handle_socket` | websocket loop: relays heartbeat pulses, starts agent runs | retired by non-use | A | false | websocket front end of the heartbeat/agent orchestration (starts execute_task at 547); retired by non-use with aegis-runtime. LEGACY / NOT-IN-CHARGE | `loop {` | +| AR-009 | aegis-runtime | `src/gateway.rs` | 546 | `handle_socket` | websocket agent run max_turns | retired by non-use | A | false | websocket entry into the agent loop. LEGACY / NOT-IN-CHARGE | `let max_turns = parsed.get("max_turns").and_then(\|v\| v.as_u64()).unwrap_or(8) as usize;` | +| AR-010 | aegis-runtime | `src/gateway.rs` | 547 | `handle_socket` | websocket calls execute_task | retired by non-use | A | false | websocket entry into the agent loop. LEGACY / NOT-IN-CHARGE | `let res = state.agent.execute_task(prompt, None, max_turns).await;` | +| AR-011 | aegis-runtime | `src/heartbeat.rs` | 102 | `pulse_once` | heartbeat pending-task dispatch | retired by non-use | A | false | migration map heartbeat.rs:94 pulse_once dispatches pending SQLite tasks (heartbeat task dispatch); spec §3.1 class A, retired by non-use. LEGACY / NOT-IN-CHARGE | `for task in pending_tasks {` | +| AR-012 | aegis-runtime | `src/heartbeat.rs` | 228 | `start_loop` | HeartbeatEngine::start_loop timer | retired by non-use | A | false | timed polling loop calling pulse_once; spec §3.1 class A. LEGACY / NOT-IN-CHARGE | `loop {` | +| AR-013 | aegis-runtime | `src/main.rs` | 86 | `-` | CLI max_turns option | retired by non-use | A | false | CLI entry into the agent loop. LEGACY / NOT-IN-CHARGE | `max_turns: usize,` | +| AR-014 | aegis-runtime | `src/main.rs` | 251 | `main` | daemon polling loop | retired by non-use | A | false | migration map main.rs:251 polling; spec §3.1 class A. LEGACY / NOT-IN-CHARGE | `loop {` | +| AR-015 | aegis-runtime | `src/main.rs` | 293 | `main` | CLI passes max_turns | retired by non-use | A | false | CLI entry into the agent loop. LEGACY / NOT-IN-CHARGE | `max_turns,` | +| AR-016 | aegis-runtime | `src/main.rs` | 311 | `main` | CLI calls execute_task | retired by non-use | A | false | CLI entry into the agent loop. LEGACY / NOT-IN-CHARGE | `match agent.execute_task(&prompt, None, max_turns).await {` | +| AR-017 | aegis-runtime | `src/orchestration/budget.rs` | 5 | `-` | orchestration RunBudget.max_steps | retired by non-use | A | false | step budget of the legacy orchestration module; retired by non-use with aegis-runtime. LEGACY / NOT-IN-CHARGE | `pub max_steps: u32,` | +| AR-018 | aegis-runtime | `src/orchestration/budget.rs` | 14 | `default` | RunBudget default max_steps 25 | retired by non-use | A | false | step budget of the legacy orchestration module. LEGACY / NOT-IN-CHARGE | `max_steps: 25,` | +| AR-019 | aegis-runtime | `src/persistence/legacy.rs` | 135 | `list_recent_turns` | DB rows to turn records | - | N | false | N: read: database row iterator read without wait or hand-off | `for r in rows {` | +| AR-020 | aegis-runtime | `tests/stage2_primitives_tests.rs` | 103 | `test_orchestration_run_and_budget` | test/benchmark loop (named:max_steps) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `max_steps: 10,` | +| AO-001 | aienos | `crates/aienos-boot/src/handoff.rs` | 128 | `alloc` | bump-allocator CAS retry | - | N | false | N: CAS retry: bump allocator atomic CAS retry without wait or hand-off | `loop {` | +| AO-002 | aienos | `crates/aienos-boot/src/rollback_mock.rs` | 295 | `run_candidate` | mock candidate hang spin | rollback test mock | D | false | deliberate hang in the rollback mock candidate (timeout mode) used to test rollback; test path | `loop {` | +| AO-003 | aienos | `crates/aienos-boot/src/usb_keyboard.rs` | 393 | `run` | USB keyboard poll until deadline | boot keyboard hardware poll | E | true | polls the xHCI keyboard for operator input until a deadline; hardware polling | `while !exit && counter_ticks().wrapping_sub(start) < deadline && !keyboard.is_halted() {` | +| AO-004 | aienos | `crates/aienos-capability/src/lib.rs` | 106 | `take_boot_gen` | boot-generation CAS retry | - | N | false | N: CAS retry: boot generation allocation retry without wait or hand-off | `loop {` | +| AO-005 | aienos | `crates/aienos-capability/src/lib.rs` | 336 | `chain_ok` | capability chain walk | - | N | false | N: walk: capability delegation chain walk without wait or hand-off | `loop {` | +| AO-006 | aienos | `crates/aienos-capability/src/lib.rs` | 358 | `ancestor_hops` | ancestor hop count walk | - | N | false | N: walk: ancestor hop count traversal walk without wait or hand-off | `loop {` | +| AO-007 | aienos | `crates/aienos-capability/src/lib.rs` | 501 | `cascade_revoke` | cascade revoke worklist | - | N | false | N: walk: capability revocation tree walk without wait or hand-off | `loop {` | +| AO-008 | aienos | `crates/aienos-evidence/src/capture.rs` | 126 | `file_sha256` | file hash read loop | - | N | false | N: read: file chunk read loop for hashing without wait or hand-off | `loop {` | +| AO-009 | aienos | `crates/aienos-evidence/src/http.rs` | 124 | `send` | HTTP header reader | evidence upload HTTP client | F | true | reads HTTP response headers; external protocol | `loop {` | +| AO-010 | aienos | `crates/aienos-kernel/src/arch/aarch64.rs` | 409 | `halt` | CPU halt loop | kernel halt | E | true | final wfe/wfi halt of the CPU; physical | `loop {` | +| AO-011 | aienos | `crates/aienos-kernel/src/arch/aarch64.rs` | 494 | `write_u64` | decimal digit conversion | - | N | false | N: arithmetic: decimal digit conversion without wait or hand-off | `loop {` | +| AO-012 | aienos | `crates/aienos-kernel/src/arch/aarch64.rs` | 519 | `read_byte` | UART blocking read | UART hardware poll | E | true | polls the UART until a byte arrives; hardware polling | `loop {` | +| AO-013 | aienos | `crates/aienos-kernel/src/artifact_loader_tests.rs` | 605 | `sealed_address_space_is_wx_with_read_only_code_alias` | test/benchmark loop (for:body:scheduler) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for map in MAPS {` | +| AO-014 | aienos | `crates/aienos-kernel/src/artifact_loader_tests.rs` | 952 | `full_scheduler_fails_closed_at_admission` | test/benchmark loop (for:body:scheduler) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for id in 0..LOADED_TASK_SLOTS as u32 {` | +| AO-015 | aienos | `crates/aienos-kernel/src/gic.rs` | 83 | `wake` | GIC wake poll | interrupt controller poll | E | true | bounded poll of the GIC redistributor wake bit; hardware | `for _ in 0..poll_limit {` | +| AO-016 | aienos | `crates/aienos-kernel/src/infer/tokenizer.rs` | 151 | `encode_bytes` | BPE merge loop | - | N | false | N: merge: BPE merge loop without wait or hand-off | `loop {` | +| AO-017 | aienos | `crates/aienos-kernel/src/scheduler.rs` | 287 | `equal_priority_tasks_share_n_ticks_fairly` | test/benchmark loop (for:body:tick) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for _ in 0..20 {` | +| AO-018 | aienos | `crates/aienos-kernel/src/scheduler.rs` | 310 | `background_runs_within_configured_interval_under_latency_load` | test/benchmark loop (for:body:tick) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for _ in 0..INTERVAL {` | +| AO-019 | aienos | `crates/aienos-kernel/src/scheduler.rs` | 324 | `latency_keeps_large_majority_of_ticks_with_background_budget` | test/benchmark loop (for:body:tick) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for _ in 0..TICKS {` | +| AO-020 | aienos | `crates/aienos-kernel/src/scheduler.rs` | 375 | `removed_tasks_free_their_slot_and_leave_the_queue` | test/benchmark loop (for:body:tick) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for _ in 0..4 {` | +| AO-021 | aienos | `crates/aienos-kernel/src/thread.rs` | 310 | `yield_now` | yield_now | kernel thread scheduler | E | true | kernel cooperative yield; physical CPU scheduling | `for _ in 0..MAX {` | +| AO-022 | aienos | `crates/aienos-kernel/src/thread.rs` | 340 | `park` | park | kernel thread scheduler | E | true | park until woken, yielding the CPU; physical CPU scheduling | `loop {` | +| AO-023 | aienos | `crates/aienos-kernel/src/thread.rs` | 389 | `worker_a` | preemption demo worker A | kernel preemption self-test | D | false | spin worker that proves timer preemption; self-test only | `loop {` | +| AO-024 | aienos | `crates/aienos-kernel/src/thread.rs` | 396 | `worker_b` | preemption demo worker B | kernel preemption self-test | D | false | spin worker that proves timer preemption; self-test only | `loop {` | +| AO-025 | aienos | `crates/aienos-kernel/src/thread.rs` | 532 | `worker` | test/benchmark loop (for:body:yield) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for _ in 0..5 {` | +| AO-026 | aienos | `crates/aienos-kernel/src/thread.rs` | 547 | `worker` | test/benchmark loop (while:body:yield) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `while RUNNABLE.iter().any(\|r\| *r) {` | +| AO-027 | aienos | `crates/aienos-kernel/src/usb/xhci/controller.rs` | 583 | `wait_event` | xHCI event wait | USB controller event poll | E | true | polls the xHCI event ring; hardware | `loop {` | +| AO-028 | aienos | `crates/aienos-kernel/src/usb/xhci/ring.rs` | 201 | `take` | xHCI ring consume | USB ring consumer | E | true | consumes TRBs by cycle bit; hardware ring mechanics | `loop {` | +| AO-029 | aienos | `crates/aienos-kernel/tests/nvme_completion.rs` | 606 | `completion_queue_phase_flips_at_depth_eight` | test/benchmark loop (for:body:poll) | test / reference path | D | false | test, benchmark or example code; not built into any production binary | `for _ in 0..8 {` | +| AO-030 | aienos | `native/capability/aienos_capability.c` | 65 | `take_boot_gen` | boot-generation CAS retry | - | N | false | N: CAS retry: boot generation atomic CAS retry without wait or hand-off | `for (;;) {` | +| AO-031 | aienos | `native/capability/aienos_capability.c` | 174 | `chain_ok` | capability chain walk | - | N | false | N: walk: capability delegation chain walk without wait or hand-off | `for (;;) {` | +| AO-032 | aienos | `native/capability/aienos_capability.c` | 190 | `ancestor_hops` | ancestor hop count walk | - | N | false | N: walk: ancestor hop count traversal walk without wait or hand-off | `for (;;) {` | +| PH-001 | physics | `m15/tools/m15tool.c` | 638 | `main` | --demonstrate-accelerator | M15 demonstration (oracle) | D | false | historical M15 demonstration mode of the physics tool; not a production entry point | `if (argc >= 2 && strcmp(argv[1], "--demonstrate-accelerator") == 0) {` | +| PH-002 | physics | `m15/tools/m15tool.c` | 647 | `main` | --run-m15-gates | maintenance: M15 gate runner | B | false | deterministic gate runner (spec §4: --run-*-gates B) | `bool run_all = (argc >= 2 && strcmp(argv[1], "--run-m15-gates") == 0);` | +| PH-003 | physics | `m16/m16_native.c` | 102 | `m16_native_wait_marker_ge` | wait for GPU marker | GPU completion wait | E | true | bounded usleep poll on a GPU completion marker; hardware | `while (now_ns() < end) {` | +| PH-004 | physics | `m3/tools/m3tool.c` | 50 | `read_file` | file read in M3 tool | M3 qualification tooling | D | false | tool helper, not a production path | `for (;;) {` | +| PH-005 | physics | `nvrm/nvrm.c` | 194 | `acquire_va_slot` | VA-slot CAS retry | - | N | false | N: CAS retry: virtual address slot allocation CAS retry without wait or hand-off | `for (;;) {` | + + +### 4.1 Manual rows (straight-line sequencers and glue) + +The loop patterns cannot see these. The tool checks that each evidence line still +exists in the file (symbol not verified) and applies the same class rules. + + +| id | repo | path | line | symbol | old role | new role | class | authoritative | reason | evidence | +|---|---|---|---|---|---|---|---|---|---|---| +| AO-M01 | aienos | `crates/aienos-boot/src/handoff.rs` | manual (1621) | `main` | fixed boot stage sequence, then halt | boot / awakening sequence; deterministic maintenance and recovery path | C | true | migration map `handoff.rs:1621`: keep, "must never be removed (§49)"; spec §4 starting verdict C | `fn main() -> Status {` | +| SC-M01 | aien-sovereign-core | `crates/aien-cli/src/commands.rs` | manual (1536) | `-` | CLI shells out to `spark-aegis` | legacy service glue, kept (Q2 = A) | A | false | spec §3.3 item 3: service glue used only by the retired aegis-runtime sequencing; not removed under Q2 = A, retired by non-use; omega never execs `spark-aegis` (G3 checks). LEGACY / NOT-IN-CHARGE | `let status = std::process::Command::new("spark-aegis")` | +| OM-M01 | omega | `tools/omegatool.c` | manual (2642) | `legacy_oracle_run_demonstration_living_matvec` | body of the hand-sequenced living-matvec demonstration | retire with `--demonstrate-living-matvec` (W5) | A | false | the function the class-A dispatcher row calls; moved behind a `legacy_oracle` name (W5) | `static void legacy_oracle_run_demonstration_living_matvec(void) {` | + + +## 5. Structural findings (non-greppable §4 terms) + +| §4 term | finding | authoritative side | class / status | +|---|---|---|---| +| synchronous AIEN → Omega calls | omega's AIEN faculty (`src/runtime/rx_aien.c`) reaches Omega only through world publications; R11 spec: `rx_aien.o` must not have an undefined omega symbol. sovereign-core links no omega symbol; its only omega contact is the `crumbs` curriculum gates (`crates/crumbs/src/gates.rs`, `protocol.rs`), which start omega's `crumbline-learner` as a child process and talk to it over a framed stdin/stdout protocol (F rows SC `protocol.rs:311` and OM `crumbline_learner.c:188`); that is a curriculum/test harness, not the living-system path (word search `omega` over sovereign-core `*.rs`/`*.toml`: 4 hits, all in `crates/crumbs`). | omega reaction world | no central call on the production path; G3 re-checks from the link map | +| synchronous Omega → AEGIS calls | omega calls the native AIENOS capability library (`AIENOS_CAP_LIB`, `native/capability/libaienos_capability.a`) for authority; it never execs or links aegis-runtime or `spark-aegis` (grep of omega `src/`, `tools/`, Makefile: zero hits). | native AIENOS capability authority | aegis-runtime path: class A by non-use (AR rows) | +| duplicate schedulers | (1) omega `rx_world.c` reaction scheduler (E, authoritative); (2) sovereign-core `aien-scheduler` token batching for LLM serving (E, spec §3.1, not on the reaction path); (3) aienos kernel CPU scheduler `scheduler.rs` / `thread.rs` (E, physical); (4) aegis-runtime heartbeat task polling (A, retired by non-use). Only (1) orders faculty work. | omega `rx_world.c` | no duplicate semantic scheduler after R16 within scope | +| duplicate world ownership | omega has the reaction world (`rx_world.c`, authoritative) and the M19 accelerator world (`omega_accelerator_world.c`), which the spec keeps as the known-good fallback (C). | reaction world; M19 world = fallback | C row OM for `omega_world_drain`; fallback status proved in G6 | +| duplicate authority ownership | (1) aienos `native/capability/aienos_capability.c` (C, "native AIENOS capability authority"); (2) aienos `crates/aienos-capability` (Rust twin of the same design); (3) omega `rx_caproot.c`, self-described "host reference capability root … R7 is not claimed"; (4) physics `m3/capability.s` historical assembly oracle. | (1) | C3: native C library is authoritative; Rust crate is legacy; omega rx_caproot.c is a host reference root | +| duplicate semantic task queues | aegis-runtime SQLite pending-task queue (A, non-use); sovereign-core cortex writer queue is a disk-write batcher (E), not a task queue. | omega reaction world | none remaining in scope | +| duplicate generation model | omega `rx_generation.c` is the generation mechanism (protected, §49). Other "promotion" code (word search `promot` over the four other repos, vendor/third_party excluded): sovereign-core `cortex-rs/src/promotion.rs` promotes memory candidates, `crumbs/src/promotion.rs` promotes curriculum operations; aienos `crates/aienos-aegis/src/world.rs` has a Rust J-Space sandbox world with a `Promoted` state (`mark_promoted` used only in that file), `aienos-cortex/src/store.rs` and the capability library use the word for other things; aegis-runtime and physics have none. None of them promotes a reaction-world generation; none is linked by omega (G3 checks). | omega `rx_generation.c` | protected; G6 | +| duplicate resource pool | omega `rx_world.c` admission budgets; aien-proof test-board CPU/memory slots are test infrastructure (E, non-authoritative). | omega `rx_world.c` | none in scope | +| duplicate causal state | not assessed by grep; the R4 causal-trace target is still to be named (spec §2 precondition 4). | — | open, belongs to spec §2 item 4 | +| service/RPC boundaries replaced by reactions | aegis-runtime HTTP/websocket gateway (A rows, non-use); sovereign-core runtime IPC socket (F, serves the LLM loop that stays per §3.1). | — | as rows | +| operator consoles (Omega Visor V1, merged #69 after the spec) | `src/visor/` REPL runs one operator command per line; commands call Omega functions directly on operator request, never on their own. `tools/qualify_visor.py` is Python and outside the gate's file types. | operator | B row for `run_loop`; W5 / G5 should state that Visor is an operator console, not the production entry point | + +## 6. Questions for the orchestrator (resolved 2026-09-29) + +All 44 pending questions have been decided by Drake Stapleton (2026-09-29) and +resolved in the map: + +- **Question N (30 rows)**: Adopted class N (NOT A CENTRAL LOOP) via spec + clarification C1 for data and control-flow idioms (CAS retry, seqlock retry, + probe, parse, walk, read, arithmetic, sift, sample, merge). All 30 rows + reclassified as class N, authoritative = false, with reason starting with + `N: : `. +- **Question CLI (13 rows)**: Reclassified as class A (retired by non-use), + authoritative = false. Reason: "retired by non-use: legacy terminal operator + CLI, superseded by orchestrator interface". Added to spec §7 not-claimed list + via clarification C2. +- **Question DREAM (1 row)**: Reclassified as class A (retired by non-use), + authoritative = false. Reason: "retired by non-use: legacy idle-time + consolidation service, disabled since 2026-09-28". Added to spec §7 not-claimed + list via clarification C2. +- **Question AUTH (structural, §5)**: Resolved via clarification C3. The native + C library is authoritative; the Rust capability crate is legacy under the + no-Rust port; omega rx_caproot.c is a host reference root. + +## 7. Counts + +Filled from the tool's JSON output on this map (§8). + +| repo | A | B | C | D | E | F | N | ? | loop/named/cli sites | manual rows | +|---|---|---|---|---|---|---|---|---|---|---| +| omega | 1 | 18 | 2 | 84 | 13 | 2 | 16 | 0 | 136 | 1 | +| aien-sovereign-core | 14 | 5 | 0 | 40 | 11 | 18 | 2 | 0 | 90 | 1 | +| aegis-runtime | 18 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 20 | 0 | +| aienos | 0 | 0 | 0 | 12 | 8 | 1 | 11 | 0 | 32 | 1 | +| physics | 0 | 1 | 0 | 2 | 1 | 0 | 1 | 0 | 5 | 0 | + +Manual rows: omega OM-M01 = A, sovereign-core SC-M01 = A, aienos AO-M01 = C. +Total: 283 pattern sites + 3 manual rows; 0 unclassified; 0 questions remaining; +31 class N data/control-flow idiom sites. + +## 8. Gate result on this map (R16-G2 tool, after W5 retirement) + +`make r16-inventory` -> exit 0, PASS: + +`sites=283 unclassified=0 question=0 bad_class=0 a_reachable=0 stale=0 map_errors=0 skipped=0 -> PASS` + +1. `question=0`: all 44 question rows are resolved and reclassified (§6). +2. `a_reachable=0`: omegatool `--demonstrate-living-matvec` (OM-103 dispatcher line and + OM-M01 function, class A) retired behind `legacy_oracle` symbol names (W5). + +The tool prints `WARN omega: scanned HEAD ... differs from map SHA`, because the +R16 branch builds on top of omega main. Expected. diff --git a/spec/r16-orchestrator-retirement.md b/spec/r16-orchestrator-retirement.md new file mode 100644 index 000000000..df79d16b9 --- /dev/null +++ b/spec/r16-orchestrator-retirement.md @@ -0,0 +1,280 @@ +# R16 orchestrator retirement (pre-registration) + +Status: METHODOLOGY. This file is committed before any R16 retirement code, +inventory tool output, test run or qualification data exists. Branch +`feat/r16-orchestrator-retirement`, based on omega `origin/main` `ceb68d6`. +Its acceptance criteria are binding. Changing a criterion, the scope (§3) or +the classification rules (§4) requires a new commit to this file that says +what changed and why, made before any data that depends on the change, and +followed by a rerun of every gate whose evidence the change affects. Only a +clean, candidate-bound run that meets every gated criterion below may say +`R16_ORCHESTRATOR_RETIRED = PASS`. + +ADR 0016 §49 (aien-architecture `f6baa35`, +`docs/adr/0016-resident-reaction-architecture.md`), verbatim: + +> Only after prior gates pass: remove central sequencing where reactions now +> provide equivalent or stronger behavior. Do not remove: known-good fallback; +> recovery path; deterministic maintenance controls; trusted capability root; +> generation mechanism; evidence. +> +> Gate: `R16_ORCHESTRATOR_RETIRED` + +Supporting ADR text: §32 migration ladder (… → REACTION AUTHORITATIVE FOR +CAPABILITY-BOUND EFFECTS → LEGACY FALLBACK → LEGACY RETIRED; "the legacy +orchestrated runtime becomes the reference oracle"); §54 invariants I1–I16, +which every R16 change must preserve; §57 "Do not remove rollback", "Do not +remove deterministic operator control", "Do not make neural inference the +scheduler". + +The operator brief for R16 (Part II of the ADR 0016 completion prompt) is +copied verbatim into `docs/r16-operator-brief.md`. Where this spec and the +brief differ, this spec governs and §3.3 lists every difference. + +## 1. Purpose + +R1–R15 proved that the resident reaction world is correct, recovers, and +(R15) performs against the central-loop pattern. R16 makes that official: +central semantic orchestration — code that decides "AIEN now, wait, Omega +now, wait, AEGIS now, wait, GPU now" — is no longer in charge anywhere in +production within the scope of §3. After R16 the normal semantic progression +is the brief's production law: + +state publication → dependency readiness → resource admission → authority +validation → reaction execution → atomic publication → new readiness. + +R16 does not delete loops because they are loops. The forbidden thing is +central semantic orchestration on the authoritative path. + +## 2. Preconditions (binding; not gates) + +No R16 code, inventory tool or test is written before all of these hold: + +1. `R15_REACTION_PERFORMANCE = PASS` is merged to omega main, candidate-bound + (omega sessions rule 8: "R16 starts only after R15 PASS is merged"). +2. omega main contains `03d2820` (GPU seat clean stop; rule 7). At the time + of this commit it does not (it is on the R15 branches); this branch is + rebased onto main after R15 merges. +3. Fix PRs merged, one at a time, each rebased and given its targeted Spark + test: omega #62 capability generation 64 (after aienos #158), #63 R11 + miscount, #64 evidence digest writer, #65 M19 world faulted. #66 is not + required. +4. The make target that proves R4 (causal trace) on the candidate is + identified and written into a clarification commit to this file before + qualification. omega main has no `evidence/R4/`; without this, an R4 PASS + in the receipt is unsupported and G7 cannot pass. + +This spec (and the retirement map, §4) may be written and committed before +the preconditions hold; it contains no data. + +## 3. Scope + +### 3.1 Decisions (decided by Drake 2026-09-28) + +**Q1 = Option A — scoped R16.** R16 retires the central orchestrators that +reactions have actually replaced: + +- omega's hand-sequenced tool path (`tools/omegatool.c`, the + `--demonstrate-living-matvec` sequencing and any other production-reachable + sequencer of faculties), marked "Oracle until R16" in the ADR migration map + `docs/plans/CURRENT_CODE_TO_R0_R16_MIGRATION.md`; +- the old aegis-runtime loops: `AgentEngine::execute_task` tool-turn loop + (`src/agent.rs`), `HeartbeatEngine::start_loop` / `pulse_once` pending-task + dispatch (`src/heartbeat.rs`, `src/main.rs` polling), marked "Oracle → + retire" in the migration map. + +The aien-sovereign-core language-model request loop +(`AienRuntimeSpine::run_until_complete` / `step`, +`crates/aien-runtime/src/spine.rs`) is classified **"still in use, not +replaced by reactions"** and is **not retired by R16**. Reason, recorded: each +`step` is one batched LLM forward pass (prefill chunks and one decode token +per sequence over a paged KV cache). It has no goal, plan, candidate +realization, verification, measurement, selection, authority grant, GPU +experiment or generation promotion (R15 spec §2 read of sovereign-core +`63fe7a7`: "NOT DIRECTLY COMPARABLE"). The reaction world has never taken +over LLM request serving, so there is no equivalent-or-stronger reaction +behaviour for §49 to retire it in favour of. In the map it is class E +(physical scheduler: the brief's "PHYSICAL ENGINE STEP … may remain"), with +the note "LLM request serving, not replaced; retirement deferred to the +planned C rewrite of sovereign-core". The receipt states plainly that it is +not retired. + +**Q2 = Option A — no edits to the Rust repositories.** R16 makes no change to +aien-sovereign-core or aegis-runtime. Their loops appear in the retirement map +labelled LEGACY / NOT-IN-CHARGE (aegis-runtime loops: class A, retired from +the production path by non-use; sovereign-core spine: class E per Q1). +aegis-runtime may be archived. R16 proves, by build/link/exec checks and by +the authoritative-path test (G3), that omega's living system never invokes, +links or execs either repository. + +A different answer to Q1 or Q2 is a scope change under the header clause: a +new commit to this file before any data. + +### 3.2 In scope + +omega (all code changes), plus read-only inventory of aien-sovereign-core, +aegis-runtime, aienos and physics. + +### 3.3 Where this scope departs from the operator brief + +Recorded so the receipt cannot overclaim: + +1. Brief "R16 TARGET 1" names `AienRuntimeSpine::run_until_complete` "the + clearest known legacy semantic orchestrator" and says production AIEN must + not require a caller to repeatedly call `step()`. Under Q1=A it stays. This + is consistent with the brief only under its own exception (a physical + engine step may remain); the map must justify class E, and if that + justification fails the loop is unclassifiable under this scope and G2 + fails. +2. Brief "R16 API / BUILD SURFACE" asks that the distinction be "visible in + code" and that `run_until_complete()` not be the obvious production entry + point. Under Q2=A this is met in omega only; for the Rust repositories it + is met by map labels and documentation, not code. +3. Brief "DEAD-CODE / DEPENDENCY AUDIT" asks to remove service glue used only + by retired sequencing. sovereign-core `aien-cli/src/commands.rs` still + shells out to `spark-aegis`; under Q2=A it stays and is listed in the map + as legacy glue, not removed. +4. The brief warns "Do not stop merely because old code was marked + deprecated". Q2=A labels the Rust loops rather than removing them. What R16 + proves instead is non-dependence: the production path does not link, exec + or call them (G3), and they cannot reach authoritative state (G4). +5. R16 PASS therefore means "ADR 0016 migration complete within the scope of + §3.1", not that every central loop in the organization is gone. + +## 4. Loop inventory method + +Output: `spec/r16-orchestrator-retirement-map.md`, committed after this file +and before any retirement code. + +Repositories, each at its `origin/main` SHA recorded in the map header: +aien-dev/omega, aien-dev/aien-sovereign-core, aien-dev/aegis-runtime, +aien-dev/aienos, aien-dev/physics. + +Search terms (from the brief; each must appear in the map with its hit count): +`run_until_complete`; `for`/`while` semantic step loops; `max_steps`; +`max_turns`; manual faculty invocation; polling for semantic readiness; +central switch statements choosing subsystem order; synchronous AIEN → Omega +calls; synchronous Omega → AEGIS calls; heartbeat task dispatch; duplicate +schedulers; duplicate world ownership; duplicate authority ownership; duplicate +semantic task queues, generation model, resource pool or causal state; +service/RPC boundaries now replaced by shared reactions. + +One row per loop: repo, path, symbol, line (at the recorded SHA), old role, +new role, class, evidence reason, authoritative (true/false). Every loop gets +exactly one class: + +| Class | Meaning | +|---|---| +| A RETIRE | production semantic sequencing now replaced by reactions | +| B KEEP — MAINTENANCE CONTROL | explicit deterministic operator or maintenance mechanism | +| C KEEP — RECOVERY | needed for boot, recovery or repair | +| D KEEP — REFERENCE ORACLE | non-authoritative comparison or test path (e.g. `rx_seq_reference`) | +| E KEEP — PHYSICAL SCHEDULER | schedules physical resources or work, not faculty semantics | +| F KEEP — EXTERNAL PROTOCOL LOOP | network/socket/event-loop mechanics that do not decide faculty order | +| N NOT A CENTRAL LOOP | data/control-flow idiom; no sequencing, wait, or hand-off; authoritative N/A | + +A class-A row in omega is retired by code change (moved behind an explicit +`legacy_oracle`/`reference` name out of the production build, or removed). A +class-A row in a Rust repository is retired by non-use (§3.1 Q2) and must say +so. `authoritative` is false for every A, D row after R16. + +Known starting verdicts (to be re-checked against current code, not trusted): +omegatool `--demonstrate-living-matvec` A; `--run-*-gates` B; M19 +`omega_world_*` C (known-good fallback); `rx_seq_reference` D; `rx_plan_arrange` +`max_steps` (a plan-length field) listed, D or E; aegis-runtime agent loop and +heartbeat dispatch A (by non-use); sovereign-core spine E (§3.1); aienos boot +`handoff.rs` C ("must never be removed", §49). + +## 5. Acceptance criteria (gated) + +| # | Gate | PASS condition | +|---|---|---| +| R16-G1 | Retirement map complete | `spec/r16-orchestrator-retirement-map.md` exists, was committed before any retirement code, records the five repository SHAs, reports a hit count for every §4 search term, and gives every loop found exactly one class A–F with a reason; zero rows unclassified | +| R16-G2 | Code-search gate | `tools/r16_loop_inventory.sh` (shell or C; no Python) scans the five repositories for the §4 patterns, joins each match with the map, prints a machine-readable JSON inventory and exits non-zero if any match is unclassified or any omega match is class A and still reachable from a production build. On the candidate: remaining unclassified semantic-loop count = 0 and exit 0. With a planted `run_until_complete` loop in a scratch copy: exit non-zero | +| R16-G3 | Authoritative path without legacy orchestrators | A test target (`make test-r16-authpath`) builds the production golden path with every class-A orchestrator absent: no omegatool sequencer linked, no aien-sovereign-core or aegis-runtime symbol linked, no exec of `spark-aegis`, `aegis-runtime` or any sovereign-core binary (checked from the link map and by exec tracing during the run). In that configuration R13 living system (`R13_LIVING_SYSTEM_PASS`) and the R14 recovery subset pass, host and silicon: goal in → AIEN reacts → Omega reacts → authority → GPU → evidence → generation promotes → recovery works | +| R16-G4 | Legacy paths cannot bypass authority | `tests/runtime/rx_r16_negative.c` (`make test-r16-negative`): from a legacy/reference/oracle context, each of six acts is attempted and refused by the R7 native authority or the publication boundary: (1) write authoritative AIEN belief, (2) select an Omega realization, (3) mint authority, (4) promote a generation, (5) bypass the effect/authority boundary, (6) advance the world generation. 6/6 refused, with no change to authoritative state; removing any one guard turns the test red | +| R16-G5 | API/build surface | In omega, every surviving legacy entry point lives under an explicit name (`legacy_oracle`, `maintenance`, `recovery` or `reference`); the supported production entry point is documented in the repo; no legacy sequencer is the default target or default mode of any production binary. For the Rust repositories (§3.3 item 2), the map row carries the LEGACY / NOT-IN-CHARGE label | +| R16-G6 | Protected things kept | The receipt shows, each with the file/symbol and the test that exercised it on the candidate: known-good fallback present = true; recovery path present = true; deterministic maintenance controls present = true; trusted capability root present = true; generation mechanism present = true; evidence present = true (the six of §49); and R9 crash recovery, R10 verifier, R12 seat-loss handling, R14 recovery paths, operator emergency controls and needed benchmark reference paths (SEQ) present and passing | +| R16-G7 | Full ladder on the candidate | On the frozen candidate commit, clean tree: R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12 host, R12 silicon, R13 host, R13 silicon, R14 host, R14 silicon all PASS, each named in the receipt with the make target that proved it; and the R15 physical qualification meets every pre-registered R15 gated criterion (R15 spec §11 G1–G16, with its clarifications). R15 numbers need not be byte-identical; if performance changes materially, a new R15-compatible measurement bundle is recorded in the R16 qualification | +| R16-G8 | Receipt and merge | `evidence/R16/.json`, named by the SHA-256 of its own bytes, schema `AIEN_RX_R16_ORCHESTRATOR_RETIRED_V1`, written by the #64 evidence writer, committed unchanged; candidate_commit == run_commit; candidate_bound = true; tree_dirty = false; silicon_observed = true; all fields of §6 present; the PR is merged with a merge commit (not squash) | + +If any gate fails: no PASS. Fix the defect at its layer, add coverage, and +rerun every gate whose evidence the fix touches; G7 is rerun in full on the +new candidate. + +After merge (not a gate, but reported): a fresh clean checkout of merged main +reruns R1–R16; R15 may reuse the G7 bundle only if the code is unchanged, +and the report says so. + +## 6. Evidence + +- Map: `spec/r16-orchestrator-retirement-map.md`. +- Inventory: `evidence/R16/raw//inventory.json` (G2 tool output) and + `SHA256SUMS`. +- Test logs for G3, G4 and every G7 gate under + `evidence/R16/raw//`, one file per gate, plus `machine.json` + (hardware identity as R15 spec §13). +- R15-compatible bundle, if recorded: `evidence/R16/raw//r15/`, + reduced by the R15 reducer `tools/r15_reduce.c` unchanged. +- Receipt `evidence/R16/.json`, schema + `AIEN_RX_R16_ORCHESTRATOR_RETIRED_V1`, with: candidate_commit, run_commit, + candidate_bound, tree_dirty, silicon_observed; commits of omega, aienos, + physics, aien-sovereign-core, aegis-runtime; R1–R15 rerun results with the + proving target per gate; retirement inventory rows (repo, path, symbol, old + role, new role, classification, authoritative); production entry point; + legacy-orchestrators-disabled test result (G3); legacy-cannot-bypass- + authority test result (G4); remaining central-loop count; remaining + unclassified semantic-loop count = 0; the six presence flags of G6; R15 + acceptance still passing = true; scope (§3.1, including "sovereign-core LLM + request loop: not retired, still in use"); `not_claimed` (§7); raw + directory digest; gate `R16_ORCHESTRATOR_RETIRED` = PASS or FAIL. +- No field is edited by hand. + +## 7. Not claimed by R16 + +- Retirement of the aien-sovereign-core LLM request loop (§3.1, Q1). +- Removal of any Rust code (§3.1, Q2); the Rust loops still run if started + by hand outside the AIEN production path. +- Retirement or code removal of the aien-sovereign-core aien-cli operator tool + loops (13 rows) and spark-dream idle-time cycle loop (1 row); classified as + class A (retired by non-use), their code is not removed under §3.1 Q2. +- From the brief's DO NOT OVERCLAIM: R16 PASS means ADR 0016 Resident + Reaction Architecture migration complete (within §3.1 scope). It does not + mean the AIEN 42-phase master plan is complete, nor full Skill Network, + J-Space productization, Fabric deployment, whole-product Effect Broker + path, Cortex product integration, RSI product integration, final + install/update UX, Phase 41 whole-AIEN golden path or Phase 42 final + release qualification. + +## 8. Clarifications + +Later changes to this file are appended here as numbered clarifications +(C1, C2, ...), each dated and stating whether any data existed when it was +made, following the R15 convention. + +### C1 (2026-09-29) + +Class N (NOT A CENTRAL LOOP) is adopted. Inventory patterns flag data or +control-flow idioms (CAS retry, seqlock retry, probe, parse, walk, read, +arithmetic, sift, sample, merge, retry, format, bpe, utf8, token, decode, +scan) that contain no faculty sequencing, no wait on another component, +and no hand-off. Class N rows have authoritative = false. The reason +field for every class N row must name the specific idiom from the fixed +idiom vocabulary. Any loop containing a wait word or faculty dispatch +cannot be class N. + +### C2 (2026-09-29) + +The 13 aien-cli tool-calling loops and the spark-dream idle-time cycle +loop are classified as class A (retired by non-use) with authoritative = false. +Under §3.1 Q2, Rust code is not modified; the production path does not invoke +or link them. They are recorded in §7 as not claimed for code removal. + +### C3 (2026-09-29) + +Capability root authority clarification: the native C library +(aienos native/capability/aienos_capability.c) is authoritative. The Rust +aienos-capability crate is legacy under the no-Rust port (aienos #156). +Omega's rx_caproot.c is a host reference root, not the trusted capability +root. This affects G4/G6 wording only; the native C capability root remains +the sole authoritative capability root. diff --git a/tests/r16_inventory/fixture/aegis-runtime/src/agent.rs b/tests/r16_inventory/fixture/aegis-runtime/src/agent.rs new file mode 100644 index 000000000..15f315340 --- /dev/null +++ b/tests/r16_inventory/fixture/aegis-runtime/src/agent.rs @@ -0,0 +1,5 @@ +fn execute_task(max_turns: usize) { + for turn in 1..=max_turns { + let _ = turn; + } +} diff --git a/tests/r16_inventory/fixture/aien-sovereign-core/src/spine.rs b/tests/r16_inventory/fixture/aien-sovereign-core/src/spine.rs new file mode 100644 index 000000000..c4e8b2957 --- /dev/null +++ b/tests/r16_inventory/fixture/aien-sovereign-core/src/spine.rs @@ -0,0 +1,18 @@ +fn step() {} +fn accept() -> Option { None } + +pub fn run_until_complete(max_steps: usize) { + for _ in 0..max_steps { + step(); + } +} + +fn serve() { + loop { + let c = accept(); + if c.is_none() { return; } + } +} + +// 'a lifetimes and char literals must not confuse the scanner +fn lt<'a>(x: &'a str) -> char { let _ = x; '}' } diff --git a/tests/r16_inventory/fixture/aienos/src/halt.rs b/tests/r16_inventory/fixture/aienos/src/halt.rs new file mode 100644 index 000000000..0bc6eb024 --- /dev/null +++ b/tests/r16_inventory/fixture/aienos/src/halt.rs @@ -0,0 +1,5 @@ +pub fn halt() -> ! { + loop { + core::hint::spin_loop(); + } +} diff --git a/tests/r16_inventory/fixture/map.md b/tests/r16_inventory/fixture/map.md new file mode 100644 index 000000000..7e578ed32 --- /dev/null +++ b/tests/r16_inventory/fixture/map.md @@ -0,0 +1,23 @@ +# R16 inventory fixture map (test data for tests/r16_inventory/run.sh) + + +| id | repo | path | line | symbol | old role | new role | class | authoritative | reason | evidence | +|---|---|---|---|---|---|---|---|---|---|---| +| FX-01 | omega | `src/legacy_oracle_demo.c` | 4 | `demo_main` | hand sequencer | legacy oracle | A | false | fixture: class A under a legacy_oracle name passes | `while (1) {` | +| FX-02 | omega | `src/world.c` | 8 | `worker_main` | worker | worker | E | true | fixture | `for (;;) {` | +| FX-03 | omega | `src/world.c` | 22 | `wait_ready` | readiness poll | hardware wait | E | true | fixture | `for (int i = 0; i < 100; i++) {` | +| FX-04 | omega | `tools/tool.c` | 4 | `main` | gate runner | maintenance | B | false | fixture | `if (argc > 1 && strcmp(argv[1], "--run-x-gates") == 0) return 0;` | +| FX-05 | aien-sovereign-core | `src/spine.rs` | 4 | `run_until_complete` | spine | LLM serving | E | false | fixture | `pub fn run_until_complete(max_steps: usize) {` | +| FX-06 | aien-sovereign-core | `src/spine.rs` | 5 | `run_until_complete` | spine loop | LLM serving | E | false | fixture | `for _ in 0..max_steps {` | +| FX-07 | aien-sovereign-core | `src/spine.rs` | 11 | `serve` | accept loop | protocol | F | false | fixture | `loop {` | +| FX-08 | aegis-runtime | `src/agent.rs` | 1 | `execute_task` | agent loop | retired by non-use | A | false | fixture: Rust-repo A is allowed (non-use) | `fn execute_task(max_turns: usize) {` | +| FX-09 | aegis-runtime | `src/agent.rs` | 2 | `execute_task` | agent loop | retired by non-use | A | false | fixture | `for turn in 1..=max_turns {` | +| FX-10 | aienos | `src/halt.rs` | 2 | `halt` | halt | halt | E | true | fixture | `loop {` | +| FX-11 | physics | `nvrm.c` | 4 | `wait_marker` | marker wait | hardware wait | E | true | fixture | `while (*m == 0) {` | + + + +| id | repo | path | line | symbol | old role | new role | class | authoritative | reason | evidence | +|---|---|---|---|---|---|---|---|---|---|---| +| FX-M1 | physics | `nvrm.c` | manual | `-` | manual row | manual row | C | true | fixture: manual row present | `int wait_marker(volatile int *m) {` | + diff --git a/tests/r16_inventory/fixture/omega/src/legacy_oracle_demo.c b/tests/r16_inventory/fixture/omega/src/legacy_oracle_demo.c new file mode 100644 index 000000000..35f4a86ea --- /dev/null +++ b/tests/r16_inventory/fixture/omega/src/legacy_oracle_demo.c @@ -0,0 +1,7 @@ +void step_all(void); + +void demo_main(void) { + while (1) { + step_all(); + } +} diff --git a/tests/r16_inventory/fixture/omega/src/world.c b/tests/r16_inventory/fixture/omega/src/world.c new file mode 100644 index 000000000..eac70dc07 --- /dev/null +++ b/tests/r16_inventory/fixture/omega/src/world.c @@ -0,0 +1,27 @@ +/* R16 inventory fixture. while (1) { } in a comment is not a site. */ +static const char *s = "run_until_complete while(1) for(;;)"; +int pop(void); +int ready(void); +int usleep(unsigned); + +int worker_main(void) { + for (;;) { + if (pop()) break; + } + return 0; +} + +int data_loop(int n) { + int t = 0; + for (int i = 0; i < n; i++) t += i; /* bounded data loop: not a site */ + while (t > 100) t -= 7; /* no wait word; "return" is not "turn" */ + return t + (s != 0); +} + +int wait_ready(void) { + for (int i = 0; i < 100; i++) { + if (ready()) return 0; + usleep(1000); + } + return -1; +} diff --git a/tests/r16_inventory/fixture/omega/tools/tool.c b/tests/r16_inventory/fixture/omega/tools/tool.c new file mode 100644 index 000000000..db12629d5 --- /dev/null +++ b/tests/r16_inventory/fixture/omega/tools/tool.c @@ -0,0 +1,6 @@ +#include + +int main(int argc, char **argv) { + if (argc > 1 && strcmp(argv[1], "--run-x-gates") == 0) return 0; + return 1; +} diff --git a/tests/r16_inventory/fixture/physics/nvrm.c b/tests/r16_inventory/fixture/physics/nvrm.c new file mode 100644 index 000000000..25c0d83af --- /dev/null +++ b/tests/r16_inventory/fixture/physics/nvrm.c @@ -0,0 +1,8 @@ +int usleep(unsigned); + +int wait_marker(volatile int *m) { + while (*m == 0) { + usleep(10); + } + return 0; +} diff --git a/tests/r16_inventory/run.sh b/tests/r16_inventory/run.sh new file mode 100755 index 000000000..54d67cb0e --- /dev/null +++ b/tests/r16_inventory/run.sh @@ -0,0 +1,113 @@ +#!/bin/sh +# R16-G2 inventory tool self-test. Usage: run.sh +# Copies the fixture repos to a scratch directory, makes each a git repo, and +# checks: clean fixture PASSES; each planted defect FAILS for the right reason; +# JSON output is byte-stable. No network; seconds. +set -u +TOOL=${1:?usage: run.sh } +case $TOOL in /*) ;; *) TOOL=$(pwd)/$TOOL ;; esac +HERE=$(cd "$(dirname "$0")" && pwd) +FAILS=0 +SCR=$(mktemp -d "${TMPDIR:-/tmp}/r16inv.XXXXXX") || exit 2 +trap 'rm -rf "$SCR"' EXIT INT TERM + +setup() { + rm -rf "$SCR/w" && mkdir -p "$SCR/w" && cp -R "$HERE/fixture/." "$SCR/w/" || exit 2 + for r in omega aien-sovereign-core aegis-runtime aienos physics; do + g() { git -C "$SCR/w/$r" -c user.name=r16 -c user.email=r16@invalid -c commit.gpgsign=false "$@"; } + g init -q && g add -A && g commit -qm fixture || exit 2 + done +} +commit_all() { + for r in omega aien-sovereign-core aegis-runtime aienos physics; do + [ -d "$SCR/w/$r/.git" ] || continue + git -C "$SCR/w/$r" add -A + git -C "$SCR/w/$r" -c user.name=r16 -c user.email=r16@invalid -c commit.gpgsign=false commit -qm planted >/dev/null 2>&1 + done +} +run() { + R16_REPO_OMEGA=$SCR/w/omega R16_REPO_SOVEREIGN_CORE=$SCR/w/aien-sovereign-core \ + R16_REPO_AEGIS_RUNTIME=$SCR/w/aegis-runtime R16_REPO_AIENOS=$SCR/w/aienos \ + R16_REPO_PHYSICS=$SCR/w/physics "$TOOL" --map "$SCR/w/map.md" --json "$SCR/out.json" 2>"$SCR/err.txt" +} +# expect [stderr-pattern] +expect() { + name=$1 want=$2 pat=${3:-} + run; got=$? + if [ "$got" -ne "$want" ]; then + echo "FAIL $name: exit $got, want $want"; sed 's/^/ /' "$SCR/err.txt"; FAILS=$((FAILS + 1)); return + fi + if [ -n "$pat" ] && ! grep -q -- "$pat" "$SCR/err.txt"; then + echo "FAIL $name: stderr lacks '$pat'"; sed 's/^/ /' "$SCR/err.txt"; FAILS=$((FAILS + 1)); return + fi + echo "ok $name (exit $got)" +} + +# 1. clean fixture: every site classified, class-A omega site under a legacy_oracle name +setup +expect clean-fixture-passes 0 "sites=11 unclassified=0 question=0 bad_class=0 a_reachable=0 stale=0 map_errors=0 skipped=0 -> PASS" +cp "$SCR/out.json" "$SCR/a.json"; run; if cmp -s "$SCR/a.json" "$SCR/out.json"; then echo "ok json-byte-stable"; else echo "FAIL json-byte-stable"; FAILS=$((FAILS + 1)); fi + +# 2. planted run_until_complete loop (spec R16-G2 case) +setup +printf 'int busy(void);\nvoid rx_run_until_complete(void);\nvoid drive(void) {\n while (busy()) {\n rx_run_until_complete();\n }\n}\n' >> "$SCR/w/omega/src/world.c"; commit_all +expect planted-run-until-complete-fails 1 "UNCLASSIFIED omega src/world.c:.*named:run_until_complete" + +# 3. planted unlabelled while (1) +setup +printf 'void spin(void) {\n while (1) {\n }\n}\n' >> "$SCR/w/physics/nvrm.c"; commit_all +expect planted-while-1-fails 1 "UNCLASSIFIED physics nvrm.c:.*while:unbounded" + +# 4. planted Rust heartbeat loop (bounded, wait word in body) +setup +printf 'fn tick() {}\nfn heartbeat_loop() {\n for _ in 0..10 {\n tick();\n }\n}\n' >> "$SCR/w/aegis-runtime/src/agent.rs"; commit_all +expect planted-rust-tick-loop-fails 1 "UNCLASSIFIED aegis-runtime src/agent.rs:.*for:body:tick" + +# 5. a '?' row fails +setup +sed 's/| FX-10 \(.*\) | E | true |/| FX-10 \1 | ? | ? |/' "$HERE/fixture/map.md" > "$SCR/w/map.md" +expect question-row-fails 1 "QUESTION FX-10" + +# 6. omega class A under a production name fails +setup +git -C "$SCR/w/omega" mv src/legacy_oracle_demo.c src/demo.c; commit_all +sed 's#src/legacy_oracle_demo.c#src/demo.c#' "$HERE/fixture/map.md" > "$SCR/w/map.md" +expect omega-class-a-reachable-fails 1 "A-REACHABLE FX-01" + +# 7. a classified site that disappeared (non-A) is a stale row +setup +sed 's/while (\*m == 0) {/if (*m == 0) {/; s/^ }$//' "$HERE/fixture/physics/nvrm.c" > "$SCR/w/physics/nvrm.c"; commit_all +expect stale-row-fails 1 "STALE FX-11" + +# 8. a missing repository is SKIPPED, and skipping is not a pass +setup +rm -rf "$SCR/w/physics" +expect missing-repo-skipped-fails 1 "SKIPPED physics" + +# 9. manual row whose line is gone is stale +setup +sed 's/^int wait_marker(volatile int \*m) {$/int wait_marker2(volatile int *m) {/' "$HERE/fixture/physics/nvrm.c" > "$SCR/w/physics/nvrm.c"; commit_all +expect manual-row-gone-fails 1 "STALE FX-M1" + +# 10. bad class letter fails +setup +sed 's/| FX-07 \(.*\) | F | false |/| FX-07 \1 | G | false |/' "$HERE/fixture/map.md" > "$SCR/w/map.md" +expect bad-class-fails 1 "BAD-CLASS FX-07" + +# 11. class N with valid idiom passes +setup +sed 's/| FX-10 \(.*\) | E | true | fixture |/| FX-10 \1 | N | false | N: walk: halt loop walk |/' "$HERE/fixture/map.md" > "$SCR/w/map.md" +expect class-n-passes 0 "PASS" + +# 12. class N without idiom in reason fails +setup +sed 's/| FX-10 \(.*\) | E | true | fixture |/| FX-10 \1 | N | false | some non idiom reason |/' "$HERE/fixture/map.md" > "$SCR/w/map.md" +expect class-n-no-idiom-fails 1 "N-NO-IDIOM FX-10" + +# 13. class N on a loop with wait word in body fails +setup +sed 's/| FX-03 \(.*\) | E | true | fixture |/| FX-03 \1 | N | false | N: walk: wait loop |/' "$HERE/fixture/map.md" > "$SCR/w/map.md" +expect class-n-wait-word-fails 1 "N-WAIT-WORD FX-03" + +if [ "$FAILS" -ne 0 ]; then echo "R16 inventory self-test: $FAILS FAILED"; exit 1; fi +echo "R16 inventory self-test: PASS" diff --git a/tools/omegatool.c b/tools/omegatool.c index 32efdc0f5..beb816a21 100644 --- a/tools/omegatool.c +++ b/tools/omegatool.c @@ -2639,7 +2639,7 @@ static bool test_m12_receipt(void) { return ok; } -static void run_demonstration_living_matvec(void) { +static void legacy_oracle_run_demonstration_living_matvec(void) { printf("================================================================================\n"); printf(" AIEN OMEGA SUBSTRATE — MILESTONE 12: OMEGA_LIVING_MATVEC DEMONSTRATION\n"); printf("================================================================================\n"); @@ -3740,6 +3740,15 @@ int omega_run_m15_gates(void) { return (gate_passed == gate_count) ? 0 : 1; } +static int legacy_oracle_demonstrate_living_matvec(int argc, char **argv) { + (void)argc; + if (strcmp(argv[1], "--demonstrate-living-matvec") == 0) { + legacy_oracle_run_demonstration_living_matvec(); + return 0; + } + return -1; +} + int main(int argc, char **argv) { if (argc < 2) { printf("Usage: %s [--run-gates | --run-m5-gates | --run-m6-gates | --run-m7-gates | --run-m8-gates | --run-m9-gates | --run-m10-gates | --run-m11-gates | --run-m12-gates | --run-m13-gates | --run-m14-gates | --demonstrate-arithmetic | --demonstrate-physics | --demonstrate-realization | --demonstrate-self-host | --demonstrate-verify | --demonstrate-program | --demonstrate-synthesis | --demonstrate-library | --demonstrate-discovery | --demonstrate-living-matvec | --demonstrate-machine | --demonstrate-realization-synthesis | --dump-test-vectors ]\n", argv[0]); @@ -3807,8 +3816,7 @@ int main(int argc, char **argv) { return omega_run_m12_gates(); } - if (strcmp(argv[1], "--demonstrate-living-matvec") == 0) { - run_demonstration_living_matvec(); + if (legacy_oracle_demonstrate_living_matvec(argc, argv) == 0) { return 0; } diff --git a/tools/r16_loop_inventory.c b/tools/r16_loop_inventory.c new file mode 100644 index 000000000..05f431289 --- /dev/null +++ b/tools/r16_loop_inventory.c @@ -0,0 +1,1106 @@ +/* + * r16_loop_inventory: R16-G2 code-search gate (spec/r16-orchestrator-retirement.md). + * + * Scans the five R16 repositories for loop-shaped sites, joins every site + * with spec/r16-orchestrator-retirement-map.md, prints a machine-readable + * JSON inventory on stdout and a human summary on stderr. + * + * Exit status: 0 PASS, 1 FAIL (unclassified site, "?" row, omega class-A + * site still reachable, stale/duplicate/bad map row, or a repository + * SKIPPED), 2 usage or I/O error. + * + * Deterministic: files come from `git ls-files` (sorted, tracked files only), + * no network, no clock, no randomness. C and Rust only (asm, shell, Mojo are + * outside the gate's file-type scope; the map says so). + * + * What counts as a site (see --patterns): + * loop head : C while/for/do, Rust while/for..in/loop + * flagged if : unbounded (while(1), while(true), for(;;), Rust loop, + * while true) OR a wait/hand-off word appears in the + * loop condition or body (word list below) + * named term : any code line naming run_until_complete (anywhere in an + * identifier), or max_steps / max_turns (whole identifier) + * cli-mode : C line testing argv[ against "--demonstrate-..." or "--run-..." + * manual row : map row whose line cell starts with "manual"; its evidence + * line must still exist in the file + * Comments and string/char literal contents are blanked before matching. + * Identifiers are split into words at '_', digits and case changes, so + * "return" never matches "turn" and "HeartbeatEngine" matches "heartbeat". + * + * Map join key: repo + path + enclosing symbol + evidence (the source line, + * whitespace-collapsed). Line numbers are informative only. + * + * Class-A reachability (omega only) is a naming proxy: an omega class-A + * site passes only if its path or symbol contains "legacy_oracle" or + * "reference" (spec R16-G5 naming). R16-G3 does the real link-map check. + */ +#include +#include +#include +#include +#include + +#define NREPO 5 +static const char *REPO_NAME[NREPO] = {"omega", "aien-sovereign-core", "aegis-runtime", "aienos", "physics"}; +static const char *REPO_ENV[NREPO] = {"R16_REPO_OMEGA", "R16_REPO_SOVEREIGN_CORE", "R16_REPO_AEGIS_RUNTIME", + "R16_REPO_AIENOS", "R16_REPO_PHYSICS"}; +/* Excluded path prefixes / substrings (declared in --patterns and the map). */ +static const char *EXCLUDE_SUB[] = {"vendor/", "third_party/", "tests/r16_inventory/", NULL}; + +/* Words that make a bounded loop loop-shaped (wait / hand-off / sequencing). */ +static const char *BODY_WORDS[] = {"sleep", "usleep", "nanosleep", "msleep", "poll", "recv", "heartbeat", + "tick", "dispatch", "schedule", "scheduler", "orchestrate", "orchestrator", + "turn", "turns", "pulse", "yield", "epoll", NULL}; +/* Named terms (identifier, lowercased, underscores removed, substring). */ +static const char *NAMED[] = {"rununtilcomplete", "maxsteps", "maxturns", NULL}; +static const char *NAMED_SHOW[] = {"run_until_complete", "max_steps", "max_turns", NULL}; +/* Search-term hit counts reported for the map (spec §4: each term with its count). */ +static const char *TERM_WORDS[] = {"poll", "sleep", "wait", "recv", "heartbeat", "tick", "dispatch", "schedule", + "orchestrate", "turn", "step", "pulse", "yield", NULL}; + +static void die(const char *fmt, ...) { + va_list ap; + va_start(ap, fmt); + fprintf(stderr, "r16_loop_inventory: "); + vfprintf(stderr, fmt, ap); + fprintf(stderr, "\n"); + va_end(ap); + exit(2); +} +static void *xrealloc(void *p, size_t n) { + void *q = realloc(p, n ? n : 1); + if (!q) die("out of memory"); + return q; +} +static char *xstrdup(const char *s) { + char *d = strdup(s); + if (!d) die("out of memory"); + return d; +} + +/* ---------- sites ---------- */ +typedef struct { + int repo; + char *path, *symbol, *evidence, *trigger, *lines; + int first_line, count; + int row; /* matched map row or -1 */ +} Site; +static Site *sites; +static int nsites, capsites; + +/* ---------- map rows ---------- */ +typedef struct { + char *id, *repo, *path, *line, *symbol, *oldrole, *newrole, *cls, *auth, *reason, *evidence; + int repo_idx, hits; +} Row; +static Row *rows; +static int nrows, caprows; +static char map_sha[NREPO][64]; + +static unsigned long term_hits[NREPO][32]; +static unsigned long named_hits[NREPO][8]; + +/* ---------- helpers ---------- */ +static char *normalize_ws(const char *s, size_t n) { + char *o = xrealloc(NULL, n + 1); + size_t k = 0; + int sp = 0; + for (size_t i = 0; i < n; i++) { + char c = s[i]; + if (c == '\r') continue; + if (c == ' ' || c == '\t') { + sp = 1; + continue; + } + if (sp && k) o[k++] = ' '; + sp = 0; + o[k++] = c; + } + o[k] = 0; + return o; +} +static int is_id(int c) { return isalnum(c) || c == '_'; } +static int ends_with(const char *s, const char *suf) { + size_t a = strlen(s), b = strlen(suf); + return a >= b && !strcmp(s + a - b, suf); +} + +/* Blank comments and string/char literal contents (keeps newlines). */ +static void strip_code(char *b, size_t n, int rust) { + size_t i = 0; + while (i < n) { + char c = b[i]; + if (c == '/' && i + 1 < n && b[i + 1] == '/') { + while (i < n && b[i] != '\n') b[i++] = ' '; + } else if (c == '/' && i + 1 < n && b[i + 1] == '*') { + int depth = 0; + do { + if (i + 1 < n && b[i] == '/' && b[i + 1] == '*') { + depth++; + b[i] = b[i + 1] = ' '; + i += 2; + if (!rust) depth = 1; + } else if (i + 1 < n && b[i] == '*' && b[i + 1] == '/') { + depth--; + b[i] = b[i + 1] = ' '; + i += 2; + } else { + if (b[i] != '\n') b[i] = ' '; + i++; + } + } while (i < n && depth > 0); + } else if (rust && (c == 'r' || (c == 'b' && i + 1 < n && b[i + 1] == 'r')) && + (i == 0 || !is_id((unsigned char)b[i - 1]))) { + size_t j = i + (c == 'b' ? 2 : 1); + int hashes = 0; + while (j < n && b[j] == '#') hashes++, j++; + if (j < n && b[j] == '"' && (hashes > 0 || j == i + (c == 'b' ? 2 : 1))) { + j++; + while (j < n) { + if (b[j] == '"') { + int h = 0; + while (h < hashes && j + 1 + h < n && b[j + 1 + h] == '#') h++; + if (h == hashes) { + j += 1 + h; + break; + } + } + j++; + } + for (size_t k = i; k < j && k < n; k++) + if (b[k] != '\n') b[k] = ' '; + i = j; + } else { + i++; + } + } else if (c == '"') { + b[i++] = ' '; + while (i < n && b[i] != '"') { + if (b[i] == '\\' && i + 1 < n) { + b[i] = ' '; + i++; + } + if (b[i] != '\n') b[i] = ' '; + i++; + } + if (i < n) b[i++] = ' '; + } else if (c == '\'') { + /* char literal vs Rust lifetime / label */ + size_t j = i + 1; + int lit = 0; + if (j < n && b[j] == '\\') { + lit = 1; + } else { + for (size_t k = j + 1; k < n && k <= j + 4; k++) + if (b[k] == '\'') { + lit = 1; + break; + } + if (rust && j < n && is_id((unsigned char)b[j]) && !(j + 1 < n && b[j + 1] == '\'')) lit = 0; + } + if (!lit) { + i++; + continue; + } + b[i++] = ' '; + while (i < n && b[i] != '\'' && b[i] != '\n') { + if (b[i] == '\\' && i + 1 < n) { + b[i] = ' '; + i++; + } + b[i] = ' '; + i++; + } + if (i < n && b[i] == '\'') b[i++] = ' '; + } else { + i++; + } + } +} + +/* Split identifier into lowercase words at '_', digits and case changes. */ +static int split_words(const char *id, size_t len, char words[][40], int maxw) { + int nw = 0; + size_t i = 0; + while (i < len && nw < maxw) { + while (i < len && !isalpha((unsigned char)id[i])) i++; + if (i >= len) break; + size_t s = i; + if (isupper((unsigned char)id[i])) { + i++; + if (i < len && isupper((unsigned char)id[i])) { + while (i < len && isupper((unsigned char)id[i]) && + !(i + 1 < len && islower((unsigned char)id[i + 1]))) + i++; + } else { + while (i < len && islower((unsigned char)id[i])) i++; + } + } else { + while (i < len && islower((unsigned char)id[i])) i++; + } + size_t L = i - s; + if (L > 39) L = 39; + for (size_t k = 0; k < L; k++) words[nw][k] = (char)tolower((unsigned char)id[s + k]); + words[nw][L] = 0; + nw++; + } + return nw; +} +static int word_in(const char *w, const char **list) { + for (int i = 0; list[i]; i++) + if (!strcmp(w, list[i])) return i; + return -1; +} +/* Returns index into NAMED if the identifier names a gated term: + run_until_complete anywhere in the name; max_steps / max_turns only as the + whole name (so size constants such as CL_MAX_STEPS are counted, not gated). */ +static int named_in_ident(const char *id, size_t len) { + char t[256]; + size_t k = 0; + for (size_t i = 0; i < len && k < sizeof t - 1; i++) + if (id[i] != '_') t[k++] = (char)tolower((unsigned char)id[i]); + t[k] = 0; + for (int i = 0; NAMED[i]; i++) + if (i == 0 ? strstr(t, NAMED[i]) != NULL : !strcmp(t, NAMED[i])) return i; + return -1; +} +/* Counting form: substring for all terms. */ +static int named_count_in_ident(const char *id, size_t len) { + char t[256]; + size_t k = 0; + for (size_t i = 0; i < len && k < sizeof t - 1; i++) + if (id[i] != '_') t[k++] = (char)tolower((unsigned char)id[i]); + t[k] = 0; + for (int i = 0; NAMED[i]; i++) + if (strstr(t, NAMED[i])) return i; + return -1; +} + +/* First body word found in stripped range [a,b); writes it to out. */ +static int find_body_word(const char *s, size_t a, size_t b, char *out, size_t outn) { + size_t i = a; + while (i < b) { + if (is_id((unsigned char)s[i]) && (i == 0 || !is_id((unsigned char)s[i - 1]))) { + size_t j = i; + while (j < b && is_id((unsigned char)s[j])) j++; + char words[16][40]; + int nw = split_words(s + i, j - i, words, 16); + for (int w = 0; w < nw; w++) + if (word_in(words[w], BODY_WORDS) >= 0) { + size_t wl = strnlen(words[w], 39); + if (wl >= outn) wl = outn - 1; + memcpy(out, words[w], wl); + out[wl] = 0; + return 1; + } + i = j; + } else { + i++; + } + } + return 0; +} + +static void add_site(int repo, const char *path, int line, const char *symbol, const char *evidence, + const char *trigger) { + for (int i = nsites - 1; i >= 0 && sites[i].repo == repo && !strcmp(sites[i].path, path); i--) { + if (!strcmp(sites[i].symbol, symbol) && !strcmp(sites[i].evidence, evidence)) { + if (sites[i].first_line == line) return; /* same line flagged twice */ + size_t L = strlen(sites[i].lines); + sites[i].lines = xrealloc(sites[i].lines, L + 16); + snprintf(sites[i].lines + L, 16, ",%d", line); + sites[i].count++; + return; + } + } + if (nsites == capsites) { + capsites = capsites ? capsites * 2 : 256; + sites = xrealloc(sites, sizeof *sites * (size_t)capsites); + } + Site *st = &sites[nsites++]; + st->repo = repo; + st->path = xstrdup(path); + st->symbol = xstrdup(symbol); + st->evidence = xstrdup(evidence); + st->trigger = xstrdup(trigger); + char buf[16]; + snprintf(buf, sizeof buf, "%d", line); + st->lines = xstrdup(buf); + st->first_line = line; + st->count = 1; + st->row = -1; +} + +/* ---------- per-file scan ---------- */ +static void scan_file(int repo, const char *root, const char *rel) { + int rust = ends_with(rel, ".rs"); + size_t fulln = strlen(root) + strlen(rel) + 2; + char *full = xrealloc(NULL, fulln); + snprintf(full, fulln, "%s/%s", root, rel); + FILE *f = fopen(full, "rb"); + if (!f) { + free(full); + return; /* tracked but absent (e.g. sparse); ignore */ + } + fseek(f, 0, SEEK_END); + long fl = ftell(f); + fseek(f, 0, SEEK_SET); + if (fl < 0) die("cannot size %s", full); + size_t n = (size_t)fl; + char *orig = xrealloc(NULL, n + 1); + if (fread(orig, 1, n, f) != n) die("cannot read %s", full); + fclose(f); + free(full); + orig[n] = 0; + char *s = xrealloc(NULL, n + 1); + memcpy(s, orig, n + 1); + strip_code(s, n, rust); + + /* line starts */ + int nl = 1; + for (size_t i = 0; i < n; i++) + if (orig[i] == '\n') nl++; + size_t *ls = xrealloc(NULL, sizeof(size_t) * (size_t)(nl + 1)); + int *lnof_dummy = NULL; + (void)lnof_dummy; + ls[0] = 0; + int li = 1; + for (size_t i = 0; i < n; i++) + if (orig[i] == '\n') ls[li++] = i + 1; + ls[nl] = n + 1; + + /* enclosing symbol per line */ + char **sym = xrealloc(NULL, sizeof(char *) * (size_t)nl); + { + char cur[128] = "-", cand[128] = "-"; + int depth = 0, pd = 0; + for (int L = 0; L < nl; L++) { + size_t a = ls[L], b = ls[L + 1] - 1; + if (b > n) b = n; + if (rust) { + /* nearest preceding `fn name` */ + for (size_t i = a; i + 3 < b; i++) { + if (s[i] == 'f' && s[i + 1] == 'n' && (s[i + 2] == ' ' || s[i + 2] == '\t') && + (i == 0 || !is_id((unsigned char)s[i - 1]))) { + size_t j = i + 2; + while (j < b && (s[j] == ' ' || s[j] == '\t')) j++; + size_t k = j; + while (k < b && is_id((unsigned char)s[k])) k++; + if (k > j && k - j < sizeof cur) { + memcpy(cur, s + j, k - j); + cur[k - j] = 0; + } + break; + } + } + sym[L] = xstrdup(cur); + } else { + const char *startsym = depth > 0 ? cur : "-"; + for (size_t i = a; i < b; i++) { + char c = s[i]; + if (depth == 0) { + if (c == ')' && pd > 0) pd--; + if (c == '(' && pd++ == 0) { + size_t k = i; + while (k > a && (s[k - 1] == ' ' || s[k - 1] == '\t')) k--; + size_t j = k; + while (j > a && is_id((unsigned char)s[j - 1])) j--; + if (k > j && k - j < sizeof cand && strcmp(cand, "=") != 0) { + memcpy(cand, s + j, k - j); + cand[k - j] = 0; + } + } else if (c == ';') { + strcpy(cand, "-"); + } else if (c == '=') { + strcpy(cand, "="); + } + } + if (c == '{') { + if (depth == 0) strcpy(cur, strcmp(cand, "=") ? cand : "-"); + depth++; + } else if (c == '}') { + if (depth > 0) depth--; + if (depth == 0) { + strcpy(cand, "-"); + } + } + } + /* a loop on this line belongs to the function open at its start + or opened on it */ + sym[L] = xstrdup(depth > 0 ? cur : startsym); + if (depth == 0) strcpy(cur, "-"); + } + } + } + + /* token scan */ + int line = 0; + for (size_t i = 0; i < n; i++) { + while (line + 1 < nl && ls[line + 1] <= i) line++; + if (!is_id((unsigned char)s[i]) || (i > 0 && is_id((unsigned char)s[i - 1]))) continue; + size_t j = i; + while (j < n && is_id((unsigned char)s[j])) j++; + size_t len = j - i; + /* named terms and term counts */ + int nt = named_in_ident(s + i, len); + char words[16][40]; + int nw = split_words(s + i, len, words, 16); + for (int w = 0; w < nw; w++) { + int t = word_in(words[w], TERM_WORDS); + if (t < 0 && (!strcmp(words[w], "schedule") || !strcmp(words[w], "scheduler") || + !strcmp(words[w], "sched"))) + t = word_in("schedule", TERM_WORDS); + if (t < 0 && (!strcmp(words[w], "orchestrator") || !strcmp(words[w], "orchestration"))) + t = word_in("orchestrate", TERM_WORDS); + if (t < 0 && !strcmp(words[w], "turns")) t = word_in("turn", TERM_WORDS); + if (t < 0 && !strcmp(words[w], "steps")) t = word_in("step", TERM_WORDS); + if (t < 0 && (!strcmp(words[w], "usleep") || !strcmp(words[w], "nanosleep") || !strcmp(words[w], "msleep"))) + t = word_in("sleep", TERM_WORDS); + if (t >= 0) term_hits[repo][t]++; + } + size_t la = ls[line], lb = ls[line + 1] - 1; + if (lb > n) lb = n; + int ntc = named_count_in_ident(s + i, len); + if (ntc >= 0) named_hits[repo][ntc]++; + if (nt >= 0) { + char *ev = normalize_ws(orig + la, lb - la); + char trig[64]; + snprintf(trig, sizeof trig, "named:%s", NAMED_SHOW[nt]); + add_site(repo, rel, line + 1, sym[line], ev, trig); + free(ev); + } + const char *kw = NULL; + if (len == 5 && !memcmp(s + i, "while", 5)) kw = "while"; + else if (len == 3 && !memcmp(s + i, "for", 3)) kw = "for"; + else if (rust && len == 4 && !memcmp(s + i, "loop", 4)) kw = "loop"; + else if (!rust && len == 2 && !memcmp(s + i, "do", 2)) kw = "do"; + if (!kw) { + i = j - 1; + continue; + } + size_t k = j; + while (k < n && isspace((unsigned char)s[k])) k++; + if (!strcmp(kw, "loop") && (k >= n || s[k] != '{')) kw = NULL; + else if (!strcmp(kw, "do") && (k >= n || s[k] != '{')) kw = NULL; + else if (!rust && (!strcmp(kw, "while") || !strcmp(kw, "for")) && (k >= n || s[k] != '(')) kw = NULL; + else if (rust && !strcmp(kw, "for")) { + /* `for pat in expr {` : require " in " before '{' on this line */ + int ok = 0; + for (size_t q = k; q + 1 < n && s[q] != '{' && s[q] != '\n' && s[q] != ';'; q++) + if (s[q] == 'i' && s[q + 1] == 'n' && q > 0 && !is_id((unsigned char)s[q - 1]) && + (q + 2 >= n || !is_id((unsigned char)s[q + 2]))) { + ok = 1; + break; + } + if (!ok) kw = NULL; + } + if (kw && !rust && !strcmp(kw, "while")) { + /* do { } while (..); tail: previous non-space is '}' */ + size_t p = i; + while (p > 0 && isspace((unsigned char)s[p - 1])) p--; + if (p > 0 && s[p - 1] == '}') kw = NULL; + } + if (!kw) { + i = j - 1; + continue; + } + /* extent: condition + body */ + size_t e = k; + int par = 0, unbounded = 0; + if (!strcmp(kw, "loop")) unbounded = 1; + if (!rust && s[k] == '(') { + size_t q = k; + int d = 0; + for (; q < n; q++) { + if (s[q] == '(') d++; + else if (s[q] == ')' && --d == 0) break; + } + char cond[64]; + size_t ci = 0; + for (size_t r = k + 1; r < q && ci < sizeof cond - 1; r++) + if (!isspace((unsigned char)s[r])) cond[ci++] = s[r]; + cond[ci] = 0; + if (!strcmp(kw, "while") && (!strcmp(cond, "1") || !strcmp(cond, "true") || !strcmp(cond, "!0"))) + unbounded = 1; + if (!strcmp(kw, "for") && !strcmp(cond, ";;")) unbounded = 1; + e = q + 1; + } + if (rust && !strcmp(kw, "while")) { + size_t q = k; + while (q < n && isspace((unsigned char)s[q])) q++; + if (q + 4 <= n && !memcmp(s + q, "true", 4) && (q + 4 == n || !is_id((unsigned char)s[q + 4]))) + unbounded = 1; + } + /* find body start '{' at paren depth 0, or ';' ending a single statement */ + size_t endp = n; + for (size_t q = e; q < n; q++) { + char c = s[q]; + if (c == '(' || c == '[') par++; + else if ((c == ')' || c == ']') && par > 0) par--; + else if (par == 0 && c == ';') { + endp = q + 1; + break; + } else if (par == 0 && c == '{') { + int d = 0; + size_t r = q; + for (; r < n; r++) { + if (s[r] == '{') d++; + else if (s[r] == '}' && --d == 0) break; + } + endp = r < n ? r + 1 : n; + if (!strcmp(kw, "do")) { /* include the while(...) tail */ + while (endp < n && s[endp] != ';') endp++; + } + break; + } + } + char word[40] = ""; + int hit = find_body_word(s, j, endp, word, sizeof word); + if (unbounded || hit) { + char trig[96]; + if (unbounded && hit) snprintf(trig, sizeof trig, "%s:unbounded+%s", kw, word); + else if (unbounded) snprintf(trig, sizeof trig, "%s:unbounded", kw); + else snprintf(trig, sizeof trig, "%s:body:%s", kw, word); + char *ev = normalize_ws(orig + la, lb - la); + add_site(repo, rel, line + 1, sym[line], ev, trig); + free(ev); + } + i = j - 1; + } + /* CLI mode dispatch to a hand-sequenced demonstration or gate runner (C). */ + if (!rust) + for (int L = 0; L < nl; L++) { + size_t a = ls[L], b = ls[L + 1] - 1; + if (b > n) b = n; + char *ev = normalize_ws(orig + a, b - a); + char *code = normalize_ws(s + a, b - a); /* strings blanked: argv[ must be code */ + int in_code = strstr(code, "argv[") != NULL; + free(code); + if (in_code && (strstr(ev, "\"--demonstrate-") || strstr(ev, "\"--run-")) && + strspn(s + a, " \t") < b - a) + add_site(repo, rel, L + 1, sym[L], ev, "cli-mode"); + free(ev); + } + for (int L = 0; L < nl; L++) free(sym[L]); + free(sym); + free(ls); + free(s); + free(orig); +} + +static int excluded(const char *rel) { + for (int i = 0; EXCLUDE_SUB[i]; i++) { + size_t L = strlen(EXCLUDE_SUB[i]); + if (!strncmp(rel, EXCLUDE_SUB[i], L)) return 1; + const char *p = strstr(rel, EXCLUDE_SUB[i]); + if (p && p > rel && p[-1] == '/' && strcmp(EXCLUDE_SUB[i], "tests/r16_inventory/")) return 1; + } + return 0; +} + +static int run_cmd(const char *cmd, char *out, size_t outn) { + FILE *p = popen(cmd, "r"); + if (!p) return -1; + size_t k = fread(out, 1, outn - 1, p); + out[k] = 0; + while (k && (out[k - 1] == '\n' || out[k - 1] == '\r')) out[--k] = 0; + return pclose(p); +} + +/* Shell-quote a path into buf (single quotes). */ +static void shq(char *buf, size_t n, const char *s) { + size_t k = 0; + buf[k++] = '\''; + for (; *s && k + 5 < n; s++) { + if (*s == '\'') { + memcpy(buf + k, "'\\''", 4); + k += 4; + } else + buf[k++] = *s; + } + buf[k++] = '\''; + buf[k] = 0; +} + +static char repo_head[NREPO][64]; +static int repo_skipped[NREPO]; + +static void scan_repo(int r, const char *root) { + char q[4200], cmd[8600]; + shq(q, sizeof q, root); + snprintf(cmd, sizeof cmd, "git -C %s rev-parse HEAD 2>/dev/null", q); + if (run_cmd(cmd, repo_head[r], sizeof repo_head[r]) != 0 || !repo_head[r][0]) { + repo_skipped[r] = 1; + return; + } + snprintf(cmd, sizeof cmd, "git -C %s ls-files -z -- '*.c' '*.h' '*.rs'", q); + FILE *p = popen(cmd, "r"); + if (!p) die("popen failed"); + char path[4096]; + size_t k = 0; + int c; + char **files = NULL; + int nf = 0, cf = 0; + while ((c = fgetc(p)) != EOF) { + if (c == 0) { + path[k] = 0; + if (k && !excluded(path)) { + if (nf == cf) { + cf = cf ? cf * 2 : 512; + files = xrealloc(files, sizeof(char *) * (size_t)cf); + } + files[nf++] = xstrdup(path); + } + k = 0; + } else if (k < sizeof path - 1) + path[k++] = (char)c; + } + if (pclose(p) != 0) die("git ls-files failed in %s", root); + /* git ls-files order is already sorted by path bytes; keep it */ + for (int i = 0; i < nf; i++) { + scan_file(r, root, files[i]); + free(files[i]); + } + free(files); +} + +/* ---------- map parsing ---------- */ +static char *trim(char *s) { + while (*s == ' ' || *s == '\t') s++; + size_t L = strlen(s); + while (L && (s[L - 1] == ' ' || s[L - 1] == '\t' || s[L - 1] == '\r' || s[L - 1] == '\n')) s[--L] = 0; + return s; +} +static char *untick(char *s) { + s = trim(s); + size_t L = strlen(s); + while (L >= 2 && s[0] == '`' && s[L - 1] == '`') { + s[L - 1] = 0; + s++; + L -= 2; + } + return trim(s); +} +/* split a markdown table row on unescaped '|', unescaping "\|" */ +static int split_row(char *line, char **cells, int maxc) { + int nc = 0; + char *p = line; + while (*p == ' ') p++; + if (*p != '|') return 0; + p++; + char *start = p, *w = p; + while (*p) { + if (*p == '\\' && p[1] == '|') { + *w++ = '|'; + p += 2; + } else if (*p == '|') { + *w = 0; + if (nc < maxc) cells[nc++] = start; + p++; + start = w = p; + } else + *w++ = *p++; + } + return nc; +} +static int repo_index(const char *name) { + for (int i = 0; i < NREPO; i++) + if (!strcmp(name, REPO_NAME[i])) return i; + return -1; +} +static int map_errors; +static void load_map(const char *mp) { + FILE *f = fopen(mp, "r"); + if (!f) die("cannot open map %s", mp); + char *line = NULL; + size_t cap = 0; + int mode = 0; /* 1 shas, 2 rows */ + int lineno = 0; + while (getline(&line, &cap, f) > 0) { + lineno++; + if (strstr(line, "")) { mode = 1; continue; } + if (strstr(line, "")) { mode = 2; continue; } + if (strstr(line, "