nx_perceptual_judge.nx source
↩ module page · 101 lines · 4582 B
1// nx_perceptual_judge.nx -- signal-vs-profile honesty judge.
2//
3// module: nishi-core.perception.judge
4// depends: nishi-core.perception.profile + nishi-core.io.syscalls
5// disk_kb: 4
6// capability: PERCEPTION
7// wired_status: PARTIAL_WIRED
8//
9// MISSING_CAPABILITIES:
10// - JUDGE_BEHAVIORAL_VALIDATION_DATASET (needs nx_perceptual_dataset
11// entries from Customer Zero behavioral A/B per
12// [[NISHI_DOG_PERCEPTUAL_TEST_HARDWARE]])
13// - JUDGE_PER_AXIS_BREAKDOWN (current stub returns coarse score
14// only; per-axis frequency/spatial/dynamic/periodicity/reverb
15// decomposition queued)
16//
17// license_tier: PUBLIC_NISHI_SUBSTRATE
18// genealogy_id: feedback-multi-species-perceptual-substrate-not-anthropocentric_2026 +
19// feedback-honest-perf-verdict-no-aspirational-claims +
20// feedback-no-false-ok-substrate-honesty-audit
21//
22// Per cardinal [[feedback-multi-species-perceptual-substrate-not-anthropocentric]]:
23// Produces a MEASURABLE verdict score (0..100) of how likely a target
24// species' perceptual system would classify a given signal as
25// "real prey / real conspecific / real environmental" vs "artificial
26// rendered media." Substrate uses this to gate honest claims of
27// "this codec is dog-real" without anecdote.
28//
29// THIS IS A PARTIAL_WIRED STUB. Implementation requires behavioral
30// validation dataset; signatures + per-axis decomposition shape +
31// honesty gate are wired so downstream callers can compose against
32// the stable interface while the model trains.
33
34import "nx_syscalls.nx"
35import "nx_perceptual_profile.nx"
36
37// ===== Score axes (per-axis composite) ============================
38//
39// Five axes the judge decomposes by. Each contributes 0..20 to a
40// 0..100 total. Below-zero (loss-above-perceptual-range) is treated
41// as zero, never negative, because we cannot earn back perceptual
42// realism by over-providing content the species cannot perceive.
43
44const NX_JUDGE_AXIS_FREQ_PRESERVATION: i64 = 1
45const NX_JUDGE_AXIS_SPATIAL_REALISM: i64 = 2
46const NX_JUDGE_AXIS_DYNAMIC_RANGE: i64 = 3
47const NX_JUDGE_AXIS_PERIODICITY_NOVELTY: i64 = 4
48const NX_JUDGE_AXIS_REVERB_MATCH: i64 = 5
49
50func nx_judge_axis_name(a: i64) -> *u8 {
51 if a == NX_JUDGE_AXIS_FREQ_PRESERVATION { return "FREQ_PRESERVATION" }
52 if a == NX_JUDGE_AXIS_SPATIAL_REALISM { return "SPATIAL_REALISM" }
53 if a == NX_JUDGE_AXIS_DYNAMIC_RANGE { return "DYNAMIC_RANGE" }
54 if a == NX_JUDGE_AXIS_PERIODICITY_NOVELTY { return "PERIODICITY_NOVELTY" }
55 if a == NX_JUDGE_AXIS_REVERB_MATCH { return "REVERB_MATCH" }
56 return "UNKNOWN_AXIS"
57}
58
59// ===== Honesty verdict gate =======================================
60//
61// Returns 1 if the substrate can HONESTLY claim "perceptually real
62// to species X" for the given signal+profile pair. Until behavioral
63// dataset lands, always returns 0 and emits MISSING_CAPABILITIES.
64
65func nx_perceptual_judge_can_claim_real(signal_ptr: *u8, signal_len: i64,
66 profile: i64) -> i64 {
67 // PARTIAL_WIRED: behavioral validation dataset not yet ingested.
68 // Honest verdict per [[feedback-honest-perf-verdict-no-aspirational-claims]]:
69 // refuse to claim until measured.
70 if nx_perceptual_profile_is_valid(profile) == 0 { return 0 }
71 if signal_len <= 0 { return 0 }
72 // Future: actual scoring against trained model + behavioral data.
73 return 0
74}
75
76// ===== Coarse score stub ==========================================
77//
78// Returns 0..100 score. Currently returns 0 always; signature is
79// wired so downstream pathway probes can compose against it.
80// Replaced when nx_perceptual_dataset + trained judge lands.
81
82func nx_perceptual_judge_score(signal_ptr: *u8, signal_len: i64,
83 profile: i64) -> i64 {
84 if nx_perceptual_profile_is_valid(profile) == 0 { return 0 }
85 if signal_len <= 0 { return 0 }
86 return 0
87}
88
89// ===== Per-axis score stub ========================================
90//
91// Returns 0..20 score for the named axis. Per-axis decomposition
92// is queued behind dataset; signature stable.
93
94func nx_perceptual_judge_axis_score(signal_ptr: *u8, signal_len: i64,
95 profile: i64, axis: i64) -> i64 {
96 if nx_perceptual_profile_is_valid(profile) == 0 { return 0 }
97 if signal_len <= 0 { return 0 }
98 if axis < NX_JUDGE_AXIS_FREQ_PRESERVATION { return 0 }
99 if axis > NX_JUDGE_AXIS_REVERB_MATCH { return 0 }
100 return 0
101}