code wiki / _hdl_build / nx_trajscan.nx

nx_trajscan.nx

buildroot/runtime/_hdl_build/nx_trajscan.nx

15658 B331 linesdepth 3pulls 4 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_trajscan.nx -- TRAJECTORY ANTI-PATTERN SCANNER (quality-ruler R3, seq1248, 2026-07-29). Deterministic, judge-free detectors over the sovereign action journal (nx_actlog frame grammar: <ts>\t<ws>\t<tool>\t<verb>\t<outcome>\t<note>). Field basis: TraceProbe arXiv 2607.06184 + AgentLens 2607.06624 + EvilGenie 2511.21654 -- trajectory failures are visible in the ACTION LOG before the output is: verification-skip, search-loops, oracle-edits, retry-echo. scan <journal> [ws] -> one-line JSON envelope (counts + permil + verdict FLAG/OK) selftest <scratch-journal> -> gate; EVERY detector cell is bite-proven: fires on crafted-bad frames AND stays 0 on crafted-good (non-vacuity by construction) license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 3 imports · 0 importers

nx_sovjson_lib.nx nx_syscalls.nx nx_gate_verdict.nx nx_trajscan.nx

imports: nx_sovjson_lib.nxnx_syscalls.nxnx_gate_verdict.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main tj_werr sys_write sys_exit tj_lit_eq sj_vlen sys_mmap tj_core sys_mmap ↻ tj_read sys_openat_rd sys_read sys_close sj_vlen ↻ sj_le sj_col tj_lit_eq ↻ tj_is_edit tj_has sj_vlen ↻ tj_lc tj_is_verify tj_has ↻ tj_is_search tj_has ↻ tj_is_oracle_note tj_has ↻ tj_span_eq tj_emit sys_mmap ↻ sj_cat sj_catn sys_mmap ↻ sys_write ↻ sys_openat_wr sys_close ↻ tj_app sys_mmap ↻ sj_catn ↻ sj_cat ↻

structs

none

consts

13const TJ_MAGIC_4096: i64 = 4096
15const TJ_WIN: i64 = 4194304
16const TJ_VWIN: i64 = 5 // an edit must see a verify-class frame within this many followers
17const TJ_SRUN: i64 = 5 // consecutive search-class frames that count as one loop
18const TJ_ECHO: i64 = 3 // identical (tool,verb,note) frames that count as an echo group
19const TJ_FLAG_VSKIP_PERMIL: i64 = 500 // rule-11: promote to conf once field-tuned
20const TJ_MODE: i64 = 420
21const TJ_MAXF: i64 = 65536
22const TJ_OUT: i64 = 65536
23const TJ_EXIT_USAGE: i64 = 2

functions

25func tj_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
calls 1: sys_write
26func tj_werr(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(2, s, n); return 0 }
called by 1: main calls 1: sys_write
27func tj_lc(c: i64) -> i64 { if c >= 65 { if c <= 90 { return c + 32 } } return c }
called by 1: tj_has
29func tj_has(q: *u8, s: i64, e: i64, lit: *u8) -> i64
42func tj_span_eq(q: *u8, s1: i64, e1: i64, s2: i64, e2: i64) -> i64
called by 1: tj_core
48func tj_lit_eq(q: *u8, s: i64, e: i64, lit: *u8) -> i64
called by 2: tj_coremain
54func tj_read(path: *u8, buf: *u8, cap: i64) -> i64
68func tj_app(journal: *u8, ts: i64, ws: *u8, tool: *u8, verb: *u8, outcome: *u8, note: *u8) -> i64
95func tj_is_edit(q: *u8, s: i64, e: i64) -> i64
called by 1: tj_core calls 1: tj_has
100func tj_is_verify(q: *u8, s: i64, e: i64) -> i64
called by 1: tj_core calls 1: tj_has
120func tj_is_oracle_note(q: *u8, s: i64, e: i64) -> i64
called by 1: tj_core calls 1: tj_has
128func tj_core(journal: *u8, wsf: *u8, out: *i64) -> i64
231func tj_emit(out: *i64) -> i64
called by 1: main calls 4: sys_mmapsj_catsj_catnsys_write
263func main(argc: i64, argv: *i64) -> i64