code wiki / (root) / nx_content_guard.nx

nx_content_guard.nx

buildroot/runtime/nx_content_guard.nx

17247 B476 linesdepth 7pulls 10 transitivereach 2 importersview sourcekind librarytopic content
docsdependenciesstructsconstsfunctions

about

nx_content_guard.nx -- extensible content-policy detector. Runs between scene-index build and caption emit. For each SceneCandidate, scans the source span for content-policy signals and writes a flags bitset back into the candidate. caption_emit checks those flags and refuses CONFIRMED categories, emits SUSPECT categories with a warning header. Default categories (V1): NTR_SUSPECT -- multiple male active referents present NTR_CONFIRMED -- NTR-coded phrasing detected ("her husband", "cuckold", "watched him with", etc.) MULTI_MALE_ACTIVE -- >= 2 distinct male pronoun groups doing verbs OBSERVER_PASSIVE -- the user/observer pronouns are predominantly passive verbs (watching, observing); the user spec is DOMINANT ACTOR not watcher Future categories (sealed enum extensible append-only): MINOR_INDICATOR -- age signals below threshold NONCON_INDICATOR -- non-consent phrasing without resolution GORE_INDICATOR -- graphic violence Per cardinal feedback-build-intelligence-never-strip-features: the guard SURFACES + ATTRIBUTES; it does not silently drop content. The user reviews flagged candidates and pins / rejects. Caption emit only refuses CONFIRMED -- everything else is opt-in. Per cardinal feedback-user-owns-every-bit: thresholds + cue lists are caller-configurable. No hard-coded magic that the user can't audit. nx_safety_envelope: intended_use: "Scan each SceneCandidate's source span for content-policy signals (NTR / multi-male- active / observer-passive / etc.) and attach flag bits to the candidate." sil_target: SIL2 asil_target: QM dal_target: DAL C iec_62304_class: NONE

dependencies 6 imports · 2 importers

nx_syscalls.nx nx_storybeat.nx nx_storydb.nx nx_media_pool.nx nx_scene_index.nx nx_phrase_match.nx nx_content_guard.nx nx_content_guard_test.nx nx_ingest_cli.nx

imports: nx_syscalls.nxnx_storybeat.nxnx_storydb.nxnx_media_pool.nxnx_scene_index.nxnx_phrase_match.nx

imported by: nx_content_guard_test.nxnx_ingest_cli.nx

structs

none

consts

68const NX_CG_FLAG_USER_PINNED: i64 = 1 // bit 0 (existing)
69const NX_CG_FLAG_NTR_SUSPECT: i64 = 2 // bit 1
70const NX_CG_FLAG_NTR_CONFIRMED: i64 = 4 // bit 2
71const NX_CG_FLAG_MULTI_MALE_ACTIVE: i64 = 8 // bit 3
72const NX_CG_FLAG_OBSERVER_PASSIVE: i64 = 16 // bit 4
76const NX_CG_VERDICT_NONE: i64 = 0
77const NX_CG_VERDICT_SUSPECT: i64 = 1
78const NX_CG_VERDICT_CONFIRMED: i64 = 2
94const NX_CG_NTR_CUE_COUNT: i64 = 14
137const NX_CG_OBS_PASSIVE_CUE_COUNT: i64 = 6
168const NX_CG_MALE_VERB_PAIR_COUNT: i64 = 8

functions

82func nx_cg_load_u8(p: *u8, i: i64) -> i64
96func nx_cg_ntr_cue_at(idx: i64) -> *u8
called by 1: nx_cg_scan_ntr
114func nx_cg_ntr_cue_len(idx: i64) -> i64
called by 1: nx_cg_scan_ntr
139func nx_cg_obs_passive_cue_at(idx: i64) -> *u8
149func nx_cg_obs_passive_cue_len(idx: i64) -> i64
170func nx_cg_male_verb_pair_at(idx: i64) -> *u8
182func nx_cg_male_verb_pair_len(idx: i64) -> i64
196func nx_cg_scan_ntr(src: *u8, start: i64, end: i64) -> i64
218func nx_cg_scan_male_active(src: *u8, start: i64, end: i64) -> i64
240func nx_cg_scan_observer_passive(src: *u8, start: i64, end: i64) -> i64
267func nx_cg_scan_candidate(db: *StoryDb, cand: *SceneCandidate) -> i64
312func nx_content_guard_scan_bytes(src: *u8, n: i64) -> i64
333func nx_content_guard_scan_index(idx: *SceneIndex, db: *StoryDb) -> i64
359func nx_content_guard_verdict(flags: i64) -> i64
384func nx_content_guard_emit_explain(flags: i64,
called by 2: mainmain calls 1: nx_content_guard_verdict