code wiki / (root) / nx_greeting.nx

nx_greeting.nx

buildroot/runtime/nx_greeting.nx

6472 B138 linesdepth 0pulls 0 transitivereach 1 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_greeting.nx -- WRITING arc, rung W-GR-1: THE THREE-BEAT GREETING. Closes gap-queue row #4 of nx_writebench (pop 342/378). The ruler (arXiv:2601.14324) finds the greeting is THE LOAD-BEARING ARTIFACT of a character bot: it is the only text every user reads, it sets the register, and it is what makes an opening feel like a scene instead of a bio. Its structure is three ordered beats: 1. SELF-INTRODUCTION -- who is speaking 2. SCENARIO / INCITING INCIDENT -- the situation that has already started 3. DIRECT ADDRESS -- the turn to the reader that hands them the move ★WHY ORDER IS PART OF THE MEASUREMENT AND NOT A STYLE OPINION. The same three beats in a different order produce a different artifact: address-first is a chatbot prompt, scenario-first with no introduction is a narrator, and introduction-only is a character sheet. The ruler's finding is about a SEQUENCE, so a detector that only counted presence would call all four of those "complete" and measure nothing. Presence and order are reported separately, and the headline requires both. ★CRAFT, NOT COMPLIANCE. This organ scores STRUCTURE. It has no view on register or content: an SFW greeting and an explicit one are graded by the same three beats, because the thing being measured is whether the opening works, not what it is about. Register lives in nx_register and the legal line lives upstream in rg_decision -- see [[feedback-hosting-legal-posture]]. Lexicons stay pure operator DATA (the packed NUL-terminated terms + parallel weights contract nx_register/nx_dialogue/nx_realperson already use), so a lane can tune or translate the markers without touching this logic, and this organ authors no content. Pure integer, NO syscalls, caller owns every buffer. license_tier: ORIGINAL module: nishi-core.write.greeting capability: WRITE_GREETING_STRUCTURE

dependencies 0 imports · 1 importers

nx_greeting.nx nx_greeting_gate.nx

imports: none

imported by: nx_greeting_gate.nx

structs

none

consts

32const GR_BEAT_INTRO: i64 = 0
33const GR_BEAT_SCENARIO: i64 = 1
34const GR_BEAT_ADDRESS: i64 = 2
35const GR_NOT_FOUND: i64 = 0 - 1
38const GR_FLAT: i64 = 0 // fewer than two beats: a bio or a line of dialogue, not a greeting
39const GR_PARTIAL: i64 = 1 // two beats, or three out of canonical order
40const GR_COMPLETE: i64 = 2 // all three, in order
124const GR_PERMIL: i64 = 1000

functions

42func gr_lower(c: i64) -> i64 { if c >= 65 { if c <= 90 { return c + 32 } } return c }
called by 1: gr_find_word
43func gr_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
44func gr_is_wordch(c: i64) -> i64
called by 1: gr_find_word
55func gr_find_word(buf: *u8, a: i64, b: i64, term: *u8) -> i64
79func gr_beat_pos(buf: *u8, a: i64, b: i64, terms: *u8, nterms: i64) -> i64
called by 1: main calls 2: gr_lengr_find_word
97func gr_beats_present(pi: i64, ps: i64, pa: i64) -> i64
106func gr_ordered(pi: i64, ps: i64, pa: i64) -> i64
115func gr_verdict(pi: i64, ps: i64, pa: i64) -> i64
called by 1: main calls 2: gr_beats_presentgr_ordered
132func gr_score_permil(pi: i64, ps: i64, pa: i64) -> i64
called by 1: main calls 2: gr_orderedgr_beats_present