nx_term_registry.nx
buildroot/runtime/nx_term_registry.nx
about
nx_term_registry.nx -- open string-id pool with sightings + stage.
Foundation of the LEARNING ingestion layer. Replaces hand-written
sealed-enum dictionaries (nx_outfit_vocabulary, nx_location_dict,
etc.) with a self-grown registry that LEARNS its vocabulary from
the ingested corpus.
Every noun phrase the discovery layer finds gets registered here
with provenance: where first seen, how many times sighted across
the corpus, what semantic role (outfit / location / character /
action / object), and which self-surfacing-intelligence stage it
has reached.
Per cardinals:
feedback-self-surfacing-intelligence-staged-autonomy:
STAGE1 SUPERVISED (default for fresh sightings),
STAGE2 PROMPTED (>= N sightings + 0 contradictions),
STAGE3 UNSUPERVISED (user-pinned or arc-anchor confirmed).
feedback-user-owns-every-bit:
this primitive holds the LIVE counts in-memory; durable
snapshots ship to nishi-library/seeds/*.toml on demand,
never via background daemon.
feedback-loras-and-negatives-are-patches:
the registry is a substrate-native CLOSED-LOOP measurement
surface -- not a black-box embedding -- so confidence is
auditable per-term.
nx_safety_envelope:
intended_use: "Open string-id pool for discovered noun
phrases, with sighting counts, semantic
role tags, and self-surfacing stage."
sil_target: SIL2
asil_target: QM
dal_target: DAL C
iec_62304_class: NONE
evidence: [no_floating_point,
fixed_capacity_hash_table,
bounded_probe_length_per_jpl_rule_2,
sealed_role_enum,
sealed_stage_enum,
dependencies 1 imports · 11 importers
diagram shows first 10 each side; +0 more imports, +1 more importers in the complete lists below.
imports: nx_syscalls.nx
imported by: nx_arc_anchor.nxnx_arc_anchor_test.nxnx_caption_emit_test.nxnx_content_guard_test.nxnx_ingest_cli.nxnx_noun_phrase_scan.nxnx_scene_index.nxnx_scene_index_test.nxnx_term_cooccur.nxnx_term_extract.nxnx_term_extract_test.nx
structs
| 88 | struct Term |
| 118 | struct TermRegistry |
consts
| 62 | const NX_TERM_ROLE_UNKNOWN: i64 = 0 |
| 63 | const NX_TERM_ROLE_OUTFIT: i64 = 1 |
| 64 | const NX_TERM_ROLE_LOCATION: i64 = 2 |
| 65 | const NX_TERM_ROLE_CHARACTER: i64 = 3 |
| 66 | const NX_TERM_ROLE_ACTION: i64 = 4 |
| 67 | const NX_TERM_ROLE_OBJECT: i64 = 5 |
| 68 | const NX_TERM_ROLE_AFFECT: i64 = 6 |
| 69 | const NX_TERM_ROLE_TIME: i64 = 7 |
| 75 | const NX_TERM_STAGE_UNKNOWN: i64 = 0 |
| 76 | const NX_TERM_STAGE_SUPERVISED: i64 = 1 // fresh sighting, human reviews |
| 77 | const NX_TERM_STAGE_PROMPTED: i64 = 2 // proposes; human approves |
| 78 | const NX_TERM_STAGE_UNSUPERVISED: i64 = 3 // auto-applies; logs only |
| 81 | const NX_TERM_PROMOTE_N_PROMPTED: i64 = 5 // 5 sightings -> STAGE2 |
| 82 | const NX_TERM_PROMOTE_N_UNSUPERVISED: i64 = 30 // user pin or 30+ sights |
| 106 | const NX_TERM_BYTES: i64 = 96 |
| 114 | const NX_TERM_REGISTRY_DEFAULT_CAP: i64 = 16384 |
| 115 | const NX_TERM_REGISTRY_STR_ARENA: i64 = 1048576 // 1 MiB |
| 116 | const NX_TERM_PROBE_LIMIT: i64 = 64 |
| 128 | const NX_TERM_REGISTRY_BYTES: i64 = 48 |
functions
| 132 | func nx_term_load_u8(p: *u8, i: i64) -> i64 |
| 137 | func nx_term_store_u8(p: *u8, i: i64, v: i64) called by 1: nx_term_intern_canonical |
| 142 | func nx_term_to_lower(c: i64) -> i64 |
| 155 | func nx_term_fnv1a_lower(buf: *u8, n: i64) -> i64 |
| 174 | func nx_term_registry_alloc_sized(cap: i64, str_cap: i64) -> *TermRegistry |
| 191 | func nx_term_registry_alloc() -> *TermRegistry |
| 195 | func nx_term_at(r: *TermRegistry, i: i64) -> *Term |
| 206 | func nx_term_is_trim(c: i64) -> i64 called by 1: nx_term_intern_canonical |
| 222 | func nx_term_intern_canonical(r: *TermRegistry, src: *u8, called by 2: nx_term_observenx_term_lookup calls 4: nx_term_is_trimnx_term_load_u8nx_term_to_lowernx_term_store_u8 |
| 273 | func nx_term_canon_eq(r: *TermRegistry, off1: i64, len1: i64, |
| 295 | func nx_term_find_slot(r: *TermRegistry, h: i64, |
| 336 | func nx_term_observe(r: *TermRegistry, src: *u8, called by 1: nx_term_extract_beat calls 4: nx_term_intern_canonicalnx_term_fnv1a_lowernx_term_find_slotnx_term_at |
| 409 | func nx_term_pin(r: *TermRegistry, slot: i64) -> i64 calls 1: nx_term_at |
| 419 | func nx_term_lookup(r: *TermRegistry, src: *u8, |