code wiki / _hdl_build / nx_trajscan.nx
nx_trajscan.nx
buildroot/runtime/_hdl_build/nx_trajscan.nx
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
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
structs
| none |
consts
| 13 | const TJ_MAGIC_4096: i64 = 4096 |
| 15 | const TJ_WIN: i64 = 4194304 |
| 16 | const TJ_VWIN: i64 = 5 // an edit must see a verify-class frame within this many followers |
| 17 | const TJ_SRUN: i64 = 5 // consecutive search-class frames that count as one loop |
| 18 | const TJ_ECHO: i64 = 3 // identical (tool,verb,note) frames that count as an echo group |
| 19 | const TJ_FLAG_VSKIP_PERMIL: i64 = 500 // rule-11: promote to conf once field-tuned |
| 20 | const TJ_MODE: i64 = 420 |
| 21 | const TJ_MAXF: i64 = 65536 |
| 22 | const TJ_OUT: i64 = 65536 |
| 23 | const TJ_EXIT_USAGE: i64 = 2 |
functions
| 25 | func 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 |
| 26 | func 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 } |
| 27 | func tj_lc(c: i64) -> i64 { if c >= 65 { if c <= 90 { return c + 32 } } return c } called by 1: tj_has |
| 29 | func tj_has(q: *u8, s: i64, e: i64, lit: *u8) -> i64 |
| 42 | func tj_span_eq(q: *u8, s1: i64, e1: i64, s2: i64, e2: i64) -> i64 called by 1: tj_core |
| 48 | func tj_lit_eq(q: *u8, s: i64, e: i64, lit: *u8) -> i64 |
| 54 | func tj_read(path: *u8, buf: *u8, cap: i64) -> i64 |
| 68 | func tj_app(journal: *u8, ts: i64, ws: *u8, tool: *u8, verb: *u8, outcome: *u8, note: *u8) -> i64 |
| 95 | func tj_is_edit(q: *u8, s: i64, e: i64) -> i64 |
| 100 | func tj_is_verify(q: *u8, s: i64, e: i64) -> i64 |
| 113 | func tj_is_search(q: *u8, s: i64, e: i64) -> i64 |
| 120 | func tj_is_oracle_note(q: *u8, s: i64, e: i64) -> i64 |
| 128 | func tj_core(journal: *u8, wsf: *u8, out: *i64) -> i64 |
| 231 | func tj_emit(out: *i64) -> i64 |
| 263 | func main(argc: i64, argv: *i64) -> i64 |