nx_scaffolding_audit.nx
buildroot/runtime/nx_scaffolding_audit.nx
about
nx_scaffolding_audit.nx -- REPO-FILE audit primitive that enforces the
no-temporary-third-party-scaffolding-when-substrate-arc-exists cardinal.
AUDIT-FIRST CORRECTION (2026-05-20, post-creation): user caught that I
built this without checking for existing prior art. The substrate
already ships an audit family:
- nx_audit_dashboard.nx : substrate-STATE aggregation
(hunter kills / gatherer yields /
xenocell alerts / immune health /
book unseen-alert / organism pressure /
pollinate pending)
- nx_audit_server_daemon.nx : exposes substrate state over HTTP
- nx_audit_server_main.nx : daemon entry point
- nx_audit_compose_test.nx : test harness
- nx_ai_audit.nx : AI-output audit
- nx_adversarial_pattern_audit.nx: adversarial input pattern detection
THIS primitive (nx_scaffolding_audit) is a DIFFERENT DOMAIN: it audits
REPO FILES against the SCAFFOLDING_REPLACED_BY cardinal. Distinct from
the substrate-state-aggregation primitives above. However it could
COMPOSE INTO the dashboard: future nx_audit_dashboard rows could include
a "scaffolding violations" counter sourced from nx_saudit_run, surfacing
the cardinal-compliance state alongside other substrate health metrics.
Per feedback-no-temporary-third-party-scaffolding-when-substrate-arc-exists
audit-first rule: ls nxc2/runtime/ before authoring new primitives.
module: nishi-core.ops.scaffolding_audit
depends: nishi-core.perception.profile + nishi-core.io.syscalls
disk_kb: 9
capability: OPS
wired_status: PARTIAL_WIRED (nx_saudit_check_one_file + nx_saudit_run
both GRADUATED to basic-glue 2026-05-20:
compose sys_read_file + nx_str_find +
nx_dir_list; refuses self-exempt loophole
at substrate level; aggregates per-file
findings into NxSauditSummary; rest of
entries still PARTIAL_WIRED)
dependencies 4 imports · 0 importers
imports: nx_syscalls.nxnx_perceptual_profile.nxnx_string_ops.nxnx_dir.nx
imported by: nobody (leaf or entry point)
structs
| 138 | struct NxSauditFinding |
| 154 | struct NxSauditSummary |
consts
| 89 | const NX_SAUDIT_VIOLATION_MISSING_HEADER: i64 = 1 // no SCAFFOLDING_REPLACED_BY line |
| 90 | const NX_SAUDIT_VIOLATION_BAD_REFERENCE: i64 = 2 // named primitive file missing |
| 91 | const NX_SAUDIT_VIOLATION_SUNSET_OVERDUE: i64 = 4 // primitive FULLY_WIRED; |
| 93 | const NX_SAUDIT_VIOLATION_AUDITOR_SELF_EXEMPT: i64 = 8 // ANY file claiming |
| 110 | const NX_SAUDIT_SCOPE_OPS_DIR: i64 = 1 // bench/ops/* |
| 111 | const NX_SAUDIT_SCOPE_OPERATIONAL_FILENAME: i64 = 2 // nishifamily_* etc |
| 112 | const NX_SAUDIT_SCOPE_CONTENT_HEURISTIC: i64 = 3 // grep for nginx/sudo/etc |
| 113 | const NX_SAUDIT_SCOPE_OUT_OF_SCOPE: i64 = 4 // substrate-test prefixes |
| 125 | const NX_SAUDIT_VERDICT_CLEAN: i64 = 0 |
| 126 | const NX_SAUDIT_VERDICT_VIOLATIONS_PRESENT: i64 = 1 // any violation class |
| 127 | const NX_SAUDIT_VERDICT_DEPENDENCY_MISSING: i64 = 2 // PARTIAL_WIRED default |
functions
| 97 | func nx_saudit_violation_name(v: i64) -> *u8 |
| 115 | func nx_saudit_scope_name(s: i64) -> *u8 |
| 129 | func nx_saudit_verdict_name(v: i64) -> *u8 |
| 183 | func nx_saudit_run(repo_root_ptr: *u8, repo_root_len: i64, |
| 300 | func nx_saudit_check_one_file(file_path_ptr: *u8, file_path_len: i64, |
| 368 | func nx_saudit_in_scope(file_path_ptr: *u8, file_path_len: i64) -> i64 |
| 378 | func nx_saudit_refuse_self_exempt(file_path_ptr: *u8, file_path_len: i64) -> i64 |
| 387 | func nx_saudit_get_last_verdict() -> i64 |