code wiki / (root) / nx_batch_audit_sidecar.nx

nx_batch_audit_sidecar.nx

buildroot/runtime/nx_batch_audit_sidecar.nx

9725 B265 linesdepth 4pulls 6 transitivereach 3 importersview sourcekind librarytopic batch
docsdependenciesstructsconstsfunctions

about

nx_batch_audit_sidecar.nx -- READ-ONLY observability sidecar for live-fire batch monitoring. Architecture: This is "Step C" of the surgical 3-step wedge. Steps A (nx_world_state) and B (nx_trace_emit) are the foundation; this sidecar threads them. It does NOT change picks, prompts, or renders -- it observes the existing system's decisions and emits trace spans + continuity verdicts so the user can SEE what's happening instead of staring at a black box. Assumed input schema (one event per JSONL line; production host converts to the in-memory AuditEvent struct via a thin reader, can be NishiLang nx_json parser or Python boundary code): {"batch_id":42,"scene_seq":3,"trace_id":100, "character_id":7,"arc_id":10,"stage_idx":1, "outfit_id":200,"location_id":101,"pose_id":300, "affect_axis":8,"camera_id":500, "day_clock_min":420,"beat_armed":3} "beat_armed" maps to NX_WS_BEAT_* and tells the sidecar whether the existing picker already authorised an outfit/location change at this step. Omitting it -> NX_WS_BEAT_NONE -> any change flags a continuity violation. Pool-utilization tracking: the sidecar maintains parallel histograms (outfit_pool, pose_pool, location_pool, arc_pool) so at batch close it can name the under-sampled IDs. genealogy_id: canvas_qa_verification + opentelemetry_traces + helicone_2025_proxy_observability lineage_id: batch_audit_sidecar_v1

dependencies 6 imports · 3 importers

nx_syscalls.nx nx_runtime.nx nx_tier.nx nx_directors_note.nx nx_world_state.nx nx_trace_emit.nx nx_batch_audit_sidecar.nx nx_batch_audit_sidecar_test.nx nx_dashboard.nx nx_dashboard_test.nx

imports: nx_syscalls.nxnx_runtime.nxnx_tier.nxnx_directors_note.nxnx_world_state.nxnx_trace_emit.nx

imported by: nx_batch_audit_sidecar_test.nxnx_dashboard.nxnx_dashboard_test.nx

structs

50struct AuditEvent

consts

46const NX_MAGIC_1024: i64 = 1024
66const NX_AE_BYTES: nx_int = 104 // 13 fields * 8
92const NX_POOL_EMPTY_KEY: nx_int = 0
143const NX_UTIL_EMPTY: nx_int = 0 // nothing picked
144const NX_UTIL_SEVERE_BIAS: nx_int = 1 // one id dominates >75%
145const NX_UTIL_MILD_BIAS: nx_int = 2 // 50%-75% from one id
146const NX_UTIL_UNIFORM: nx_int = 3 // close to uniform
147const NX_UTIL_N_BANDS: nx_int = 4

functions

68func nx_audit_event_alloc() -> *AuditEvent
called by 1: main calls 1: sys_mmap
94func nx_pool_hist_init(keys: *i64, counts: *i64, cap: nx_int) -> nx_int
called by 1: main
104func nx_pool_hist_bump(keys: *i64, counts: *i64, cap: nx_int,
131func nx_pool_hist_distinct(keys: *i64, cap: nx_int) -> nx_int
150func nx_util_classify_q10(max_share_q10: nx_int, total: nx_int) -> nx_int
157func nx_pool_hist_max_share_q10(counts: *i64, cap: nx_int,
178func nx_audit_process_event(cfg: *TraceCfg, ws: *WorldState,
231func nx_audit_emit_batch_summary(cfg: *TraceCfg, trace_id: nx_int,