nx_instrument_diagnostician.nx
buildroot/runtime/nx_instrument_diagnostician.nx
about
nx_instrument_diagnostician.nx -- pattern-match measurement deltas to named fixes.
module: nishi-core.perception.instrument_diagnostician
depends: nishi-core.perception.profile + nishi-core.perception.transducer_characterizer +
nishi-core.perception.provenance_curve_store + nishi-core.io.syscalls
disk_kb: 5
capability: PERCEPTION
wired_status: PARTIAL_WIRED
MISSING_CAPABILITIES:
- PATTERN_LIBRARY_LOAD (load known-failure-signature → fix mappings from
versioned diagnostic catalog)
- SIGNATURE_MATCHING (FFT peak detection, drift-trend detection,
oscillation detection, etc.)
- CONFIDENCE_SCORING (Bayesian update over multiple observation
consistency with pattern)
- LEARNING_FROM_USER_CONFIRMED_FIXES (catalog grows as new failure
modes are encountered + diagnosed; per
[[feedback-self-surfacing-intelligence-staged-autonomy]] this is
Stage 1 SUPERVISED — user ratifies before pattern enters library)
- SUGGESTED_NEXT_MEASUREMENT (when initial diagnosis is ambiguous,
substrate names the disambiguating measurement to take)
license_tier: PUBLIC_NISHI_SUBSTRATE
genealogy_id: feedback-substrate-does-heavy-lifting-user-is-partner-not-gate_2026 +
feedback-substrate-primitives-meta-not-one-off_2026 +
feedback-self-surfacing-intelligence-staged-autonomy +
feedback-bug-class-prevention-additive-not-restrictive +
toyota_5_whys_root_cause +
ohm_kirchhoff_circuit_laws
Per cardinal [[feedback-substrate-does-heavy-lifting-user-is-partner-not-gate]]:
When a measurement deviates from expected, THIS primitive names the
likely cause + the fix. User doesn't need to know "consult datasheet
+ bisect signal chain" — substrate names "47 pF compensation cap here"
or "ribbon damping insufficient, add 0.5mm acoustic felt strip" directly.
Reuse set served by this single primitive:
- DAC build diagnostics (which resistor is wrong, ground bounce, supply ripple)
- Amp build diagnostics (oscillation, bias drift, capacitive load instability)
dependencies 4 imports · 3 importers
imports: nx_syscalls.nxnx_perceptual_profile.nxnx_transducer_characterizer.nxnx_provenance_curve_store.nx
imported by: nx_calibration_drift_monitor.nxnx_daemon_health_audit.nxnx_external_reach_probe.nx
structs
| 159 | struct NxDiagPattern |
| 176 | struct NxDiagResult |
consts
| 62 | const NX_DIAG_SIG_VALUE_OUT_OF_RANGE: i64 = 1 // scalar measurement deviates |
| 63 | const NX_DIAG_SIG_TREND_DRIFT: i64 = 2 // value drifts over time |
| 64 | const NX_DIAG_SIG_OSCILLATION_DETECTED: i64 = 3 // spurious oscillation in output |
| 65 | const NX_DIAG_SIG_DC_OFFSET: i64 = 4 // unexpected DC bias |
| 66 | const NX_DIAG_SIG_NOISE_FLOOR_ELEVATED: i64 = 5 // baseline noise too high |
| 67 | const NX_DIAG_SIG_HARMONIC_DISTORTION: i64 = 6 // nonlinearity in output |
| 68 | const NX_DIAG_SIG_IMPULSE_ARTIFACT: i64 = 7 // periodic clicks / pops |
| 69 | const NX_DIAG_SIG_MISSING_CHANNEL: i64 = 8 // expected channel silent |
| 70 | const NX_DIAG_SIG_CHANNEL_SWAP: i64 = 9 // L/R inverted etc. |
| 71 | const NX_DIAG_SIG_SATURATION: i64 = 10 // output clipping |
| 72 | const NX_DIAG_SIG_DROPOUT: i64 = 11 // intermittent silence |
| 73 | const NX_DIAG_SIG_RESONANCE_PEAK: i64 = 12 // FRF has unexpected peak |
| 74 | const NX_DIAG_SIG_RESONANCE_DIP: i64 = 13 // FRF has unexpected dip |
| 75 | const NX_DIAG_SIG_ROLLOFF_EARLY: i64 = 14 // bandwidth lower than spec |
| 76 | const NX_DIAG_SIG_TIME_DELAY_EXCESSIVE: i64 = 15 // group delay too high |
| 77 | const NX_DIAG_SIG_TEMPERATURE_RUNAWAY: i64 = 16 // thermal protection trip |
| 78 | const NX_DIAG_SIG_CURRENT_INRUSH: i64 = 17 // power supply current spike |
| 106 | const NX_DIAG_SEV_INFO: i64 = 1 // observation only, no action |
| 107 | const NX_DIAG_SEV_NOTICE: i64 = 2 // worth knowing; substrate compensates |
| 108 | const NX_DIAG_SEV_WARNING: i64 = 3 // marginal; user should review |
| 109 | const NX_DIAG_SEV_ERROR: i64 = 4 // failed; user must address |
| 110 | const NX_DIAG_SEV_CRITICAL: i64 = 5 // safety risk; halt assembly |
| 126 | const NX_DIAG_FIX_ADJUST_COMPONENT: i64 = 1 // turn trim pot, tighten clamp |
| 127 | const NX_DIAG_FIX_ADD_COMPONENT: i64 = 2 // solder additional cap/resistor |
| 128 | const NX_DIAG_FIX_REMOVE_COMPONENT: i64 = 3 // desolder a part |
| 129 | const NX_DIAG_FIX_REWORK_CONNECTION: i64 = 4 // cold solder joint, bad crimp |
| 130 | const NX_DIAG_FIX_RESEAT: i64 = 5 // unplug + replug, reseat IC |
| 131 | const NX_DIAG_FIX_RECALIBRATE: i64 = 6 // re-run nx_transducer_characterize |
| 132 | const NX_DIAG_FIX_REPLACE_COMPONENT: i64 = 7 // component failed; swap |
| 133 | const NX_DIAG_FIX_SOFTWARE_COMPENSATE: i64 = 8 // nx_signal_compensator handles |
| 134 | const NX_DIAG_FIX_INVESTIGATE_FURTHER: i64 = 9 // ambiguous; substrate names |
| 136 | const NX_DIAG_FIX_DEFER_TO_HUMAN: i64 = 10 // outside substrate diagnostic |
functions
| 80 | func nx_diag_sig_name(s: i64) -> *u8 |
| 112 | func nx_diag_sev_name(s: i64) -> *u8 |
| 139 | func nx_diag_fix_name(f: i64) -> *u8 |
| 191 | func nx_diag_examine_measurement(instrument_serial_ptr: *u8, instrument_serial_len: i64, |
| 209 | func nx_diag_register_pattern(pattern_ptr: *NxDiagPattern, |
| 219 | func nx_diag_suggest_next_measurement(instrument_serial_ptr: *u8, instrument_serial_len: i64, |
| 232 | func nx_diag_library_size() -> i64 |
| 238 | func nx_diag_get_last_verdict() -> i64 |