nx_batch_audit_sidecar.nx
buildroot/runtime/nx_batch_audit_sidecar.nx
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
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
| 50 | struct AuditEvent |
consts
| 46 | const NX_MAGIC_1024: i64 = 1024 |
| 66 | const NX_AE_BYTES: nx_int = 104 // 13 fields * 8 |
| 92 | const NX_POOL_EMPTY_KEY: nx_int = 0 |
| 143 | const NX_UTIL_EMPTY: nx_int = 0 // nothing picked |
| 144 | const NX_UTIL_SEVERE_BIAS: nx_int = 1 // one id dominates >75% |
| 145 | const NX_UTIL_MILD_BIAS: nx_int = 2 // 50%-75% from one id |
| 146 | const NX_UTIL_UNIFORM: nx_int = 3 // close to uniform |
| 147 | const NX_UTIL_N_BANDS: nx_int = 4 |
functions
| 68 | func nx_audit_event_alloc() -> *AuditEvent |
| 94 | func nx_pool_hist_init(keys: *i64, counts: *i64, cap: nx_int) -> nx_int called by 1: main |
| 104 | func nx_pool_hist_bump(keys: *i64, counts: *i64, cap: nx_int, |
| 131 | func nx_pool_hist_distinct(keys: *i64, cap: nx_int) -> nx_int |
| 150 | func nx_util_classify_q10(max_share_q10: nx_int, total: nx_int) -> nx_int |
| 157 | func nx_pool_hist_max_share_q10(counts: *i64, cap: nx_int, |
| 178 | func nx_audit_process_event(cfg: *TraceCfg, ws: *WorldState, |
| 231 | func nx_audit_emit_batch_summary(cfg: *TraceCfg, trace_id: nx_int, |