nx_elder_supervisor_main.nx
buildroot/runtime/nx_elder_supervisor_main.nx
about
nx_elder_supervisor_main.nx -- substrate-side Elder AI supervisor.
Cardinal 2026-05-21 dual-mandate (top-down + bottom-up): the
SUBSTRATE owns the service-lifecycle decision (which services
exist, which ports, which healthchecks). The OS adapter
(bench/nx_elder_supervise.sh) is now a dumb pipe -- read the
substrate-emitted manifest, launch python, poll the URL.
V1 contract -- emit one tab-separated line per registered
service on stdout (fd 1):
SVC<TAB>service_name<TAB>port<TAB>healthcheck_url<NEWLINE>
Lines prefixed by anything other than "SVC" are diagnostic
(logged by the adapter, not parsed as service entries).
V1 mechanics: builds an nx_elder_registry with the services the
substrate currently knows how to host (svc-config today;
svc-discovery + the data-* + orch-* tier when those are wired),
then iterates and writes one manifest line per service. Adapter
reads stdin, parses, launches.
Why not bash-only? Because then bash owns the source of truth
about services + ports + healthchecks, and as Elder AI's 150-
service inventory ports over, that bash table becomes the
substrate's most important policy artifact -- shadow state.
Putting it in nx_elder_registry means the registry IS the
policy, with canary protection + sealed-enum validation + the
supervisor state machine attached.
genealogy_id: erlang_otp_application_start_1996 +
systemd_unit_files_2010 +
docker_compose_v3_2021 +
cardinal_2026-05-21_top_down_bottom_up_dual_mandate
lineage_id: substrate_elder_supervisor_main_v1
dependencies 3 imports · 0 importers
imports: nx_syscalls.nxnx_hal.nxnx_elder_registry.nx
imported by: nobody (leaf or entry point)
structs
| none |
consts
| 40 | const K_MAGIC_8423: i64 = 8423 |
| 41 | const K_MAGIC_8600: i64 = 8600 |
| 42 | const K_MAGIC_8100: i64 = 8100 |
| 43 | const K_MAGIC_8101: i64 = 8101 |
| 44 | const K_MAGIC_8102: i64 = 8102 |
functions
| 50 | func _emit_line(buf: *u8, len: i64) -> i64 |
| 54 | func _emit_byte(b: i64) -> i64 |
| 62 | func _emit_i64(n: i64) -> i64 |
| 91 | func _emit_manifest_line(name: *u8, name_len: i64, port: i64, hc: *u8, hc_len: i64) -> i64 |
| 109 | func _build_registry(r: *NxElderRegistry) -> i64 calls 1: nx_elder_register |
| 151 | func _emit_banner() -> i64 |
| 158 | func main() -> i64 |