typeglish 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/NOTICE +13 -0
- package/README.md +301 -0
- package/dist/chunk-3NQ3VYO6.js +566 -0
- package/dist/chunk-3NQ3VYO6.js.map +1 -0
- package/dist/chunk-KRYC4OTL.js +3573 -0
- package/dist/chunk-KRYC4OTL.js.map +1 -0
- package/dist/chunk-NLQIL5WD.js +25 -0
- package/dist/chunk-NLQIL5WD.js.map +1 -0
- package/dist/chunk-PR4QN5HX.js +39 -0
- package/dist/chunk-PR4QN5HX.js.map +1 -0
- package/dist/chunk-PXAMTGYY.js +3 -0
- package/dist/chunk-PXAMTGYY.js.map +1 -0
- package/dist/chunk-VMACILYN.js +140 -0
- package/dist/chunk-VMACILYN.js.map +1 -0
- package/dist/chunk-Y64EAEYB.js +10919 -0
- package/dist/chunk-Y64EAEYB.js.map +1 -0
- package/dist/chunk-YH4ZLQ4G.js +4260 -0
- package/dist/chunk-YH4ZLQ4G.js.map +1 -0
- package/dist/chunk-ZKMHZHID.js +56 -0
- package/dist/chunk-ZKMHZHID.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +447 -0
- package/dist/cli.js.map +1 -0
- package/dist/compile-DViQS2oG.d.ts +310 -0
- package/dist/diagnostics-BWJ_oMd8.d.ts +49 -0
- package/dist/exhaustiveness-VBVWCX5W.js +123 -0
- package/dist/exhaustiveness-VBVWCX5W.js.map +1 -0
- package/dist/index-Df_QnTgq.d.ts +313 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp.d.ts +11 -0
- package/dist/mcp.js +36378 -0
- package/dist/mcp.js.map +1 -0
- package/dist/monaco.css +46 -0
- package/dist/monaco.d.ts +43 -0
- package/dist/monaco.js +971 -0
- package/dist/monaco.js.map +1 -0
- package/dist/node.d.ts +21 -0
- package/dist/node.js +8 -0
- package/dist/node.js.map +1 -0
- package/dist/spell-node.d.ts +8 -0
- package/dist/spell-node.js +23 -0
- package/dist/spell-node.js.map +1 -0
- package/dist/spell.d.ts +18 -0
- package/dist/spell.js +4 -0
- package/dist/spell.js.map +1 -0
- package/dist/z3-MWU3GSVT.js +5 -0
- package/dist/z3-MWU3GSVT.js.map +1 -0
- package/package.json +160 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/highlight.ts","../src/core/fmt.ts","../src/core/layout.ts","../src/core/charset.ts","../src/core/logic.ts","../src/core/order.ts","../src/core/definiteness.ts","../src/core/quantifier.ts","../src/core/security.ts","../src/core/coverage.ts","../src/core/diagnostics.ts","../src/core/catalog.ts","../src/core/edits.ts","../src/core/semantic/atoms.ts","../src/core/semantic/config.ts","../src/core/semantic/candidates.ts","../src/core/semantic/classify.ts","../src/core/semantic/reduce.ts","../src/core/semantic/report.ts","../src/core/resolve.ts","../src/core/compile.ts","../src/core/report.ts"],"names":["tokens","m","lines","dedupe","lower","normMember","decls","k","STOP","report","SEV_RANK"],"mappings":";;;;AAyCO,SAAS,gBAAgB,GAAA,EAAsB;AACpD,EAAA,MAAM,IAAI,GAAA,CACP,IAAA,GACA,OAAA,CAAQ,YAAA,EAAc,EAAE,CAAA,CACxB,OAAA,CAAQ,OAAA,EAAS,EAAE,EACnB,OAAA,CAAQ,qBAAA,EAAuB,EAAE,CAAA,CACjC,IAAA,GACA,WAAA,EAAY;AACf,EAAA,IAAI,mDAAA,CAAoD,IAAA,CAAK,CAAC,CAAA,EAAG,OAAO,aAAA;AACxE,EAAA,IAAI,4DAAA,CAA6D,IAAA,CAAK,CAAC,CAAA,EAAG,OAAO,WAAA;AACjF,EAAA,IAAI,2CAAA,CAA4C,IAAA,CAAK,CAAC,CAAA,EAAG,OAAO,aAAA;AAChE,EAAA,IAAI,gEAAA,CAAiE,IAAA,CAAK,CAAC,CAAA,EAAG,OAAO,SAAA;AACrF,EAAA,IACE,oHAAA,CA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,iBAAiB,CAAC,CAAA;AAE9G,EAAA,MAAM,MAAA,GAAS;AAAA,IACb,KAAA,EAAO,YAAY,MAAA,CAAO,CAAC,MAAM,CAAA,CAAE,iBAAA,KAAsB,OAAO,CAAA,CAAE,MAAA;AAAA,IAClE,IAAA,EAAM,YAAY,MAAA,CAAO,CAAC,MAAM,CAAA,CAAE,iBAAA,KAAsB,MAAM,CAAA,CAAE,MAAA;AAAA,IAChE,IAAA,EAAM,YAAY,MAAA,CAAO,CAAC,MAAM,CAAA,CAAE,iBAAA,KAAsB,MAAM,CAAA,CAAE;AAAA,GAClE;AAEA,EAAA,OAAO;AAAA,IACL,EAAA,EAAI,OAAO,KAAA,KAAU,CAAA;AAAA,IACrB,YAAY,QAAA,CAAS,UAAA;AAAA,IACrB,YAAY,QAAA,CAAS,UAAA;AAAA,IACrB,MAAA;AAAA,IACA,WAAA;AAAA,IACA,OAAA,EAAS,UAAU,MAAM,CAAA;AAAA,IACzB,KAAK,QAAA,CAAS;AAAA,GAChB;AACF","file":"chunk-KRYC4OTL.js","sourcesContent":["import { classifyLines } from './prompt';\nimport type { LineKind } from './types';\n\n// Declared valence — what an instruction line *claims to be*. Static and honest: it\n// never asserts the line matters to the model (that is measured weight, a separate\n// channel). Rendered as a quiet gutter-edge tint.\nexport type Valence =\n | 'prohibition'\n | 'directive'\n | 'conditional'\n | 'example'\n | 'format'\n | 'role'\n | 'plain';\n\nexport interface InlineToken {\n text: string;\n cls?: string;\n}\n\nexport interface RenderLine {\n kind: LineKind;\n lineClass?: string;\n valence: Valence;\n tokens: InlineToken[];\n}\n\nconst VALENCE_VAR: Record<Valence, string> = {\n prohibition: 'var(--v-prohibition)',\n directive: 'var(--v-directive)',\n conditional: 'var(--v-conditional)',\n example: 'var(--v-example)',\n format: 'var(--v-format)',\n role: 'var(--v-role)',\n plain: 'transparent',\n};\n\nexport function valenceColor(v: Valence): string {\n return VALENCE_VAR[v];\n}\n\nexport function classifyValence(raw: string): Valence {\n const t = raw\n .trim()\n .replace(/^#{1,6}\\s+/, '')\n .replace(/^>\\s?/, '')\n .replace(/^(?:[-*+]|\\d+\\.)\\s+/, '')\n .trim()\n .toLowerCase();\n if (/^(never|don'?t|do not|avoid|must not|cannot|no\\b)/.test(t)) return 'prohibition';\n if (/^(always|must\\b|ensure|make sure|be sure|you must|require)/.test(t)) return 'directive';\n if (/^(if|when|whenever|unless|in case|should)/.test(t)) return 'conditional';\n if (/^(e\\.?g\\.?\\b|for example|example:|input:|output:|for instance)/.test(t)) return 'example';\n if (\n /(respond (with|only|in)|output (a|the|only|in)|return (a|the|only)|format:|json|markdown|use the following format)/.test(\n t,\n )\n ) {\n return 'format';\n }\n if (/^(you are|you'?re|act as|your role|your job|as an?\\b)/.test(t)) return 'role';\n return 'plain';\n}\n\ninterface InlineRule {\n re: RegExp;\n cls: string;\n delim: number;\n}\n\n// Underscore emphasis is deliberately omitted — it false-positives on snake_case\n// identifiers (no_invented_pricing), which are common in prompts. Asterisk forms only.\nconst INLINE_RULES: InlineRule[] = [\n { re: /^`[^`\\n]+`/, cls: 'md-code-inline', delim: 1 },\n { re: /^\\*\\*\\*[^*\\n]+\\*\\*\\*/, cls: 'md-strong-em', delim: 3 },\n { re: /^\\*\\*[^*\\n]+\\*\\*/, cls: 'md-strong', delim: 2 },\n { re: /^~~[^~\\n]+~~/, cls: 'md-strike', delim: 2 },\n { re: /^\\*[^*\\s][^*\\n]*\\*/, cls: 'md-em', delim: 1 },\n];\nconst LINK_RE = /^\\[([^\\]\\n]+)\\]\\(([^)\\n]+)\\)/;\n\n// Tokenize a line's inline markdown, preserving every character exactly (delimiters\n// included, dimmed) so the overlay reproduces the textarea byte-for-byte.\nfunction tokenizeInline(text: string): InlineToken[] {\n const tokens: InlineToken[] = [];\n let buf = '';\n const flush = (): void => {\n if (buf) {\n tokens.push({ text: buf });\n buf = '';\n }\n };\n let i = 0;\n while (i < text.length) {\n const sub = text.slice(i);\n const lm = sub.match(LINK_RE);\n if (lm) {\n flush();\n tokens.push({ text: '[', cls: 'md-marker' });\n tokens.push({ text: lm[1] ?? '', cls: 'md-link' });\n tokens.push({ text: '](', cls: 'md-marker' });\n tokens.push({ text: lm[2] ?? '', cls: 'md-link-url' });\n tokens.push({ text: ')', cls: 'md-marker' });\n i += lm[0].length;\n continue;\n }\n let matched = false;\n for (const r of INLINE_RULES) {\n const m = sub.match(r.re);\n if (m) {\n flush();\n const full = m[0];\n tokens.push({ text: full.slice(0, r.delim), cls: 'md-marker' });\n tokens.push({ text: full.slice(r.delim, full.length - r.delim), cls: r.cls });\n tokens.push({ text: full.slice(full.length - r.delim), cls: 'md-marker' });\n i += full.length;\n matched = true;\n break;\n }\n }\n if (!matched) {\n buf += text[i] ?? '';\n i += 1;\n }\n }\n flush();\n return tokens;\n}\n\nfunction lineLevel(raw: string): { lineClass?: string; contentStart: number } {\n const h = raw.match(/^\\s*#{1,6}\\s+/);\n if (h) return { lineClass: 'md-heading', contentStart: h[0].length };\n const q = raw.match(/^\\s*>\\s?/);\n if (q) return { lineClass: 'md-quote', contentStart: q[0].length };\n const li = raw.match(/^\\s*(?:[-*+]|\\d+\\.)\\s+/);\n if (li) return { contentStart: li[0].length };\n return { contentStart: 0 };\n}\n\n/**\n * Turn raw lines into per-line render info: the profiler `kind` (content/blank/comment),\n * a declared `valence`, an optional whole-line class (heading/quote/code/comment), and\n * exact-text inline tokens. Comments and code fences are rendered verbatim.\n */\nexport function renderLines(rawLines: string[]): RenderLine[] {\n const kinds = classifyLines(rawLines);\n const out: RenderLine[] = [];\n let inFence = false;\n for (let i = 0; i < rawLines.length; i += 1) {\n const raw = rawLines[i] ?? '';\n const kind = kinds[i] ?? 'content';\n const t = raw.trim();\n const isFence = t.startsWith('```') || t.startsWith('~~~');\n\n if (inFence) {\n if (isFence) inFence = false;\n out.push({ kind, lineClass: 'md-code', valence: 'plain', tokens: [{ text: raw }] });\n continue;\n }\n if (kind === 'comment') {\n out.push({ kind, lineClass: 'ol-comment', valence: 'plain', tokens: [{ text: raw }] });\n continue;\n }\n if (isFence) {\n inFence = true;\n out.push({ kind, lineClass: 'md-code', valence: 'plain', tokens: [{ text: raw }] });\n continue;\n }\n if (kind === 'blank') {\n out.push({ kind, valence: 'plain', tokens: [{ text: raw }] });\n continue;\n }\n const { lineClass, contentStart } = lineLevel(raw);\n const marker: InlineToken[] =\n contentStart > 0 ? [{ text: raw.slice(0, contentStart), cls: 'md-marker' }] : [];\n out.push({\n kind,\n lineClass,\n valence: classifyValence(raw),\n tokens: [...marker, ...tokenizeInline(raw.slice(contentStart))],\n });\n }\n return out;\n}\n","// ── tg fmt — mechanical normalization toward statement-per-line ─────────────────────────────────────\n// The grammar is line-oriented: one line, one statement. Two habits break that invariant — hard-\n// wrapping a sentence across lines (markdown muscle memory; the parser reads the fragment as its own\n// unclassifiable statement) and packing two rules onto one line with a semicolon (the IR swallows the\n// second rule into the first's action text — probe-verified). fmt repairs both mechanically, the way\n// gofmt repairs indentation: detection is shared with the diagnostics (one detector, two consumers,\n// zero drift), the transform is idempotent (fmt∘fmt = fmt, tested), and prose blocks / fences are\n// never touched.\nimport { configSectionMask, examplesMask, isAnnotationLine, maskQuotes, toolBlockMask } from './clause';\nimport { classifyClause, parseLine } from './grammar';\nimport { MODAL_KEYWORDS } from './lexicon';\nimport { renderLines } from './highlight';\nimport { proseExemptLines } from './predicate';\nimport { buildStructure } from './structure';\nimport type { StructuredDoc } from './structure';\nimport { parseSwitches } from './switch';\nimport type { SwitchBlock } from './switch';\nimport { testBlockLines } from './testblock';\n\n/** Spaces per indent level. Matches the editor's tabSize so cleanup and live auto-indent agree. */\nexport const INDENT_UNIT = 2;\n\n/** A semicolon followed by a second modal — two rules on one line. Shared with diagnostics. The modal\n * alternation is DERIVED from the lexicon's MODAL_KEYWORDS (invariant #1): they're already longest-first\n * (`MUST NOT` before `MUST`) and carry no regex metacharacters, so a plain `|`-join is exact. Add a modal\n * to the lexicon and this boundary tracks it — no hardcoded copy. */\nexport const COMPOUND_RE = new RegExp(`;\\\\s*(?:and\\\\s+|but\\\\s+)?(${MODAL_KEYWORDS.join('|')})\\\\b`, 'i');\n\n/** Hard-wrapped continuations: line → the line it continues. A lowercase, prose-classified,\n * non-list content line whose previous content line doesn't end a sentence. Shared with\n * diagnostics so the warn and the fix can never disagree about what a fragment is. */\nexport function wrappedContinuations(rawLines: string[]): Map<number, number> {\n const render = renderLines(rawLines);\n const exempt = proseExemptLines(rawLines);\n const tests = testBlockLines(rawLines);\n const tools = toolBlockMask(rawLines);\n const cfg = configSectionMask(rawLines);\n const out = new Map<number, number>();\n let prevContent = -1;\n for (let i = 0; i < rawLines.length; i += 1) {\n const raw = rawLines[i] ?? '';\n if (tests.has(i)) continue; // never rewrite inside a $TEST block — bad-test errors guide the author\n if (tools[i] || cfg[i]) {\n prevContent = -1; // a $TOOL/$SERVICE body or <$CONFIG> extent is scaffolding, not wrapped prose — and it resets continuation context\n continue;\n }\n const r = render[i];\n if (!r || r.kind !== 'content' || r.lineClass === 'md-code') continue;\n if (r.lineClass === 'md-heading') {\n prevContent = -1; // a heading resets continuation context\n continue;\n }\n const before = prevContent;\n prevContent = i;\n if (before === -1 || exempt.has(i) || exempt.has(before)) continue;\n const parsed = parseLine(raw);\n if (parsed.list !== 'none') continue; // a fresh list item is a new statement, never a fragment\n const clause = parsed.clause.trim();\n if (clause === '' || !/^[a-z]/.test(clause)) continue;\n if (classifyClause(clause) !== 'prose') continue;\n const prevText = (rawLines[before] ?? '').trim();\n if (prevText === '' || /[.!?:;\"'`)\\]]$/.test(prevText)) continue;\n out.set(i, before);\n }\n return out;\n}\n\nexport interface FmtChange {\n /** 1-based line number in the ORIGINAL source. */\n line: number;\n kind: 'join' | 'split' | 'trim' | 'sentence' | 'blank' | 'indent';\n detail: string;\n}\n\nexport interface FmtResult {\n text: string;\n changes: FmtChange[];\n}\n\nexport interface FmtOptions {\n /** Join hard-wrapped continuations into their statement (default true). */\n join?: boolean;\n /** Split semicolon-compound rules into one statement per line (default true). */\n split?: boolean;\n /** Split a multi-sentence body line into one sentence per line (default OFF — cleanup turns it on). */\n sentences?: boolean;\n /** Normalize blank lines: one between statements, none before an attached annotation (default OFF). */\n blankLines?: boolean;\n /** Re-derive indentation from section/switch/step nesting (default OFF). */\n reindent?: boolean;\n}\n\n/** The full \"cleanup\" pass — every normalization on. Deterministic + idempotent; never changes the compiled\n * prompt (indentation and blank lines are cosmetic to the compiler; sentence/compound splits only add line\n * breaks between statements the compiler already reads one-per-line). */\nexport function cleanup(source: string): FmtResult {\n return formatSource(source, { join: true, split: true, sentences: true, blankLines: true, reindent: true });\n}\n\n/** The list-marker/indent prefix of a line (` - `, `3. `, or bare indent). */\nfunction linePrefix(raw: string): string {\n const m = /^(\\s*(?:[-*+]|\\d+[.)])\\s+|\\s*)/.exec(raw);\n return m?.[1] ?? '';\n}\n\nconst leadingSpaces = (raw: string): string => raw.slice(0, raw.length - raw.trimStart().length);\nconst isHeadingLine = (raw: string): boolean => /^\\s*#{1,6}\\s/.test(raw);\nconst isOpenTagLine = (raw: string): boolean => /^\\s*<[a-z$][\\w-]*(?:\\s[^>]*)?>\\s*$/i.test(raw) && !/^\\s*<\\//.test(raw);\nconst isCloseTagLine = (raw: string): boolean => /^\\s*<\\/[a-z$][\\w-]*\\s*>\\s*$/i.test(raw);\n\n// ── Sentence splitting ─────────────────────────────────────────────────────────────────────────────────\n// Abbreviations whose trailing `.` is NOT a sentence end. Compared case-folded, with any trailing dots stripped.\nconst ABBREVIATIONS = new Set([\n 'mr', 'mrs', 'ms', 'dr', 'prof', 'sr', 'jr', 'st', 'ave', 'blvd', 'rd', 'no', 'vs', 'etc', 'al', 'inc', 'ltd',\n 'co', 'corp', 'dept', 'est', 'fig', 'approx', 'min', 'max', 'eg', 'ie', 'ph', 'vol', 'pp', 'e.g', 'i.e', 'a.m',\n 'p.m', 'u.s', 'u.k',\n]);\n\n/** Split a line into sentences at `. ` / `! ` / `? ` boundaries. Conservative — it only cuts where the period\n * is followed by whitespace and a capitalized/opening start, and never after a decimal, an abbreviation, a\n * single-letter initial, or an ellipsis. Quotes are masked so a `.` inside a quote never splits. Returns the\n * original as a one-element array when there's no safe boundary. Pure. */\nexport function splitSentences(line: string): string[] {\n const masked = maskQuotes(line);\n const out: string[] = [];\n let start = 0;\n let k = 0;\n while (k < masked.length) {\n const c = masked[k];\n if (c === '.' || c === '!' || c === '?') {\n const m = /^(\\s+)[\"'“([]*[A-Z]/.exec(masked.slice(k + 1)); // whitespace, then a sentence-opening capital\n let cut = !!m;\n if (cut && c === '.') {\n if (masked[k + 1] === '.' || masked[k - 1] === '.') cut = false; // ellipsis\n else if (/\\d$/.test(masked.slice(0, k))) cut = false; // number-dot: \"$79.\" / \"v1.\" / \"3.\"\n else {\n const word = (/[A-Za-z][A-Za-z.]*$/.exec(masked.slice(0, k))?.[0] ?? '').toLowerCase().replace(/\\.+$/, '');\n if (word.length <= 1 || ABBREVIATIONS.has(word)) cut = false; // single-letter initial or abbreviation\n }\n }\n if (cut && m) {\n out.push(line.slice(start, k + 1).trim());\n start = k + 1 + (m[1] ?? '').length;\n k = start;\n continue;\n }\n }\n k += 1;\n }\n out.push(line.slice(start).trim());\n return out.filter((s) => s !== '');\n}\n\n// ── Blank-line normalization ───────────────────────────────────────────────────────────────────────────\n/** One blank line between statements; none where content is bound together — an attached `@@` annotation and\n * its statement, a heading/`<tag>` and the content it wraps, consecutive list items, and a $SWITCH's arms.\n * Literal zones (examples, tool/config/test bodies, fenced code) are emitted verbatim, blanks and all. */\nfunction normalizeBlankLines(lines: string[], changes: FmtChange[]): string[] {\n const render = renderLines(lines);\n const switches = parseSwitches(lines);\n const tools = toolBlockMask(lines);\n const cfg = configSectionMask(lines);\n const ex = examplesMask(lines);\n const tests = testBlockLines(lines);\n const literal = (i: number): boolean =>\n !!(tools[i] || cfg[i] || ex[i] || tests.has(i) || render[i]?.lineClass === 'md-code');\n const isList = (raw: string): boolean => parseLine(raw).list !== 'none';\n const sameSwitch = (a: number, b: number): boolean =>\n switches.some((s) => s.error === null && a >= s.headerLine && a < s.blockEnd && b >= s.headerLine && b < s.blockEnd);\n // Desired blank count between the last emitted non-blank line `a` and the next content line `b`.\n const gap = (a: number, b: number): number => {\n const la = lines[a] ?? '';\n if (isAnnotationLine(la)) return 0; // annotation glued to the statement it documents\n if (isHeadingLine(la) || isOpenTagLine(la)) return 0; // a heading / opening tag hugs its first content\n if (isCloseTagLine(lines[b] ?? '')) return 0; // content hugs its closing tag\n if (!literal(a) && !literal(b) && isList(la) && isList(lines[b] ?? '')) return 0; // consecutive list items stay tight\n if (sameSwitch(a, b)) return 0; // a $SWITCH's header/arms/bodies stay tight\n return 1;\n };\n const out: string[] = [];\n let prev = -1; // index of the last emitted non-blank line\n let wasLiteral = false;\n for (let i = 0; i < lines.length; i += 1) {\n const raw = lines[i] ?? '';\n if (literal(i)) {\n if (!wasLiteral && prev >= 0) for (let x = 0; x < gap(prev, i); x += 1) out.push('');\n out.push(raw);\n wasLiteral = true;\n prev = i;\n continue;\n }\n wasLiteral = false;\n if (raw.trim() === '') continue; // swallow blanks — re-inserted canonically by gap()\n if (prev >= 0) {\n const g = gap(prev, i);\n for (let x = 0; x < g; x += 1) out.push('');\n if (g === 0 && i - prev > 1) changes.push({ line: i + 1, kind: 'blank', detail: 'removed blank(s)' });\n if (g === 1 && i - prev === 1) changes.push({ line: i + 1, kind: 'blank', detail: 'added a blank line' });\n }\n out.push(raw);\n prev = i;\n }\n return out;\n}\n\n// ── Reindentation ──────────────────────────────────────────────────────────────────────────────────────\n/** The canonical nesting depth of a line: section interiors (headings + `<tag>` bodies) plus a $SWITCH's arm\n * depth (CASE/ELSE +1, arm body +2) plus a dotted step's own path depth. Computed from the parser, not from\n * the text's current whitespace — the one source of truth the editor's live auto-indent also reads. */\nfunction indentDepth(i: number, doc: StructuredDoc, switches: SwitchBlock[]): number {\n let d = 0;\n for (const s of doc.sections) {\n if (s.syntax === 'heading') {\n if (s.startLine < i && i < s.endLine) d += 1; // content under a heading (the heading line itself stays out)\n } else if (s.syntax === 'xml') {\n if (s.startLine < i && i < s.endLine - 1) d += 1; // interior of a tag (open + close lines stay out)\n }\n }\n for (const b of switches) {\n if (b.error !== null || i <= b.headerLine || i >= b.blockEnd) continue;\n if (b.arms.some((a) => a.headerLine === i)) d += 1; // a CASE / ELSE header\n else if (b.arms.some((a) => i > a.headerLine && i < a.spanEnd)) d += 2; // an arm body\n else d += 1; // a stray line between the header and the first arm\n }\n const step = doc.steps.find((s) => s.line === i);\n if (step) d += step.depth;\n return d;\n}\n\n/** Set every line's leading indentation to `indentDepth × INDENT_UNIT`. Blank lines become empty; literal zones\n * keep their exact whitespace. Safe: indentation is cosmetic to the compiler, and the $SWITCH depths are chosen\n * so the block re-parses identically (header < arms < bodies; the next statement dedents to the header). */\nfunction reindentLines(lines: string[], changes: FmtChange[]): string[] {\n const doc = buildStructure(lines);\n const switches = parseSwitches(lines);\n const render = renderLines(lines);\n const tools = toolBlockMask(lines);\n const cfg = configSectionMask(lines);\n const ex = examplesMask(lines);\n const tests = testBlockLines(lines);\n return lines.map((raw, i) => {\n if (raw.trim() === '') return ''; // a blank line carries no indentation\n if (tools[i] || cfg[i] || ex[i] || tests.has(i) || render[i]?.lineClass === 'md-code') return raw; // literal\n const target = ' '.repeat(indentDepth(i, doc, switches) * INDENT_UNIT);\n const next = target + raw.replace(/^\\s+/, '');\n if (next !== raw) changes.push({ line: i + 1, kind: 'indent', detail: 'reindented' });\n return next;\n });\n}\n\nexport function formatSource(source: string, opts: FmtOptions = {}): FmtResult {\n const join = opts.join !== false;\n const split = opts.split !== false;\n const changes: FmtChange[] = [];\n let lines = source.replace(/\\r\\n/g, '\\n').split('\\n');\n\n // 1 — trailing whitespace, everywhere (safe: never rendered, never significant).\n lines = lines.map((raw, i) => {\n const trimmed = raw.replace(/[ \\t]+$/, '');\n if (trimmed !== raw) changes.push({ line: i + 1, kind: 'trim', detail: 'trailing whitespace' });\n return trimmed;\n });\n\n // 2 — join wrapped fragments, bottom-up so chains (one statement wrapped over three lines)\n // collapse in one pass: L3 folds into L2 first, then the extended L2 folds into L1.\n if (join) {\n const continuations = wrappedContinuations(lines);\n const drop = new Set<number>();\n for (const [line, prev] of [...continuations.entries()].sort((a, b) => b[0] - a[0])) {\n lines[prev] = `${(lines[prev] ?? '').replace(/\\s+$/, '')} ${(lines[line] ?? '').trim()}`;\n drop.add(line);\n changes.push({ line: line + 1, kind: 'join', detail: `joined into line ${prev + 1}` });\n }\n if (drop.size > 0) lines = lines.filter((_, i) => !drop.has(i));\n }\n\n // 3 — split compound statements. Quoted spans are masked for detection (a quoted \"…; MUST …\" is\n // literal prose); the split itself happens on the raw text at the matched offset. Loop per line:\n // a line with two semicolons splits twice.\n if (split) {\n const exempt = proseExemptLines(lines);\n const tests = testBlockLines(lines);\n const tools = toolBlockMask(lines);\n const cfg = configSectionMask(lines);\n const next: string[] = [];\n lines.forEach((raw, i) => {\n if (exempt.has(i) || tests.has(i) || tools[i] || cfg[i]) {\n next.push(raw);\n return;\n }\n let head = raw;\n const parts: string[] = [];\n const prefix = linePrefix(raw);\n for (let guard = 0; guard < 8; guard += 1) {\n const m = COMPOUND_RE.exec(maskQuotes(head));\n if (!m) break;\n const cut = m.index;\n const rest = head.slice(cut + 1).replace(/^\\s*(?:and\\s+|but\\s+)?/i, '');\n parts.push(head.slice(0, cut).replace(/[ \\t]+$/, ''));\n head = `${prefix}${rest}`;\n changes.push({ line: i + 1, kind: 'split', detail: `split at \";\" before ${rest.split(/\\s+/)[0] ?? ''}` });\n }\n parts.push(head);\n next.push(...parts);\n });\n lines = next;\n }\n\n // 4 — split a multi-sentence BODY line into one sentence per line. Same spirit as (3): each sentence is its\n // own statement. List items, `X IS …` declarations, control lines, headings, $SWITCH content, annotations,\n // and literal zones are already one statement (or must stay whole) and pass through untouched.\n if (opts.sentences) {\n const render = renderLines(lines);\n const exempt = proseExemptLines(lines);\n const tests = testBlockLines(lines);\n const tools = toolBlockMask(lines);\n const cfg = configSectionMask(lines);\n const ex = examplesMask(lines);\n const switches = parseSwitches(lines);\n const inSwitch = (i: number): boolean => switches.some((s) => s.error === null && i >= s.headerLine && i < s.blockEnd);\n const next: string[] = [];\n lines.forEach((raw, i) => {\n const r = render[i];\n const parsed = parseLine(raw);\n const skip =\n !r || r.kind !== 'content' || r.lineClass === 'md-code' || r.lineClass === 'md-heading' ||\n tools[i] || cfg[i] || ex[i] || tests.has(i) || exempt.has(i) || inSwitch(i) ||\n parsed.list !== 'none' || parsed.clause.trim().startsWith('$') || isAnnotationLine(raw);\n if (skip) {\n next.push(raw);\n return;\n }\n const parts = splitSentences(raw.trim());\n if (parts.length <= 1) {\n next.push(raw);\n return;\n }\n const prefix = leadingSpaces(raw);\n for (const p of parts) next.push(prefix + p);\n changes.push({ line: i + 1, kind: 'sentence', detail: `split into ${parts.length} sentences` });\n });\n lines = next;\n }\n\n // 5 — normalize blank lines: one between statements, none where content is bound together.\n if (opts.blankLines) lines = normalizeBlankLines(lines, changes);\n\n // 6 — reindent from structure. LAST, so it sees the final line set (post split / sentence / blank passes).\n if (opts.reindent) lines = reindentLines(lines, changes);\n\n const text = lines.join('\\n');\n // The blank pass owns whole-file blank hygiene: exactly one trailing newline, no leading blanks. (Kept off\n // the basic join/split path so those stay byte-faithful.)\n return { text: opts.blankLines ? `${text.replace(/^\\n+/, '').replace(/\\n+$/, '')}\\n` : text, changes };\n}\n","// ── layout.ts · SSOT: the ONE column/indentation model, shared by the checker AND the editor (CLAUDE.md inv #1) ──\n// Indentation mirrors the XML-section tree: a tag sits at 2 × its nesting depth, content one unit\n// deeper, a close tag back at its open's column. Headings are markdown-plane (no depth). This module\n// computes the REQUIRED column per line — and it is the single source of truth: the diagnostics\n// layout pass flags with it, and the Monaco auto-indent places with it, so the editor can never\n// auto-indent a line the compiler then rejects (the same one-engine rule the dependency map shares\n// with the reference squiggles). Pure, synchronous, zero-dependency — safe in any bundle.\nimport { defEntries, illustrationZoneMask, toolBlockMask } from './clause';\nimport { renderLines } from './highlight';\nimport { buildStructure, matchSectionTag } from './structure';\nimport { parseSwitches, switchBlockMask } from './switch';\nimport { testBlockLines } from './testblock';\nimport { exampleBlockLines } from './exampleblock';\n\nexport interface LayoutSpec {\n /** Required 0-based column per line — or null where layout is FREE: blanks, comments, fence\n * content, illustration-zone interiors, tool/switch bodies (relative to their header), wrapped\n * definition continuations (the wrapped-definition error owns those), and tab-led lines (the tab\n * error owns those). */\n col: (number | null)[];\n /** Lines where col + 2 is ALSO legal — a substep (`a.` / `2.1.`) may nest one unit under its\n * step. The checker accepts both; `col` stays the canonical editor target. */\n substep: boolean[];\n}\n\n/** Compute the layout doctrine's expected columns for every line. */\nexport function layoutColumns(rawLines: string[]): LayoutSpec {\n const n = rawLines.length;\n const col: (number | null)[] = new Array<number | null>(n).fill(null);\n const substep: boolean[] = new Array<boolean>(n).fill(false);\n const render = renderLines(rawLines);\n const zoneMask = illustrationZoneMask(rawLines);\n const toolMask = toolBlockMask(rawLines);\n const swMask = switchBlockMask(rawLines);\n // A chain's FIRST arm is column-checked like any statement (it IS the chain's anchor); later\n // arms and bodies are relative to it — the parser enforces same-column arms structurally.\n const chainStarts = new Set(parseSwitches(rawLines).filter((b) => b.error === null).map((b) => b.headerLine));\n const testLines = testBlockLines(rawLines);\n const exampleLines = exampleBlockLines(rawLines);\n const doc = buildStructure(rawLines);\n\n // Section geometry: tags at 2 × depth, interiors one unit deeper than the innermost enclosing tag.\n const baseCol: number[] = new Array<number>(n).fill(0);\n const tagCol = new Map<number, number>();\n for (const s of doc.sections) {\n if (s.syntax !== 'xml') continue;\n const end = Math.min(s.endLine ?? n, n);\n tagCol.set(s.startLine, 2 * s.depth);\n const closeLine = end - 1;\n if (closeLine > s.startLine && matchSectionTag(rawLines[closeLine] ?? '') !== null) {\n tagCol.set(closeLine, 2 * s.depth);\n }\n for (let i = s.startLine + 1; i < closeLine; i += 1) {\n baseCol[i] = Math.max(baseCol[i] ?? 0, 2 * (s.depth + 1));\n }\n }\n\n // Definition bodies: sub-items and fence MARKERS sit exactly one unit under their entry; fence\n // CONTENT inside a body is a verbatim sample; anything else there is a wrapped-definition error's\n // business, not a column's.\n const defBody = new Map<number, number | null>();\n for (const e of defEntries(rawLines)) {\n let fence = false;\n // Sub-items NEST: a `- ` bullet indented deeper than the previous one is its child (a sub-definition\n // of a sub-definition), so each level sits one unit under its parent — entry+2, +4, +6. Depth reads\n // from the relative source indent (a stack) — the SAME tree renderDefBlock emits — so a legal source\n // layout and the compiled layout always agree. `curCol` is the tier a fence marker sits at.\n const stack: number[] = []; // source indents of the open `- ` ancestors\n let curCol = e.indent + 2; // the entry's own body tier\n for (const li of e.lines) {\n if (li === e.line) continue;\n const raw = rawLines[li] ?? '';\n const t = raw.trim();\n if (t.startsWith('```') || t.startsWith('~~~')) {\n defBody.set(li, fence ? null : curCol);\n fence = !fence;\n continue;\n }\n if (fence || t === '') {\n defBody.set(li, null);\n continue;\n }\n if (t.startsWith('- ')) {\n const si = raw.length - raw.trimStart().length;\n while (stack.length > 0 && (stack[stack.length - 1] ?? 0) >= si) stack.pop();\n stack.push(si);\n curCol = e.indent + 2 * stack.length;\n defBody.set(li, curCol);\n continue;\n }\n defBody.set(li, null); // a non-bullet continuation — wrapped-definition owns it\n }\n }\n\n for (let i = 0; i < n; i += 1) {\n const raw = rawLines[i] ?? '';\n const t = raw.trim();\n if (t === '') continue; // blank — free (the blank-line budget is its own rule)\n if (render[i]?.lineClass === 'md-code') continue; // fence content is verbatim\n if (defBody.has(i)) {\n col[i] = defBody.get(i) ?? null;\n continue;\n }\n if (testLines.has(i)) continue; // a $TEST block is control-plane, body relative to its header\n if (exampleLines.has(i)) continue; // an $EXAMPLE block: body relative to its header, same as $TEST\n if (zoneMask[i] === true && !tagCol.has(i)) continue; // zone interior — illustration\n if (toolMask[i] === true && !/^\\s*\\$(?:TOOL|SERVICE)\\b/i.test(raw)) continue; // body: relative\n if (swMask[i] === true && !chainStarts.has(i)) continue; // later arms + bodies: relative to the FIRST arm\n if (t.startsWith('//') || t.startsWith('/*') || t.startsWith('*')) continue; // stripped metadata\n const leadWs = (raw.match(/^[ \\t]*/) ?? [''])[0];\n if (leadWs.includes('\\t')) continue; // the tab error owns a tabbed indent\n col[i] = tagCol.get(i) ?? baseCol[i] ?? 0;\n substep[i] = /^(?:[a-z]\\.|\\d+(?:\\.\\d+)+\\.?)\\s/i.test(t);\n }\n return { col, substep };\n}\n","// ── The plain-ASCII character set — the SSOT for characters outside the language ─────────────────────\n// TypeGlish is a strict subset of written English in plain ASCII punctuation. This module OWNS the rule\n// DATA: the denylist of typographic/decorative codepoints, each with its diagnostic code, message, and\n// deterministic ASCII fix. It is the ONE place the checker (diagnostics.ts `specialCharacters`) and the\n// generated syntax page (syntax-doc.ts) read. The ≤/≥ fixes DERIVE their operator word from the lexicon,\n// so a renamed bound operator carries its character-fix with it. charset.test.ts locks it all.\nimport { COMPARISON_SYMBOLS } from './lexicon';\nimport type { DocTable } from './lexicon';\n\n// The model-plane bound word each symbol rewrites to, DERIVED from the lexicon (invariant #1): `≤`→\"at\n// most\", `≥`→\"at least\". Never a local copy.\nconst BOUND: Record<string, string> = Object.fromEntries(\n COMPARISON_SYMBOLS.flatMap((c) => (c.bound ? c.symbols.map((s) => [s, c.bound as string]) : [])),\n);\n\n// The instruction plane is plain text whose every punctuation mark is one the parsers read. This is\n// not aesthetics — each typographic character HIDES meaning from a tier that parses its ASCII/English\n// form, proven in this codebase: `Sarah’s role…` (curly apostrophe) conceals the property\n// contradiction the ASCII form flags; `MUST use ≤ 3 sentences.` lowers with numeric:null while\n// `at most 3` carries a Z3-provable bound; a curly “quote” never binds as a string literal (only\n// ASCII \" does); an em-dash splices two statements into one line, dodging one-statement-per-line;\n// `•` is not a bullet the list parser reads; NBSP/zero-width characters are invisible saboteurs and\n// a documented injection surface. Models also MIRROR prompt typography (the em-dash is the canonical\n// AI-tell, ~3x over-produced and resistant to instruction), and unusual codepoints fragment tokens.\n// So: COMPILE ERRORS (structure/ gates wellFormed and the grade), each with the deterministic ASCII\n// fix where one exists. The legitimate homes for symbols are the literal zones — <examples>, <\"name\">,\n// fences, and quoted utterances — all exempt, which is exactly where illustrations belong.\n// NOT flagged: human language. Accented letters (café), non-Latin scripts, currency, °, % — this is\n// a targeted denylist of typographic/decorative codepoints, never a ban on non-ASCII text.\nexport interface CharsetRule {\n re: RegExp;\n source: string;\n msg: string;\n fix?: (m: RegExpMatchArray, text: string) => { title: string; replacement: string } | null;\n}\n\nexport const CHARSET_RULES: CharsetRule[] = [\n // Emoji first, as full ZWJ sequences, so a joiner inside one is never re-flagged as an invisible.\n // ©®™ are Extended_Pictographic but meaning-bearing marks, not decoration — excluded.\n {\n re: /(?![©®™])\\p{Extended_Pictographic}(?:️)?(?:(?![©®™])\\p{Extended_Pictographic}(?:️)?)*/gu,\n source: 'structure/special-character',\n msg: 'Emoji is outside the language: the instruction plane is checkable English, and models mirror prompt decoration into output. Remove it, or demonstrate it inside <examples>.',\n },\n // En-dash between digits is a RANGE — the fix is a hyphen, not a comma.\n {\n re: /(?<=\\d) ?– ?(?=\\d)/g,\n source: 'structure/em-dash',\n msg: 'Typographic dash in a range: write a plain hyphen (3-5). The en-dash is a lookalike the parsers do not read.',\n fix: () => ({ title: '→ \"-\"', replacement: '-' }),\n },\n {\n re: / ?[—–] ?/g,\n source: 'structure/em-dash',\n msg: 'An em-dash splices two statements into one line: the checker reads one unparseable blob, and models mirror the tic (the canonical AI-tell). Split the statements, or use a comma or colon.',\n fix: (m, text) =>\n (m.index ?? 0) > 0 && (m.index ?? 0) + m[0].length < text.length\n ? { title: '→ \",\"', replacement: ', ' }\n : null,\n },\n {\n re: /[“”„]/g,\n source: 'structure/curly-quote',\n msg: 'A curly quote is not a TG string literal: only straight \" binds an utterance, so this text is invisible to the quote doctrine. Straighten it.',\n fix: () => ({ title: '→ \"', replacement: '\"' }),\n },\n {\n re: /[‘’‚]/g,\n source: 'structure/curly-quote',\n msg: \"A curly apostrophe is a lookalike: the parsers read ASCII ', so possession and contractions written with it are invisible to the consistency checker. Straighten it.\",\n fix: () => ({ title: \"→ '\", replacement: \"'\" }),\n },\n {\n re: /≤ ?/g,\n source: 'structure/special-character',\n msg: `The numeric tier parses bounds written in English: '≤ 3' lowers with no bound while '${BOUND['≤']} 3' is Z3-provable. Write it out.`,\n fix: () => ({ title: `→ \"${BOUND['≤']}\"`, replacement: `${BOUND['≤']} ` }),\n },\n {\n re: /≥ ?/g,\n source: 'structure/special-character',\n msg: `The numeric tier parses bounds written in English: '≥ 3' lowers with no bound while '${BOUND['≥']} 3' is Z3-provable. Write it out.`,\n fix: () => ({ title: `→ \"${BOUND['≥']}\"`, replacement: `${BOUND['≥']} ` }),\n },\n {\n re: / ?≠ ?/g,\n source: 'structure/special-character',\n msg: \"The parsers read negation in English: write 'is not'.\",\n fix: () => ({ title: '→ \"is not\"', replacement: ' is not ' }),\n },\n {\n re: /−/g, // U+2212 minus sign, a hyphen lookalike\n source: 'structure/special-character',\n msg: 'Unicode minus sign: a hyphen lookalike the parsers do not read. Use \"-\".',\n fix: () => ({ title: '→ \"-\"', replacement: '-' }),\n },\n {\n re: /(?<=\\d) ?× ?(?=\\d)/g,\n source: 'structure/special-character',\n msg: 'Multiplication sign: write a plain \"x\" (3x) — the × is a lookalike outside the language.',\n fix: () => ({ title: '→ \"x\"', replacement: 'x' }),\n },\n {\n re: /…/g,\n source: 'structure/special-character',\n msg: 'Unicode ellipsis: write \"...\" — or finish the statement.',\n fix: () => ({ title: '→ \"...\"', replacement: '...' }),\n },\n {\n re: /(?<=^\\s*)[•◦▪‣·] ?/g,\n source: 'structure/special-character',\n msg: 'Not a list bullet the parser reads: use \"- \".',\n fix: () => ({ title: '→ \"- \"', replacement: '- ' }),\n },\n {\n re: /[→←⇒⇐↔⇔↦➜➤▶◀]/g,\n source: 'structure/special-character',\n msg: 'An arrow encodes sequence or mapping the language already has words for: use THEN for flow, \"to\" for mappings. Arrows belong only inside <examples> demos.',\n },\n {\n re: /[ ]/g, // no-break space family — invisible, breaks token/word matching\n source: 'structure/special-character',\n msg: 'Non-breaking space: an invisible lookalike that breaks word matching and is a known injection surface. Use a plain space.',\n fix: () => ({ title: '→ space', replacement: ' ' }),\n },\n {\n re: /[️]/g, // zero-width family — pure sabotage\n source: 'structure/special-character',\n msg: 'Zero-width character: invisible to a human, real to the model — a documented injection vector. Remove it.',\n fix: () => ({ title: 'Remove', replacement: '' }),\n },\n {\n re: /[─-╿]/g, // box drawing\n source: 'structure/special-character',\n msg: 'Box-drawing character: verbatim layouts belong in a <\"name\"> literal zone or a fence, not the instruction plane.',\n },\n {\n re: /[•◦▪‣·★☆✦✧✱✳✴❇✨†‡¶≈×÷±∞]/g,\n source: 'structure/special-character',\n msg: 'Decorative or symbolic Unicode is outside the language: every mark here has an English or ASCII form the checker reads. Use plain text; illustrations belong in <examples>.',\n },\n];\n\n// Fast pre-test: one combined class covering every pattern above — most lines exit here for free.\nexport const SPECIAL_ANY =\n /[—–“”„‘’‚…•◦▪‣·≥≤≠≈×÷±∞−★☆✦✧✱✳✴❇✨†‡¶→←⇒⇐↔⇔↦➜➤▶◀ -️─-╿]|\\p{Extended_Pictographic}/u;\n\n// ── The reference-page view — GENERATED into public/syntax.html (syntax-doc.ts) ─────────────────────\n// The human-readable summary of the denylist above: the banned glyph(s), the ASCII fix, the one-line why.\n// Authored HERE beside the rules (one file owns both), so the page can't drift into a separate hand-kept\n// doc. The ≤/≥ fix words interpolate from the lexicon (BOUND); charset.test.ts checks every rule CODE is\n// represented and the freshness gate locks the committed page.\nexport const CHARSET_DOC: DocTable = {\n id: 'charset',\n title: 'Character set',\n lead:\n 'The instruction plane is plain ASCII: typographic and decorative codepoints are **compile errors**, each with a one-click ASCII fix. Not aesthetics — every mark here hides meaning from a tier that parses the ASCII/English form (a curly apostrophe conceals a possession contradiction; `≤ 3` lowers with no bound while `at most 3` is Z3-provable; an em-dash splices two statements into one line). Symbols are legal only inside the literal zones: `<examples>`, `<\"name\">`, fences, and `\"quotes\"`.',\n headers: ['Not allowed', 'Fix', 'Why'],\n rows: [\n ['`—` `–` em/en dash', '`,` or `:`', 'Splices two statements into one line; the canonical AI-tell, mirrored into output'],\n ['`“ ”` `‘ ’` curly quotes', 'straighten to ASCII', 'Only a straight quote binds a string literal; a curly apostrophe hides a possession contradiction'],\n ['`≤` `≥` `≠`', `\\`${BOUND['≤']}\\` \\`${BOUND['≥']}\\` \\`is not\\``, 'A bound in English is Z3-provable; the symbol lowers with no bound'],\n ['`…` `−` `×`', '`...` `-` `x`', 'Lookalikes the parsers do not read'],\n ['`•` `◦` `▪` bullets', '`- `', 'Not a list bullet the parser reads'],\n ['`→` `⇒` `↔` arrows', '`THEN` or the word `to`', 'The language already has words for flow and mapping'],\n ['non-breaking / zero-width space', 'a plain space, or remove', 'Invisible saboteurs and a documented injection surface'],\n ['box-drawing, `★ ÷ ± ¶`, emoji', 'a fence or `<\"name\">` zone', 'Verbatim layout and decoration belong in the literal zones'],\n ],\n};\n","import { maskQuotes } from './clause';\nimport { FREQUENCY_WORDS } from './lexicon';\nimport { parseLine } from './grammar';\nimport { canonicalActionKey, normAtom, parsePredicate, proseExemptLines, toolsFromLines } from './predicate';\nimport { splitSentences } from './sentence';\n\n// --- Propositional core: a formula type + a brute-force satisfiability check (the solver). ---\n\nexport type Formula =\n | { t: 'true' }\n | { t: 'false' }\n | { t: 'atom'; name: string }\n | { t: 'not'; f: Formula }\n | { t: 'and'; fs: Formula[] }\n | { t: 'or'; fs: Formula[] };\n\nexport const TRUE: Formula = { t: 'true' };\n\nfunction atomsOf(f: Formula, into: Set<string>): void {\n if (f.t === 'atom') into.add(f.name);\n else if (f.t === 'not') atomsOf(f.f, into);\n else if (f.t === 'and' || f.t === 'or') f.fs.forEach((x) => atomsOf(x, into));\n}\n\nfunction evalF(f: Formula, a: Map<string, boolean>): boolean {\n switch (f.t) {\n case 'true':\n return true;\n case 'false':\n return false;\n case 'atom':\n return a.get(f.name) ?? false;\n case 'not':\n return !evalF(f.f, a);\n case 'and':\n return f.fs.every((x) => evalF(x, a));\n case 'or':\n return f.fs.some((x) => evalF(x, a));\n }\n}\n\n/**\n * Is there a truth assignment that satisfies the formula? Brute-force over the formula's atoms\n * — sound, and prompt conditions carry only a handful of atoms. Bails out (as satisfiable, so\n * it never falsely claims a conflict) past 20 atoms.\n */\nexport function satisfiable(f: Formula): boolean {\n const set = new Set<string>();\n atomsOf(f, set);\n const atoms = [...set];\n const n = atoms.length;\n if (n > 20) return true;\n for (let mask = 0; mask < 1 << n; mask += 1) {\n const a = new Map<string, boolean>();\n for (let i = 0; i < n; i += 1) a.set(atoms[i] ?? '', (mask & (1 << i)) !== 0);\n if (evalF(f, a)) return true;\n }\n return false;\n}\n\n// --- Deontic extraction: pull MUST/NEVER-style rules (with optional IF conditions) from lines. ---\n\n// The CHECKER's deontic lexicon — deliberately wider than the grammar's operator catalog: plain\n// English says \"you need to X\" as readily as \"you MUST X\", and a contradiction the checker can\n// prove from either phrasing should flip the badge. The grammar/compile surface is unchanged —\n// these extra phrasings still render as prose; only the consistency layer reads their force.\n// Exported (readonly) so the highlighter's action-quantity rules anchor on the SAME deontic words the\n// checker reads — this stays the checker's deliberately-fuzzy lexicon (CLAUDE.md carve-out), one definition.\nexport const PROHIBIT = ['MUST NOT', 'DO NOT', \"DON'T\", 'NEVER'] as const; // DON'T = DO NOT (prompts write the contraction)\nexport const OBLIGATE = ['NEEDS TO', 'NEED TO', 'HAVE TO', 'HAS TO', 'MUST', 'ALWAYS', 'REQUIRE', 'ENSURE'] as const;\n\n// An action-leading negation flips the force: `need to NOT output` and `must NEVER stall` are\n// prohibitions wearing an obligation's modal. Folded by parity so `not not X` lands positive.\nfunction foldLeadingNegation(\n kind: 'obligate' | 'prohibit',\n action: string,\n): { kind: 'obligate' | 'prohibit'; action: string } {\n let k = kind;\n let a = action.trim();\n for (;;) {\n const m = /^(?:not|never)\\s+/i.exec(a);\n if (!m) return { kind: k, action: a };\n k = k === 'obligate' ? 'prohibit' : 'obligate';\n a = a.slice(m[0].length);\n }\n}\n\n\nfunction negate(f: Formula): Formula {\n if (f.t === 'true') return { t: 'false' };\n if (f.t === 'false') return TRUE;\n return { t: 'not', f };\n}\n\n/** Is `a -> b` valid? True iff `a AND NOT b` has no satisfying assignment. */\nfunction implies(a: Formula, b: Formula): boolean {\n return !satisfiable({ t: 'and', fs: [a, negate(b)] });\n}\n\n/**\n * Do two guarded rules on the same action actually collide? Only when one guard IMPLIES the other — i.e.\n * whenever one fires, the other necessarily fires too, so the action is at once required and forbidden in\n * that state. Merely-overlapping guards are NOT a contradiction: `IF weekend THEN never` against `IF\n * weekday THEN must` is satisfiable (just not in a state that is somehow both), so flagging it would be a\n * false alarm. The unconditional case (both guards `true`) and the same-guard case each reduce to a valid\n * implication, so they still fire; a guard that is a strict subset of the other (`IF premium AND new`\n * under `IF premium`) fires too, since the narrower one implies the wider.\n */\nexport function guardsCollide(c1: Formula, c2: Formula): boolean {\n return implies(c1, c2) || implies(c2, c1);\n}\n\n/** Parse an IF condition into a formula over condition-atoms (flat AND / OR / NOT). Exported so the\n * quantifier layer reuses the EXACT guard semantics — a guarded quantified rule collides on the same\n * terms a guarded deontic rule does. */\nexport function parseCondition(text: string): Formula {\n const t = text.trim();\n if (t === '') return TRUE;\n const ors = t.split(/\\s+OR\\s+/i).map((op): Formula => {\n const ands = op\n .split(/\\s+AND\\s+/i)\n .map((ap) => ap.trim())\n .filter((x) => x !== '')\n .map((term): Formula => {\n const neg = /^NOT\\s+/i.test(term);\n const atom: Formula = { t: 'atom', name: normAtom(neg ? term.replace(/^NOT\\s+/i, '') : term) };\n return neg ? { t: 'not', f: atom } : atom;\n });\n return ands.length === 0 ? TRUE : ands.length === 1 ? (ands[0] ?? TRUE) : { t: 'and', fs: ands };\n });\n return ors.length === 1 ? (ors[0] ?? TRUE) : { t: 'or', fs: ors };\n}\n\n/** The checker reads bare imperatives (`Output the label.`) as obligations when the head verb is\n * a catalog hit at lexicon confidence — most real prompt rules are written modal-free. Prose\n * blocks (# Role, # Examples, …) are exempt via proseExemptLines. */\nexport const IMPERATIVES_AS_OBLIGATIONS = true;\n\n// ── The FREQUENCY square — the quantifier square over OCCASIONS (SPEC §7) ──────────────────────────────\n// A rule's frequency grades WHAT SHARE of occasions it claims: ALWAYS/MUST = every occasion, `sometimes` =\n// some, `usually` = most, `rarely` = few (most-not, and still some). Each (polarity, frequency) corner is\n// an INTERVAL over p = the fraction of occasions on which the action happens — so the whole opposition\n// table is interval algebra: DISJOINT intervals cannot co-hold (hard conflict), a PROPER SUBSET restates\n// one rule at an entailed weaker grade (the slot axiom; a model may read the weaker as \"not always\").\nexport type Freq = 'all' | 'some' | 'most' | 'few';\nconst FREQ_KIND_TO_FREQ = { existential: 'some', majority: 'most', minority: 'few' } as const;\nconst FREQ_ALT = FREQUENCY_WORDS.flatMap((f) => f.words.map((w) => ({ w, freq: FREQ_KIND_TO_FREQ[f.kind] })))\n .sort((a, b) => b.w.length - a.w.length);\nconst FREQ_LEAD_RE = new RegExp(`^(?:you\\\\s+)?(${FREQ_ALT.map((x) => x.w.replace(/ /g, '\\\\s+')).join('|')})\\\\b,?\\\\s+(.+)$`, 'i');\n\n/** Peel a frequency adverb off the head of a phrase (`sometimes use X` → some + `use X`), or pass it\n * through unchanged. One door for the segment lead and the post-modal position (`should sometimes …`). */\nfunction peelFrequency(text: string): { freq: Freq | null; rest: string } {\n const m = text.trim().match(FREQ_LEAD_RE);\n if (!m) return { freq: null, rest: text };\n const word = (m[1] ?? '').toUpperCase().replace(/\\s+/g, ' ');\n const hit = FREQ_ALT.find((x) => x.w === word);\n return hit ? { freq: hit.freq, rest: m[2] ?? '' } : { freq: null, rest: text };\n}\n\n// The corner's interval over p ∈ [0,1] (the share of occasions with the action). Polarity mirrors it:\n// obligate-some = p > 0, prohibit-some = p < 1, obligate-few = 0 < p < 1/2, and so on.\ninterface PInterval { lo: number; hi: number; loOpen: boolean; hiOpen: boolean }\nfunction pInterval(kind: 'obligate' | 'prohibit', freq: Freq): PInterval {\n if (kind === 'obligate') {\n if (freq === 'all') return { lo: 1, hi: 1, loOpen: false, hiOpen: false };\n if (freq === 'most') return { lo: 0.5, hi: 1, loOpen: true, hiOpen: false };\n if (freq === 'few') return { lo: 0, hi: 0.5, loOpen: true, hiOpen: true };\n return { lo: 0, hi: 1, loOpen: true, hiOpen: false }; // some: p > 0\n }\n if (freq === 'all') return { lo: 0, hi: 0, loOpen: false, hiOpen: false };\n if (freq === 'most') return { lo: 0, hi: 0.5, loOpen: false, hiOpen: true };\n if (freq === 'few') return { lo: 0.5, hi: 1, loOpen: true, hiOpen: true }; // rarely NOT = mostly yes, some not\n return { lo: 0, hi: 1, loOpen: false, hiOpen: true }; // some-not: p < 1\n}\nconst disjointP = (a: PInterval, b: PInterval): boolean => {\n if (a.hi < b.lo || b.hi < a.lo) return true;\n if (a.hi === b.lo) return a.hiOpen || b.loOpen;\n if (b.hi === a.lo) return b.hiOpen || a.loOpen;\n return false;\n};\nconst subsetP = (a: PInterval, b: PInterval): boolean => {\n const loOk = a.lo > b.lo || (a.lo === b.lo && (b.loOpen ? a.loOpen : true));\n const hiOk = a.hi < b.hi || (a.hi === b.hi && (b.hiOpen ? a.hiOpen : true));\n return loOk && hiOk;\n};\nconst FREQ_PHRASE: Record<Freq, string> = { all: 'on every occasion', most: 'on most occasions', some: 'on some occasions', few: 'on few occasions' };\nconst freqPhrase = (c: { kind: 'obligate' | 'prohibit'; freq: Freq }): string =>\n `${c.kind === 'obligate' ? 'required' : 'skipped'} ${FREQ_PHRASE[c.freq]}`;\n\ninterface DeonticClause {\n kind: 'obligate' | 'prohibit';\n /** The share of occasions the rule claims — `all` for a plain modal, graded by a frequency adverb. */\n freq: Freq;\n atom: string;\n /** Original action text for messages — canonical keys are machine identities, not prose. */\n display: string;\n /** True when `atom` is a predicate-canonical key (synonym/tool/role-merged). */\n canonical: boolean;\n /** True when the kind was flipped by antonym polarity (`suppress` read as ¬emit). */\n viaAntonym: boolean;\n cond: Formula;\n line: number;\n}\n\n/** Match a modal at the start of `rest`, scoping the atom to `subject`. A bare modal's implicit\n * subject is the agent (\"you\"), left unprefixed so `MUST x` and `You MUST x` are the same\n * proposition; any other subject is scoped in, so a constraint on it isn't a constraint on \"you\". */\ntype ModalBase = Pick<DeonticClause, 'kind' | 'atom' | 'display' | 'canonical' | 'viaAntonym'>;\ntype ModalMatch = ModalBase & { freq: Freq };\n\nfunction keyedClause(kind: 'obligate' | 'prohibit', action: string, scope: string, tools?: Set<string>): ModalBase {\n const { key, parsed, canonical } = canonicalActionKey(action, tools);\n let k = kind;\n let viaAntonym = false;\n // D5: an antonym head carries polarity −1 — `MUST suppress X` becomes prohibit-emit(X), so it\n // collides provably with `ALWAYS emit X` and dedups with `NEVER output X`.\n if (canonical && parsed && parsed.lexicalPolarity === -1) {\n k = k === 'obligate' ? 'prohibit' : 'obligate';\n viaAntonym = true;\n }\n return { kind: k, atom: scope + key, display: action.trim(), canonical, viaAntonym };\n}\n\nfunction matchModalAt(rest: string, subject: string, tools?: Set<string>, addressees?: Set<string>): ModalMatch | null {\n // THE ADDRESSEE MODEL (prompt.ts addresseeSubjects): a subject the prompt DECLARED as `you` — an alias\n // (`You are Claude` → `Claude must…`) or a role (`You are a support agent` → `the support agent must…`)\n // — is the implicit subject, so its rules and bare rules are ONE subject's rules. Undeclared subjects\n // stay scoped: no guessing.\n const canon = subject !== 'you' && addressees?.has(subject) === true ? 'you' : subject;\n const scope = canon === 'you' ? '' : `${canon}: `;\n // Modals are case-insensitive (`must` ≡ `MUST`): compare on an uppercased copy, slice the original.\n const u = rest.toUpperCase();\n // A frequency adverb may sit after the modal (`should sometimes use X`) or after its negation — peel on\n // both sides of the fold so the atom never embeds the adverb and the grade lands on the clause.\n const graded = (kind0: 'obligate' | 'prohibit', raw: string): ModalMatch => {\n const pre = peelFrequency(raw);\n const f = foldLeadingNegation(kind0, pre.rest);\n const post = peelFrequency(f.action);\n return { ...keyedClause(f.kind, post.rest, scope, tools), freq: pre.freq ?? post.freq ?? 'all' };\n };\n for (const p of PROHIBIT) {\n if (u.startsWith(`${p} `)) return graded('prohibit', rest.slice(p.length));\n }\n for (const o of OBLIGATE) {\n if (u.startsWith(`${o} `)) return graded('obligate', rest.slice(o.length));\n }\n return null;\n}\n\nfunction detectModal(seg: string, tools?: Set<string>, addressees?: Set<string>): ModalMatch | null {\n const s = seg.trim();\n // A bare leading modal keeps the implicit \"you\" subject.\n const bare = matchModalAt(s, 'you', tools, addressees);\n if (bare) return bare;\n // Otherwise peel a leading subject phrase — `You`, `The agent`, `the support team` — dropping a leading\n // article, until the remainder begins with a modal. Multi-word subjects are supported, and each is scoped\n // so a directive on one subject isn't read as a directive on another.\n const words = s.split(/\\s+/);\n for (let i = 1; i < words.length; i += 1) {\n const subject = words.slice(0, i).join(' ').replace(/^(?:the|a|an)\\s+/i, '').trim().toLowerCase();\n const m = matchModalAt(words.slice(i).join(' '), subject === '' ? 'you' : subject, tools, addressees);\n if (m) return m;\n }\n return null;\n}\n\n/** Split a sentence into its guard and consequent — the ONE definition every tier reads (deontic,\n * cardinality, action-count, dead-rule). Two surface forms:\n * `IF <cond> THEN <consequent>` — the canonical operator pair;\n * `If <cond>, [you] [then] <consequent>` — the comma form English actually writes.\n * The comma form is accepted ONLY when the consequent (after the optional `you then` connective) leads\n * with a deontic modal, so a descriptive comma (`IF a, b, or c THEN x`) can never split early — sound\n * over clever. The `then` connective is folded into the consequent (`you then must X` → `you must X`).\n * Returns null when the sentence is not guard-led. */\nexport function splitGuard(sentence: string): { cond: string; body: string } | null {\n const s = sentence.trim();\n if (!/^IF\\b/i.test(s)) return null;\n // Comma form FIRST — so `If the user's name is Joe, you then must …` gets the clean condition instead of\n // the lazy THEN split biting the connective `then` inside `you then must` (cond polluted with `, you`).\n // Acceptance is gated on a deontic lead AT THE HEAD of the consequent (stripDeonticLead), never the deep\n // subject-peel — `IF a, b, or c THEN must x` keeps its descriptive commas and falls through to THEN.\n const rest = s.slice(2);\n for (let i = rest.indexOf(','); i !== -1; i = rest.indexOf(',', i + 1)) {\n const body = rest\n .slice(i + 1)\n .trim()\n .replace(/^(?:you\\s+then\\s+|then\\s+you\\s+)/i, 'you ')\n .replace(/^then\\s+/i, '');\n if (body !== '' && stripDeonticLead(body).matched) return { cond: rest.slice(0, i), body };\n }\n const thenSplit = s.match(/^IF\\b(.+?)\\bTHEN\\b(.+)$/i);\n if (thenSplit) return { cond: thenSplit[1] ?? '', body: (thenSplit[2] ?? '').trim() };\n return null;\n}\n\n/** Peel an implicit-subject deontic lead off a segment — `you must call X` → `call X` (obligation),\n * `never call X` → prohibited. The deontic word lists live HERE (the checker's deliberately-fuzzy\n * lexicon, per the CLAUDE.md carve-out), so consumers peel through this one door. */\nexport function stripDeonticLead(segment: string, opts?: { peelSubject?: boolean }): { body: string; prohibited: boolean; matched: boolean; subject: string } {\n const direct = (text: string, subject: string): { body: string; prohibited: boolean; matched: boolean; subject: string } | null => {\n const u = text.toUpperCase();\n for (const p of PROHIBIT) if (u.startsWith(`${p} `)) return { body: text.slice(p.length + 1), prohibited: true, matched: true, subject };\n for (const o of OBLIGATE) {\n if (u.startsWith(`${o} `)) {\n const rest = text.slice(o.length + 1);\n const neg = rest.match(/^not\\s+/i);\n return neg ? { body: rest.slice(neg[0].length), prohibited: true, matched: true, subject } : { body: rest, prohibited: false, matched: true, subject };\n }\n }\n return null;\n };\n const s = segment.trim().replace(/^you\\s+/i, '');\n const hit = direct(s, 'you');\n if (hit) return hit;\n // SUBJECT PEEL (opt-in): `the agent must call…` / `Sarah must call…` — the subject is a REFINEMENT\n // field of the claim, never a gate to checking it (claims are keyed by what they are about; subject/\n // owner/frame must agree where present). Kept off for splitGuard's comma gate, whose precision depends\n // on the modal sitting at the consequent's head. Subjects are 1–3 plain words (a leading article\n // dropped, connectives excluded), so a descriptive clause can never masquerade as one.\n if (opts?.peelSubject === true) {\n const words = s.split(/\\s+/);\n for (let i = 1; i <= 3 && i < words.length; i += 1) {\n const raw = words.slice(0, i);\n if (!raw.every((w) => /^[A-Za-z][A-Za-z'-]*$/.test(w) && !/^(?:if|then|otherwise|and|or|when|while|unless)$/i.test(w))) break;\n const m = direct(words.slice(i).join(' '), raw.join(' ').toLowerCase().replace(/^(?:the|a|an)\\s+/, '') || 'you');\n if (m) return m;\n }\n }\n return { body: s, prohibited: false, matched: false, subject: 'you' };\n}\n\nfunction pushSegments(\n text: string,\n cond: Formula,\n line: number,\n out: DeonticClause[],\n tools?: Set<string>,\n imperativesAllowed = false,\n addressees?: Set<string>,\n): void {\n for (const seg of text.split(';')) {\n // FREQUENCY lead — `Sometimes use firm language.` grades the directive to SOME occasions (the square\n // over occasions); `You sometimes must …` peels the same way. The core then parses as usual — a modal\n // or a lexicon-confidence imperative — so descriptive prose (`Sometimes users ask …`) still abstains.\n const lead = peelFrequency(seg);\n const core = lead.freq === null ? seg : lead.rest;\n const m = detectModal(core, tools, addressees);\n if (m && m.atom) {\n out.push({ ...m, freq: lead.freq ?? m.freq, cond, line });\n continue;\n }\n // Imperative fallback (owner decision): a modal-free segment whose head verb is a catalog hit\n // at lexicon confidence reads as an obligation — `Output the label.` is a rule, written the way\n // people actually write rules. Guarded consequents inherit their IF condition.\n if (!imperativesAllowed || !IMPERATIVES_AS_OBLIGATIONS) continue;\n const t = core.trim();\n if (t === '') continue;\n const parsed = parsePredicate(t, tools);\n // A bare imperative needs the strict catalog bar (lexicon confidence). A FREQUENCY-led one does not:\n // the adverb itself is the rule marker — `Sometimes use firm language.` is graded exactly like\n // `ALWAYS use firm language.`, which forms with no catalog gate at all (the modal path). The parse\n // requirement still holds the line on prose: `Sometimes users ask about pricing.` has no predicate\n // shape (subject-led), so it never forms a clause.\n if (parsed && (parsed.confidence === 'lexicon' || lead.freq !== null)) {\n const clause = keyedClause('obligate', t.replace(/[.!?]+$/, ''), '', tools); // display without the terminator\n out.push({ ...clause, freq: lead.freq ?? 'all', cond, line });\n }\n }\n}\n\nfunction extractClauses(rawLine: string, line: number, tools?: Set<string>, exempt?: Set<number>, addressees?: Set<string>): DeonticClause[] {\n const imperativesAllowed = exempt === undefined ? false : !exempt.has(line);\n const { clause } = parseLine(rawLine);\n // Mask quoted spans so a copula / modal / IF inside a \"string\" isn't read as logic.\n const masked = maskQuotes(clause);\n const out: DeonticClause[] = [];\n // Each sentence is its own statement (sentence.ts), mirroring lower(): process each independently so\n // a period is a real boundary. Otherwise the head modal claims the whole line and a second rule on\n // the same line (\"NEVER quote a price. ALWAYS quote a price.\") never forms its own clause — so the\n // conflict / redundancy / subsumption checks can't see it. A single-sentence line takes the whole-\n // clause path unchanged, so existing findings stay byte-identical.\n const sentences = splitSentences(masked);\n const segments = sentences.length > 1 ? sentences.map((s) => s.text) : [masked];\n for (const sentence of segments) {\n let cond: Formula = TRUE;\n let body = sentence;\n const g = splitGuard(sentence); // THEN form + the modal-gated comma form (`If X, you must …`)\n if (g) {\n cond = parseCondition(g.cond);\n body = g.body;\n }\n const ow = g ? body.match(/^(.+?)\\bOTHERWISE\\b(.+)$/i) : null;\n if (ow) {\n pushSegments(ow[1] ?? '', cond, line, out, tools, imperativesAllowed, addressees);\n pushSegments(ow[2] ?? '', negate(cond), line, out, tools, imperativesAllowed, addressees);\n } else {\n pushSegments(body, cond, line, out, tools, imperativesAllowed, addressees);\n }\n }\n return out;\n}\n\nexport interface LogicConflict {\n atom: string;\n lines: number[];\n message: string;\n /** True when the opposition was proven through the antonym table (suppress = ¬emit). */\n viaAntonym?: boolean;\n /** True for a SLOT-AXIOM finding — an entailed weaker restatement (`Always X` then `Sometimes X`),\n * not a hard contradiction. Maps to logic/quantifier-strength instead of logic/contradiction. */\n strength?: boolean;\n}\n\n/**\n * Find rules that are logically inconsistent: an action both required (MUST/ALWAYS) and\n * forbidden (NEVER/MUST NOT) under conditions that can co-occur. The conflict is real only if\n * the two conditions are jointly satisfiable — so disjoint branches (IF c … / IF NOT c …) don't\n * trip it, but `IF c THEN MUST x` against an unconditional `NEVER x` does.\n */\nexport function checkConsistency(lines: string[], addressees?: Set<string>): LogicConflict[] {\n const tools = toolsFromLines(lines);\n const exempt = proseExemptLines(lines);\n const clauses: DeonticClause[] = [];\n lines.forEach((l, i) => clauses.push(...extractClauses(l, i, tools, exempt, addressees)));\n\n const byAtom = new Map<string, DeonticClause[]>();\n for (const c of clauses) {\n const list = byAtom.get(c.atom);\n if (list) list.push(c);\n else byAtom.set(c.atom, [c]);\n }\n\n const conflicts: LogicConflict[] = [];\n const seen = new Set<string>();\n for (const [atom, cs] of byAtom) {\n for (let i = 0; i < cs.length; i += 1) {\n for (let j = i + 1; j < cs.length; j += 1) {\n const a = cs[i]!;\n const b = cs[j]!;\n // THE FREQUENCY SQUARE — each (polarity, frequency) corner is an interval over p, the share of\n // occasions with the action. DISJOINT intervals cannot co-hold (MUST vs NEVER; `never X` vs\n // `sometimes X`; `usually X` vs `usually do not X`). A PROPER SUBSET is the slot axiom: the\n // stronger claim already entails the weaker restatement (`always X` then `sometimes X`), two\n // strengths on one rule. Equal intervals are redundancy's business; overlapping-but-unordered\n // pairs (`sometimes X` + `sometimes do not X` — a legal partition) abstain.\n const ia = pInterval(a.kind, a.freq);\n const ib = pInterval(b.kind, b.freq);\n const hard = disjointP(ia, ib);\n const equal = !hard && subsetP(ia, ib) && subsetP(ib, ia);\n const strong = hard || equal ? null : subsetP(ia, ib) ? a : subsetP(ib, ia) ? b : null;\n if (!hard && strong === null) continue;\n if (!guardsCollide(a.cond, b.cond)) continue;\n const conflictLines = [...new Set([a.line, b.line])].sort((x, y) => x - y);\n const key = `${hard ? 'hard' : 'strength'}|${atom}|${conflictLines.join(',')}`;\n if (seen.has(key)) continue;\n seen.add(key);\n const viaAntonym = a.viaAntonym || b.viaAntonym;\n if (hard) {\n // Orient obligate-first so the classic MUST-vs-NEVER message stays byte-identical.\n const o = a.kind === 'obligate' ? a : b;\n const p2 = o === a ? b : a;\n // Canonical keys are machine identities — messages show the humans' own words instead\n // (`\"suppress the fee\" vs \"output the fee\"`), keeping unchanged-behavior snapshots stable.\n const name =\n o.canonical || p2.canonical\n ? o.display === p2.display\n ? o.display\n : `${o.display}\" vs \"${p2.display}`\n : atom;\n conflicts.push({\n atom,\n lines: conflictLines,\n viaAntonym,\n message:\n a.freq === 'all' && b.freq === 'all'\n ? `Logical conflict — \"${name}\" is both required and forbidden. Keep one, or scope the two rules so they cannot both apply (IF <condition> THEN ...).`\n : `Frequency conflict — \"${name}\" is ${freqPhrase(o)} but ${freqPhrase(p2)}. The occasions cannot both hold.`,\n });\n } else if (strong !== null) {\n const weak = strong === a ? b : a;\n conflicts.push({\n atom,\n lines: conflictLines,\n viaAntonym,\n strength: true,\n message: `One rule, two strengths — \"${strong.display}\" (${freqPhrase(strong)}) already entails \"${weak.display}\" (${freqPhrase(weak)}); a model may read the weaker as \"not always\". Keep the stronger line.`,\n });\n }\n }\n }\n }\n return conflicts;\n}\n\nexport interface RedundancyGroup {\n atom: string;\n /** The first occurrence's original wording — what messages show when the atom is a canonical key. */\n display: string;\n kind: 'obligate' | 'prohibit';\n /** Every distinct line the rule is stated on, ascending. Always length ≥ 2. */\n lines: number[];\n}\n\n/**\n * Find rules stated more than once: the SAME directive — same subject + action, same deontic polarity —\n * under logically EQUIVALENT guards, on two or more distinct lines. Unlike a conflict (obligate vs\n * prohibit), a duplicate isn't *wrong* — it's dead weight: more tokens for the model to read, and N places\n * to keep in sync when the rule changes (the exact drift that lets two copies quietly diverge into a\n * contradiction). State it once, reference it.\n *\n * Sound and syntactic — the dual of {@link checkConsistency}: it clusters directives that share a\n * normalized action key AND provably-equivalent guards. Two guarded rules on genuinely different\n * conditions (`IF weekend …` / `IF weekday …`) are distinct, not duplicates, and an unconditional rule\n * does NOT (yet) subsume a guarded restatement — equivalence only, so there are no false alarms. A\n * PARAPHRASE (`transfer to Office Follow Up` vs `transfer_to_playbook_office_follow_up`) has a different\n * key and is deliberately NOT flagged here; catching those is a semantic-layer job, kept out of the\n * deterministic core.\n */\nexport function checkRedundancy(lines: string[], addressees?: Set<string>): RedundancyGroup[] {\n const tools = toolsFromLines(lines);\n const exempt = proseExemptLines(lines);\n const clauses: DeonticClause[] = [];\n lines.forEach((l, i) => clauses.push(...extractClauses(l, i, tools, exempt, addressees)));\n\n // Bucket by polarity + atom — a duplicate can only live among same-kind directives on the same action.\n const byKey = new Map<string, DeonticClause[]>();\n for (const c of clauses) {\n const key = `${c.kind}|${c.freq}|${c.atom}`; // corner-exact: `Always X` and `Sometimes X` are strengths, never duplicates\n const list = byKey.get(key);\n if (list) list.push(c);\n else byKey.set(key, [c]);\n }\n\n const groups: RedundancyGroup[] = [];\n for (const cs of byKey.values()) {\n if (cs.length < 2) continue;\n // Partition the bucket into guard-equivalence classes. Logical equivalence is transitive, so\n // gathering everything equivalent to a representative forms a correct class. Guards carry a handful\n // of atoms and buckets a handful of clauses, so the O(k²) pass is trivial.\n const used = new Array<boolean>(cs.length).fill(false);\n for (let a = 0; a < cs.length; a += 1) {\n const ca = cs[a];\n if (used[a] || !ca) continue;\n used[a] = true;\n const cluster = [ca];\n for (let b = a + 1; b < cs.length; b += 1) {\n const cb = cs[b];\n if (used[b] || !cb) continue;\n if (implies(ca.cond, cb.cond) && implies(cb.cond, ca.cond)) {\n used[b] = true;\n cluster.push(cb);\n }\n }\n // A rule stated once — however many `;`-separated segments it spans — is fine; need ≥ 2 lines.\n const distinct = [...new Set(cluster.map((c) => c.line))].sort((x, y) => x - y);\n if (distinct.length >= 2) groups.push({ atom: ca.canonical ? ca.display : ca.atom, display: ca.display, kind: ca.kind, lines: distinct });\n }\n }\n return groups;\n}\n\nexport interface Subsumption {\n atom: string;\n kind: 'obligate' | 'prohibit';\n /** The narrower rule that adds nothing: its guard strictly implies a broader same-action rule's guard. */\n redundantLine: number;\n /** The broader rule that already covers it. */\n coveringLine: number;\n}\n\n/**\n * Find rules a broader rule already covers — the strict-implication sibling of {@link checkRedundancy}\n * (which keys on guard EQUIVALENCE). Same subject, action, and deontic polarity, but one guard strictly\n * IMPLIES the other: whenever the narrower rule fires the broader one fires too and forces the same action,\n * so the narrower one never changes the outcome. `MUST x` makes `IF urgent THEN MUST x` dead weight;\n * `IF premium THEN MUST x` makes `IF premium AND new THEN MUST x` dead weight (the more specific guard is\n * the redundant one). Equivalent guards are excluded — those are duplicates, not subsumption — and opposite\n * polarities are a conflict, owned by {@link checkConsistency}. A warn: a subsumed rule is often a sign the\n * author forgot the broader one, or meant the broader one to carry the narrower guard.\n */\nexport function checkSubsumption(lines: string[], addressees?: Set<string>): Subsumption[] {\n const tools = toolsFromLines(lines);\n const exempt = proseExemptLines(lines);\n const clauses: DeonticClause[] = [];\n lines.forEach((l, i) => clauses.push(...extractClauses(l, i, tools, exempt, addressees)));\n\n const byKey = new Map<string, DeonticClause[]>();\n for (const c of clauses) {\n const key = `${c.kind}|${c.freq}|${c.atom}`; // corner-exact: `Always X` and `Sometimes X` are strengths, never duplicates\n const list = byKey.get(key);\n if (list) list.push(c);\n else byKey.set(key, [c]);\n }\n\n const out: Subsumption[] = [];\n const reported = new Set<number>();\n for (const cs of byKey.values()) {\n if (cs.length < 2) continue;\n for (const x of cs) {\n if (reported.has(x.line)) continue;\n // A different-line rule y strictly covers x when guard(x) → guard(y) but not the reverse — x's\n // condition is a special case of y's, and y already forces the action everywhere x would fire.\n const cover = cs.find((y) => y.line !== x.line && implies(x.cond, y.cond) && !implies(y.cond, x.cond));\n if (!cover) continue;\n reported.add(x.line);\n out.push({ atom: x.canonical ? x.display : x.atom, kind: x.kind, redundantLine: x.line, coveringLine: cover.line });\n }\n }\n return out;\n}\n\n/** Rules whose guard can never hold — `IF c AND NOT c THEN …`. They never fire, so they are dead weight\n * and almost always a mistake. A clarity signal, not a contradiction (the prompt stays satisfiable). */\nexport function deadRules(rawLines: string[]): number[] {\n const dead: number[] = [];\n rawLines.forEach((raw, i) => {\n const g = splitGuard(maskQuotes(parseLine(raw).clause));\n if (!g) return;\n const cond = parseCondition(g.cond);\n if (cond.t !== 'true' && !satisfiable(cond)) dead.push(i);\n });\n return dead;\n}\n","// Strict-order contradictions. A comparative (\"A is higher priority than B\") or a temporal (\"A opens\n// before B\") statement asserts an ORDER. A cycle in that order is unsatisfiable — no strict order loops\n// back on itself: gold > silver > bronze > gold, or \"opens before 9am\" together with \"opens after 10am\"\n// (which, since 9am is before 10am, forces opens < 9am < 10am < opens). We detect cycles per relation with\n// a plain DFS — comparatives grouped by their dimension so \"faster\" and \"higher priority\" never mix, and\n// temporal edges sharing one graph with auto-added orderings between recognized clock times. No solver.\nimport { maskQuotes } from './clause';\nimport { parseLine } from './line';\n\nexport interface OrderConflict {\n lines: number[];\n message: string;\n}\n\ninterface Edge {\n from: string;\n to: string;\n line: number;\n}\n\nfunction normNode(s: string): string {\n return s\n .trim()\n .toLowerCase()\n .replace(/^the\\s+/, '')\n .replace(/[.,;:!?]+$/, '')\n .replace(/\\s+/g, ' ')\n .trim();\n}\n\n// \"A is <dir> [dimension] than B\": a greater-word puts A above B, a lesser-word flips it. The dimension\n// (the words after the direction) keys the graph so different scales stay independent; bare comparatives\n// (\"higher than\") share one generic key.\nconst GREATER = new Set([\n 'higher', 'greater', 'more', 'larger', 'bigger', 'better', 'faster', 'stronger', 'longer', 'taller',\n 'heavier', 'older', 'newer', 'hotter', 'harder', 'wider', 'broader', 'deeper',\n]);\nconst LESSER = new Set([\n 'lower', 'less', 'smaller', 'worse', 'slower', 'weaker', 'shorter', 'younger', 'lighter', 'narrower',\n]);\n\nfunction comparativeEdges(clauses: { clause: string; line: number }[]): Map<string, Edge[]> {\n const byDim = new Map<string, Edge[]>();\n for (const { clause, line } of clauses) {\n const m = clause.match(/^(.+?)\\s+(?:is|are|was|were)\\s+(.+?)\\s+than\\s+(.+)$/i);\n if (!m) continue;\n const a = normNode(m[1] ?? '');\n const b = normNode(m[3] ?? '');\n if (!a || !b) continue;\n const words = (m[2] ?? '').trim().toLowerCase().replace(/^(?:a|an|the)\\s+/, '').split(/\\s+/);\n const dir = words[0] ?? '';\n let edge: Edge | null = null;\n if (GREATER.has(dir)) edge = { from: a, to: b, line };\n else if (LESSER.has(dir)) edge = { from: b, to: a, line };\n if (!edge) continue;\n const key = words.slice(1).join(' ') || '_ord_';\n if (!byDim.has(key)) byDim.set(key, []);\n byDim.get(key)?.push(edge);\n }\n return byDim;\n}\n\n// Clock times to a comparable minute-of-day, so \"9am\" and \"10am\" auto-order even though no statement says\n// 9am is before 10am. Returns null for anything that isn't a recognizable time point (it's then just a name).\nfunction timeValue(token: string): number | null {\n const named = token.trim().toLowerCase();\n if (named === 'noon' || named === 'midday') return 12 * 60;\n if (named === 'midnight') return 0;\n let m = token.match(/^(\\d{1,2})(?::?(\\d{2}))?\\s*(am|pm)$/i);\n if (m) {\n let h = Number(m[1]) % 12;\n if (/pm/i.test(m[3] ?? '')) h += 12;\n return h * 60 + Number(m[2] || 0);\n }\n m = token.match(/^(\\d{1,2}):(\\d{2})$/);\n if (m) return Number(m[1]) * 60 + Number(m[2]);\n return null;\n}\n\n// Fold a gerund event onto its base verb so `greeting`↔`greet` and `answering`↔`answer` share a node — an\n// event and its `-ing` form name the same act. Conservative: only `-ing` on a word longer than 5 (so `sing`,\n// `bring`, `thing` are untouched), undoing a doubled final consonant (`running`→`run`). Only the leading word\n// (the verb) is folded; the rest of a phrase is left as-is. Applied to temporal events, never comparatives.\nfunction stemEvent(node: string): string {\n const parts = node.split(' ');\n const w = parts[0] ?? '';\n if (w.length > 5 && w.endsWith('ing')) {\n let base = w.slice(0, -3);\n const last = base[base.length - 1] ?? '';\n if (last !== '' && last === base[base.length - 2] && !'aeiou'.includes(last)) base = base.slice(0, -1);\n parts[0] = base;\n }\n return parts.join(' ');\n}\n\nfunction temporalEdges(clauses: { clause: string; line: number }[]): Edge[] {\n const edges: Edge[] = [];\n const points = new Set<string>();\n for (const { clause, line } of clauses) {\n const m = clause.match(/^(.+?)\\s+(before|after|prior to|earlier than|later than)\\s+(.+)$/i);\n if (!m) continue;\n const x = stemEvent(normNode(m[1] ?? ''));\n const y = stemEvent(normNode(m[3] ?? ''));\n if (!x || !y) continue;\n const rel = (m[2] ?? '').toLowerCase();\n const before = rel === 'before' || rel === 'prior to' || rel === 'earlier than';\n edges.push(before ? { from: x, to: y, line } : { from: y, to: x, line });\n if (timeValue(x) !== null) points.add(x);\n if (timeValue(y) !== null) points.add(y);\n }\n const sorted = [...points].map((p) => ({ p, v: timeValue(p) ?? 0 })).sort((m, n) => m.v - n.v);\n for (let i = 0; i < sorted.length - 1; i += 1) {\n const lo = sorted[i];\n const hi = sorted[i + 1];\n if (lo && hi && lo.v < hi.v) edges.push({ from: lo.p, to: hi.p, line: -1 });\n }\n return edges;\n}\n\n// DFS for a directed cycle. Returns the source lines on the path when a back-edge is found (synthetic\n// auto-ordering edges carry line -1 and are dropped from the report), or null if the order is acyclic.\nfunction findCycle(edges: Edge[]): number[] | null {\n const adj = new Map<string, { to: string; line: number }[]>();\n for (const e of edges) {\n if (!adj.has(e.from)) adj.set(e.from, []);\n adj.get(e.from)?.push({ to: e.to, line: e.line });\n }\n const color = new Map<string, 1 | 2>(); // 1 = on the current path, 2 = fully explored\n const path: number[] = [];\n const dfs = (u: string): number[] | null => {\n color.set(u, 1);\n for (const { to, line } of adj.get(u) ?? []) {\n path.push(line);\n if (color.get(to) === 1) return [...new Set(path.filter((l) => l >= 0))].sort((m, n) => m - n);\n if (!color.has(to)) {\n const found = dfs(to);\n if (found) return found;\n }\n path.pop();\n }\n color.set(u, 2);\n return null;\n };\n for (const node of adj.keys()) {\n if (!color.has(node)) {\n path.length = 0;\n const found = dfs(node);\n if (found) return found;\n }\n }\n return null;\n}\n\nexport function checkOrder(rawLines: string[]): OrderConflict[] {\n const clauses = rawLines\n .map((raw, line) => ({ clause: maskQuotes(parseLine(raw).clause), line }))\n .filter((c) => c.clause.trim() !== '');\n const out: OrderConflict[] = [];\n for (const edges of comparativeEdges(clauses).values()) {\n const cycle = findCycle(edges);\n if (cycle && cycle.length > 0) {\n out.push({ lines: cycle, message: 'Logical conflict — these comparative claims (more/better/higher than) chain back onto themselves, so no consistent ranking exists. Remove or reverse one link of the loop.' });\n }\n }\n const temporal = findCycle(temporalEdges(clauses));\n if (temporal && temporal.length > 0) {\n out.push({ lines: temporal, message: 'Logical conflict — these before/after claims chain back onto themselves, so no consistent timeline exists. Remove or reverse one link of the loop.' });\n }\n return out;\n}\n","// The definiteness axis — logical meaning for the article `the` over declared symbols.\n//\n// `the X` carries a UNIQUENESS + EXISTENCE presupposition (Russell's theory of descriptions): a definite\n// reference presupposes exactly one salient X. TypeGlish can prove both when X names a declared symbol KIND\n// (a tool, section, step, variable, route): bind \"the tool\" to two different symbols and the reference is\n// ambiguous; write \"the tool\" when no tool is declared and the reference is dangling.\n//\n// The FALSE-POSITIVE guardrail is everything here. Both checks key on the BINDING form with a bare symbol\n// token — `the <kind> is <token>` — never a bare mention. So generic prose (\"pick the tool that fits\", \"read\n// the section above\", \"the user is happy\") stays silent: `user`/`message`/`caller` are not symbol-kind nouns,\n// a plural (\"the tools\") is the \"all\" reading not a unique one, and a prose predicate (\"the tool is the\n// source of truth\", value not a bare token) is not a symbol assertion. Prose objects (`Persona IS …`) are\n// deferred to propertyConflicts/conflictingDeclarations — this axis owns ONLY the symbol registries.\nimport { examplesMask, maskQuotes, stripAnnotation } from './clause';\nimport { copulaAlternation } from './copula';\nimport { classifyLines, isHeadingLine } from './prompt';\nimport { buildStructure } from './structure';\n\nexport interface DefConflict {\n lines: number[];\n message: string;\n code: 'definite-ambiguous' | 'definite-undeclared';\n}\n\n// Head noun → the symbol-kind registry that decides its presupposition. Matched on the EXACT singular surface\n// form, so a plural (\"the tools\") never keys in — a plural definite reads as \"all\", not \"the unique one\".\ntype Kind = 'tool' | 'section' | 'step' | 'variable' | 'route';\nconst KIND_NOUN: Record<string, Kind> = { tool: 'tool', section: 'section', step: 'step', variable: 'variable', input: 'variable', route: 'route' };\nconst kindLabel: Record<Kind, string> = { tool: 'tool', section: 'section', step: 'step', variable: 'variable', route: 'route' };\n\n// A definite binding: `the <noun> <copula> <bare-token>`. The value is a bare symbol token (a name the model\n// could resolve), never a prose predicate — so \"the tool is the source of truth\" is inert.\nconst DEF_BINDING = new RegExp(`\\\\bthe\\\\s+([a-z]+)\\\\s+(?:${copulaAlternation})\\\\s+([a-z][a-z0-9_-]*)\\\\b`, 'i');\n\ninterface Binding {\n kind: Kind;\n value: string; // the bare-token filler, lowercased\n line: number;\n}\n\n/** The declared symbols a definite `the <noun>` resolves against — for the hover surface. Null when the noun\n * is not a symbol-kind word (so the hover stays silent on generic nouns, exactly as the checker does). */\nexport function definiteReferents(rawLines: string[], noun: string): { label: string; members: string[] } | null {\n const kind = KIND_NOUN[noun.toLowerCase()];\n if (!kind) return null;\n const ix = buildStructure(rawLines).index;\n const reg: Record<Kind, Set<string>> = { tool: ix.tools, section: ix.sections, step: ix.steps, variable: ix.inputs, route: ix.routes };\n return { label: kindLabel[kind], members: [...reg[kind]] };\n}\n\nexport function checkDefiniteness(rawLines: string[]): DefConflict[] {\n const ix = buildStructure(rawLines).index;\n const registry: Record<Kind, Set<string>> = {\n tool: ix.tools,\n section: ix.sections,\n step: ix.steps,\n variable: ix.inputs,\n route: ix.routes,\n };\n\n // Masked scan — mirrors objectOccurrences (prompt.ts): fences, literal zones, comments, headings, and\n // quoted / @@-annotated spans are illustration, never a live reference.\n const kinds = classifyLines(rawLines);\n const litMask = examplesMask(rawLines);\n const bindings: Binding[] = [];\n let inFence = false;\n rawLines.forEach((line, i) => {\n const t = line.trim();\n if (t.startsWith('```') || t.startsWith('~~~')) {\n inFence = !inFence;\n return;\n }\n if (inFence || litMask[i] || kinds[i] === 'comment' || isHeadingLine(line)) return;\n const masked = maskQuotes(stripAnnotation(line)).replace(/\\s+\\/\\/.*$/, (m) => ' '.repeat(m.length));\n const m = masked.match(DEF_BINDING);\n if (!m) return;\n const kind = KIND_NOUN[(m[1] ?? '').toLowerCase()]; // exact singular; plural / generic nouns are undefined\n if (!kind) return;\n bindings.push({ kind, value: (m[2] ?? '').toLowerCase(), line: i });\n });\n\n const out: DefConflict[] = [];\n const byKind = new Map<Kind, Binding[]>();\n for (const b of bindings) byKind.set(b.kind, [...(byKind.get(b.kind) ?? []), b]);\n\n for (const [kind, bs] of byKind) {\n const distinct = new Map<string, number>(); // value → first line\n for (const b of bs) if (!distinct.has(b.value)) distinct.set(b.value, b.line);\n const label = kindLabel[kind];\n if (distinct.size >= 2) {\n // Uniqueness violation — one definite slot, two fillers (the propertyConflicts shape).\n const vals = [...distinct.keys()].map((v) => `\"${v}\"`).join(', ');\n out.push({\n lines: [...distinct.values()].sort((a, b) => a - b),\n code: 'definite-ambiguous',\n message: `Ambiguous definite reference — \"the ${label}\" is bound to ${distinct.size} different ${label}s (${vals}). A definite \"the ${label}\" names exactly one — say which.`,\n });\n } else if (registry[kind].size === 0) {\n // Existence violation — a bare-token binding for a kind the file never declares.\n const [line] = [...distinct.values()];\n out.push({\n lines: [line ?? bs[0]?.line ?? 0],\n code: 'definite-undeclared',\n message: `Dangling definite reference — \"the ${label}\" names a ${label}, but no ${label} is declared. Declare it, or drop \"the\".`,\n });\n }\n }\n return out;\n}\n","// The quantifier layer — logical meaning for the English words that describe HOW MANY.\n//\n// A determiner is a relation between two sets (Generalized Quantifier Theory): the restrictor S (the\n// subject noun) and the scope P (the predicate). `all S are P` = S ⊆ P; `some S are P` = S ∩ P ≠ ∅;\n// `no S are P` = S ∩ P = ∅. Reduced to the classic square of opposition (A / E / I / O), a fixed table\n// decides which pairs are provable contradictions — the same \"sound over clever\" posture the deontic and\n// numeric tiers hold: fire ONLY on a proven conflict, abstain on the merely-suspicious.\n//\n// A all S are P S ⊆ P ⊥ O some S are not P (contradictories)\n// E no S are P S ∩ P = ∅ ⊥ I some S are P (contradictories)\n// A all S are P ⊥ E no S are P (contraries — jointly false only under existential import)\n// I some S are P / O some S are not P (subcontraries — CAN co-hold, never a conflict)\n//\n// Two OFF-square forms: `only R T` (exclusive — closes R to {T}; any R with another target conflicts) and\n// `most S P` (majority — `most S P` ⊥ `most S ¬P`, ⊥ E, and `most S ¬P` ⊥ A). Cross-scope opposition fires\n// ONLY through a proof: an ANTONYM bridge (predicate.ts normalizes `withhold`→`emit`,lexicalPolarity −1, so\n// antonyms bucket together with flipped polarity for free) or an ENUM bridge (two scopes that are distinct\n// members of a declared `one of` set are mutually exclusive). Nothing else crosses scopes — a different\n// predicate with no bridge is left to the semantic/NLI tier.\n//\n// Today's universal-vs-instance rule (`every refund … / this refund is not …`) is exactly the A⊥O row: an\n// instance is an existential witness, so every prior test passes as a subset.\nimport { boundText, parseActionCount, parseCardinalBody, pluralizeNoun, singularizeNoun } from './cardinality';\nimport type { ActionCount, CardinalBound } from './cardinality';\nimport { maskQuotes } from './clause';\nimport { parseLine } from './grammar';\nimport { QUANTIFIER_WORDS } from './lexicon';\nimport type { QuantKind } from './lexicon';\nimport { guardsCollide, parseCondition, splitGuard, stripDeonticLead, TRUE } from './logic';\nimport type { Formula } from './logic';\nimport { canonicalActionKey, parsePredicate, proseExemptLines } from './predicate';\nimport { splitSentences } from './sentence';\nimport type { PredicateIR } from './predicate';\nimport { addresseeSubjects, collectObjects, findEnumDeclaration } from './prompt';\n\n// A⊥E contraries are UNSAT only under existential import (a nonempty category). Prompts never author rules\n// about empty categories, so the default is to fire as an error; the dial mirrors ANTONYM_CONFLICT_SEVERITY.\nconst QUANT_CONTRARY_FIRES = true;\n\nexport interface QuantConflict {\n lines: number[];\n message: string;\n kind: 'opposition' | 'exclusivity' | 'majority' | 'strength' | 'cardinality' | 'action-count' | 'insufficient-set';\n}\n\n// --- vocabulary — DERIVED from the lexicon (invariant #1): QUANTIFIER_WORDS is the one definition of the\n// determiner families and their kinds; this module holds only the parse and the proofs. `a`/`an` are\n// deliberately absent from the existential family — \"a user should…\" is a generic, not ∃; reading it as ∃\n// is a large false-positive class (in the existential-THERE frame, cardinality.ts gives them meaning).\nconst KIND_OF = new Map<string, QuantKind>(QUANTIFIER_WORDS.flatMap((q) => q.words.map((w) => [w.toLowerCase(), q.kind] as const)));\n// Regex alternations derive from the same table: the subject-position determiners (everything but the\n// exclusive family, which attaches to the action) and the `only` lead. Longest-first within families is\n// irrelevant here (no member is a prefix of another), but lowercased forms keep the match case-insensitive.\nconst SUBJECT_QUANT_ALT = QUANTIFIER_WORDS.filter((q) => q.kind !== 'exclusive').flatMap((q) => q.words).map((w) => w.toLowerCase()).join('|');\nconst EXCLUSIVE_ALT = QUANTIFIER_WORDS.filter((q) => q.kind === 'exclusive').flatMap((q) => q.words).map((w) => w.toLowerCase()).join('|');\nconst EXCLUSIVE_RE = new RegExp(`^(?:${EXCLUSIVE_ALT})\\\\s+(.+)$`, 'i');\nconst SUBJECT_QUANT_RE = new RegExp(`^(${SUBJECT_QUANT_ALT})\\\\s+(?:of\\\\s+(?:the\\\\s+)?)?(\\\\w+)\\\\s+(.+)$`, 'i');\n\n// The corner of the square a (kind, polarity) reduces to. `no S ¬P` folds to A (double negation); `all S ¬P`\n// folds to E. Majority is off-square (M+/M-); exclusive has no corner (handled by its own pass).\ntype Corner = 'A' | 'E' | 'I' | 'O' | 'M+' | 'M-';\nfunction corner(kind: QuantKind, negated: boolean): Corner | null {\n switch (kind) {\n case 'universal':\n return negated ? 'E' : 'A';\n case 'negative':\n return negated ? 'A' : 'E';\n case 'existential':\n return negated ? 'O' : 'I';\n case 'majority':\n return negated ? 'M-' : 'M+';\n case 'exclusive':\n return null;\n }\n}\n\n// The opposition table: 'hard' contradictories (never co-true, never co-false), 'contrary' (never co-true,\n// under existential import). Order-independent. Everything absent is compatible — subcontraries (I/O),\n// subalternation (A/I, E/O), and duplicates never fire.\nfunction opposes(a: Corner, b: Corner): 'hard' | 'contrary' | null {\n const has = (x: Corner, y: Corner): boolean => (a === x && b === y) || (a === y && b === x);\n if (has('A', 'O') || has('E', 'I')) return 'hard';\n if (has('M+', 'M-') || has('M+', 'E') || has('M-', 'A')) return 'hard';\n if (has('A', 'E')) return 'contrary';\n return null;\n}\n\n// --- noun/scope normalization ---\n// Singularization is SHARED with the object model (cardinality.ts singularizeNoun), so a restrictor here\n// and a count fold there can never key the same noun differently.\nconst normNoun = singularizeNoun;\n// Strip a leading modal/copula so \"MUST be approved\" and \"gets approved\" reduce to the same property.\nfunction bareProperty(rest: string): string {\n return rest.replace(/^(?:must(?:\\s+be)?|should(?:\\s+be)?|shall(?:\\s+be)?|will(?:\\s+be)?|is|are|be|gets?|always)\\s+/i, '').trim();\n}\n// Detect a negated scope, preserving today's family (is/are/was/were not, isn't/wasn't, never, not) plus the\n// do-support forms, then bare the remaining property. Returns the positive property text + the polarity.\nfunction parseScope(rest: string): { negated: boolean; text: string } {\n const strip = (s: string): string => s.replace(/[.,;:!?]+$/, '').trim(); // shed the statement terminator from the display form\n const neg = rest.match(/\\b(?:is\\s+not|are\\s+not|was\\s+not|were\\s+not|isn't|wasn't|do\\s+not|does\\s+not|don't|must\\s+not|should\\s+not|never|not)\\s+(.+)$/i);\n if (neg) return { negated: true, text: strip(bareProperty(neg[1] ?? '')) };\n return { negated: false, text: strip(bareProperty(rest)) };\n}\n\n// --- disjoint (\"one of\") sets — the enum bridge. Re-implemented locally (a ~10-line copy of diagnostics.ts's\n// normMember/membersDisjoint) to avoid an import cycle: diagnostics.ts imports THIS module. ---\nfunction normMember(s: string): string {\n return s.toLowerCase().replace(/^(?:a|an|the)\\s+/, '').replace(/[.,;:!?]+$/, '').replace(/\\s+/g, ' ').trim();\n}\nfunction disjoint(a: string, b: string, sets: Set<string>[]): boolean {\n const ma = normMember(a);\n const mb = normMember(b);\n return ma !== '' && mb !== '' && ma !== mb && sets.some((s) => s.has(ma) && s.has(mb));\n}\n\n// Exported for the syllogism pass (checkSyllogism), which reads the same restrictor/scope/corner.\nexport interface QuantifiedClause {\n det: string; // surface determiner, lowercased\n kind: QuantKind;\n restrictor: string; // S — singularized noun key\n scope: string; // P — canonical (antonym-normalized) predicate key; the bucket axis\n scopeText: string; // the readable positive property, for messages\n parsed: PredicateIR | null;\n negated: boolean; // scope polarity, AFTER folding an antonym's lexical polarity\n corner: Corner | null;\n guard: Formula;\n line: number;\n}\n\n// A `only R T` exclusive: R is the relation (head + theme), closed to the single target T.\ninterface Exclusive {\n relation: string; // `${head}(${theme})` — the action identity minus its goal\n target: string; // the one allowed goal\n scopeText: string;\n guard: Formula;\n line: number;\n}\n\nconst relationKey = (p: PredicateIR): string => `${p.head}(${p.theme ?? ''})`;\n\n/** Parse one clause into a quantified statement, an exclusive, or null. Guard-aware and quote-safe. */\nfunction parseQuantified(clause: string, line: number, tools: Set<string>): QuantifiedClause | Exclusive | null {\n // Split an IF…THEN guard first, reusing the deontic tier's exact condition parse.\n let guard: Formula = TRUE;\n let body = clause.trim();\n const ifm = body.match(/^IF\\b(.+?)\\bTHEN\\b(.+)$/i);\n if (ifm) {\n guard = parseCondition(ifm[1] ?? '');\n body = (ifm[2] ?? '').trim();\n }\n\n // `only R T` — the exclusive attaches to the action, not a subject NP.\n const only = body.match(EXCLUSIVE_RE);\n if (only) {\n const p = parsePredicate(only[1] ?? '', tools);\n if (!p || p.confidence !== 'lexicon' || p.roles.goal === undefined) return null; // need a resolvable target\n return { relation: relationKey(p), target: p.roles.goal, scopeText: (only[1] ?? '').replace(/[.,;:!?]+$/, '').trim(), guard, line };\n }\n\n // Quantifier-led at SUBJECT position (anchored ^) — an object quantifier (\"log every request\") never reads\n // as a universal. `(?:of the)?` accepts \"all of the users\".\n const qm = body.match(SUBJECT_QUANT_RE);\n const im = qm ? null : body.match(/^(this|that|the)\\s+(\\w+)\\s+(.+)$/i); // instance = existential witness\n const m = qm ?? im;\n if (!m) return null;\n const kind: QuantKind = qm ? (KIND_OF.get((qm[1] ?? '').toLowerCase()) ?? 'existential') : 'existential';\n const restrictor = normNoun(m[2] ?? '');\n const { negated: surfaceNeg, text } = parseScope(m[3] ?? '');\n if (text === '') return null;\n const { key, parsed } = canonicalActionKey(text, tools);\n // The antonym bridge, for free: a lexicon-confidence negative pole ('withhold'→head 'emit', polarity −1)\n // buckets on the positive key with flipped polarity, so `all S emit X` ⊥ `some S withhold X` falls out.\n const polarityNeg = parsed?.confidence === 'lexicon' && parsed.lexicalPolarity === -1;\n const negated = surfaceNeg !== polarityNeg;\n return { det: (m[1] ?? '').toLowerCase(), kind, restrictor, scope: key, scopeText: text, parsed, negated, corner: corner(kind, negated), guard, line };\n}\n\nconst isExclusive = (x: QuantifiedClause | Exclusive): x is Exclusive => 'relation' in x;\n\nfunction describe(c: QuantifiedClause): string {\n const q = c.det === 'this' || c.det === 'that' || c.det === 'the' ? `this ${c.restrictor}` : `${c.det} ${c.restrictor}`;\n return `${q} is ${c.negated ? 'not ' : ''}\"${c.scopeText}\"`;\n}\n\n// --- The CARDINAL family — the existential-there frame asserts a BOUND on |S| itself ---\n// `There is only one tool` = |tool| ∈ [1,1]; `There are many tools` = |tool| ∈ [2,∞). A different quantity\n// family from the proportion words (all/some/no relate S to a predicate P; cardinals bound the set's size),\n// carried by a different frame (the expletive `there` + a pivot NP, not a quantified subject). The parse\n// lives in cardinality.ts — a LEAF the object model (prompt.ts collectObjects, which folds counts onto\n// DeclaredObject.count) shares, so the checker and the graph can never read a claim differently. Here we\n// only add the guard (an IF…THEN split, deontic-identical).\ninterface CardinalClaim extends CardinalBound {\n guard: Formula;\n line: number;\n /** True for a SYNTHETIC claim derived from a list declaration (`Tools INCLUDING a, b, c` → |tool| ≥ 3).\n * A list PROVES a floor, so it joins the emptiness check — but it states no count, so the strength\n * pass (entailed weaker restatement) never reads it. */\n fromList?: boolean;\n}\n\n/** Parse an existential-there clause into a guarded cardinality claim, or null. */\nfunction parseCardinal(clause: string, line: number): CardinalClaim | null {\n const g = splitGuard(clause.trim()); // ONE guard grammar for every tier (logic.ts)\n const guard: Formula = g ? parseCondition(g.cond) : TRUE;\n const body = g ? g.body : clause.trim();\n const bound = parseCardinalBody(body);\n return bound === null ? null : { ...bound, guard, line };\n}\n\n// ── ACTION COUNTS — the slot axiom for directives ────────────────────────────────────────────────────────\n// `call five tools` claims the count of the (verb, noun, tail) slot the way a property claims its value.\n// A sentence is comma/semicolon-segmented so a directive spliced after a fact (`The user's name is Joe,\n// call five tools`) is still seen; a PROHIBITED count (`never call five tools`) claims nothing.\ninterface ActionClaim extends ActionCount {\n guard: Formula;\n line: number;\n /** The directive's executor — `you` for bare/implicit directives, the peeled subject otherwise\n * (`the agent must…` → `agent`). A REFINEMENT field: claims compare when subjects agree, and a\n * subject's absence never exempts a claim from checking (the vacuum-of-subject doctrine). */\n subject: string;\n}\n\nfunction collectActionCounts(clause: string, line: number): ActionClaim[] {\n const out: ActionClaim[] = [];\n for (const sentence of splitSentences(clause).map((x) => x.text.trim()).filter((x) => x !== '')) {\n if (/\\bOTHERWISE\\b/i.test(sentence)) continue; // a negated-branch count abstains (sound over clever)\n const g = splitGuard(sentence);\n const guard: Formula = g ? parseCondition(g.cond) : TRUE;\n const body = g ? g.body : sentence;\n for (const seg of body.split(/[;,]/)) {\n const t = seg.trim().replace(/^then\\s+/i, ''); // a sequential connective, not part of the directive\n if (t === '') continue;\n const lead = stripDeonticLead(t, { peelSubject: true });\n if (lead.prohibited) continue;\n const ac = parseActionCount(lead.body);\n if (ac) out.push({ ...ac, guard, line, subject: lead.subject });\n }\n }\n return out;\n}\n\n// The single parse of every quantified clause + exclusive + cardinal across the source — shared by the sync\n// checker and the async syllogism collector so the tiers can never read a line differently. Prose/example\n// lines and quoted spans are inert, exactly as the deontic tier treats them.\nfunction parseAll(rawLines: string[]): { clauses: QuantifiedClause[]; exclusives: Exclusive[]; cardinals: CardinalClaim[]; actions: ActionClaim[] } {\n const exempt = proseExemptLines(rawLines);\n const tools = new Set<string>(); // scope keys stay byte-stable across tiers without light-verb tool binding here\n const clauses: QuantifiedClause[] = [];\n const exclusives: Exclusive[] = [];\n const cardinals: CardinalClaim[] = [];\n const actions: ActionClaim[] = [];\n rawLines.forEach((raw, line) => {\n if (exempt.has(line)) return;\n const clause = maskQuotes(parseLine(raw).clause).trim();\n if (clause === '') return;\n actions.push(...collectActionCounts(clause, line));\n const card = parseCardinal(clause, line);\n if (card) {\n cardinals.push(card);\n return; // an existential-there line is a cardinality claim, nothing else\n }\n const parsed = parseQuantified(clause, line, tools);\n if (!parsed) return;\n if (isExclusive(parsed)) exclusives.push(parsed);\n else clauses.push(parsed);\n });\n return { clauses, exclusives, cardinals, actions };\n}\n\n/** Every quantified clause across the source (exclusives excluded) — the syllogism tier's input. Pure. */\nexport function collectQuantified(rawLines: string[]): QuantifiedClause[] {\n return parseAll(rawLines).clauses;\n}\n\nexport function checkQuantifier(rawLines: string[]): QuantConflict[] {\n const parsed = parseAll(rawLines);\n const { clauses, exclusives } = parsed;\n // THE ADDRESSEE MODEL — a declared alias/role of `you` IS `you`: fold action subjects and possession\n // owners through the prompt's own declarations, so `Claude has only one tool` and `You have two tools`\n // bound ONE owner's set. Resolution lives in prompt.ts (addresseeSubjects); this is the one fold site.\n const addr = addresseeSubjects(rawLines);\n const foldSubject = (sub: string): string => (sub !== 'you' && addr.has(sub) ? 'you' : sub);\n const actions = parsed.actions.map((a) => ({ ...a, subject: foldSubject(a.subject) }));\n const cardinals = parsed.cardinals.map((c) => (c.owner === undefined ? c : { ...c, owner: foldSubject(c.owner) }));\n // A LIST declaration PROVES a floor: `Tools INCLUDING a, b, c` names three distinct members, so\n // |tool| ≥ 3 — a synthetic world-level claim that meets any stated count in the same bucket\n // (\"There is only one tool\" cannot hold). The object graph already collected the members.\n for (const [key, obj] of collectObjects(rawLines)) {\n const members = obj.listMembers ?? [];\n if (members.length === 0) continue;\n cardinals.push({\n noun: singularizeNoun(key),\n lo: members.length,\n hi: Infinity,\n text: `${key} INCLUDING ${members.join(', ')}`,\n tail: '',\n guard: TRUE,\n line: obj.lines[0] ?? 0,\n fromList: true,\n });\n }\n const exempt = proseExemptLines(rawLines); // the exclusivity scan below re-reads every line\n const tools = new Set<string>();\n\n const disjointSets: Set<string>[] = [];\n for (const raw of rawLines) {\n const e = findEnumDeclaration(raw);\n if (e) disjointSets.push(new Set(e.members.map(normMember).filter((x) => x !== '')));\n }\n\n const out: QuantConflict[] = [];\n const seen = new Set<string>();\n\n // Opposition: pairwise within a restrictor. Same scope key → direct square lookup. Different scope keys →\n // ONLY through the enum bridge (a member asserted excludes a disjoint member: A on P2 ⇒ E on P1, I on P2 ⇒\n // O on P1). Guards must collide, identical to the deontic tier.\n for (let i = 0; i < clauses.length; i += 1) {\n for (let j = i + 1; j < clauses.length; j += 1) {\n const a = clauses[i]!;\n const b = clauses[j]!;\n if (a.restrictor !== b.restrictor || a.corner === null || b.corner === null) continue;\n if (!guardsCollide(a.guard, b.guard)) continue;\n let rel: 'hard' | 'contrary' | null = null;\n if (a.scope === b.scope) {\n rel = opposes(a.corner, b.corner);\n } else if (disjoint(a.scopeText, b.scopeText, disjointSets)) {\n // Reframe a member assertion into the peer's frame: A→E, I→O; E/O imply nothing about a disjoint peer.\n const reframe = (c: Corner): Corner | null => (c === 'A' ? 'E' : c === 'I' ? 'O' : null);\n const rb = reframe(b.corner);\n const ra = reframe(a.corner);\n rel = (rb && opposes(a.corner, rb)) || (ra && opposes(b.corner, ra)) || null;\n }\n // THE SLOT AXIOM — one quantity per fact. A pair where one claim ENTAILS the other (all→some,\n // no→some-not) is two strengths for one (S, P) slot: an inconsistency under the language's axioms,\n // exactly as a second `is`-value on a single-valued property is. The complementary pair (some P /\n // some not P) stays legal — a deliberate partition, neither side entailed. Demonstrative witnesses\n // (`this X is not P`) are counter-INSTANCES, not slot re-assignments, so they never trip strength.\n const demonstrative = (c: QuantifiedClause): boolean => c.det === 'this' || c.det === 'that' || c.det === 'the';\n const subaltern = (x: Corner, y: Corner): boolean => (x === 'A' && y === 'I') || (x === 'E' && y === 'O');\n if (rel === null && a.scope === b.scope && !demonstrative(a) && !demonstrative(b) && (subaltern(a.corner, b.corner) || subaltern(b.corner, a.corner))) {\n const strong = a.corner === 'A' || a.corner === 'E' ? a : b;\n const weak = strong === a ? b : a;\n const lines = [...new Set([a.line, b.line])].sort((x, y) => x - y);\n const dedupe = `strength|${lines.join(',')}`;\n if (seen.has(dedupe)) continue;\n seen.add(dedupe);\n const exception = strong.corner === 'A' ? `Some ${weak.restrictor}s are not ${weak.scopeText}.` : `Some ${weak.restrictor}s are ${weak.scopeText}.`;\n out.push({\n lines,\n kind: 'strength',\n message: `One quantity per fact — ${describe(strong)} already entails ${describe(weak)}, so this fact carries two strengths (a model may read the weaker \"some\" as \"not all\"). Keep the stronger line, or state the exception you meant: \"${exception}\".`,\n });\n continue;\n }\n if (rel !== 'hard' && !(rel === 'contrary' && QUANT_CONTRARY_FIRES)) continue;\n const lines = [...new Set([a.line, b.line])].sort((x, y) => x - y);\n const dedupe = lines.join(',');\n if (seen.has(dedupe)) continue;\n seen.add(dedupe);\n const majority = a.corner.startsWith('M') || b.corner.startsWith('M');\n // A CONTRARY pair (all vs no) is jointly false only for a NONEMPTY set — and when the prompt itself\n // proves the set nonempty (a stated count or a list with a floor ≥ 1), say so: the existential\n // import stops being an assumption and becomes the prompt's own fact.\n const proof = rel === 'contrary' ? cardinals.find((c) => c.owner === undefined && c.tail === '' && c.lo >= 1 && (c.noun === a.restrictor || pluralizeNoun(c.noun) === a.restrictor || c.noun === singularizeNoun(a.restrictor))) : undefined;\n out.push({\n lines,\n kind: majority ? 'majority' : 'opposition',\n message: majority\n ? `Majority conflict — ${describe(a)} and ${describe(b)} can't both hold; each needs over half of \"${a.restrictor}\".`\n : `Quantifier conflict — ${describe(a)}, but ${describe(b)}. Both cannot hold${proof !== undefined ? ` — and \"${proof.text}\" proves the set is nonempty` : ''}.`,\n });\n }\n }\n\n // Cardinality: two |S| bounds on the same (owner, noun) whose intervals don't intersect — `only one tool`\n // ([1,1]) vs `many tools` ([2,∞)) — cannot both hold. The owner is part of the bucket: `you have only one\n // tool` bounds YOUR set, so it never crosses an ownerless `there are many tools` (different scopes — sound\n // abstention). Pure interval emptiness; guards must collide as everywhere.\n for (let i = 0; i < cardinals.length; i += 1) {\n for (let j = i + 1; j < cardinals.length; j += 1) {\n const a = cardinals[i]!;\n const b = cardinals[j]!;\n if (a.noun !== b.noun || (a.owner ?? '') !== (b.owner ?? '') || a.tail !== b.tail) continue; // one set: same noun, owner, AND restrictor tail\n if (!guardsCollide(a.guard, b.guard)) continue;\n const lines = [...new Set([a.line, b.line])].sort((x, y) => x - y);\n const setName = `${pluralizeNoun(a.noun)}${a.tail !== '' ? ` ${a.tail}` : ''}`;\n if (Math.max(a.lo, b.lo) <= Math.min(a.hi, b.hi)) {\n // Intervals intersect — compatible, UNLESS one strictly CONTAINS the other: an entailed weaker\n // restatement is two strengths on one slot (the slot axiom, exactly `all` then `some`). Only\n // STATED counts play — a generic `a`/`an` and a list-derived floor state no count.\n const inside = (x: CardinalClaim, y: CardinalClaim): boolean => y.lo <= x.lo && x.hi <= y.hi; // x ⊆ y\n const counted = (x: CardinalClaim): boolean => x.fromList !== true && x.phrase !== 'a' && x.phrase !== 'an';\n if (!counted(a) || !counted(b)) continue;\n if (a.lo === b.lo && a.hi === b.hi) continue; // the same count twice is redundancy's business\n if (!inside(a, b) && !inside(b, a)) continue; // overlapping but neither entails — compatible bounds\n const strong = inside(a, b) ? a : b;\n const weak = strong === a ? b : a;\n const dedupe = `cardstrength|${lines.join(',')}`;\n if (seen.has(dedupe)) continue;\n seen.add(dedupe);\n out.push({\n lines,\n kind: 'strength',\n message: `One count per set — \"${strong.text}\" (${boundText(strong.lo, strong.hi)}) already entails \"${weak.text}\" (${boundText(weak.lo, weak.hi)}): two strengths for \"${setName}\". Keep the stronger claim.`,\n });\n continue;\n }\n const dedupe = `card|${lines.join(',')}`;\n if (seen.has(dedupe)) continue;\n seen.add(dedupe);\n const list = a.fromList === true ? a : b.fromList === true ? b : null;\n const stated = list === a ? b : a;\n out.push({\n lines,\n kind: 'cardinality',\n message: list !== null\n ? `The list disproves the count — \"${list.text}\" names ${list.lo} member${list.lo === 1 ? '' : 's'}, but \"${stated.text}\" bounds \"${setName}\" to ${boundText(stated.lo, stated.hi)}.`\n : `Cardinality conflict — \"${a.text}\" (${boundText(a.lo, a.hi)}) but \"${b.text}\" (${boundText(b.lo, b.hi)}). The counts cannot both hold — state how many \"${setName}\" ${a.owner !== undefined ? `\"${a.owner}\" has` : 'there are'} once.`,\n });\n }\n }\n\n // ACTION COUNTS — the slot axiom for directives: one action carries ONE count. `call six tools` and\n // `call five tools` both claim the (call, tool, tail) slot; two DIFFERENT counts on it cannot both be\n // the intended instruction, whatever the exact/at-least reading — the same two-strengths-one-slot defect\n // as `all users are cool` then `some users are cool`. Sound abstentions: one line is a SEQUENCE\n // (`call five tools, then call six tools` is a procedure), two numbered STEPS may count differently,\n // identical counts are redundancy's business, and guards must collide as everywhere.\n const orderedStep = new Set<number>();\n rawLines.forEach((raw, i) => {\n if (/^\\s*\\d+(?:\\.\\d+)*[.)]\\s/.test(raw)) orderedStep.add(i);\n });\n for (let i = 0; i < actions.length; i += 1) {\n for (let j = i + 1; j < actions.length; j += 1) {\n const a = actions[i]!;\n const b = actions[j]!;\n if (a.line === b.line) continue; // one line = one procedure — sequences never conflict with themselves\n if (orderedStep.has(a.line) && orderedStep.has(b.line)) continue; // two steps of a procedure\n if (a.verb !== b.verb || a.noun !== b.noun || a.tail !== b.tail) continue; // one slot: verb, noun, tail\n if (a.subject !== b.subject) continue; // subjects must AGREE when present — `sarah:` never crosses `you`\n if (a.lo === b.lo && a.hi === b.hi) continue; // the same count twice is redundancy, not a conflict\n if (!guardsCollide(a.guard, b.guard)) continue;\n const lines = [...new Set([a.line, b.line])].sort((x, y) => x - y);\n const dedupe = `act|${lines.join(',')}|${a.verb}|${a.noun}`;\n if (seen.has(dedupe)) continue;\n seen.add(dedupe);\n const slot = `${a.verb} ${pluralizeNoun(a.noun)}${a.tail !== '' ? ` ${a.tail}` : ''}`;\n out.push({\n lines,\n kind: 'action-count',\n message: `One action, two counts — \"${a.text}\" but \"${b.text}\". A directive carries ONE count for \"${slot}\" — state how many once.`,\n });\n }\n }\n\n // CROSS-FRAME: set supply vs action demand — the vacuum-of-subject doctrine. A WORLD set-size claim\n // (`there is only one tool` → |tool| ∈ [1,1]) and a directive demanding n of that noun (`call five\n // tools` → needs 5) share ONE identity axis (noun + tail); the frames differ, no subject binds them,\n // and the conflict is still provable: a directive cannot draw more items than the set holds. Owned\n // (have-frame) supplies abstain — possession does not provably bound action (sound over clever). Any\n // executor draws from the world set, so the action's subject does not gate this comparison.\n for (const supply of cardinals) {\n if (supply.owner !== undefined || supply.hi === Infinity) continue; // world sets with a real upper bound\n for (const demand of actions) {\n if (supply.noun !== demand.noun || supply.tail !== demand.tail) continue;\n if (demand.lo <= supply.hi) continue; // the set covers the demand\n if (!guardsCollide(supply.guard, demand.guard)) continue;\n const lines = [...new Set([supply.line, demand.line])].sort((x, y) => x - y);\n const dedupe = `sup|${lines.join(',')}|${demand.verb}|${demand.noun}`;\n if (seen.has(dedupe)) continue;\n seen.add(dedupe);\n out.push({\n lines,\n kind: 'insufficient-set',\n message: `The set cannot cover the directive — \"${demand.text}\" needs ${demand.lo} ${pluralizeNoun(demand.noun)}, but \"${supply.text}\" bounds the set to ${boundText(supply.lo, supply.hi)}. Raise the count or shrink the demand.`,\n });\n }\n }\n\n // Exclusivity: `only R T1` closes R to {T1}; any other clause asserting the same relation R with a target\n // T2 ∉ {T1} violates it. Scan every predicate-bearing line (not just quantified ones).\n for (const ex of exclusives) {\n if (!guardsCollide(ex.guard, TRUE)) continue; // an unconditional exclusive; a guarded exclusive is future work\n rawLines.forEach((raw, line) => {\n if (exempt.has(line) || line === ex.line) return;\n const clause = maskQuotes(parseLine(raw).clause).trim();\n const only = clause.match(EXCLUSIVE_RE); // a second `only …` on the same relation is fine (same closure)\n const p = parsePredicate(only ? (only[1] ?? '') : clause, tools);\n if (!p || p.confidence !== 'lexicon' || relationKey(p) !== ex.relation) return;\n const goal = p.roles.goal;\n if (goal === undefined || goal === ex.target) return;\n const lines = [ex.line, line].sort((x, y) => x - y);\n const key = `only|${lines.join(',')}`;\n if (seen.has(key)) return;\n seen.add(key);\n out.push({ lines, kind: 'exclusivity', message: `Exclusivity violation — \"only ${ex.scopeText}\" closes this to \"${ex.target}\", but \"${goal}\" is added. Drop one, or remove \"only\".` });\n });\n }\n\n return out;\n}\n\n// --- The transitive-syllogism pass — a chain the pairwise table can't see ---\n// A universal `all A are B` is a SUBSET edge A ⊆ B; a negative `no A are B` is a DISJOINT edge A ∩ B = ∅.\n// Chained, `all A ⊆ B`, `all B ⊆ C`, `no A ∩ C` is UNSAT: existential import forces an A into C, which the\n// disjoint edge forbids. The monadic subset/disjoint fragment is decided EXACTLY by reachability (no SMT\n// search needed): a contradiction is a disjoint edge {x, y} both of whose endpoints are reachable, over\n// subset edges, from a common witness set. So this is a pure graph walk — sound, complete, and in-browser.\n// Guarded clauses are deferred (unguarded only, so a fire is unconditional); a chain needs ≥3 distinct lines,\n// which is exactly what keeps it from re-reporting the 2-clause cases the pairwise table above already owns.\n// (Z3 earns its place only once cardinality — `at most 2`, `most` — enters a chain; subset/disjoint don't need it.)\nexport function checkSyllogism(rawLines: string[]): { lines: number[]; message: string }[] {\n const clauses = collectQuantified(rawLines).filter((c) => (c.corner === 'A' || c.corner === 'E') && c.guard.t === 'true');\n // ONE key per category: drop a leading article and a plural `s`, so a scope (\"all staff are employees\")\n // and a restrictor (\"no employee is …\") name the same node — restrictors are already singularized, scopes\n // (predicate keys) are not, and an action key with no trailing `s` is unaffected (it just never links).\n const setKey = (s: string): string => s.toLowerCase().replace(/^(?:a|an|the)\\s+/, '').replace(/s$/, '').trim();\n const subsetEdges: { s: string; p: string; line: number }[] = [];\n const disjointEdges: { x: string; y: string; line: number }[] = [];\n for (const c of clauses) {\n const s = setKey(c.restrictor);\n const p = setKey(c.scope);\n if (s === p || s === '' || p === '') continue; // a self-edge carries no information\n if (c.corner === 'A') subsetEdges.push({ s, p, line: c.line });\n else disjointEdges.push({ x: s, y: p, line: c.line });\n }\n if (subsetEdges.length === 0 || disjointEdges.length === 0) return [];\n\n const adj = new Map<string, { to: string; line: number }[]>();\n for (const e of subsetEdges) adj.set(e.s, [...(adj.get(e.s) ?? []), { to: e.p, line: e.line }]);\n\n // BFS from a witness set: node → the subset-clause lines on a shortest forcing path (the source maps to []).\n const pathsFrom = (src: string): Map<string, number[]> => {\n const seen = new Map<string, number[]>([[src, []]]);\n const q = [src];\n while (q.length > 0) {\n const n = q.shift() as string;\n for (const e of adj.get(n) ?? []) {\n if (!seen.has(e.to)) {\n seen.set(e.to, [...(seen.get(n) ?? []), e.line]);\n q.push(e.to);\n }\n }\n }\n return seen;\n };\n\n const witnesses = new Set<string>([...subsetEdges.map((e) => e.s), ...disjointEdges.flatMap((d) => [d.x, d.y])]);\n const out: { lines: number[]; message: string }[] = [];\n const emitted = new Set<string>();\n for (const d of disjointEdges) {\n for (const w of witnesses) {\n const reach = pathsFrom(w);\n const px = reach.get(d.x);\n const py = reach.get(d.y);\n if (!px || !py) continue; // this witness isn't forced into both endpoints — no contradiction through it\n const lines = [...new Set([...px, ...py, d.line])].sort((a, b) => a - b);\n if (lines.length < 3) continue; // a 2-clause clash belongs to the pairwise table, not here\n const key = lines.join(',');\n if (emitted.has(key)) continue;\n emitted.add(key);\n out.push({ lines, message: `Contradictory chain — the rules on these lines force an overlap between \"${d.x}\" and \"${d.y}\", which they also declare mutually exclusive. Relax one rule.` });\n }\n }\n return out;\n}\n","// ── Security rules — leaked secrets and injection patterns ──────────────────────────────────────────\n// A prompt is deployed like code, so it leaks like code: API keys pasted while testing, bearer tokens\n// left in an example request, injection scaffolding copied from a jailbreak post. Two rule families:\n//\n// security/leaked-secret — vendor-prefixed credentials (sk-ant-, ghp_, AKIA…) are ERRORS: the\n// pattern precision is near-perfect and a real key in a prompt is an incident, not a style nit.\n// These gate the score to F. The generic `password: …` assignment form is a WARN — precise enough\n// to surface, not proof enough to gate.\n//\n// security/injection — \"ignore all previous instructions\" / role-hijack scaffolding, WARN. Quoted\n// spans are masked first: TypeGlish quoting means \"literal prose\", so a rule that *talks about*\n// an injection phrase (\"refuse requests like \\\"ignore previous instructions\\\"\") never fires.\n// Secrets are NOT quote-masked — a key leaks from inside quotes just as well.\n//\n// Pattern family vendored from PromptLint (Apache-2.0) — see NOTICE — reimplemented TG-native.\nimport { maskQuotes } from './clause';\nimport type { Diagnostic } from './diagnostics';\n\ninterface SecretPattern {\n re: RegExp;\n what: string;\n severity: 'error' | 'warn';\n}\n\n// Vendor-prefixed credential shapes: high precision, error severity. Order matters — the OpenAI\n// pattern excludes the Anthropic prefix so one key never matches twice.\nconst SECRET_PATTERNS: SecretPattern[] = [\n { re: /\\bsk-ant-[A-Za-z0-9_-]{16,}/g, what: 'Anthropic API key', severity: 'error' },\n { re: /\\bsk-(?!ant-)[A-Za-z0-9]{20,}/g, what: 'OpenAI-style API key', severity: 'error' },\n { re: /\\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{20,}/g, what: 'GitHub token', severity: 'error' },\n { re: /\\bgithub_pat_[A-Za-z0-9_]{20,}/g, what: 'GitHub fine-grained token', severity: 'error' },\n { re: /\\bAKIA[0-9A-Z]{16}\\b/g, what: 'AWS access key id', severity: 'error' },\n { re: /\\bxox[baprs]-[A-Za-z0-9-]{10,}/g, what: 'Slack token', severity: 'error' },\n { re: /\\bAIza[0-9A-Za-z_-]{30,}/g, what: 'Google API key', severity: 'error' },\n { re: /\\b[sr]k_(?:live|test)_[A-Za-z0-9]{16,}/g, what: 'Stripe key', severity: 'error' },\n { re: /-----BEGIN (?:RSA |EC |OPENSSH |DSA |PGP )?PRIVATE KEY-----/g, what: 'private key material', severity: 'error' },\n { re: /\\bBearer\\s+[A-Za-z0-9_\\-.=+/]{25,}/g, what: 'bearer token', severity: 'error' },\n // Generic assignment (`api_key: …`, `password=…`) — warn: precise enough to surface, but a\n // documented config shape can look identical, so it never gates on its own.\n {\n re: /\\b(?:api[_-]?key|apikey|secret|passwd|password|auth[_-]?token|access[_-]?token)\\s*[:=]\\s*['\"]?([A-Za-z0-9_\\-.+/]{12,})/gi,\n what: 'credential assignment',\n severity: 'warn',\n },\n];\n\n// A matched \"secret\" that is obviously a placeholder is the author doing the right thing.\nconst PLACEHOLDER = /\\{|\\$|<|\\bYOUR[_-]|\\bEXAMPLE\\b|X{4,}|\\*{3,}|\\.\\.\\./i;\n\n/** Scan one line for leaked credentials. Runs on EVERY line — comments and code fences included:\n * a key in a comment never reaches the model, but it is committed to the file, and that is the leak. */\nexport function leakedSecrets(line: string, i: number): Diagnostic[] {\n const out: Diagnostic[] = [];\n for (const p of SECRET_PATTERNS) {\n p.re.lastIndex = 0;\n let m: RegExpExecArray | null;\n while ((m = p.re.exec(line)) !== null) {\n const value = m[1] ?? m[0];\n if (PLACEHOLDER.test(value)) continue;\n out.push({\n source: 'security/leaked-secret',\n severity: p.severity,\n line: i,\n start: m.index,\n end: m.index + m[0].length,\n message: `Leaked secret — this looks like a real ${p.what}. Remove it and rotate the credential; reference it as a {variable} instead.`,\n });\n }\n }\n return out;\n}\n\nconst INJECTION_PATTERNS: { re: RegExp; what: string }[] = [\n {\n re: /\\b(?:ignore|disregard|forget)\\s+(?:all\\s+|any\\s+)?(?:previous|prior|above|earlier)\\s+(?:instructions?|prompts?|rules?|messages?)/gi,\n what: 'instruction-override phrasing',\n },\n { re: /\\byou\\s+are\\s+now\\s+(?:DAN|jailbroken|unrestricted)\\b/gi, what: 'role-hijack phrasing' },\n { re: /\\b(?:pretend|act)\\s+(?:that\\s+)?you\\s+have\\s+no\\s+(?:restrictions|guidelines|rules)\\b/gi, what: 'restriction-bypass phrasing' },\n { re: /\\bdo\\s+anything\\s+now\\b/gi, what: 'DAN-style phrasing' },\n];\n\n/** Scan one line for injection scaffolding. Quoted spans are masked (quoting = talking ABOUT the\n * phrase); content lines only — injection text in a stripped comment never reaches the model. */\nexport function injectionPatterns(line: string, i: number): Diagnostic[] {\n const masked = maskQuotes(line);\n const out: Diagnostic[] = [];\n for (const p of INJECTION_PATTERNS) {\n p.re.lastIndex = 0;\n let m: RegExpExecArray | null;\n while ((m = p.re.exec(masked)) !== null) {\n out.push({\n source: 'security/injection',\n severity: 'warn',\n line: i,\n start: m.index,\n end: m.index + m[0].length,\n message: `Injection pattern — \"${m[0]}\" is ${p.what}. If this is a rule ABOUT such phrases, quote the phrase to mark it literal.`,\n });\n }\n }\n return out;\n}\n","// ── Rule ↔ test-case coverage — code coverage, for prompts ─────────────────────────────────────────\n// The attribution-cost spike demonstrated the epistemic limit live: a line with no exercising test\n// case measured Δ 0.00 not because it does nothing, but because nothing LOOKS. A rule no case\n// exercises has unknowable behavioral impact — so coverage is a first-class measure: % of hard rules\n// linked to at least one $TEST case, and a per-rule case list the profile surfaces.\n//\n// Linkage is STATIC and deliberately conservative (prefer under-linking; the finding is info-severity\n// and never gates): a case exercises a rule when they share the rule's predicate head/theme, or at\n// least two significant content words. The empirical ground truth stays the ablation delta — this is\n// the cheap map that tells you which deltas are worth buying.\nimport type { DirectiveIR, IR } from './ir';\nimport type { ExtractedSuite } from './testblock';\n\nconst STOP = new Set([\n 'the', 'a', 'an', 'to', 'of', 'for', 'and', 'or', 'not', 'is', 'are', 'be', 'you', 'your', 'it',\n 'that', 'this', 'with', 'in', 'on', 'at', 'by', 'do', 'does', 'must', 'never', 'always', 'should',\n 'may', 'every', 'any', 'all', 'when', 'if', 'then', 'than', 'as', 'so', 'no', 'yes',\n]);\n\nfunction tokens(text: string): Set<string> {\n const out = new Set<string>();\n for (const w of text.toLowerCase().match(/[a-z][a-z'-]{2,}/g) ?? []) {\n const t = w.replace(/'s$/, '').replace(/s$/, ''); // cheap singular fold: prices/price, numbers/number\n if (!STOP.has(w) && !STOP.has(t) && t.length >= 3) out.add(t);\n }\n return out;\n}\n\n/** Everything a case \"talks about\": its input, its judge steering, and its assert payloads. */\nfunction caseTokens(suite: ExtractedSuite, id: string): Set<string> {\n const parts: string[] = [];\n const tc = suite.testCases.find((c) => c.id === id);\n if (tc) parts.push(tc.input, tc.expectation ?? '');\n for (const a of suite.asserts[id] ?? []) {\n if (a.kind === 'contains') parts.push(a.value);\n else if (a.kind === 'matches') parts.push(a.source.replace(/\\\\[a-z]/gi, ' '));\n else if (a.kind === 'atMost' || a.kind === 'atLeast') parts.push(a.unit);\n }\n return tokens(parts.join(' '));\n}\n\nexport interface RuleCoverage {\n line: number;\n action: string;\n covered: boolean;\n cases: string[];\n}\n\nexport interface CoverageReport {\n perRule: RuleCoverage[];\n /** Covered hard rules ÷ hard rules; 1 when there are no hard rules. */\n coveredRate: number;\n}\n\n/** Same word, inflection-tolerant: exact, or a ≥4-char prefix relationship (state/stated,\n * price/prices, escalate/escalation). Still conservative — unrelated stems rarely prefix-match. */\nfunction sameWord(a: string, b: string): boolean {\n if (a === b) return true;\n return a.length >= 4 && b.length >= 4 && (a.startsWith(b) || b.startsWith(a));\n}\n\nfunction hasWord(toks: Set<string>, word: string): boolean {\n for (const t of toks) if (sameWord(t, word)) return true;\n return false;\n}\n\nfunction linked(rule: DirectiveIR, caseToks: Set<string>): boolean {\n const head = rule.predicate?.head;\n const theme = rule.predicate?.theme;\n const themeToks = theme ? tokens(theme) : new Set<string>();\n // Strongest signal: the case names the rule's canonical verb or its theme.\n if (head && hasWord(caseToks, head)) return true;\n for (const t of themeToks) if (hasWord(caseToks, t)) return true;\n // Fallback: two significant content words in common (conservative — one shared word is noise).\n const ruleToks = tokens(rule.action.text);\n let shared = 0;\n for (const t of ruleToks) if (hasWord(caseToks, t)) shared += 1;\n return shared >= 2;\n}\n\n/** Which hard rules (obligate/prohibit) the suite's cases exercise. */\nexport function ruleCoverage(ir: IR, suite: ExtractedSuite): CoverageReport {\n const hard = ir.nodes.filter(\n (n): n is DirectiveIR => n.kind === 'directive' && (n.deontic === 'obligate' || n.deontic === 'prohibit'),\n );\n const tokensByCase = new Map(suite.testCases.map((c) => [c.id, caseTokens(suite, c.id)]));\n const perRule: RuleCoverage[] = hard.map((rule) => {\n const cases = [...tokensByCase.entries()].filter(([, toks]) => linked(rule, toks)).map(([id]) => id);\n return { line: rule.line, action: rule.action.text, covered: cases.length > 0, cases };\n });\n const coveredRate = hard.length === 0 ? 1 : perRule.filter((r) => r.covered).length / hard.length;\n return { perRule, coveredRate };\n}\n","import { addresseeSubjects, aliasMap, findEnumDeclaration, resolveDeclarations } from './prompt';\nimport { parseSwitches } from './switch';\nimport { DEF_ENTRY, SNAKE_RE, TAG_NAME_SRC, TAG_ONLY_LINE, TRANSCLUSION_LINE_RE, configSectionMask, defEntries, defListMask, displayLine, examplesMask, hasTrailingAnnotation, illustrationZoneMask, isAnnotationLine, lineOrdinals, maskQuotes, stripAnnotation, stripInlineComment } from './clause';\nimport { wrappedContinuations } from './fmt';\nimport { classifyClause, parseLine } from './grammar';\nimport { GUARD_OPENERS, keywordAlternation } from './guards';\nimport { MODAL_HINT } from './lexicon';\nimport { CHARSET_RULES, SPECIAL_ANY } from './charset';\nimport { toolBlockMask } from './clause';\nimport { parseTools } from './tool';\nimport { checkModel } from './models';\nimport { renderLines } from './highlight';\nimport type { InlineToken } from './highlight';\nimport { lower } from './ir';\nimport { checkConsistency, checkRedundancy, checkSubsumption, deadRules } from './logic';\nimport { checkOrder } from './order';\nimport { proseExemptLines } from './predicate';\nimport { checkDefiniteness } from './definiteness';\nimport { checkQuantifier, checkSyllogism } from './quantifier';\nimport { injectionPatterns, leakedSecrets } from './security';\nimport { ruleCoverage } from './coverage';\nimport { BUILTIN_CONFIG_SCHEMA, configParamDiagnostics, configRuleDiagnostics, parseConfigRules, resolveConfigSchema } from './config-schema';\nimport { layoutColumns } from './layout';\nimport { buildStructure, headingsOutsideSections, looseContentLines, matchSectionTag, structuralConflicts } from './structure';\nimport { extractSuite, rubricExpectLines, testBlockLines } from './testblock';\nimport { exampleBlockLines } from './exampleblock';\n\nexport type Severity = 'info' | 'warn' | 'error';\n\nexport interface Diagnostic {\n source: string;\n severity: Severity;\n line: number; // 0-based line index\n start: number; // char offset within the line\n end: number;\n message: string;\n fix?: { title: string; replacement: string };\n}\n\nexport interface RubricDim {\n key: string;\n description: string;\n}\n\nconst SEV_RANK: Record<Severity, number> = { info: 1, warn: 2, error: 3 };\n\n// ---------------------------------------------------------------------------\n// Providers — each scans one line and emits diagnostics. All static and objective:\n// a nag only fires when it's an undeniable text win or a structural fact. Aesthetic\n// \"this phrasing is worse\" judgments are deliberately absent — those must be measured.\n//\n// THE MESSAGE CONTRACT — agents fix from the message alone, so every message must let them act\n// without a second look (a vague message sends an agent into an edit-guess-recompile loop):\n// 1. EVIDENCE — state what triggered the finding, interpolating the specifics (the word, the\n// term, the two colliding values, the expected vs found columns), never just the rule's name.\n// 2. EVERY EXIT — a finding with two honest resolutions must name both (\"join them; or\n// capitalize it\"), because recommending only one sends half the cases the wrong way.\n// 3. GUTTER NUMBERS — every line reference goes through `disp` (clause.ts lineOrdinals); a raw\n// index cites a line no gutter shows. Prefer quoting content over citing a number when the\n// reference is inside another construct.\n// 4. ONE-CLICK FIX — attach `fix` whenever one exit is deterministic.\n// ---------------------------------------------------------------------------\n\nconst WORDY: { re: RegExp; to: string }[] = [\n { re: /\\bin order to\\b/gi, to: 'to' },\n { re: /\\bdue to the fact that\\b/gi, to: 'because' },\n { re: /\\bat this point in time\\b/gi, to: 'now' },\n { re: /\\bin the event that\\b/gi, to: 'if' },\n { re: /\\bfor the purpose of\\b/gi, to: 'to' },\n { re: /\\bwith regard to\\b/gi, to: 'about' },\n { re: /\\ba large number of\\b/gi, to: 'many' },\n { re: /\\bin spite of the fact that\\b/gi, to: 'although' },\n];\n\nfunction wordy(line: string, i: number): Diagnostic[] {\n const out: Diagnostic[] = [];\n for (const w of WORDY) {\n w.re.lastIndex = 0;\n let m: RegExpExecArray | null;\n while ((m = w.re.exec(line)) !== null) {\n out.push({\n source: 'style/wordy',\n severity: 'info',\n line: i,\n start: m.index,\n end: m.index + m[0].length,\n message: `Wordy — \"${m[0]}\" can be \"${w.to}\".`,\n fix: { title: `→ \"${w.to}\"`, replacement: w.to },\n });\n }\n }\n return out;\n}\n\n// Quotes are for UTTERANCES — the exact words to say — and for samples. A WHOLE-LINE quoted statement\n// is prose hiding from the checker: nothing inside \"…\" is parsed, so an over-quoted prompt is invisible\n// to the very analysis TypeGlish exists to run. And the hiding is never needed — a plain statement\n// renders and stays checkable (a declaration renders too: definition IS use). Embedded quotes under a\n// speech verb (`ALWAYS open with \"How can I help?\"`) are the legitimate form and never flag; quoted\n// LIST items stay unflagged too (an utterance list under `Rotate between:` is exactly what quotes are\n// for). <examples> interiors are exempt via the final sweep; fences/headings/tool bodies via loop gates.\nconst WHOLE_LINE_QUOTE = /^\\s*\"([^\"]*)\"\\s*$/;\nfunction quotedProse(line: string, i: number): Diagnostic[] {\n const m = line.match(WHOLE_LINE_QUOTE);\n if (m === null) return [];\n const start = line.indexOf('\"');\n return [\n {\n source: 'style/quoted-prose',\n severity: 'warn',\n line: i,\n start,\n end: line.lastIndexOf('\"') + 1,\n message:\n 'A whole-line quote hides this statement from the checker — reserve \"…\" for exact words to say (an utterance after a speech verb, or a sample in <examples>). Unquote it: a plain statement renders and stays checkable.',\n fix: { title: 'Unquote', replacement: m[1] ?? '' },\n },\n ];\n}\n\n// Statements end with a terminal marker — the semicolon rule, one level up, and like a missing\n// semicolon in strict JS it is a COMPILE ERROR (structure/, so it gates wellFormed and the grade): an\n// explicit terminator makes \"one statement per line\" a CONTRACT instead of wrapped-fragment's\n// heuristic, and gives the model clean sentence boundaries. Accepted terminals: . ! ? — or a lead-in\n// ':' (a line introducing a list is a deliberate structure, the block-opener of prose) — optionally\n// followed by closing quotes/brackets ('…with \"How can I help?\"' ends correctly). One-click fixable.\nconst TERMINATED = /[.!?:][\"')\\]]*\\s*$/;\nfunction unterminated(line: string, i: number, end: number): Diagnostic {\n // The squiggle spans the WHOLE statement, not just its last character — the unit missing a\n // terminator is the statement. Indentation stays outside the span (it starts at the first\n // visible character), and so does a trailing comment (`end` is the statement end, pre-comment).\n const start = Math.max(0, Math.min(line.length - line.trimStart().length, end - 1));\n return {\n source: 'structure/missing-period',\n severity: 'error',\n line: i,\n start,\n end,\n message: 'Unterminated statement — end it with a period (or ! ?; a lead-in may end with \":\"). Statement boundaries are a compile contract.',\n fix: { title: 'Add \".\"', replacement: `${line.slice(start, end)}.` },\n };\n}\nfunction missingPeriod(line: string, i: number): Diagnostic[] {\n // The statement span excludes a trailing `// comment` — `Speak warmly. // note` IS terminated, and\n // when a period is missing it belongs at the statement's end, never after the comment.\n const stmt = stripInlineComment(line);\n const end = stmt.trimEnd().length;\n if (end === 0 || TERMINATED.test(stmt)) return [];\n // A line that IS a transclusion pointer (`@<section>` / `@<alias.member>` alone) is STRUCTURE, not a\n // statement — it splices a section or imported file the way a `<tag>` line opens one, so the terminator\n // contract doesn't apply. An inline pointer mid-sentence still terminates like any statement.\n if (TRANSCLUSION_LINE_RE.test(stmt)) return [];\n return [unterminated(line, i, end)];\n}\n// The literal variant, for definition-entry lines: a def body is PARSE-literal, so `//` and `@@`\n// there are content (a comments:: row SHOWS a comment) — termination judges the whole raw line.\nfunction missingPeriodLiteral(line: string, i: number): Diagnostic[] {\n const end = line.trimEnd().length;\n if (end === 0 || TERMINATED.test(line)) return [];\n return [unterminated(line, i, end)];\n}\n\n// The `one of` quantifier never takes a colon — `:` is TypeGlish's pairing/lead-in mark, and the\n// quantifier reads the SAME everywhere (a declaration's closed set, a variable domain, a tool type,\n// a condition). Only the MID-SENTENCE form flags (`ARE one of: voice, chat.`); a bare `one of:`\n// ending a line is an ordinary lead-in into a list and stays legal. Quotes are masked first.\nfunction oneOfColon(line: string, i: number): Diagnostic[] {\n const masked = maskQuotes(stripInlineComment(line));\n const m = /\\bone\\s+of\\s*:(?=\\s*\\S)/i.exec(masked);\n if (!m) return [];\n const start = m.index;\n const end = m.index + m[0].length;\n return [\n {\n source: 'structure/one-of-colon',\n severity: 'error',\n line: i,\n start,\n end,\n message: `\"one of\" never takes a colon — the quantifier is the same everywhere (declarations, domains, tool types, conditions). Write \"${line.slice(start, end - 1).trimEnd()} ${line.slice(end).trimStart().split(',')[0] ?? ''}, …\" — just drop the \":\".`,\n fix: { title: 'Drop \":\"', replacement: line.slice(start, end - 1).trimEnd() },\n },\n ];\n}\n\n// The `::` marker OPENS a labeled definition, and a definition is a LINE — it begins at a line head\n// (`[- ]term::`), optionally nested as a deeper `- ` sub-item. A `::` anywhere ELSE on a line has no\n// meaning: it is a second object stuffed inline (give it its own bullet — a sub-definition) or a sample\n// of the marker written bare (quote it). The one legal `::` is a def-entry HEAD separator, so the scan\n// begins AFTER it; comments, annotations, and quoted samples are masked away first, and the caller skips\n// tool bodies (a `::` there is a schema field) and illustration zones (verbatim). Symbols live in their\n// literal homes — this is the same doctrine `structure/retired-brace-ref` enforces for `{braces}`.\nfunction inlineMarker(line: string, i: number): Diagnostic[] {\n const text = maskQuotes(stripAnnotation(stripInlineComment(line)));\n const head = line.match(DEF_ENTRY); // the entry head owns the FIRST `::`; scan past it\n const scanStart = head ? (head[1] ?? '').length + (head[2] ?? '').length + (head[3] ?? '').length + 2 : 0;\n const out: Diagnostic[] = [];\n for (const m of text.matchAll(/:{2,}/g)) {\n const ci = m.index ?? 0;\n if (ci < scanStart) continue; // the entry head separator — the one legal marker\n // Widen to the adjacent sample token (`term::`, `base::`, or a lone `::`) so the fix quotes a clean span.\n let s = ci;\n let e = ci + m[0].length;\n while (s > 0 && /[A-Za-z0-9_?-]/.test(line[s - 1] ?? '')) s -= 1;\n while (e < line.length && /[A-Za-z0-9_?-]/.test(line[e] ?? '')) e += 1;\n const sample = line.slice(s, e);\n out.push({\n source: 'structure/inline-marker',\n severity: 'error',\n line: i,\n start: s,\n end: e,\n message: `\"::\" opens a definition at a line head — here it is inline. Give the second object its own \"- \" bullet (a sub-definition), or quote \"${sample}\" as a sample.`,\n fix: { title: `Quote \"${sample}\"`, replacement: `\"${sample}\"` },\n });\n }\n return out;\n}\n\nfunction specialCharacters(line: string, i: number): Diagnostic[] {\n // Scan the model-read statement text: inline comments and @@ notes stripped (compile-stripped, never\n // model-read), ASCII-quoted utterances masked (a quote is the author's literal choice). All three\n // helpers preserve prefix offsets, so match indices are raw-line columns. Curly quotes SURVIVE the\n // masking — they are not literals, which is exactly their finding.\n const text = maskQuotes(stripAnnotation(stripInlineComment(line)));\n if (!SPECIAL_ANY.test(text)) return [];\n const out: Diagnostic[] = [];\n const claimed = new Array<boolean>(text.length).fill(false);\n for (const p of CHARSET_RULES) {\n for (const m of text.matchAll(p.re)) {\n const s = m.index ?? 0;\n const e = s + m[0].length;\n if (e === s) continue;\n let clash = false;\n for (let k = s; k < e; k += 1) if (claimed[k]) clash = true;\n if (clash) continue;\n for (let k = s; k < e; k += 1) claimed[k] = true;\n const fix = p.fix ? p.fix(m, text) : null;\n out.push({\n source: p.source,\n severity: 'error',\n line: i,\n start: s,\n end: e,\n message: p.msg,\n ...(fix ? { fix } : {}),\n });\n }\n }\n return out;\n}\n\n// ── Layout — indentation IS structure ─────────────────────────────────────────────────────────────\n// The layout doctrine kills \"LLM spacing\": whitespace doing a job that syntax, highlighting, or the\n// compiler already owns. Alignment columns, ragged continuation gutters, phantom mid-line columns,\n// floating indents, tabs, and blank-line padding are all COMPILE ERRORS with one-click fixes. The\n// rules are few and hand-writable: the indent unit is 2 spaces; indentation MIRRORS XML-section\n// nesting (a nested tag sits one unit deeper, its content one deeper than that; # headings are\n// markdown-plane and add no depth); ONE space between things; nothing trails; at most one blank line.\n// Fences, literal zones, and quoted interiors stay verbatim (ASCII layouts live there); tool and\n// switch BODIES keep their relative indent (their headers sit at the section column). stripIndent\n// removes the cosmetic indent at compile, so the model always reads flat text — nesting indentation\n// is a SOURCE feature, for the humans and agents reading the file.\nconst TRAILING_WS = /[ \\t]+$/;\nfunction trailingSpace(line: string, i: number): Diagnostic[] {\n const m = line.match(TRAILING_WS);\n if (!m || m.index === undefined || line.trim() === '') return [];\n return [\n {\n source: 'structure/trailing-space',\n severity: 'error',\n line: i,\n start: m.index,\n end: line.length,\n message: 'Trailing whitespace: invisible noise every diff and every token count carries. Strip it.',\n fix: { title: 'Strip', replacement: '' },\n },\n ];\n}\n\nfunction tabCharacters(line: string, i: number): Diagnostic[] {\n const out: Diagnostic[] = [];\n for (let k = line.indexOf('\\t'); k !== -1; k = line.indexOf('\\t', k + 1)) {\n out.push({\n source: 'structure/tab',\n severity: 'error',\n line: i,\n start: k,\n end: k + 1,\n message: 'Tab character: the indent unit is 2 spaces — a tab is an invisible, variable-width impostor.',\n fix: { title: '→ spaces', replacement: ' ' },\n });\n }\n return out;\n}\n\n// A run of 2+ interior spaces is a PHANTOM COLUMN — spacing doing alignment's job. The def-list\n// feature exists so tables never need hand-alignment (the compiler owns the emitted layout, the\n// editor highlights the term), and commentary beside content belongs in a // comment, not padding.\nconst PHANTOM_RUN = /(?<=\\S) {2,}(?=\\S)/g;\nfunction phantomColumns(line: string, i: number, literalBody: boolean): Diagnostic[] {\n // Quoted interiors are the author's exact text — masked. Outside a literal body (def entries and\n // tool bodies read their markers as content), runs INSIDE a trailing // comment or @@ note are\n // stripped metadata and exempt — but the run BEFORE the marker is an aligned comment column, and\n // that is exactly the disease.\n const masked = maskQuotes(line);\n const cut = literalBody ? masked.length : stripAnnotation(stripInlineComment(line)).trimEnd().length;\n const out: Diagnostic[] = [];\n for (const m of masked.matchAll(PHANTOM_RUN)) {\n const s = m.index ?? 0;\n // Runs strictly INSIDE stripped metadata are exempt; the run that SEPARATES a statement from its\n // trailing marker starts exactly at the cut — an aligned comment column, the disease itself.\n if (s > cut) continue;\n out.push({\n source: 'structure/phantom-column',\n severity: 'error',\n line: i,\n start: s,\n end: s + m[0].length,\n message: 'Phantom column: a space run doing alignment\\'s job. One space between things — commentary belongs in a // comment, layout tables in a fence or <\"name\"> zone.',\n fix: { title: '→ one space', replacement: ' ' },\n });\n }\n return out;\n}\n\n// Extended with the PromptLint-family hedge lexicon (see NOTICE) — each entry weakens a directive\n// into a suggestion the model is free to skip.\nconst HEDGES =\n /\\b(try to|tries to|try your best to|do your best to|should probably|might want to|you may want to|it would be good to|it might be good to|if possible|when possible|where possible|as much as possible|attempt to|attempts to|strive to|aim to|feel free to|ideally|maybe|perhaps|kind of|sort of)\\b/gi;\n\nfunction hedging(line: string, i: number): Diagnostic[] {\n const out: Diagnostic[] = [];\n HEDGES.lastIndex = 0;\n let m: RegExpExecArray | null;\n while ((m = HEDGES.exec(line)) !== null) {\n out.push({\n source: 'prompt/hedging',\n severity: 'info',\n line: i,\n start: m.index,\n end: m.index + m[0].length,\n message: `Hedging — \"${m[0]}\" turns this instruction into a suggestion the model may skip. Delete the hedge, or commit to a modal (${MODAL_HINT}).`,\n });\n }\n return out;\n}\n\n// Extended with the PromptLint-family vagueness lexicon (see NOTICE) — words that name a judgment\n// call without giving the model the criterion to judge by.\nconst VAGUE =\n /\\b(appropriately|appropriate|as needed|as appropriate|as necessary|as required|if needed|if necessary|if applicable|when necessary|when appropriate|where appropriate|in a timely manner|properly|reasonable|relevant|somehow|various|etc\\.?|and so on|and so forth)\\b/gi;\n\nfunction vague(line: string, i: number): Diagnostic[] {\n const out: Diagnostic[] = [];\n VAGUE.lastIndex = 0;\n let m: RegExpExecArray | null;\n while ((m = VAGUE.exec(line)) !== null) {\n out.push({\n source: 'prompt/vague',\n severity: 'info',\n line: i,\n start: m.index,\n end: m.index + m[0].length,\n message: `Vague — \"${m[0]}\" names a judgment call without the criterion to judge by, so nothing can check it. Replace it with a measurable form (\"at most 3 sentences\", \"within 24 hours\", \"cite the source\").`,\n });\n }\n return out;\n}\n\n/** Hard-wrapped continuations break statement-per-line: the parser reads the fragment as its own\n * (unclassifiable) statement and line references stop meaning statements. Detection shared with\n * tg fmt (fmt.ts). */\nfunction wrappedFragments(rawLines: string[], disp: (i: number) => number = (i) => i + 1): Diagnostic[] {\n const out: Diagnostic[] = [];\n for (const [i, before] of wrappedContinuations(rawLines)) {\n const raw = rawLines[i] ?? '';\n const lead = raw.length - raw.trimStart().length;\n // The message states the heuristic's EVIDENCE, because the finding has two honest exits and the\n // author must know which applies: it either IS a wrapped statement (join it), or it's a statement\n // that merely LOOKS like one — usually a capitalization slip — so name exactly what made it look\n // that way (lowercase start + plain prose + the unterminated line above) and offer the one-click\n // capitalize. `disp` speaks GUTTER numbers (clause.ts lineOrdinals), like every line reference.\n const body = raw.slice(lead);\n const capitalized = body.replace(/[a-z]/, (c) => c.toUpperCase());\n out.push({\n source: 'structure/wrapped-fragment',\n severity: 'warn',\n line: i,\n start: lead,\n end: raw.length,\n message: `Reads as a hard-wrapped continuation of line ${disp(before)} — it starts lowercase, classifies as plain prose, and line ${disp(before)} has no terminator. If they are ONE statement, join them (tg fmt --join); if this line stands alone, capitalize its first word (and terminate line ${disp(before)}).`,\n ...(capitalized !== body ? { fix: { title: 'Capitalize', replacement: capitalized } } : {}),\n });\n }\n return out;\n}\n\n/** A rule that names a QUALITY instead of an action is a rule nothing can check — \"MUST be\n * helpful\" has no observable behavior to verify. This is deliberately narrower than \"the verb\n * isn't in the catalog\": \"NEVER argue with the customer\" is perfectly observable, TG just can't\n * prove facts about it yet (that visibility gap is the Enforceability facet's job, not a warn).\n * Two shapes: a deontic IR node whose action is a copula/quality phrase, and the bare\n * adjective-directive line (\"Be helpful and professional.\") that never reaches the IR at all.\n * Prose blocks are exempt — persona prose is allowed to be soft. */\nconst QUALITY_ACTION = /^(?:be|being|stay|remain|sound|seem|appear|act|feel)\\b/i;\n\nfunction unmeasurableDirectives(rawLines: string[], exempt: Set<number>): Diagnostic[] {\n const out: Diagnostic[] = [];\n const flagged = new Set<number>();\n const doc = buildStructure(rawLines);\n for (const node of lower(rawLines.join('\\n'), { tools: doc.index.tools }).nodes) {\n if (node.kind !== 'directive') continue;\n if (node.deontic !== 'obligate' && node.deontic !== 'prohibit') continue;\n if (node.predicate !== null || node.numeric !== null) continue;\n if (!QUALITY_ACTION.test(node.action.text.trim())) continue;\n if (exempt.has(node.line) || flagged.has(node.line)) continue;\n flagged.add(node.line);\n out.push({\n source: 'prompt/unmeasurable',\n severity: 'warn',\n line: node.line,\n start: node.span.start,\n end: node.span.end,\n message:\n 'Unmeasurable rule — no observable action or bound, so nothing can check compliance. ' +\n 'Name a concrete action (\"cite the source\", \"at most 3 sentences\") or move it to a prose block.',\n });\n }\n const render = renderLines(rawLines);\n rawLines.forEach((raw, i) => {\n if (flagged.has(i) || exempt.has(i)) return;\n const r = render[i];\n if (!r || r.kind !== 'content' || r.lineClass === 'md-code' || r.lineClass === 'md-heading') return;\n const clause = parseLine(raw).clause.trim();\n if (!/^be\\s+\\w/i.test(clause) || classifyClause(clause) !== 'prose') return;\n out.push({\n source: 'prompt/unmeasurable',\n severity: 'warn',\n line: i,\n start: raw.length - raw.trimStart().length,\n end: raw.length,\n message:\n 'Unmeasurable rule — \"be <quality>\" names no observable action, so nothing can check compliance. ' +\n 'Name a concrete action, or move it to a prose block (persona prose is allowed to be soft).',\n });\n });\n return out;\n}\n\n/** Once a file carries its own tests, an uncovered hard rule is a visible gap: the attribution\n * spike measured Δ 0.00 on exactly such lines — not because they do nothing, but because nothing\n * LOOKS. Info severity, and only when $TEST blocks exist (don't badger an un-eval'd prompt —\n * the reclaimed, case-grounded version of the retired keyword-overlap nag). */\nfunction untestedRules(rawLines: string[], testLines: Set<number>): Diagnostic[] {\n if (testLines.size === 0) return [];\n const source = rawLines.join('\\n');\n const suite = extractSuite(source);\n if (suite.testCases.length === 0) return [];\n const doc = buildStructure(rawLines);\n const coverage = ruleCoverage(lower(source, { tools: doc.index.tools }), suite);\n return coverage.perRule\n .filter((r) => !r.covered)\n .map((r) => {\n const raw = rawLines[r.line] ?? '';\n return {\n source: 'prompt/untested-rule',\n severity: 'info' as const,\n line: r.line,\n start: raw.length - raw.trimStart().length,\n end: raw.length,\n message: 'No $TEST case exercises this rule — its behavioral impact is unmeasurable until one does. Add a $TEST whose \"- input::\" triggers the rule, with a \"- expect::\" sub-bullet that checks the required behavior.',\n };\n });\n}\n\n// ── prompt/determinable-expect — the deterministic-first nudge ──────────────────────────────────────\n// A rubric expectation costs a judge call and carries ≈0.05 sd of noise (Spike A); a deterministic\n// assert is free, instant, and exact. When a judge-scored expectation has an OBVIOUS deterministic\n// form, suggest the conversion — with a one-click fix. Precision-first: every pattern is anchored\n// to the WHOLE payload, so \"politely says \\\"thanks\\\" and offers help\" (real semantics beyond the\n// phrase) never fires. The judge stays for what only a judge can check.\n\nconst NUM_WORDS: Record<string, number> = {\n one: 1, two: 2, three: 3, four: 4, five: 5, six: 6, seven: 7, eight: 8, nine: 9, ten: 10,\n};\n\n/** The deterministic EXPECT payload equivalent to a rubric text, or null when the rubric carries\n * semantics no deterministic assert can hold. */\nexport function determinableForm(text: string): string | null {\n const t = text.trim();\n // A mention-verb + quoted phrase, and nothing else → contains.\n const q = /^(?:the\\s+(?:reply|response|answer|output)\\s+)?(?:mentions?|includes?|contains?|says?|quotes?|uses?|references?)\\s+(?:the\\s+(?:word|phrase|term)\\s+)?\"([^\"]+)\"[.!]?$/i.exec(t);\n if (q) return `contains \"${q[1] ?? ''}\"`;\n // A mention-verb + one bare word, and nothing else → contains.\n const w = /^(?:the\\s+(?:reply|response|answer|output)\\s+)?(?:mentions?|includes?|contains?|says?|references?|names?)\\s+(?:the\\s+(?:word|phrase|term)\\s+)?([A-Za-z][A-Za-z0-9_-]*)[.!]?$/i.exec(t);\n if (w) return `contains \"${w[1] ?? ''}\"`;\n // A pure length bound → at most / at least. Only exact bound phrasings convert (\"fewer than 4\"\n // would need off-by-one arithmetic a suggestion should not silently do).\n const b = /^(?:is\\s+|stays?\\s+(?:to\\s+|within\\s+)?|keeps?\\s+(?:to\\s+)?|responds?\\s+in\\s+)?(at\\s+most|at\\s+least|no\\s+more\\s+than|no\\s+longer\\s+than)\\s+(\\d+|one|two|three|four|five|six|seven|eight|nine|ten)\\s+(sentences?|words?|characters?)(?:\\s+(?:long|or\\s+fewer|or\\s+less|max))?[.!]?$/i.exec(t);\n if (b) {\n const rawN = (b[2] ?? '').toLowerCase();\n const n = /^\\d+$/.test(rawN) ? Number(rawN) : NUM_WORDS[rawN];\n if (n === undefined) return null;\n const dir = /least/i.test(b[1] ?? '') ? 'at least' : 'at most';\n const unit = (b[3] ?? '').toLowerCase().replace(/s?$/, 's');\n return `${dir} ${n} ${unit}`;\n }\n return null;\n}\n\nfunction determinableExpects(rawLines: string[]): Diagnostic[] {\n return rubricExpectLines(rawLines).flatMap(({ line, start, text }) => {\n const form = determinableForm(text);\n if (form === null) return [];\n const raw = rawLines[line] ?? '';\n return [\n {\n source: 'prompt/determinable-expect',\n severity: 'info' as const,\n line,\n start,\n end: raw.length,\n message: `Judge-scored expectation with a deterministic form — the sub-bullet \\`- ${form}\\` checks this free, instantly, with zero variance.`,\n fix: { title: `→ ${form}`, replacement: form },\n },\n ];\n });\n}\n\nconst DOUBLE_WORD = /\\b(\\w+)\\s+\\1\\b/gi;\n\nfunction doubleWord(line: string, i: number): Diagnostic[] {\n const out: Diagnostic[] = [];\n // Quoted spans are literal examples / spoken lines, not the author's rule prose — a deliberate \"nine nine\"\n // (a zip read digit-by-digit) or a quoted stutter isn't a typo. Mask them so only unquoted repeats flag.\n const masked = maskQuotes(line);\n DOUBLE_WORD.lastIndex = 0;\n let m: RegExpExecArray | null;\n while ((m = DOUBLE_WORD.exec(masked)) !== null) {\n // `2.1. #greet Greet …` — the first token is a step ANCHOR (`#greet`), metadata not prose, so it doesn't\n // repeat the word after it. Skip a match whose first word is glued to a leading `#`.\n if (line[m.index - 1] === '#') continue;\n out.push({\n source: 'grammar/double-word',\n severity: 'warn',\n line: i,\n start: m.index,\n end: m.index + m[0].length,\n message: `Repeated word — \"${m[0]}\".`,\n fix: { title: 'Remove duplicate', replacement: m[1] ?? m[0] },\n });\n }\n return out;\n}\n\n// ── Spelling ──────────────────────────────────────────────────────────────────────────────────────────\n// A curated map of unambiguous misspellings → the correction. Every KEY is a non-word — never valid English in\n// any sense — so flagging it is always right: the same soundness bar as WORDY, with no dictionary, no guessing,\n// zero false positives, and identical behaviour in Node and the browser. Grow the list freely; the one rule is\n// never add an entry whose \"wrong\" form has ANY real reading (its/it's, wont, wether, calender) — those need\n// context, not a spell-check. Values are lowercase; case is re-applied to match how the typo was written.\nconst MISSPELLINGS: Record<string, string> = {\n // ie / ei\n recieve: 'receive', recieved: 'received', reciept: 'receipt', beleive: 'believe',\n beleived: 'believed', acheive: 'achieve', acheived: 'achieved', wierd: 'weird',\n freind: 'friend', peice: 'piece', thier: 'their', feild: 'field',\n // doubled / undoubled consonants\n occured: 'occurred', occuring: 'occurring', occurance: 'occurrence', occurence: 'occurrence',\n occassion: 'occasion', occassionally: 'occasionally', refered: 'referred', prefered: 'preferred',\n begining: 'beginning', commited: 'committed', comming: 'coming', runing: 'running',\n stoped: 'stopped', embarass: 'embarrass', embarassing: 'embarrassing', harrass: 'harass',\n accomodate: 'accommodate', paralell: 'parallel', threshhold: 'threshold',\n // -ant / -ent, -ance / -ence\n independant: 'independent', persistant: 'persistent', consistant: 'consistent',\n existance: 'existence', relevent: 'relevant',\n // multi-word run together (non-words)\n alot: 'a lot', infront: 'in front', incase: 'in case', aswell: 'as well',\n // -ly / -ally / -ful\n definately: 'definitely', seperately: 'separately', basicly: 'basically', publically: 'publicly',\n succesfully: 'successfully', immediatly: 'immediately', completly: 'completely', finaly: 'finally',\n truely: 'truly', usefull: 'useful', greatful: 'grateful',\n // high-frequency singles\n seperate: 'separate', neccessary: 'necessary', necesary: 'necessary', accross: 'across',\n untill: 'until', wich: 'which', teh: 'the', hte: 'the', becuase: 'because', adress: 'address',\n arguement: 'argument', buisness: 'business', concious: 'conscious', dissapoint: 'disappoint',\n enviroment: 'environment', enviromental: 'environmental', goverment: 'government',\n garantee: 'guarantee', gaurantee: 'guarantee', guage: 'gauge', langauge: 'language',\n lenght: 'length', strenght: 'strength', tommorow: 'tomorrow', tomorow: 'tomorrow',\n writen: 'written', succesful: 'successful', sucessful: 'successful', responce: 'response',\n reccomend: 'recommend', recomend: 'recommend', priviledge: 'privilege', familar: 'familiar',\n foward: 'forward',\n};\n\n// Try longer alternatives first so `recieved` wins over `recieve`; `\\b…\\b` keeps a typo from matching inside a\n// larger word (`Teheran` is safe from `teh`, `sandwich` from `wich`).\nconst MISSPELL_RE = new RegExp(\n `\\\\b(${Object.keys(MISSPELLINGS).sort((a, b) => b.length - a.length).join('|')})\\\\b`,\n 'gi',\n);\n\n// Re-apply the typo's own casing to the correction: ALLCAPS → ALLCAPS, Capitalized → Capitalized, else lower.\nfunction recase(correct: string, matched: string): string {\n if (matched === matched.toUpperCase() && matched !== matched.toLowerCase()) return correct.toUpperCase();\n const first = matched[0] ?? '';\n if (first !== '' && first === first.toUpperCase() && first !== first.toLowerCase()) {\n return (correct[0] ?? '').toUpperCase() + correct.slice(1);\n }\n return correct;\n}\n\n// Blank the spans that aren't prose the model reads as words — {refs}, [vars], `inline code`, and URLs — so a\n// spelling or spacing check never fires inside an identifier or an address. Length-preserving, so the offsets\n// stay aligned with the raw line and a diagnostic still lands on exactly the offending characters.\nfunction maskNonProse(line: string): string {\n const blankSpan = (m: string): string => ' '.repeat(m.length);\n return line\n .replace(/\\b(?:https?:\\/\\/|www\\.)\\S+/gi, blankSpan)\n .replace(/`[^`]*`/g, blankSpan)\n .replace(/[{[][^}\\]]*[}\\]]/g, blankSpan);\n}\n\nfunction spelling(line: string, i: number): Diagnostic[] {\n const out: Diagnostic[] = [];\n const masked = maskNonProse(line);\n MISSPELL_RE.lastIndex = 0;\n let m: RegExpExecArray | null;\n while ((m = MISSPELL_RE.exec(masked)) !== null) {\n const hit = m[0];\n const correct = MISSPELLINGS[hit.toLowerCase()];\n if (correct === undefined) continue;\n const fixed = recase(correct, hit);\n out.push({\n source: 'spelling/typo',\n severity: 'warn',\n line: i,\n start: m.index,\n end: m.index + hit.length,\n message: `Misspelling — \"${hit}\" should be \"${fixed}\".`,\n fix: { title: `→ \"${fixed}\"`, replacement: fixed },\n });\n }\n return out;\n}\n\n// A space before sentence punctuation (`word ,`) is always a typo in prose — the space is the error, so the fix\n// deletes it. `.` is deliberately excluded (decimals, ellipses, and abbreviations make a leading-space `.`\n// ambiguous); a `:`/`;` followed by a paren is left alone so a `:)` / `;)` emoticon survives.\nconst SPACE_BEFORE_PUNCT = /(\\w|[\"')\\]])(\\s+)([,;:!?]+)/g;\n\nfunction spacing(line: string, i: number): Diagnostic[] {\n const out: Diagnostic[] = [];\n const masked = maskNonProse(line);\n SPACE_BEFORE_PUNCT.lastIndex = 0;\n let m: RegExpExecArray | null;\n while ((m = SPACE_BEFORE_PUNCT.exec(masked)) !== null) {\n const punct = m[3] ?? '';\n const after = masked[m.index + m[0].length];\n if (/^[:;]/.test(punct) && (after === ')' || after === '(')) continue; // emoticon, not punctuation\n const spaceStart = m.index + (m[1] ?? '').length;\n const spaceEnd = spaceStart + (m[2] ?? '').length;\n out.push({\n source: 'grammar/spacing',\n severity: 'info',\n line: i,\n start: spaceStart,\n end: spaceEnd,\n message: `Space before \"${punct}\" — remove it.`,\n fix: { title: 'Remove space', replacement: '' },\n });\n }\n return out;\n}\n\n// A lone lowercase `i` used as the pronoun — `i think`, `i'll`, `i've` — is always capital `I`. Bounded so it\n// never touches a real word (`input`, `id`), a list/Roman-numeral `i.` / `i)`, or an abbreviation like `i.e.`;\n// a following apostrophe is allowed so contractions (`i'm` → `I'm`) are caught. The fix capitalizes just the `i`.\nconst STANDALONE_I = /(^|[^\\w'])(i)(?=$|[\\s,;!?]|'[a-z])/g;\n\nfunction standaloneI(line: string, i: number): Diagnostic[] {\n const out: Diagnostic[] = [];\n const masked = maskNonProse(line);\n STANDALONE_I.lastIndex = 0;\n let m: RegExpExecArray | null;\n while ((m = STANDALONE_I.exec(masked)) !== null) {\n const start = m.index + (m[1] ?? '').length;\n out.push({\n source: 'grammar/standalone-i',\n severity: 'warn',\n line: i,\n start,\n end: start + 1,\n message: 'Lowercase \"i\" — the pronoun is always capital \"I\".',\n fix: { title: '→ \"I\"', replacement: 'I' },\n });\n }\n return out;\n}\n\n// ── Unknown-word (injected dictionary) ────────────────────────────────────────────────────────────────\n// The corrector above only knows a FIXED set of typos, so arbitrary misspellings (`ajf`, `esje`) slip past it.\n// Catching those needs a real dictionary — but the pure core ships none: there is no cross-platform native one\n// (browsers don't expose spellcheck to JS; Node has no built-in), and bundling a wordlist here would break the\n// zero-dependency rule. So the dictionary is INJECTED — the edge (nspell in the browser / CLI) supplies an\n// `isWord` predicate and this provider flags any prose token it rejects. No predicate → the check is skipped, so\n// Node, the browser, and the tests behave identically with or without a dictionary. It is `info`-only and\n// heavily guarded (proper nouns, identifiers, acronyms, in-doc symbols, and known typos are all skipped): unlike\n// every other check this is a HEURISTIC, not a proof, so the user's custom-word list is the escape hatch for the\n// false positives that remain.\nexport type SpellChecker = (word: string) => boolean;\n\n// A prose word: a letter, then letters or an internal apostrophe (`user's`, `don't`). Hyphens split compounds\n// into their parts, and digits/underscores can't appear — so identifiers never arrive here as one token.\nconst WORD_TOKEN = /[A-Za-z][A-Za-z'’]*/g;\n\nfunction unknownWords(line: string, i: number, isWord: SpellChecker, allow: Set<string>): Diagnostic[] {\n const out: Diagnostic[] = [];\n const masked = maskNonProse(line);\n WORD_TOKEN.lastIndex = 0;\n let m: RegExpExecArray | null;\n while ((m = WORD_TOKEN.exec(masked)) !== null) {\n const tok = m[0];\n if (tok.length < 3) continue; // 1–2 letters (`a`, `is`, `to`) — never worth flagging\n // An uppercase anywhere but the first letter marks an identifier/brand/acronym — `iPhone`, `TypeScript`,\n // `TTS`, `McCoy`. A sentence-initial capital (`Receive`) is still checked, so a capitalized typo is caught.\n if (/[A-Z]/.test(tok.slice(1))) continue;\n const lower = tok.toLowerCase().replace(/[’']s$/, ''); // fold a trailing possessive: `user's` → `user`\n if (lower.length < 3) continue;\n if (allow.has(lower)) continue; // a symbol this document declares/imports\n if (Object.prototype.hasOwnProperty.call(MISSPELLINGS, lower)) continue; // the corrector owns known typos\n if (isWord(tok) || isWord(lower)) continue;\n out.push({\n source: 'spelling/unknown-word',\n severity: 'info',\n line: i,\n start: m.index,\n end: m.index + tok.length,\n message: `Unrecognized word — \"${tok}\" isn't in the dictionary. Fix the spelling, or add it to your dictionary.`,\n });\n }\n return out;\n}\n\n// A conditional opened with a GUARD keyword (IF / WHEN / UNLESS / WHILE / WHENEVER / ELSE IF) must say what\n// happens — it needs a THEN. Without one its body never lowers, so the rule is invisible to the checker. The\n// opener set is DERIVED from GUARDS, so every guard keyword is covered — not just IF (FOR EACH, a loop, is exempt).\nconst GUARD_OPENER_RE = new RegExp(`^\\\\s*(${keywordAlternation(GUARD_OPENERS)})\\\\b`, 'i');\nfunction conditionalNeedsThen(raw: string, i: number): Diagnostic[] {\n const parsed = parseLine(raw);\n if (classifyClause(parsed.clause) !== 'conditional') return [];\n const opener = parsed.clause.match(GUARD_OPENER_RE);\n if (!opener || /\\bTHEN\\b/i.test(parsed.clause)) return []; // not a guard opener, or already has a THEN\n const kw = (opener[1] ?? 'IF').replace(/\\s+/g, ' ').toUpperCase();\n const lead = raw.length - raw.trimStart().length;\n return [\n {\n source: 'typeglish/if-then',\n severity: 'warn',\n line: i,\n start: lead,\n end: raw.length,\n message: `${kw} needs a THEN — write ${kw} <condition> THEN <action>.`,\n },\n ];\n}\n\n// An @{name} pointer must resolve to a DECLARED name: a $REQUIRE variable, a $DEFINE, an\n// `X IS …` object, or a file-import alias. A dangling pointer is a compile error — left alone it would\n// leak to the model as a raw runtime variable \"{name}\" filled by unvetted state. Names compare\n// case-insensitively, so @{PERSONA} still matches a `Persona IS …`.\n//\n// BARE braces are PROSE — no expansion, no checks, no meaning (one reference family: the pointer). The\n// single exception is the migration guard: a bare {name} that wraps a DECLARED name is the pre-pointer\n// reference spelling, and letting it through would silently stop expanding what the author meant to\n// expand — so it errors with the pointer rewrite. Braces around an unknown word are inert.\nfunction undefinedReference(raw: string, i: number, declared: Set<string>, fileAliases: Set<string>): Diagnostic[] {\n const out: Diagnostic[] = [];\n const sigil = /@\\{([A-Za-z][A-Za-z0-9_.]*)\\}/g;\n let m: RegExpExecArray | null;\n while ((m = sigil.exec(raw)) !== null) {\n const name = m[1] ?? '';\n const key = name.toLowerCase();\n const base = key.split('.')[0] ?? key;\n // A file import is SECTION-family — the bracket is the type, so @{alias} is the wrong bracket.\n if (fileAliases.has(base)) {\n out.push({\n source: 'structure/undefined-ref',\n severity: 'error',\n line: i,\n start: m.index,\n end: m.index + m[0].length,\n message: `Wrong bracket — \"${base}\" is a file import, and a file transcludes as a SECTION pointer. Replace @{${name}} with @<${key}>.`,\n fix: { title: `Point with @<${key}>`, replacement: `@<${key}>` },\n });\n continue;\n }\n if (declared.has(key) || declared.has(base)) continue;\n out.push({\n source: 'structure/undefined-ref',\n severity: 'error',\n line: i,\n start: m.index,\n end: m.index + m[0].length,\n message: `Dangling pointer — @{${name}} names nothing. Declare it with \"$REQUIRE variable ${name}\" (a runtime variable), or \"${name} IS …\" (a fixed value).`,\n });\n }\n // The migration guard: a DECLARED name in a retired reference spelling — bare braces (any symbol) or\n // bare squares (the old transclusion form, file aliases only). The rewrite is kind-aware: a file\n // import points with the section bracket, everything else with the variable bracket. Unknown words\n // in braces/squares are PROSE — inert, no finding.\n const bare = /(?<!@)\\{([A-Za-z][A-Za-z0-9_]*(?:[.#][A-Za-z0-9_]+)?)\\}|(?<!@)\\[([a-z][a-z0-9_]*(?:[.#][a-z0-9_]+)?)\\]/gi;\n while ((m = bare.exec(raw)) !== null) {\n const name = (m[1] ?? m[2]) ?? '';\n const square = m[1] === undefined;\n const key = name.toLowerCase();\n const base = key.split(/[.#]/)[0] ?? key;\n const isFile = fileAliases.has(base);\n if (square && !isFile) continue; // squares only ever transcluded files — anything else is prose\n if (!square && !isFile && !declared.has(key) && !declared.has(base)) continue; // prose braces\n const pointer = isFile ? `@<${key}>` : `@{${key}}`;\n out.push({\n source: 'structure/retired-brace-ref',\n severity: 'error',\n line: i,\n start: m.index,\n end: m.index + m[0].length,\n message: `Bare ${square ? 'squares' : 'braces'} are prose — they no longer reference. \"${name}\" is ${isFile ? 'a file import' : 'a declared name'}, so point at it: replace ${m[0]} with ${pointer}.`,\n fix: { title: `Point with ${pointer}`, replacement: pointer },\n });\n }\n return out;\n}\n\n// The migration guard for the literal-zone sigil: `<=name>` / `</=name>` is the RETIRED spelling — the\n// sigil is the quote pair now (`<\"name\"> … </\"name\">`), \"quotes are the one escape\" (§6) at section\n// scale. The rewrite is mechanical, so the fix carries it. A half-quoted tag (`<\"name>` missing its\n// closing quote) gets the same treatment. Both scan the QUOTE-MASKED line: a well-formed `<\"x\">` masks\n// away whole (it IS a quoted span), and a retired form inside \"…\" is a sample, not a finding; zone and\n// def interiors are swept by the caller's gates + the final sweep.\nfunction retiredLiteralSigil(raw: string, i: number): Diagnostic[] {\n const out: Diagnostic[] = [];\n const masked = maskQuotes(raw);\n // Rebuild the rewrite from the RAW slice (masking may have blanked attr text), same span. Two literal\n // `source:` emits below so the codes.test.ts ratchet scans each one.\n const rewriteAt = (m: RegExpExecArray): { found: string; rewrite: string } | null => {\n const found = raw.slice(m.index, m.index + m[0].length);\n const mm = found.match(/^<(\\/?)[=\"]([a-z][a-z0-9_]*)\"?((?:\\s[^>]*)?)>$/i);\n return mm ? { found, rewrite: `<${mm[1] ?? ''}\"${mm[2] ?? ''}\"${mm[3] ?? ''}>` } : null;\n };\n let m: RegExpExecArray | null;\n const retired = /<\\/?=[a-z][a-z0-9_]*(?:\\s[^>]*)?>/gi;\n while ((m = retired.exec(masked)) !== null) {\n const r = rewriteAt(m);\n if (!r) continue;\n out.push({\n source: 'structure/retired-literal-sigil',\n severity: 'error',\n line: i,\n start: m.index,\n end: m.index + m[0].length,\n message: `The \"=\" literal-zone sigil is retired — the sigil is the quote pair now (one escape, every scale). Replace ${r.found} with ${r.rewrite}.`,\n fix: { title: `Quote it: ${r.rewrite}`, replacement: r.rewrite },\n });\n }\n const half = /<\\/?\"[a-z][a-z0-9_]*(?!\")(?:\\s[^>]*)?>/gi;\n while ((m = half.exec(masked)) !== null) {\n const r = rewriteAt(m);\n if (!r) continue;\n out.push({\n source: 'structure/half-quoted-literal',\n severity: 'error',\n line: i,\n start: m.index,\n end: m.index + m[0].length,\n message: `A literal section quotes its WHOLE name — both quotes, ${r.rewrite}.`,\n fix: { title: `Quote it: ${r.rewrite}`, replacement: r.rewrite },\n });\n }\n return out;\n}\n\n// `@[tool]` is THE tool pointer — legal for a DEFINED tool (inline it emits the checked bare name; alone\n// on a line it surfaces the schema's `name — description`) and for an IMPORTED tool (bare name, nothing to\n// inline). Only an UNKNOWN name is a mistake: nothing to bind, nothing to check. Skips a `$TOOL` body via\n// the caller's mask, and comments / fences / headings via the caller's content guard, where `@[…]` is text.\nfunction undefinedToolInline(raw: string, i: number, defined: Set<string>, imported: Set<string>): Diagnostic[] {\n const out: Diagnostic[] = [];\n const re = /@\\[([a-z][a-z0-9_]*)\\]/gi;\n let m: RegExpExecArray | null;\n while ((m = re.exec(raw)) !== null) {\n const name = m[1] ?? '';\n if (defined.has(name.toLowerCase()) || imported.has(name.toLowerCase())) continue;\n out.push({\n source: 'structure/undefined-tool-inline',\n severity: 'error',\n line: i,\n start: m.index,\n end: m.index + m[0].length,\n message: `@[${name}] — no $TOOL or $IMPORT tool named \"${name}\" in this file. Define it (\"$TOOL ${name}\") or import it (\"$IMPORT tool ${name}\") so the pointer has a target.`,\n });\n }\n return out;\n}\n\n// The visibility guard: an EXACT tool name (defined or imported) written as bare prose is a reference the\n// compiler cannot bind — a rename strands it silently, and the logic plane can't prove rules about it. It\n// errors, carrying the pointer rewrite as the fix; quoting is the escape when the author means the NAME as\n// plain text (a sample, not a reference). Scans the quote-masked line with every pointer and tag span\n// blanked (a pointed reference IS the fix; a section may share a tool's name); SNAKE_RE's shape means only\n// underscore-bearing names participate — the same bar the reference scan uses.\nfunction bareToolRef(raw: string, i: number, toolKeys: Set<string>): Diagnostic[] {\n if (toolKeys.size === 0) return [];\n const out: Diagnostic[] = [];\n const blank = (s: string, re: RegExp): string => s.replace(re, (m2) => '_'.repeat(m2.length));\n let masked = maskQuotes(stripAnnotation(stripInlineComment(raw)));\n masked = blank(masked, /@\\{[^}\\n]*\\}|@<[^>\\n]*>|@\\[[^\\]\\n]*\\]/g); // pointers — already references\n masked = blank(masked, new RegExp(`<\\\\/?${TAG_NAME_SRC}(?:\\\\s[^>]*)?>`, 'gi')); // tag spans (clause.ts's one shape)\n SNAKE_RE.lastIndex = 0;\n let m: RegExpExecArray | null;\n while ((m = SNAKE_RE.exec(masked)) !== null) {\n const key = m[0].toLowerCase();\n if (!toolKeys.has(key)) continue;\n out.push({\n source: 'structure/bare-tool-ref',\n severity: 'error',\n line: i,\n start: m.index,\n end: m.index + m[0].length,\n message: `\"${m[0]}\" is a tool, but this mention is bare prose — the compiler cannot bind it. Point it with @[${key}] (a checked reference), or quote it (\"${m[0]}\") to speak the name as plain text.`,\n fix: { title: `Point with @[${key}]`, replacement: `@[${key}]` },\n });\n }\n return out;\n}\n\n// Normalize a declaration item (an AND conjunct or an INCLUDING list member) for comparison.\nfunction normItem(s: string): string {\n return s.toLowerCase().replace(/[.,;:!?]+$/, '').replace(/\\s+/g, ' ').trim();\n}\n\n// Normalize a value to an enum-member key: strip a leading article so `an alligator` matches the\n// declared member `alligator`.\nfunction normMember(s: string): string {\n return s\n .toLowerCase()\n .replace(/^(?:a|an|the)\\s+/, '')\n .replace(/[.,;:!?]+$/, '')\n .replace(/\\s+/g, ' ')\n .trim();\n}\n\n// Are any item of A and any item of B different members of a common disjoint (\"one of\") set?\nfunction membersDisjoint(a: string[], b: string[], sets: Set<string>[]): boolean {\n for (const ai of a) {\n const ma = normMember(ai);\n if (ma === '') continue;\n for (const bj of b) {\n const mb = normMember(bj);\n if (mb !== '' && ma !== mb && sets.some((s) => s.has(ma) && s.has(mb))) return true;\n }\n }\n return false;\n}\n\n// Two declared values of the same object that are mutually-exclusive members of a closed \"one of\" set\n// can't both hold — a real contradiction. Plain re-declaration is NOT flagged: an object accumulates its\n// traits, so \"You are X\" then \"You are also Y\" is fine. Only the closed-enum clash is an error.\nfunction conflictingDeclarations(rawLines: string[], disp: (i: number) => number = (i) => i + 1): Diagnostic[] {\n const disjointSets: Set<string>[] = [];\n for (const raw of rawLines) {\n const e = findEnumDeclaration(raw);\n if (e) disjointSets.push(new Set(e.members.map(normMember).filter((x) => x !== '')));\n }\n if (disjointSets.length === 0) return [];\n const decls = resolveDeclarations(rawLines);\n const aliases = aliasMap(decls);\n const byName = new Map<string, { line: number; items: string[] }[]>();\n for (const d of decls) {\n if (d.negated || d.path || d.owns || d.items.length === 0) continue;\n const key = aliases.get(d.name.toLowerCase()) ?? d.name.toLowerCase();\n const list = byName.get(key);\n if (list) list.push({ line: d.line, items: d.items });\n else byName.set(key, [{ line: d.line, items: d.items }]);\n }\n const out: Diagnostic[] = [];\n const seen = new Set<string>();\n for (const decls of byName.values()) {\n for (let a = 0; a < decls.length; a += 1) {\n for (let b = a + 1; b < decls.length; b += 1) {\n const da = decls[a];\n const db = decls[b];\n if (!da || !db || !membersDisjoint(da.items, db.items, disjointSets)) continue;\n for (const [self, peer] of [\n [da, db],\n [db, da],\n ] as const) {\n const dedupe = `${self.line}|${peer.line}`;\n if (seen.has(dedupe)) continue;\n seen.add(dedupe);\n const raw = rawLines[self.line] ?? '';\n const lead = raw.length - raw.trimStart().length;\n // Name BOTH assertions: the agent must see the two members that collide, or it can only\n // guess which side of the closed set to change.\n out.push({\n source: 'logic/redeclaration',\n severity: 'error',\n line: self.line,\n start: lead,\n end: raw.length,\n message: `Mutually-exclusive values — this line asserts \"${self.items.join(', ')}\" while line ${disp(peer.line)} asserts \"${peer.items.join(', ')}\", and both belong to one closed \"one of\" set (an object holds exactly ONE member). Keep one assertion, or widen the declared set.`,\n });\n }\n }\n }\n }\n return out;\n}\n\n// The declaration-axis dual of checkRedundancy: the same name bound to a value that adds nothing new.\n// Two shapes, both a warn (the prompt still means one thing — a declaration is stripped from the output,\n// so this isn't token bloat but drift risk: two bindings that can quietly diverge):\n// • IDENTICAL — `you are joe` twice.\n// • SUBSET — `you = my friend` after `you = my guy AND my friend`; its items are already asserted.\n// Items are conjunctive (the name has all of them), so containment is exactly redundancy. Disjoint values\n// (`you are friendly` / `you are helpful`) are NOT flagged — an object accumulates traits, so that's two\n// facts, not a duplicate. Negations, possessions, and ownership are skipped; their own checks own them,\n// and the closed-enum clash stays an ERROR in conflictingDeclarations (disjoint members are never a subset).\nfunction declarationRedundancy(rawLines: string[], disp: (i: number) => number = (i) => i + 1): Diagnostic[] {\n const decls = resolveDeclarations(rawLines);\n const aliases = aliasMap(decls);\n const canon = (name: string): string => aliases.get(name.toLowerCase()) ?? name.toLowerCase();\n interface Entry {\n line: number;\n items: Set<string>;\n }\n const byName = new Map<string, Entry[]>();\n for (const d of decls) {\n if (d.negated || d.path || d.owns) continue;\n const items = new Set(d.items.map(normItem).filter((x) => x !== ''));\n if (items.size === 0) continue;\n const key = canon(d.name);\n const list = byName.get(key);\n if (list) list.push({ line: d.line, items });\n else byName.set(key, [{ line: d.line, items }]);\n }\n const out: Diagnostic[] = [];\n const flagged = new Set<number>();\n for (const [name, entries] of byName) {\n if (entries.length < 2) continue;\n for (const d of entries) {\n if (flagged.has(d.line)) continue;\n // Is everything d asserts already covered by another declaration e of the same name? A strict subset\n // is redundant either way; two identical declarations pin the blame on the later one (e is earlier).\n const cover = entries.find(\n (e) =>\n e.line !== d.line &&\n [...d.items].every((it) => e.items.has(it)) &&\n (d.items.size < e.items.size || e.line < d.line),\n );\n if (!cover) continue;\n flagged.add(d.line);\n const raw = rawLines[d.line] ?? '';\n const lead = raw.length - raw.trimStart().length;\n const identical = d.items.size === cover.items.size;\n out.push({\n source: 'clarity/duplicate',\n severity: 'warn',\n line: d.line,\n start: lead,\n end: raw.length,\n message: identical\n ? `Duplicate declaration — \"${name}\" is already declared identically on line ${disp(cover.line)}. Remove this one.`\n : `Redundant declaration — everything \"${name}\" asserts here is already covered by line ${disp(cover.line)}. Merge or remove it.`,\n });\n }\n }\n return out;\n}\n\n// A direct negation contradiction: an item asserted positively AND negated for the same name —\n// `You ARE friendly` (or `… friendly AND helpful`) against `You ARE NOT friendly`. Items come from\n// AND-conjuncts and INCLUDING lists alike. Sound and syntactic; Z3 will generalize it later.\nfunction negatedFactConflicts(rawLines: string[], disp: (i: number) => number = (i) => i + 1): Diagnostic[] {\n const decls = resolveDeclarations(rawLines);\n const aliases = aliasMap(decls);\n const canon = (name: string): string => aliases.get(name.toLowerCase()) ?? name.toLowerCase();\n const facts = new Map<string, { name: string; item: string; pos: number[]; neg: number[] }>();\n for (const d of decls) {\n // A possession's value belongs to its property (`You.name`) or is an owned thing — not the object's own\n // fact list. Comparing it against `You`'s traits would let one field's value false-conflict with another.\n // Property contradictions are handled separately, with cardinality, by propertyConflicts.\n if (d.path || d.owns) continue;\n for (const rawItem of d.items) {\n const item = normItem(rawItem);\n if (item === '') continue;\n const key = `${canon(d.name)}|${item}`;\n const rec = facts.get(key) ?? { name: d.name, item: rawItem.trim(), pos: [], neg: [] };\n (d.negated ? rec.neg : rec.pos).push(d.line);\n facts.set(key, rec);\n }\n }\n const out: Diagnostic[] = [];\n for (const rec of facts.values()) {\n if (rec.pos.length === 0 || rec.neg.length === 0) continue;\n const posLine = rec.pos[0] ?? 0;\n const negLine = rec.neg[0] ?? 0;\n for (const ln of [posLine, negLine]) {\n const raw = rawLines[ln] ?? '';\n const lead = raw.length - raw.trimStart().length;\n const other = ln === posLine ? negLine : posLine;\n out.push({\n source: 'logic/contradiction',\n severity: 'error',\n line: ln,\n start: lead,\n end: raw.length,\n message: `Contradiction — \"${rec.name}\" is asserted to be and not be \"${rec.item}\" (line ${disp(other)}).`,\n });\n }\n }\n return out;\n}\n\n// Property consistency from possessions. A single-valued field (`is`/`am`) holds ONE value, so two\n// DIFFERENT values contradict (`Your name is Joe` + `Your name is Bob`). Any field — single or set —\n// contradicts if the same value is both asserted and denied (`is X` + `is NOT X`). A set field (`are`)\n// otherwise accumulates. Keyed by owner + dotted property path, so `You.name` and `You.role` are\n// independent, and a nested `You.company.policy` is its own field.\nfunction propertyConflicts(rawLines: string[]): Diagnostic[] {\n interface Field {\n cardinality: 'one' | 'many';\n pos: Map<string, number[]>;\n neg: Map<string, number[]>;\n }\n const decls = resolveDeclarations(rawLines);\n const aliases = aliasMap(decls);\n const canon = (name: string): string => aliases.get(name.toLowerCase()) ?? name.toLowerCase();\n const fields = new Map<string, Field>();\n for (const d of decls) {\n if (!d.path) continue;\n const key = `${canon(d.name)}|${d.path.join('.')}`;\n const rec: Field = fields.get(key) ?? { cardinality: 'one', pos: new Map(), neg: new Map() };\n // A field is single-valued only if EVERY assignment is a lone `is` value; one list/are makes it a set.\n if (d.cardinality === 'many') rec.cardinality = 'many';\n for (const rawItem of d.items) {\n const item = normItem(rawItem);\n if (item === '') continue;\n const bucket = d.negated ? rec.neg : rec.pos;\n bucket.set(item, [...(bucket.get(item) ?? []), d.line]);\n }\n fields.set(key, rec);\n }\n const out: Diagnostic[] = [];\n const seen = new Set<number>();\n const flag = (lines: number[], message: string): void => {\n for (const ln of lines) {\n if (seen.has(ln)) continue;\n seen.add(ln);\n const raw = rawLines[ln] ?? '';\n const lead = raw.length - raw.trimStart().length;\n out.push({ source: 'logic/contradiction', severity: 'error', line: ln, start: lead, end: raw.length, message });\n }\n };\n for (const [key, rec] of fields) {\n const label = key.replace('|', '.');\n for (const [item, posLines] of rec.pos) {\n const negLines = rec.neg.get(item);\n if (negLines && negLines.length > 0) {\n flag([posLines[0] ?? 0, negLines[0] ?? 0], `Contradiction — \"${label}\" is both assigned and denied the value \"${item}\".`);\n }\n }\n if (rec.cardinality === 'one' && rec.pos.size >= 2) {\n const vals = [...rec.pos.keys()].map((v) => `\"${v}\"`).join(', ');\n flag(\n [...rec.pos.values()].map((ls) => ls[0] ?? 0),\n `Contradiction — single-valued \"${label}\" is assigned ${rec.pos.size} different values (${vals}).`,\n );\n }\n }\n return out;\n}\n\n// Exclusive ownership: a thing has ONE owner. Two DIFFERENT owners claiming the same thing — `the decision\n// is yours` (you) and `the decision is mine` (i) — can't both hold. Owners are resolved through aliases, so\n// `the call is yours` and `the call is Sarah's` agree when `You are Sarah`; the same owner repeated is fine.\nfunction ownershipConflicts(rawLines: string[]): Diagnostic[] {\n const decls = resolveDeclarations(rawLines);\n const aliases = aliasMap(decls);\n const canon = (name: string): string => aliases.get(name.toLowerCase()) ?? name.toLowerCase();\n // owned-thing key → (resolved owner key → the lines that claim it).\n const things = new Map<string, Map<string, number[]>>();\n for (const d of decls) {\n if (!d.owns) continue;\n const thing = normMember(d.owns);\n if (thing === '') continue;\n const owner = canon(d.name);\n const owners = things.get(thing) ?? new Map<string, number[]>();\n owners.set(owner, [...(owners.get(owner) ?? []), d.line]);\n things.set(thing, owners);\n }\n const out: Diagnostic[] = [];\n const seen = new Set<number>();\n for (const [thing, owners] of things) {\n if (owners.size < 2) continue; // one owner — however many times it's stated — is consistent\n const names = [...owners.keys()].join(', ');\n for (const ln of [...owners.values()].flat().sort((a, b) => a - b)) {\n if (seen.has(ln)) continue;\n seen.add(ln);\n const raw = rawLines[ln] ?? '';\n const lead = raw.length - raw.trimStart().length;\n out.push({\n source: 'logic/contradiction',\n severity: 'error',\n line: ln,\n start: lead,\n end: raw.length,\n message: `Contradiction — \"${thing}\" is owned by ${owners.size} different owners (${names}).`,\n });\n }\n }\n return out;\n}\n\n/** Collect static diagnostics. Skips comments, blanks, headings, and fenced code. An injected `isWord`\n * dictionary (from the edge) turns on the unknown-word check; without it the pure core ships no dictionary. */\nexport function runDiagnostics(\n rawLines: string[],\n // Dormant: fed the keyword-overlap \"untested constraint\" warn, removed as noise — lexical overlap\n // can't tell whether a rubric dimension actually tests a rule (false alarms on paraphrase, false\n // silence on incidental shared words), and its phrasing hid stronger findings under a vaguer one.\n // The parameter stays so call sites are stable; the SEMANTIC rubric-coverage finding (entailment\n // between rubric descriptions and line atoms, with receipts, via the async tier) will reclaim it.\n _rubric: RubricDim[],\n opts: { isWord?: SpellChecker; addressees?: readonly string[]; glishConfig?: string } = {},\n): Diagnostic[] {\n const render = renderLines(rawLines);\n // A $TOOL block is its own SCOPE: its description is model-read English (so the per-line text checks still\n // run on it), but its statements must not cross into the PROMPT's logic — a MUST in a tool description is not\n // a rule of the conversation, and a param's `one of:` is not a prompt enum. The logic tiers below therefore\n // read `scoped` (tool spans blanked); masked lines are empty there, so they can never produce or anchor a\n // conflict, and every anchor still lands on a line whose text matches the original.\n const toolMask = toolBlockMask(rawLines);\n // An <examples> block's interior is a literal illustration zone — blank it for the logic/clarity/style tiers\n // too, so example content never anchors a finding OR counts as a duplicate/conflict of a real rule outside it.\n const exMask = examplesMask(rawLines);\n // The SPLIT under exMask: `zoneMask` is the illustration zones (<examples> / <\"name\">) alone;\n // `defMask` is definition-list lines. A def entry is PARSE-literal (samples inside never open\n // phantom zones or bind) but CONTENT-checked — it is model-read reference prose, so the character\n // set and statement termination apply there, where a zone stays fully illustrative.\n const defMask = defListMask(rawLines);\n const zoneMask = illustrationZoneMask(rawLines);\n // A `@@` statement annotation is inert authoring metadata — exclude it from analysis entirely. stripAnnotation\n // blanks a leading `@@` line and drops a trailing `@@ note` (keeping its statement), so no tier sees the note.\n // Tag-only lines are STRUCTURE, not statements — blanked so no content tier ever reads a close tag as\n // prose (a `</x>` normalizes to the same text as its `<x>`, which would flag every section as redundant\n // against its own closing tag).\n const scoped = rawLines.map((l, i) => (toolMask[i] || exMask[i] || TAG_ONLY_LINE.test(l) ? '' : stripAnnotation(l)));\n // THE ADDRESSEE MODEL — who `you` is, resolved ONCE from the prompt's own declarations (aliases +\n // roles, prompt.ts) and handed to every deontic checker, so `Claude must X` and bare `never X` meet.\n const addressees = addresseeSubjects(scoped, opts.addressees ?? []);\n // Every human-facing line reference speaks GUTTER numbers (content ordinals — clause.ts owns the rule).\n // Computed over the TRUE raw lines: masked/blanked copies would drop ordinals the gutter still shows.\n const ordinals = lineOrdinals(rawLines);\n const disp = (i: number): number => displayLine(ordinals, i);\n // ONE structure parse serves the declared-set, the allow-set, and the layout pass below.\n const doc = buildStructure(rawLines);\n // `@[tool]` resolves against DEFINED tools; imported tool keys only shape the error message (defined ⨯ imported).\n const parsed = parseTools(rawLines);\n const definedTools = parsed.tools;\n const toolDefKeys = new Set(definedTools.map((t) => t.name.toLowerCase()));\n const importedToolKeys = new Set(doc.imports.filter((im) => im.kind === 'tool').map((im) => im.key));\n // The full referenceable-tool surface — what a bare prose mention is checked against.\n const allToolKeys = new Set([...toolDefKeys, ...importedToolKeys]);\n const declared = new Set<string>();\n const decls = resolveDeclarations(rawLines);\n for (const d of decls) {\n // A negated copula doesn't bind; names are lowercased so @{Name} and @{name} both resolve.\n if (!d.negated) declared.add(d.name.toLowerCase());\n }\n // An alias is another known name for an object (`You are Sarah` → `Sarah`), so an @{Sarah} ref isn't undefined.\n for (const aliasKey of aliasMap(decls).keys()) declared.add(aliasKey);\n // The other things that DECLARE an @{name} pointer: required variables ($REQUIRE variable) and $DEFINE\n // names. File-import aliases are SECTION-family (they transclude with @<alias>), so they live in their\n // own set — the checker uses it to hand back the right bracket. Keys are already lowercased.\n for (const im of doc.imports) if (im.kind === 'variable') declared.add(im.key);\n for (const name of doc.defines.keys()) declared.add(name);\n const fileAliases = new Set(doc.fileImports.map((f) => f.key));\n\n // Unknown-word allow-set: words the DOCUMENT itself defines — declared names + aliases, and (only when a\n // dictionary is injected) imported tool/route/input names, variables, and step anchors — each split into word\n // parts so a domain term defined here (`Acme Support`, `book_appointment`) is never flagged. IMPORT manifest\n // lines are skipped wholesale: scaffolding, not prose. Built once; the per-line check consults both.\n const allow = new Set<string>();\n const addAllow = (s: string): void => {\n for (const part of s.toLowerCase().match(/[a-z][a-z'’]*/g) ?? []) if (part.length >= 3) allow.add(part);\n };\n for (const name of declared) addAllow(name);\n let importLines = new Set<number>();\n if (opts.isWord) {\n // Skip both command kinds: a config value (`claude-opus-4`) is config, not prose, so it's never a \"misspelling\".\n importLines = new Set([...doc.importLines, ...doc.configLines]);\n for (const im of doc.imports) addAllow(im.name);\n for (const base of doc.variables.keys()) addAllow(base);\n for (const anchor of doc.index.anchors) addAllow(anchor);\n // A defined tool's name and param names are the document's own vocabulary, not misspellings.\n for (const t of definedTools) {\n addAllow(t.name);\n for (const p of t.params) addAllow(p.name);\n }\n }\n\n const out: Diagnostic[] = [];\n const exempt = proseExemptLines(rawLines);\n // $TEST blocks and <$CONFIG> sections are scaffolding (stripped at render) — style/grammar rules\n // don't nag them. Secrets still scan them: a key there is committed to the file, and that is the leak.\n const testLines = testBlockLines(rawLines);\n // $EXAMPLE blocks are scaffolding for the checker too — the block's `- input::`/`- good::`/`- bad::`\n // rows are control-plane authoring structure; the model reads only the emitted few-shot (render owns\n // that), which is example content, conventionally exempt from rule/style nags exactly like <examples>.\n const exampleLines = exampleBlockLines(rawLines);\n const cfgMask = configSectionMask(rawLines);\n // Deterministic chain ARM lines (IF $x …: / ELSE IF …: / ELSE:) — structure, not prose: the\n // prose-shaped nags (an IF wanting its THEN) never apply to them. Arm BODIES stay ordinary\n // statements and keep every check.\n const chainArms = new Set(parseSwitches(rawLines).flatMap((b) => (b.error === null ? b.arms.map((a) => a.headerLine) : [])));\n for (let i = 0; i < rawLines.length; i += 1) {\n const line = rawLines[i] ?? '';\n // Secrets are scanned on EVERY line — comments and code fences included. A key in a stripped\n // comment never reaches the model, but it is committed to the file, and that is the leak.\n out.push(...leakedSecrets(line, i));\n // The <$CONFIG> extent is scaffolding — EXCEPT a $TOOL/$SERVICE span inside it: a tool is the\n // same construct wherever it sits (its description travels to the model in the compiled schema),\n // so a config-housed tool gets the same content checks a top-level tool gets. One rule, one\n // shape — a body row must never dodge statement termination by moving into <$CONFIG>.\n if (testLines.has(i) || exampleLines.has(i) || (cfgMask[i] && !toolMask[i])) continue;\n const r = render[i];\n if (!r || r.kind !== 'content' || r.lineClass === 'md-code' || r.lineClass === 'md-heading') {\n continue;\n }\n out.push(\n ...wordy(line, i),\n ...hedging(line, i),\n ...vague(line, i),\n ...doubleWord(line, i),\n ...spelling(line, i),\n ...spacing(line, i),\n ...standaloneI(line, i),\n // Prompt-shaped nags don't apply inside a tool body (a schema) or on a deterministic chain\n // arm (structure — its `:` is the branch marker, not a missing THEN).\n ...(toolMask[i] || chainArms.has(i) ? [] : conditionalNeedsThen(line, i)),\n // Same gate: a quoted string in a tool body is a schema value, not an over-quoted statement.\n ...(toolMask[i] ? [] : quotedProse(line, i)),\n // The character set: statement text only — tool bodies are schemas (an enum value may need any\n // byte), and the provider itself strips comments/annotations and masks quoted utterances.\n ...(toolMask[i] ? [] : specialCharacters(line, i)),\n // Layout, raw basis: trailing/tab everywhere content lives; phantom columns treat def entries\n // and tool bodies as literal (their // and @@ are content). Fences skip via md-code above;\n // zone interiors via the final sweep.\n ...trailingSpace(line, i),\n ...tabCharacters(line, i),\n ...phantomColumns(line, i, defMask[i] === true || toolMask[i] === true),\n // Statement termination: PROSE statements only — never structure ($-commands, tag lines), metadata\n // (@@ notes), free prose (persona/example blocks), OR a def-BLOCK field row. A `- key:: value` row in a\n // $TOOL/$SERVICE/$CONFIG body is CONFIG, not a prose statement — the model reads the COMPILED schema, not\n // the raw row — so `- max_tokens:: 8192` / `- base:: https://…` / `- via:: anthropic` need no terminator\n // (a trailing period on a number or URL is absurd or broken). A standalone def-LIST prose entry\n // (`term:: definition`) still terminates — owned by the def pass below (its basis is literal).\n // (chainArms also carries $SWITCH ON arm ROWS — `- member:: body` is command-plane structure like a\n // chain arm's `$IF …:` line, so the row itself never terminator-checks; the statements INDENTED\n // beneath a row are plain content lines and keep every check.)\n ...(defMask[i] || toolMask[i] || chainArms.has(i) || exempt.has(i) || isAnnotationLine(line) || line.trimStart().startsWith('$') || TAG_ONLY_LINE.test(line) || matchSectionTag(line) !== null\n ? []\n : missingPeriod(line, i)),\n ...oneOfColon(line, i),\n // `::` is a definition-head marker — flag it used inline (a second object stuffed mid-line, or a\n // bare sample). Exempt: a tool body (a `::` there is a schema field) and an illustration zone\n // (<examples> / <\"name\">, verbatim). A def BODY is NOT exempt — it is model-read reference prose, so\n // this content rule applies there exactly as the character set and statement-termination rules do\n // (zoneMask is illustrationZoneMask — the zones WITHOUT the def rows examplesMask folds in).\n ...(toolMask[i] || zoneMask[i] ? [] : inlineMarker(line, i)),\n // A tool body's @{bindings} are the tool's own placeholder syntax (params + env), not prompt\n // variables — don't require them to be declared as prompt inputs.\n ...(toolMask[i] ? [] : undefinedReference(line, i, declared, fileAliases)),\n // The retired `<=name>` spelling and a half-quoted `<\"name>` — migration guards with the rewrite\n // as the fix. Zone interiors are samples (same gate as inlineMarker above).\n ...(toolMask[i] || zoneMask[i] ? [] : retiredLiteralSigil(line, i)),\n // `@[tool]` must name a $TOOL defined here or an $IMPORT tool — an unknown name has no target.\n ...(toolMask[i] ? [] : undefinedToolInline(line, i, toolDefKeys, importedToolKeys)),\n // A bare EXACT tool name in prose — unbindable reference, errors with the pointer rewrite. Skips\n // tool bodies (a description naming a sibling stays legal — it is schema, not a rule), `$`-command\n // lines (the $IMPORT manifest LISTS names), and @@ annotations (authoring metadata); zones and def\n // rows are samples, dropped by the final sweep.\n ...(toolMask[i] || isAnnotationLine(line) || line.trimStart().startsWith('$') ? [] : bareToolRef(line, i, allToolKeys)),\n // Injection scanning skips only prose blocks — a tool description is model-read English, so\n // scaffolding there counts.\n ...(exempt.has(i) ? [] : injectionPatterns(line, i)),\n // The rubric-coverage nag only makes sense once a rubric exists — don't badger an un-eval'd prompt.\n // The injected dictionary catches arbitrary misspellings; IMPORT manifests are scaffolding, so skip them.\n ...(opts.isWord && !importLines.has(i) ? unknownWords(line, i, opts.isWord, allow) : []),\n );\n }\n\n // Definition entries: PARSE-literal, CONTENT-checked. One statement per line applies inside a body\n // too — the entry line and each `- ` sub-item must terminate (literal basis: `//` and `@@` in a def\n // body are content), and a hard-wrapped prose continuation is an ERROR: merge it into its statement\n // and let the editor wrap, or atomize it into a `- ` sub-item. Fences stay blocks; a def list inside\n // <examples>/<\"name\"> stays illustrative; a tool body stays a schema.\n for (const e of defEntries(rawLines)) {\n // A $TEST block's `- input::` / `- expect::` rows are def-SHAPED (`- key:: value`), so defEntries\n // finds them — but the whole block is scaffolding (stripped at render), so its content is never\n // nagged, exactly as the main per-line loop skips testLines above. Without this, a deterministic\n // `- contains \"…\"` sub-bullet (no period) would fire missing-period.\n if (zoneMask[e.line] || toolMask[e.line] || testLines.has(e.line) || exampleLines.has(e.line)) continue;\n let fence = false;\n for (const li of e.lines) {\n const raw = rawLines[li] ?? '';\n const t = raw.trim();\n if (fence) {\n if (t.startsWith('```') || t.startsWith('~~~')) fence = false;\n continue;\n }\n if (t.startsWith('```') || t.startsWith('~~~')) {\n fence = true;\n continue;\n }\n if (t === '') continue;\n if (li === e.line || t.startsWith('- ')) {\n // Sub-item and fence COLUMNS are the layout engine's business (entry + 2 per nesting level, flagged by the\n // shared bad-indent pass); this pass owns the CONTENT rules of a body.\n out.push(...missingPeriodLiteral(raw, li));\n continue;\n }\n const lead = raw.length - raw.trimStart().length;\n out.push({\n source: 'structure/wrapped-definition',\n severity: 'error',\n line: li,\n start: lead,\n end: raw.length,\n message: 'One statement per line: this hard-wrapped continuation belongs to the statement above. Merge it into that line (the editor wraps long lines), or make it its own \"- \" sub-item.',\n });\n }\n }\n\n // Layout: indentation MIRRORS the XML-section tree — the required column per line comes from the\n // shared layout ENGINE (layoutColumns), the same engine the Monaco auto-indent places lines with,\n // so the editor can never auto-indent a line this pass then rejects. Def bodies are covered by the\n // engine too (sub-items and fence markers at entry + 2 per nesting level). Blank lines are free here —\n // the compiler collapses blank runs and joins adjacent prose at emit time (PromptDoc.render), so any\n // number of blank lines is legal in source and normalizes on compile.\n {\n const spec = layoutColumns(rawLines);\n for (let i = 0; i < rawLines.length; i += 1) {\n const raw = rawLines[i] ?? '';\n if (raw.trim() === '') continue; // a blank line carries no column requirement and is never rationed\n const expected = spec.col[i];\n if (expected === null || expected === undefined) continue;\n const actual = ((raw.match(/^ */) ?? [''])[0]).length;\n if (actual === expected || (spec.substep[i] === true && actual === expected + 2)) continue;\n const depthLabel = expected / 2;\n out.push({\n source: 'structure/bad-indent',\n severity: 'error',\n line: i,\n start: 0,\n end: actual,\n message: `Indentation mirrors section nesting: expected column ${expected} (${depthLabel} level${depthLabel === 1 ? '' : 's'} deep), found ${actual}. The indent unit is 2 spaces.`,\n fix: { title: `→ col ${expected}`, replacement: ' '.repeat(expected) },\n });\n }\n }\n\n // Statement discipline + enforceability, whole-prompt passes (each needs cross-line context).\n // These read `scoped` (tool spans blanked) for the same reason the logic tiers do: a directive\n // inside a $TOOL body is the tool's contract, never a rule of the conversation.\n out.push(...wrappedFragments(rawLines, disp));\n out.push(...unmeasurableDirectives(scoped, exempt));\n out.push(...untestedRules(scoped, testLines));\n out.push(...determinableExpects(rawLines));\n\n // Whole-prompt consistency: re-declarations, then direct negation contradictions, then property\n // contradictions (a single-valued field assigned two values, or asserted-and-denied), then deontic ones.\n out.push(...conflictingDeclarations(scoped, disp));\n out.push(...declarationRedundancy(scoped, disp));\n out.push(...negatedFactConflicts(scoped, disp));\n out.push(...propertyConflicts(scoped));\n out.push(...ownershipConflicts(scoped));\n // Antonym-proven oppositions (suppress = ¬emit) flip the badge like modal oppositions do —\n // the owner's call: a hand-vetted antonym pair with an exact theme match meets the same\n // soundness bar as MUST-vs-NEVER. The dial exists so the posture is one word to revisit.\n const ANTONYM_CONFLICT_SEVERITY: 'error' | 'warn' = 'error';\n for (const conflict of checkConsistency(scoped, addressees)) {\n for (const ln of conflict.lines) {\n const raw = rawLines[ln] ?? '';\n const lead = raw.length - raw.trimStart().length;\n const other = conflict.lines.find((x) => x !== ln);\n out.push({\n source: conflict.strength === true ? 'logic/quantifier-strength' : 'logic/contradiction',\n severity: conflict.viaAntonym === true ? ANTONYM_CONFLICT_SEVERITY : 'error',\n line: ln,\n start: lead,\n end: raw.length,\n message:\n other !== undefined\n ? `${conflict.message} (conflicts with line ${disp(other)})`\n : conflict.message,\n });\n }\n }\n\n // Strict-order contradictions: comparative cycles and impossible time orderings. A cycle can run\n // through MORE than two lines, and the agent needs the whole loop to break it — name every member,\n // not just one arbitrary \"other\".\n for (const conflict of checkOrder(scoped)) {\n for (const ln of conflict.lines) {\n const raw = rawLines[ln] ?? '';\n const lead = raw.length - raw.trimStart().length;\n const others = conflict.lines.filter((x) => x !== ln).map((x) => disp(x));\n out.push({\n source: 'logic/order',\n severity: 'error',\n line: ln,\n start: lead,\n end: raw.length,\n message:\n others.length > 0\n ? `${conflict.message} (the loop runs through line${others.length > 1 ? 's' : ''} ${others.join(', ')})`\n : conflict.message,\n });\n }\n }\n\n // Quantifier contradictions: the square of opposition (all/some/no), only-exclusivity, most-majority.\n // The kind picks the code — three literal `source:` emits so the codes.test.ts ratchet scans each one.\n for (const conflict of checkQuantifier(scoped)) {\n for (const ln of conflict.lines) {\n const raw = rawLines[ln] ?? '';\n const lead = raw.length - raw.trimStart().length;\n const other = conflict.lines.find((x) => x !== ln);\n const message = other !== undefined ? `${conflict.message} (conflicts with line ${disp(other)})` : conflict.message;\n const base = { severity: 'error' as const, line: ln, start: lead, end: raw.length, message };\n if (conflict.kind === 'exclusivity') out.push({ source: 'logic/exclusivity', ...base });\n else if (conflict.kind === 'majority') out.push({ source: 'logic/majority', ...base });\n else if (conflict.kind === 'strength') out.push({ source: 'logic/quantifier-strength', ...base });\n else if (conflict.kind === 'cardinality') out.push({ source: 'logic/cardinality', ...base });\n else if (conflict.kind === 'action-count') out.push({ source: 'logic/action-count', ...base });\n else if (conflict.kind === 'insufficient-set') out.push({ source: 'logic/insufficient-set', ...base });\n else out.push({ source: 'logic/quantifier', ...base });\n }\n }\n\n // Transitive syllogisms: a contradictory subset/disjoint chain (all A⊆B, all B⊆C, no A∩C) the pairwise\n // table can't see. A pure reachability walk — sound, complete, in-browser. Spans ≥3 lines by construction.\n for (const conflict of checkSyllogism(scoped)) {\n for (const ln of conflict.lines) {\n const raw = rawLines[ln] ?? '';\n const lead = raw.length - raw.trimStart().length;\n const others = conflict.lines.filter((x) => x !== ln).map((x) => disp(x));\n const message = others.length > 0 ? `${conflict.message} (with lines ${others.join(', ')})` : conflict.message;\n out.push({ source: 'logic/syllogism', severity: 'error', line: ln, start: lead, end: raw.length, message });\n }\n }\n\n // Definiteness: `the <symbol-kind>` presupposes exactly one declared symbol of that kind. Reads rawLines —\n // the registries need the unmasked $TOOL/$IMPORT lines; the checker masks its own scan. Two literal\n // `source:` emits so the codes.test.ts ratchet scans each.\n for (const conflict of checkDefiniteness(rawLines)) {\n for (const ln of conflict.lines) {\n const raw = rawLines[ln] ?? '';\n const lead = raw.length - raw.trimStart().length;\n const other = conflict.lines.find((x) => x !== ln);\n const message = other !== undefined ? `${conflict.message} (also line ${disp(other)})` : conflict.message;\n const base = { severity: 'error' as const, line: ln, start: lead, end: raw.length, message };\n if (conflict.code === 'definite-ambiguous') out.push({ source: 'logic/definite-ambiguous', ...base });\n else out.push({ source: 'logic/definite-undeclared', ...base });\n }\n }\n\n // Structural integrity: step-sequence gaps/duplicates, dangling step/section references, and undeclared\n // tool use (against the IMPORT manifest). The completeness layer beside consistency.\n for (const c of structuralConflicts(rawLines)) {\n for (const ln of c.lines) {\n const raw = rawLines[ln] ?? '';\n const lead = raw.length - raw.trimStart().length;\n const other = c.lines.find((x) => x !== ln);\n out.push({\n source: `structure/${c.code}`,\n severity: c.severity,\n line: ln,\n start: lead,\n end: raw.length,\n message: other !== undefined ? `${c.message} (conflicts with line ${disp(other)})` : c.message,\n });\n }\n }\n\n // Config: PARAM checks (dangling `via`, bad number, refinement range/length/pattern, nested objects) plus\n // CROSS-FIELD rules ($REQUIRE X when Y is Z) — resolved against the glish-EXTENDED schema when a glish.tgc is in\n // scope (opts.glishConfig), else the built-in. One core home, so the web preview AND every IDE flag them.\n const configSchema = opts.glishConfig ? resolveConfigSchema(opts.glishConfig) : BUILTIN_CONFIG_SCHEMA;\n const configRules = opts.glishConfig ? parseConfigRules(opts.glishConfig) : [];\n const serviceNames = new Set(parsed.services.map((s) => s.name));\n for (const f of [...configParamDiagnostics(rawLines, configSchema, serviceNames), ...configRuleDiagnostics(rawLines, configRules)]) {\n out.push({ source: f.code, severity: f.severity, line: f.line, start: f.start, end: f.end, message: f.message });\n }\n\n // Clarity: a rule whose guard can never hold will never fire — dead weight, almost always a mistake.\n for (const ln of deadRules(scoped)) {\n const raw = rawLines[ln] ?? '';\n const lead = raw.length - raw.trimStart().length;\n out.push({\n source: 'clarity/dead-rule',\n severity: 'warn',\n line: ln,\n start: lead,\n end: raw.length,\n message: \"Dead rule — the IF-condition contradicts ITSELF (the shape of `IF c AND NOT c`), so it can never hold and the rule never fires. Fix the condition's logic, or remove the rule.\",\n });\n }\n\n // Structure: a prose line that sits outside every section. A `#` heading covers content until it hits a tag or\n // the next heading; a `<tag>` covers until its close — so a line that falls out the bottom has no structural\n // home and reads as stray. Advisory (warn), so it never blocks the compile.\n for (const { line, start } of looseContentLines(rawLines)) {\n out.push({\n source: 'structure/loose-content',\n severity: 'warn',\n line,\n start,\n end: (rawLines[line] ?? '').length,\n message: 'This content is outside any section — put it inside a <tag> (a heading ends where a tag or the next heading begins).',\n });\n }\n\n // Structure: once a document organizes with XML `<tag>` sections, a `#` heading OUTSIDE every tag is a stray —\n // a heading opens its own section, so loose-content (above) never catches it. Advisory (warn). A document with\n // no xml sections is exempt: headings alone are a fine structure.\n // Definition lists: within one CONTIGUOUS `term::` block, a repeated term is a table bug — the\n // second row shadows the first for a reader scanning by term. Separate lists may reuse terms freely.\n {\n const entries = defEntries(rawLines);\n const seen = new Map<string, number>();\n for (let k = 0; k < entries.length; k += 1) {\n const e = entries[k];\n if (!e) continue;\n const prev = entries[k - 1];\n const contiguous = prev !== undefined && e.line === (prev.lines[prev.lines.length - 1] ?? prev.line) + 1;\n if (!contiguous) seen.clear();\n const first = seen.get(e.term);\n if (first !== undefined) {\n out.push({\n source: 'structure/duplicate-term',\n severity: 'warn',\n line: e.line,\n start: e.termCol,\n end: e.termCol + e.term.length + 2,\n message: `Duplicate term \"${e.term}\" — this list already defines it on line ${disp(first)}.`,\n });\n } else {\n seen.set(e.term, e.line);\n }\n }\n }\n\n for (const { line, start } of headingsOutsideSections(rawLines)) {\n out.push({\n source: 'structure/heading-outside-section',\n severity: 'warn',\n line,\n start,\n end: (rawLines[line] ?? '').length,\n message: 'This heading is outside every <tag> section — when a prompt uses XML sections, headings must live inside them.',\n });\n }\n\n // Structure: a `@@` statement annotation documents the statement it PRECEDES — a leading, own-line note above\n // the statement it describes. A leading `@@` is dangling (error) only when NO statement follows it (end of a\n // section / the file). A `@@` that TRAILS content is MISPLACED (warning) — annotations go before, not after.\n // A `@@` inside fenced code is a literal sample, so fences are skipped.\n {\n // Names what sits below an annotation when it is NOT a documentable statement; null = content.\n const lineKind = (raw: string | undefined): string | null => {\n if (raw === undefined) return 'the end of the file';\n const t = raw.trim();\n if (t === '') return 'a blank line';\n if (t.startsWith('//') || t.startsWith('/*')) return 'a comment';\n if (t.startsWith('```') || t.startsWith('~~~')) return 'a code fence';\n if (TAG_ONLY_LINE.test(raw)) return 'a section tag';\n if (t.startsWith('#')) return 'a heading';\n // A deterministic chain arm ($IF …: / $ELSE IF …: / $ELSE:) — or a $SWITCH ON header — is\n // content-carrying: a note above it documents the CHAIN/SWITCH, so it stays annotatable. Every\n // other $ line is scaffolding.\n if (/^\\$(?:IF|ELSE|SWITCH)\\b/i.test(t)) return null;\n if (t.startsWith('$')) return 'a compiler command';\n if (stripAnnotation(stripInlineComment(raw)).trim() === '') return 'stripped metadata';\n return null;\n };\n let inFence = false;\n for (let i = 0; i < rawLines.length; i += 1) {\n const raw = rawLines[i] ?? '';\n const t = raw.trim();\n if (t.startsWith('```') || t.startsWith('~~~')) {\n inFence = !inFence;\n continue;\n }\n if (inFence) continue;\n if (exMask[i]) continue; // a literal zone (<examples> / <\"name\">): a `@@` inside is a SAMPLE, not a note\n if (isAnnotationLine(raw)) {\n // ADJACENCY IS THE CONTRACT: the note binds to line i+1 by position (the alias system, the\n // annotation facet, and the hover all attribute note -> statement that way), so the line\n // directly below MUST be the statement. Two violations, both compile errors:\n const lead = raw.length - raw.trimStart().length;\n const next = rawLines[i + 1];\n if (next !== undefined && isAnnotationLine(next)) {\n out.push({\n source: 'structure/stacked-annotation',\n severity: 'error',\n line: i,\n start: lead,\n end: raw.length,\n message: 'Stacked annotations: a `@@` note documents the ONE statement directly below it, and the line below is another `@@`. Merge the notes into one line, or give each note its own statement.',\n });\n } else {\n const kind = lineKind(next);\n if (kind !== null) {\n out.push({\n source: 'structure/unattached-annotation',\n severity: 'error',\n line: i,\n start: lead,\n end: raw.length,\n message: `A \\`@@\\` annotation documents the statement DIRECTLY below it — here the next line is ${kind}. Move the note to the line immediately above its statement.`,\n });\n }\n }\n continue;\n }\n if (hasTrailingAnnotation(raw)) {\n const at = raw.indexOf('@@');\n out.push({\n source: 'structure/misplaced-annotation',\n severity: 'warn',\n line: i,\n start: at < 0 ? 0 : at,\n end: raw.length,\n message: 'A `@@` statement annotation belongs on its own line, before the statement it documents — move it above.',\n });\n }\n }\n }\n\n // Clarity: the same rule stated in several places. Not an error — the prompt still means one thing —\n // but it's tokens the model re-reads and N copies to keep in sync. Flag every line so the author can\n // collapse them to a single source of truth.\n for (const group of checkRedundancy(scoped, addressees)) {\n const force = group.kind === 'obligate' ? 'required' : 'forbidden';\n for (const ln of group.lines) {\n const raw = rawLines[ln] ?? '';\n const lead = raw.length - raw.trimStart().length;\n const others = group.lines.filter((x) => x !== ln).map((x) => x + 1);\n out.push({\n source: 'clarity/duplicate',\n severity: 'warn',\n line: ln,\n start: lead,\n end: raw.length,\n message: `Duplicate rule — \"${group.atom}\" is ${force} in ${group.lines.length} places (also ${\n others.length > 1 ? 'lines' : 'line'\n } ${others.join(', ')}). State it once and reference it.`,\n });\n }\n }\n\n // Clarity: a narrower rule that a broader one already covers — its guard is a special case, so it never\n // changes the outcome. Points at the covering rule so the author can drop the redundant condition.\n for (const s of checkSubsumption(scoped, addressees)) {\n const raw = rawLines[s.redundantLine] ?? '';\n const lead = raw.length - raw.trimStart().length;\n const force = s.kind === 'obligate' ? 'required' : 'forbidden';\n out.push({\n source: 'clarity/duplicate',\n severity: 'warn',\n line: s.redundantLine,\n start: lead,\n end: raw.length,\n message: `Subsumed rule — \"${s.atom}\" is already ${force} by a broader rule on line ${disp(\n s.coveringLine,\n )}, so this narrower condition never changes the outcome. Drop the condition or remove this line.`,\n });\n }\n\n // Model target: a $CONFIG model that isn't in the (weekly-refreshed) known-model snapshot. Humble — never an\n // error, since a wrong id fails only when the agent runs and the snapshot can lag a fresh release.\n for (const f of checkModel(rawLines)) {\n out.push({ source: 'config/unknown-model', severity: f.severity, line: f.line, start: f.start, end: f.end, message: f.message });\n }\n\n // Final sweep for the line-based text checks (wordy, hedging, double-word, …) that run on raw lines: drop\n // anything landing inside an <examples> block, but KEEP spelling — a real typo in an example still matters.\n // (The logic/clarity tiers already saw examples blanked via `scoped`; this catches the per-line text tier.)\n // ALSO drop anything landing inside a `@@` annotation note — an annotation is inert metadata, out of analysis\n // entirely (spelling included). Its column start is 0 for a leading `@@` line, or the `@@` offset for a trailing\n // note. The annotation's OWN structural diagnostics (misplaced / unattached) judge its placement, not its\n // content, so they're exempt.\n const noteAt = rawLines.map((l) => {\n if (isAnnotationLine(l)) return 0;\n const m = l.match(/(^|\\s)@@/);\n return m && m.index !== undefined ? m.index + (m[1] ?? '').length : -1;\n });\n const isAnnotationDiag = (src: string): boolean =>\n src === 'structure/misplaced-annotation' ||\n src === 'structure/unattached-annotation' ||\n src === 'structure/stacked-annotation';\n // Findings that judge a literal CONSTRUCT itself (not its content) survive the literal-zone sweep.\n const judgesConstruct = (src: string): boolean => src === 'structure/duplicate-term';\n // Definition entries are PARSE-literal but CONTENT-checked: the character set, statement\n // termination, and the no-hard-wrap rule apply inside a body (it is model-read reference prose),\n // while a zone (<examples> / <\"name\">) stays fully illustrative — and a def list INSIDE a zone is\n // part of the illustration.\n const contentRuleInDefs = (src: string): boolean =>\n src === 'structure/missing-period' ||\n src === 'structure/wrapped-definition' ||\n src === 'structure/em-dash' ||\n src === 'structure/curly-quote' ||\n src === 'structure/special-character' ||\n src === 'structure/inline-marker' ||\n src === 'structure/bad-indent' ||\n src === 'structure/phantom-column' ||\n src === 'structure/trailing-space' ||\n src === 'structure/tab';\n return out.filter((d) => {\n if (!isAnnotationDiag(d.source)) {\n const a = noteAt[d.line] ?? -1;\n if (a >= 0 && d.start >= a) return false; // inside a `@@` annotation note → excluded from analysis\n }\n // Literal zones (<examples> / <\"name\">) keep SPELLING (a typo in rendered content still ships) and\n // SECURITY (a key in the file is a leak wherever it sits — the every-line invariant must survive\n // this sweep; it previously didn't, silently dropping leaked-secret findings inside <examples>).\n return (\n !exMask[d.line] ||\n d.source.startsWith('spelling/') ||\n d.source.startsWith('security/') ||\n // The determinable-expect nudge ONLY ever lands on a $TEST `- expect::` sub-bullet (that is all\n // rubricExpectLines yields), and those rows are def-SHAPED, so examplesMask marks them literal.\n // It is a control-plane nudge, not example content — it survives the literal-zone sweep by\n // construction. (Before the bullet refactor, `EXPECT …` wasn't def-shaped, so it slipped past.)\n d.source === 'prompt/determinable-expect' ||\n judgesConstruct(d.source) ||\n (defMask[d.line] === true && zoneMask[d.line] !== true && contentRuleInDefs(d.source))\n );\n });\n}\n\n/** Apply a quick-fix's text replacement at the diagnostic's range. */\nexport function applyFix(value: string, d: Diagnostic): string {\n if (!d.fix) return value;\n const lines = value.split('\\n');\n const line = lines[d.line];\n if (line === undefined) return value;\n lines[d.line] = line.slice(0, d.start) + d.fix.replacement + line.slice(d.end);\n return lines.join('\\n');\n}\n\nexport interface RenderSpan {\n text: string;\n cls?: string;\n}\n\n/**\n * Merge a line's markdown tokens with its diagnostic ranges into final overlay spans.\n * Each output span carries the markdown class of its source token plus a `diag-<sev>`\n * class where a diagnostic covers it — splitting at every boundary so underlines land on\n * exactly the offending characters while the text stays byte-for-byte identical.\n */\nexport function composeSpans(\n tokens: InlineToken[],\n diags: { start: number; end: number; severity: Severity }[],\n): RenderSpan[] {\n const text = tokens.map((t) => t.text).join('');\n const n = text.length;\n const mdCls: (string | undefined)[] = [];\n for (const t of tokens) for (let k = 0; k < t.text.length; k += 1) mdCls.push(t.cls);\n const sev: (Severity | undefined)[] = new Array(n).fill(undefined);\n for (const d of diags) {\n for (let k = Math.max(0, d.start); k < Math.min(n, d.end); k += 1) {\n const cur = sev[k];\n if (!cur || SEV_RANK[d.severity] > SEV_RANK[cur]) sev[k] = d.severity;\n }\n }\n const spans: RenderSpan[] = [];\n let k = 0;\n while (k < n) {\n const md = mdCls[k];\n const s = sev[k];\n let j = k + 1;\n while (j < n && mdCls[j] === md && sev[j] === s) j += 1;\n const cls = [md, s ? `diag-${s}` : undefined].filter(Boolean).join(' ') || undefined;\n spans.push({ text: text.slice(k, j), cls });\n k = j;\n }\n return spans;\n}\n","// ── Diagnostic catalog — importance, independent of severity ─────────────────────────────────────────────\n// Severity says how loud a diagnostic is (error / warn / info); IMPORTANCE says how much it matters. They're\n// orthogonal: a `structure/unused-import` is only a `warn`, but it's a real correctness defect an agent should\n// not ship past — whereas a `style/wordy` warn is a nudge. This is what lets a product be strict about what\n// MATTERS (\"block every important finding\") instead of blunt (\"treat all warnings as errors, noise and all\").\n//\n// Importance is DERIVED, not a 64-row table: an `error` is always critical; a warning/info in a correctness\n// category is important; everything else is advisory. Deviations go in OVERRIDES. Deriving it means a brand-new\n// code is classified correctly the moment it's added, with no registry to keep in sync.\n\nimport type { Severity } from './diagnostics';\n\nexport type Importance = 'critical' | 'important' | 'advisory';\n\nconst RANK: Record<Importance, number> = { critical: 3, important: 2, advisory: 1 };\n\n/** Is `a` at least as important as `b`? (`critical ≥ important ≥ advisory`.) */\nexport function atLeastImportant(a: Importance, b: Importance): boolean {\n return RANK[a] >= RANK[b];\n}\n\n// Correctness categories — a finding here is a real defect (a contradiction, a dangling reference, a leaked\n// secret, an unknown model), not a stylistic preference. Everything outside this set is advisory quality.\nconst CORRECTNESS = new Set(['structure', 'logic', 'security', 'config', 'typeglish', 'clarity']);\n\n// Per-code deviations from the category default. Empty today — the category rule classifies every current code\n// correctly — but this is the seam for \"this one style code is actually load-bearing\" without a full table.\nconst OVERRIDES: Record<string, Importance> = {};\n\nfunction categoryOf(code: string): string {\n const i = code.indexOf('/');\n return i < 0 ? code : code.slice(0, i);\n}\n\n/**\n * How much a diagnostic matters, independent of its severity level. An `error` is always `critical`; a\n * correctness-category warning/info is `important`; a style / quality / grammar / spelling nudge is `advisory`.\n */\nexport function importanceOf(code: string, severity: Severity): Importance {\n const override = OVERRIDES[code];\n if (override) return override;\n if (severity === 'error') return 'critical';\n return CORRECTNESS.has(categoryOf(code)) ? 'important' : 'advisory';\n}\n","// ── Structured edits — the write half of TG's agent contract ────────────────────────────────────────────\n// An agent authoring TypeGlish shouldn't regenerate the whole file and hope; it should call a verb that returns\n// a VALID, integrity-preserving edit. These are those verbs: pure and stateless (source in → new source out),\n// so a product's CRUD MCP mounts them over its own storage. Each refuses an edit that would break the program\n// (a name collision, a dangling result) and reports why — so the agent gets an actionable error, not silent rot.\n//\n// `rename` is the flagship: renaming a `$REQUIRE variable` / `$DEFINE` by hand means finding and updating every\n// `$name` reference across guards, switches, and other defines — exactly the rot TG's symbol graph exists to\n// prevent. TG does it in one call, correctly.\n\nimport { maskQuotes, toolBlockMask } from './clause';\nimport { buildStructure } from './structure';\n\nconst IDENT = /^[a-z][a-z0-9_]*$/i;\n// Expression keywords — a condition var renamed to one of these would reparse as an operator and break guards.\nconst RESERVED = new Set(['not', 'and', 'or', 'is', 'one', 'of']);\nconst escapeRegex = (s: string): string => s.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n\nexport interface EditResult {\n /** Did the edit apply? When false, `source` is unchanged and `error` says why. */\n ok: boolean;\n source: string; // the new source (identical to the input when `ok` is false)\n changed: number; // how many spans were rewritten (0 when `ok` is false)\n error?: string; // an agent-actionable reason the edit was refused\n}\n\nconst fail = (source: string, error: string): EditResult => ({ ok: false, source, changed: 0, error });\n\n/**\n * Rename a declared `$REQUIRE variable` or `$DEFINE` — the declaration AND every `$name` reference (guards,\n * switches, other defines, prose) — leaving quotes, comments, and `$TOOL`/`$SERVICE` block bodies untouched.\n * Refuses an invalid target (bad identifier, reserved word, name already taken, a no-op) so the result is\n * always well-formed. Pure and stateless.\n */\nexport function rename(source: string, kind: 'variable' | 'define', from: string, to: string): EditResult {\n const lines = source.split('\\n');\n const doc = buildStructure(lines);\n const fromKey = from.toLowerCase();\n const toKey = to.toLowerCase();\n\n if (!IDENT.test(to)) return fail(source, `\"${to}\" isn't a valid name — use letters, digits, and underscore, starting with a letter.`);\n if (RESERVED.has(toKey)) return fail(source, `\"${to}\" is a reserved word (${[...RESERVED].join(', ')}) — it would reparse as an operator.`);\n const declLine = kind === 'define' ? doc.defines.get(fromKey)?.line : doc.imports.find((im) => im.kind === 'variable' && im.key === fromKey)?.line;\n if (declLine === undefined) return fail(source, `no ${kind === 'define' ? '$DEFINE' : '$REQUIRE variable'} named \"${from}\".`);\n if (doc.index.inputs.has(toKey) || doc.defines.has(toKey)) return fail(source, `\"${to}\" is already declared — pick a name that's free.`);\n if (fromKey === toKey) return fail(source, `\"${to}\" is already the name — nothing to rename.`);\n\n const toolMask = toolBlockMask(lines);\n // `@{name}` as a read — the pointer brackets gate it out of prose. The legacy bare `$name` spelling is\n // rewritten too (a rename mid-migration must not strand half the references on the old form).\n const refPattern = new RegExp(`@\\\\{${escapeRegex(fromKey)}\\\\}|\\\\$${escapeRegex(fromKey)}\\\\b`, 'gi');\n let changed = 0;\n\n const out = lines.map((line, i) => {\n let s = line;\n // Rename the bare declaration token, staying inside the name portion (before any `:` type, so an enum value\n // that happens to share the name is left alone).\n if (i === declLine) {\n if (kind === 'define') {\n s = s.replace(/^(\\s*\\$DEFINE\\s+)([a-z][a-z0-9_]*)/i, (m, pre: string, name: string) => (name.toLowerCase() === fromKey ? ((changed += 1), `${pre}${to}`) : m));\n } else {\n // Either declaration spelling — `$REQUIRE variable …` (canonical) or the deprecated `$IMPORT input …`.\n s = s.replace(/^(\\s*(?:\\$REQUIRE\\s+variable|\\$IMPORT\\s+input)\\s+)([^:]*)/i, (_m, pre: string, names: string) => `${pre}${names.replace(new RegExp(`\\\\b${escapeRegex(fromKey)}\\\\b`, 'i'), () => ((changed += 1), to))}`);\n }\n }\n // Rewrite every LIVE read — matched on a quote-/comment-masked copy so a pointer inside a string literal\n // or a `//` comment stays as written; a `$TOOL`/`$SERVICE` block body is skipped whole. EVERY match\n // lands on the pointer spelling — rewriting a legacy `$old` to `$new` would preserve a compile error,\n // and an integrity edit never emits a form the checker rejects.\n if (!toolMask[i]) {\n const safe = maskQuotes(s).replace(/\\s+\\/\\/.*$/, (c) => ' '.repeat(c.length));\n const hits = [...safe.matchAll(refPattern)].map((m) => ({ idx: m.index ?? 0, len: m[0].length }));\n for (const h of hits.reverse()) {\n s = `${s.slice(0, h.idx)}@{${to}}${s.slice(h.idx + h.len)}`;\n changed += 1;\n }\n }\n return s;\n });\n\n return { ok: true, source: out.join('\\n'), changed };\n}\n","// Line → atomic claims. The spike's pivotal finding: sentence-level entailment FAILS on compound\n// rule-lines (real paraphrase pairs scored 0.01) while the same pairs match at ≥0.96 once each line\n// is decomposed into guard-distributed atomic claims. TypeGlish already does that decomposition\n// symbolically — ir.ts lowers `IF g THEN a; b` into guarded directive nodes — so this module rides\n// the IR and adds only two things: a prose fallback (sentence + `;` segmentation) for lines the\n// grammar doesn't classify, and claim TEXT reconstruction (guard folded in, polarity re-injected)\n// so every atom is a self-contained sentence an entailment model can read on its own.\n\nimport { configSectionMask, stripInlineComment, toolBlockMask } from '../clause';\nimport { renderLines } from '../highlight';\nimport { lower } from '../ir';\nimport { predicatesFromProse } from '../predicate';\nimport type { Cond, DeclarationIR, Deontic, DirectiveIR, IRNode } from '../ir';\nimport { parseLine } from '../line';\nimport { splitSentences } from '../sentence';\nimport { buildStructure } from '../structure';\nimport { maskInlineSwitches, parseSwitches } from '../switch';\nimport type { SemanticAtom } from './types';\n\n// FNV-1a, run twice with different offset bases for a 64-bit-ish hex id. Pure and identical in\n// browser and Node — the atom id must be content-addressed (line numbers are positions, not\n// identity) and computable anywhere the kernel runs. The server-side verdict cache layers a real\n// sha256 on top; this id only needs to be stable and collision-safe at prompt scale.\nfunction fnv32(s: string, seed: number): number {\n let h = seed >>> 0;\n for (let i = 0; i < s.length; i += 1) {\n h ^= s.charCodeAt(i);\n h = Math.imul(h, 0x01000193) >>> 0;\n }\n return h >>> 0;\n}\n\nexport function atomId(text: string, guard: string | undefined): string {\n const key = `${text.trim().toLowerCase()}|${(guard ?? '').trim().toLowerCase()}`;\n const a = fnv32(key, 0x811c9dc5).toString(16).padStart(8, '0');\n const b = fnv32(key, 0xcbf29ce4).toString(16).padStart(8, '0');\n return a + b;\n}\n\n/** Render a guard Cond back to readable text (\"urgent and not weekend\"), or null when TRUE. */\nexport function condToText(c: Cond): string | null {\n switch (c.t) {\n case 'true':\n return null;\n case 'false':\n return 'never';\n case 'atom':\n return c.text.trim();\n case 'not': {\n const inner = condToText(c.f);\n return inner === null ? 'never' : `not ${inner}`;\n }\n case 'and':\n return c.fs.map((f) => condToText(f) ?? '').filter((x) => x !== '').join(' and ');\n case 'or':\n return c.fs.map((f) => condToText(f) ?? '').filter((x) => x !== '').join(' or ');\n }\n}\n\n// The IR moves a directive's polarity out of its action text (\"NEVER capture X\" becomes\n// deontic:prohibit + action \"capture X\"), so the claim text must put it back — an entailment model\n// comparing \"capture X\" against \"do not capture X\" would read them as the same act.\nconst FORCE: Record<Deontic, string> = {\n obligate: 'must',\n prohibit: 'must not',\n recommend: 'should',\n discourage: 'should not',\n permit: 'may',\n};\n\nfunction directiveAtom(d: DirectiveIR): SemanticAtom {\n const guard = condToText(d.cond) ?? undefined;\n const subj = d.subject === '' ? 'you' : d.subject;\n // The action keeps whatever terminal punctuation it was written with — strip it so the template's\n // own period doesn't double up (and doesn't split atom identity on a trailing dot).\n const action = d.action.text.replace(/[.!?\\s]+$/, '');\n const base = `${subj} ${FORCE[d.deontic]} ${action}`;\n const text = guard ? `When ${guard}, ${base}.` : `${base}.`;\n return {\n id: atomId(text, guard),\n line: d.line,\n span: d.span,\n text,\n kind: 'directive',\n deontic: d.deontic,\n subject: d.subject,\n guard,\n predicates: d.predicate ? [d.predicate] : undefined,\n };\n}\n\nfunction declarationAtom(d: DeclarationIR): SemanticAtom {\n const value = d.value.replace(/[.!?\\s]+$/, '');\n const text = d.negated ? `${d.name} is not ${value}.` : `${d.name} is ${value}.`;\n return {\n id: atomId(text, undefined),\n line: d.line,\n span: d.span,\n text,\n kind: 'declaration',\n subject: d.name.toLowerCase(),\n };\n}\n\n/** Decompose a whole prompt into atomic claims. Lines the compiler already understands (directives,\n * conditionals, declarations) become IR-derived atoms; remaining content lines fall back to\n * sentence + `;` segmentation. Comments, blanks, headings, fenced code, and $-command manifests\n * yield nothing — the same gates runDiagnostics applies. */\nexport function decompose(source: string): SemanticAtom[] {\n const rawLines = source.replace(/\\r\\n/g, '\\n').split('\\n');\n const render = renderLines(rawLines);\n const doc = buildStructure(rawLines);\n const tools = doc.index.tools;\n\n // Blank inline `$SWITCH ON $x ( … )` spans (to equal-length spaces) before claim extraction: a fragment is a\n // conditional, mutually-exclusive branch — never an always-on claim — so it must not enter the redundancy /\n // conflict pass. Structure/render still read the ORIGINAL lines; only the IR and prose-fallback claims mask.\n const maskedSource = maskInlineSwitches(source);\n const maskedLines = maskedSource.replace(/\\r\\n/g, '\\n').split('\\n');\n\n // Conditional-layer content is host-selected and compiled away — a chain arm or a guarded section is\n // not an always-on claim (branches are mutually exclusive; a guarded block may be absent), so it never\n // belongs in the redundancy/conflict analysis. Skip those spans, exactly like the `$`-command manifests.\n const conditional = new Set<number>();\n for (const b of parseSwitches(rawLines)) for (let l = b.headerLine; l < b.blockEnd; l += 1) conditional.add(l);\n for (const s of doc.sections) if (s.guard) for (let l = s.startLine; l < s.endLine; l += 1) conditional.add(l);\n const cfgMask = configSectionMask(rawLines);\n\n // `$TOOL` / `$SERVICE` blocks are control-plane too — the compiler strips them, so the model never reads a\n // tool's description or `request:` line. They must not surface as prose claims (or the tool description\n // overlaps the Role prose and reads as redundant). Same mask the consistency checker uses.\n const toolMask = toolBlockMask(rawLines);\n\n const byLine = new Map<number, IRNode[]>();\n for (const node of lower(maskedSource, { tools }).nodes) {\n const list = byLine.get(node.line);\n if (list) list.push(node);\n else byLine.set(node.line, [node]);\n }\n\n const out: SemanticAtom[] = [];\n rawLines.forEach((raw, i) => {\n const r = render[i];\n if (!r || r.kind !== 'content' || r.lineClass === 'md-code' || r.lineClass === 'md-heading') return;\n if (doc.importLines.has(i) || doc.configLines.has(i) || doc.defineLines.has(i) || conditional.has(i) || toolMask[i]) return;\n\n if (doc.testLines.has(i) || cfgMask[i]) return; // $TEST blocks and <$CONFIG> sections are scaffolding, never claims\n\n const nodes = byLine.get(i) ?? [];\n if (nodes.length > 0) {\n for (const n of nodes) out.push(n.kind === 'directive' ? directiveAtom(n) : declarationAtom(n));\n return;\n }\n\n // Prose fallback: one atom per sentence segment. `;` joins co-equal clauses in rule prose\n // (\"stop; do not call tools\"), so it splits like a sentence boundary. Spans stay whole-line —\n // findings are per line, and sentence offsets live in the parsed clause, not the raw line.\n // Inline comments are stripped FIRST — atom ids are content-addressed, and a trailing `//` (or\n // a machine `//@` annotation) must never change a claim's identity. The IR path already strips\n // (prompt.ts does it during lowering); this makes the prose path match. Applied to the MASKED\n // line so $TOOL bodies stay masked (main's conditional-layer skip) and comments still strip.\n const { clause } = parseLine(stripInlineComment(maskedLines[i] ?? raw));\n const lead = raw.length - raw.trimStart().length;\n for (const sentence of splitSentences(clause)) {\n for (const seg of sentence.text.split(';')) {\n const text = seg.trim().replace(/[,]+$/, '');\n if (text === '') continue;\n const claim = /[.!?]$/.test(text) ? text : `${text}.`;\n const predicates = predicatesFromProse(claim, tools);\n out.push({\n id: atomId(claim, undefined),\n line: i,\n span: { start: lead, end: raw.length },\n text: claim,\n kind: 'prose',\n predicates: predicates.length > 0 ? predicates : undefined,\n });\n }\n }\n });\n return out;\n}\n","// Every semantic-layer tunable in one place. A threshold change here shows its full blast radius as\n// a snapshot diff in the benchmark's frozen-fixture tests (eval/semantic-bench) — the same\n// discipline the golden corpus applies to grammar changes. Values are seeded from the spike\n// (42 labeled pairs mined from a real ~200-line voice-agent prompt) and re-calibrated by the bench.\n\n/** The verdict model + quantization the scores were produced by. Part of every cache key and every\n * PairVerdict, so a model bump can never silently mix scores from two models. q8 was validated\n * live against fp32 (contra 1.000 / entail 0.973 on anchor pairs, 6.2ms/pair batched, ~190MB);\n * plain int8 DESTROYS deberta-v3 (everything → neutral) and must never be used. */\nexport const NLI_MODEL_VERSION = 'Xenova/nli-deberta-v3-base@q8';\n\n/** Both entailment directions at or above this ⇒ the two claims are equivalent (duplicates).\n * Spike: real paraphrase atoms scored ≥0.96; the best-F1 threshold landed near 0.8. */\nexport const THETA_EQUIV = 0.8;\n\n/** One direction at or above this (other below) ⇒ one-way coverage (paraphrased subsumption). */\nexport const THETA_COVER = 0.85;\n\n/** Contradiction trigger, applied to the SYMMETRIC signal (min of both directions): bench data\n * shows every true contradiction fires ~1.00 in both directions while several traps fire one-way.\n * Even symmetric, NLI contradiction precision on rule-prose is ~0.62 — so a contradicts verdict is\n * a candidate: panel-only until the judge tier confirms it (only confirmed conflicts warn). */\nexport const THETA_CONTRA = 0.97;\n\n/** An atom counts as covered when the conjunction of its coverers entails it at or above this.\n * Spike conjunction-coverage: 0.99 for true coverage vs 0.002 for near-misses — a wide margin. */\nexport const THETA_COVERED = 0.85;\n\n/** directionConfidence needed before the UI may say \"safe to cut X\" instead of the symmetric\n * \"these overlap — review which subsumes which\". */\nexport const THETA_DIRECTION_ACTIONABLE = 0.7;\n\n/** Cap on directionConfidence for nli-tier verdicts. NLI direction accuracy was 0.17 in the spike —\n * worse than chance on deontic scope — so an NLI-only verdict must never clear the actionable bar;\n * only the judge tier (or the fine-tuned model) can raise it. */\nexport const NLI_DIRECTION_CAP = 0.5;\n\n/** Keyword-Jaccard gate for candidate pairs. Recall-oriented: the spike's true paraphrase pairs all\n * share domain tokens (tool names, \"fee\", \"zip\"); unrelated pairs rarely do. */\nexport const JACCARD_GATE = 0.1;\n\n/** Hard cap on scored pairs per analysis — the quadratic-blowup backstop. Overflow is truncated\n * worst-first and reported in stats.pairsTruncated, never silent. */\nexport const MAX_PAIRS = 4000;\n\n/** How many top solo-entailing candidates form the conjunction premise for coverage. */\nexport const TOP_K_CONJUNCTION = 3;\n\n/** HIGH redundancy bar (owner decision: heavy duplication is a WARNING, mild overlap is fine).\n * A fully-covered line at or below this residual — near-nothing it says is unique — warns;\n * covered lines above it stay informational. */\nexport const THETA_REDUNDANCY_WARN = 0.1;\n\n/** Equivalence strength at or above which a duplicate-meaning pair warns instead of informs:\n * both entailment directions this high means the two lines are interchangeable. */\nexport const THETA_EQUIVALENT_WARN = 0.95;\n\n/** The judge — the escalation tier for exactly the judgments local NLI can't make (subsumption\n * direction 0.17, contradiction confirmation at 0.62 precision). claude-sonnet-4-6 measured on the\n * spike set: overlap F1 0.93 / P 1.00, direction 0.83, contradiction recall 1.00, 98% temp-0\n * agreement. ON by default per the owner's decision; TG_SEMANTIC_JUDGE=off is the offline mode. */\nexport const JUDGE_MODEL = 'claude-sonnet-4-6';\n\n/** Version tag for the judge prompt — part of cache keys and every distill record, so a prompt\n * rewrite can never silently mix verdicts produced under different instructions. */\nexport const JUDGE_PROMPT_VERSION = 'relation-v1';\n\n/** directionConfidence assigned to a judge-confirmed covers/covered_by verdict — the measured\n * direction accuracy of the judge model on the bench. Clears THETA_DIRECTION_ACTIONABLE. */\nexport const JUDGE_DIRECTION_CONF = 0.83;\n\n/** Escalation budget per analysis: covers/covered_by candidates and contradiction candidates are\n * judged in priority order until the budget runs out (each call is cached + distilled forever, so\n * the budget only bounds NEW calls). */\nexport const MAX_JUDGE_CALLS = 32;\n","// Candidate pair generation — the O(n²) relief valve. Scoring every atom against every other is\n// quadratic in prompt size, so pairs are gated lexically before any model sees them: two claims\n// about the same thing share content words (tool names, \"fee\", \"zip\"), and the spike's true\n// paraphrase pairs all clear a low Jaccard bar while unrelated pairs rarely do. The gate is\n// deliberately recall-oriented — a missed candidate is a missed finding, a passed candidate merely\n// costs one model call. The embedding prefilter (potion) slots in server-side behind this same\n// interface in the engine phase; this module stays pure.\n\nimport { JACCARD_GATE, MAX_PAIRS } from './config';\nimport { isAntonym } from '../predicate';\nimport type { SemanticAtom } from './types';\n\n// Content-word extraction. Mirrors the keyword idea in diagnostics.ts but keeps underscores and\n// digits — tool names (`get_diagnostic_fee`, `send_sms`) are the strongest overlap signals a real\n// agent prompt has.\nconst STOP = new Set([\n 'the', 'and', 'for', 'you', 'your', 'that', 'this', 'with', 'are', 'was', 'will', 'can', 'when',\n 'should', 'must', 'not', 'but', 'its', 'our', 'their', 'they', 'them', 'from', 'have', 'has',\n 'had', 'any', 'all', 'each', 'every', 'then', 'than', 'into', 'out', 'only', 'also', 'more',\n 'some', 'such', 'about', 'which', 'what', 'who', 'how', 'why', 'where', 'here', 'there', 'these',\n 'those', 'never', 'always', 'may', 'one', 'per', 'via', 'after', 'before', 'once',\n]);\n\nexport function contentWords(text: string): Set<string> {\n const out = new Set<string>();\n for (const w of text.toLowerCase().match(/[a-z0-9_][a-z0-9_'-]{2,}/g) ?? []) {\n if (!STOP.has(w)) out.add(w);\n }\n return out;\n}\n\nfunction jaccard(a: Set<string>, b: Set<string>): number {\n if (a.size === 0 || b.size === 0) return 0;\n let inter = 0;\n for (const w of a) if (b.has(w)) inter += 1;\n return inter / (a.size + b.size - inter);\n}\n\nexport interface CandidatePair {\n a: SemanticAtom;\n b: SemanticAtom;\n /** The lexical-overlap gate score — kept as a fusion feature and for truncation ordering. */\n jaccard: number;\n /** Which gate admitted the pair — 'predicate' marks zero-lexical-overlap recoveries. */\n via: 'lexical' | 'predicate' | 'both';\n}\n\n// The predicate gate — recall for pairs the lexical gate can't see ('stop' vs 'do not start the\n// booking flow' share zero tokens). Two claims are candidates when any of their predicates share a\n// bound tool, share a frame (incl. frames inferred from tool names), or sit on an antonym pair.\n// Recall-oriented like the Jaccard gate: a wrong admit costs one NLI call, never a verdict.\nfunction predicateGate(a: SemanticAtom, b: SemanticAtom): boolean {\n for (const pa of a.predicates ?? []) {\n for (const pb of b.predicates ?? []) {\n if (pa.tool !== undefined && pa.tool === pb.tool) return true;\n if (pa.frame !== undefined && pa.frame === pb.frame) return true;\n if (isAntonym(pa, pb)) return true;\n if (pa.head === pb.head) return true;\n }\n }\n return false;\n}\n\nexport interface CandidateSet {\n pairs: CandidatePair[];\n /** Pairs dropped by MAX_PAIRS — surfaced in stats, never silent. */\n truncated: number;\n}\n\n/** Gate all cross-line atom pairs down to the candidates worth scoring. Same-line pairs are never\n * candidates: a line doesn't overlap itself, it IS itself. */\nexport function candidatePairs(atoms: SemanticAtom[]): CandidateSet {\n const words = atoms.map((a) => contentWords(a.text));\n const pairs: CandidatePair[] = [];\n for (let i = 0; i < atoms.length; i += 1) {\n for (let j = i + 1; j < atoms.length; j += 1) {\n const a = atoms[i];\n const b = atoms[j];\n if (!a || !b || a.line === b.line) continue;\n const wa = words[i];\n const wb = words[j];\n if (!wa || !wb) continue;\n const score = jaccard(wa, wb);\n const lexical = score >= JACCARD_GATE;\n const predicate = predicateGate(a, b);\n if (!lexical && !predicate) continue;\n pairs.push({ a, b, jaccard: score, via: lexical && predicate ? 'both' : lexical ? 'lexical' : 'predicate' });\n }\n }\n // Truncation order: predicate-gated pairs get a bonus so MAX_PAIRS can't silently evict exactly\n // the pairs the gate was widened to recover (raw jaccard stays untouched for fusion features).\n pairs.sort((x, y) => (y.jaccard + (y.via !== 'lexical' ? 0.1 : 0)) - (x.jaccard + (x.via !== 'lexical' ? 0.1 : 0)));\n const truncated = Math.max(0, pairs.length - MAX_PAIRS);\n return { pairs: pairs.slice(0, MAX_PAIRS), truncated };\n}\n","// The pure verdict layer: raw model scores in, relations and per-line audits out. Everything here\n// is threshold math over numbers — fully unit-testable with hand fixtures, no model in sight. The\n// thresholds live in config.ts so a calibration change shows its blast radius in the benchmark's\n// frozen-fixture snapshots.\n\nimport {\n NLI_DIRECTION_CAP,\n NLI_MODEL_VERSION,\n THETA_CONTRA,\n THETA_COVER,\n THETA_COVERED,\n THETA_EQUIV,\n} from './config';\nimport type { AtomCoverage, LineAudit, OverlapRelation, PairVerdict, SemanticAtom, SemanticReport } from './types';\n\nexport interface PairScores {\n /** P(a entails b) — a as premise. */\n entAB: number;\n /** P(b entails a). */\n entBA: number;\n /** P(contradiction) with a as premise. */\n conAB: number;\n /** P(contradiction) with b as premise. */\n conBA: number;\n}\n\n/** Classify one scored pair. Contradiction triggers on the SYMMETRIC signal — min of both\n * directions: bench data shows every true contradiction fires ~1.00 both ways while several traps\n * fire only one way (min kills 4 of 9 trap false positives outright). Even so, NLI contradiction\n * precision on rule-prose caps at ~0.62, so a contradicts verdict is a CANDIDATE — the warn\n * diagnostic is gated on judge confirmation; unconfirmed conflicts surface panel-only. Direction\n * confidence from NLI alone is capped below the actionable threshold: the spike measured NLI at\n * 0.17 on deontic direction (worse than chance), so \"which side is broader\" must come from the\n * judge tier or the fine-tuned model, never from these scores. */\nexport function classifyPair(s: PairScores): { relation: OverlapRelation; directionConfidence: number } {\n const entMax = Math.max(s.entAB, s.entBA);\n if (Math.min(s.conAB, s.conBA) >= THETA_CONTRA && entMax < THETA_EQUIV) return { relation: 'contradicts', directionConfidence: 0 };\n if (s.entAB >= THETA_EQUIV && s.entBA >= THETA_EQUIV) return { relation: 'equivalent', directionConfidence: 0 };\n if (s.entAB >= THETA_COVER && s.entBA < THETA_COVER) {\n return { relation: 'covers', directionConfidence: Math.min(NLI_DIRECTION_CAP, s.entAB - s.entBA) };\n }\n if (s.entBA >= THETA_COVER && s.entAB < THETA_COVER) {\n return { relation: 'covered_by', directionConfidence: Math.min(NLI_DIRECTION_CAP, s.entBA - s.entAB) };\n }\n return { relation: 'distinct', directionConfidence: 0 };\n}\n\n/** Build a full PairVerdict from scores (canonical atom order preserved by the caller). */\nexport function verdictFrom(a: string, b: string, s: PairScores, tier: PairVerdict['tier'] = 'nli'): PairVerdict {\n const { relation, directionConfidence } = classifyPair(s);\n return {\n a,\n b,\n relation,\n entAB: s.entAB,\n entBA: s.entBA,\n conMax: Math.max(s.conAB, s.conBA),\n conMin: Math.min(s.conAB, s.conBA),\n directionConfidence,\n tier,\n modelVersion: NLI_MODEL_VERSION,\n };\n}\n\n/** Assemble per-line audits from atoms + verdicts + coverage. Residual is 1 − the line's WORST\n * atom coverage: a line is only as redundant as its least-covered claim, so nothing gets proposed\n * for removal while any part of it is unique. */\nexport function assembleAudits(\n atoms: SemanticAtom[],\n verdicts: PairVerdict[],\n coverage: AtomCoverage[],\n): LineAudit[] {\n const atomById = new Map(atoms.map((a) => [a.id, a]));\n const covByAtom = new Map(coverage.map((c) => [c.atom, c]));\n\n const byLine = new Map<number, SemanticAtom[]>();\n for (const a of atoms) {\n const list = byLine.get(a.line);\n if (list) list.push(a);\n else byLine.set(a.line, [a]);\n }\n\n const audits: LineAudit[] = [];\n for (const [line, lineAtoms] of [...byLine.entries()].sort((x, y) => x[0] - y[0])) {\n // Coverage receipt: which other lines cover this one's atoms, and how strongly.\n const coverers = new Map<number, { atoms: Set<string>; ent: number }>();\n let minCoverage = 1;\n let allCovered = true;\n for (const atom of lineAtoms) {\n const cov = covByAtom.get(atom.id);\n const score = cov?.score ?? 0;\n minCoverage = Math.min(minCoverage, score);\n if (score < THETA_COVERED) allCovered = false;\n if (!cov) continue;\n for (const covererId of cov.coveredBy) {\n const coverer = atomById.get(covererId);\n if (!coverer || coverer.line === line) continue;\n const rec = coverers.get(coverer.line) ?? { atoms: new Set<string>(), ent: 1 };\n rec.atoms.add(covererId);\n rec.ent = Math.min(rec.ent, score);\n coverers.set(coverer.line, rec);\n }\n }\n\n // Conflict receipt: contradicts-verdicts incident to this line, deduped per opposing line.\n // `confirmed` marks judge-tier verdicts — only those may become warn diagnostics; NLI-only\n // conflict candidates stay panel-level (precision ~0.62 on rule-prose).\n const conflicts = new Map<number, { conf: number; confirmed: boolean }>();\n for (const v of verdicts) {\n if (v.relation !== 'contradicts') continue;\n const la = atomById.get(v.a)?.line;\n const lb = atomById.get(v.b)?.line;\n const other = la === line ? lb : lb === line ? la : undefined;\n if (other === undefined || other === line) continue;\n const prev = conflicts.get(other);\n conflicts.set(other, {\n conf: Math.max(prev?.conf ?? 0, v.conMin),\n confirmed: (prev?.confirmed ?? false) || v.tier === 'nli+judge',\n });\n }\n\n audits.push({\n line,\n atoms: lineAtoms.map((a) => a.id),\n residual: 1 - minCoverage,\n coveredBy: [...coverers.entries()]\n .map(([l, rec]) => ({ line: l, atoms: [...rec.atoms], ent: rec.ent }))\n .sort((x, y) => y.ent - x.ent),\n contradicts: [...conflicts.entries()]\n .map(([l, rec]) => ({ line: l, conf: rec.conf, confirmed: rec.confirmed }))\n .sort((x, y) => y.conf - x.conf),\n proposedRemovable: lineAtoms.length > 0 && allCovered,\n });\n }\n return audits;\n}\n\n/** Assemble the full report the API returns and the UI renders. */\nexport function buildReport(\n atoms: SemanticAtom[],\n verdicts: PairVerdict[],\n coverage: AtomCoverage[],\n stats: SemanticReport['stats'],\n): SemanticReport {\n return { atoms, pairs: verdicts, coverage, lines: assembleAudits(atoms, verdicts, coverage), stats };\n}\n","// The greedy iterative reducer — residual is relative to the CURRENT set, so reduction cuts one\n// line at a time and recomputes. (Two identical lines both score ~zero residual — each covered by\n// the other — but one must survive; a batch threshold-delete would kill both.) Each pass cuts the\n// lowest-residual line the auditor marks removable, i.e. full-coverage-by-conjunction: every claim\n// the line makes is entailed by what remains. That criterion is direction-free by construction, so\n// the reducer never leans on the arrow NLI can't call. The result is a PROPOSAL — each step still\n// carries its receipt, and behavioral verification (the profiler) has the last word.\n//\n// Takes the analysis as a function so the loop is pure orchestration: tests inject a fake; the\n// server and CLI inject analyzeSemantics + the shared cache (which makes each re-analysis after a\n// cut cost only the pairs the cut disturbed).\n\nimport type { ReductionStep, SemanticReport } from './types';\n\nexport interface ReduceOptions {\n /** Runaway backstop — a prompt proposing more cuts than this deserves human eyes first. */\n maxCuts?: number;\n}\n\nexport async function proposeReduction(\n source: string,\n analyze: (source: string) => Promise<SemanticReport>,\n opts: ReduceOptions = {},\n): Promise<ReductionStep[]> {\n const maxCuts = Math.max(1, opts.maxCuts ?? 25);\n let lines = source.replace(/\\r\\n/g, '\\n').split('\\n');\n // Current position → original 0-based line, so steps report lines as the AUTHOR's file numbers\n // even after earlier cuts shift everything up.\n let origin = lines.map((_, i) => i);\n\n const steps: ReductionStep[] = [];\n while (steps.length < maxCuts) {\n const report = await analyze(lines.join('\\n'));\n const removable = report.lines\n .filter((l) => l.proposedRemovable)\n .sort((a, b) => a.residual - b.residual);\n const target = removable[0];\n if (!target) break;\n\n steps.push({\n order: steps.length + 1,\n line: origin[target.line] ?? target.line,\n text: (lines[target.line] ?? '').trim(),\n residualAtCut: target.residual,\n coveredBy: target.coveredBy.map((c) => ({ line: origin[c.line] ?? c.line, ent: c.ent })),\n });\n lines = lines.filter((_, i) => i !== target.line);\n origin = origin.filter((_, i) => i !== target.line);\n }\n return steps;\n}\n","// SemanticReport → Diagnostic[] — the advisory fold, mirroring numericDiagnostics in compile.ts.\n// The contract this module carries: semantic findings are ADVICE. Every diagnostic it emits uses\n// the `semantic/` source namespace and info/warn severity — never error — so compile.ts's\n// `consistent`/`wellFormed` gates (which key on `logic/` and `structure/` error diagnostics) are\n// structurally out of reach. A test pins this forever; a semantic model must never be able to\n// declare a prompt broken.\n\nimport { displayLine, lineOrdinals } from '../clause';\nimport type { Diagnostic } from '../diagnostics';\nimport { THETA_DIRECTION_ACTIONABLE, THETA_EQUIVALENT_WARN, THETA_REDUNDANCY_WARN } from './config';\nimport type { SemanticAtom, SemanticReport } from './types';\n\nfunction lineRange(rawLines: string[], line: number): { start: number; end: number } {\n const raw = rawLines[line] ?? '';\n return { start: raw.length - raw.trimStart().length, end: raw.length };\n}\n\nconst fmtLines = (ls: number[], disp: (i: number) => number = (i) => i + 1): string =>\n `line${ls.length > 1 ? 's' : ''} ${ls.map((l) => disp(l)).join(', ')}`;\n\n/** Fold a semantic report into advisory diagnostics — the strongest finding per line, receipts in\n * the message, everything else left to the findings panel. Priority: a semantic conflict outranks\n * redundancy (a wrong rule beats a repeated one), full coverage outranks pairwise equivalence\n * (it's the stronger, direction-free claim). */\nexport function semanticDiagnostics(report: SemanticReport, source: string, displaySource: string = source): Diagnostic[] {\n const rawLines = source.replace(/\\r\\n/g, '\\n').split('\\n');\n // Line references speak GUTTER numbers, computed over the REAL source — the audit copy has literal\n // zones blanked, which would drop ordinals the gutter still shows.\n const ordinals = lineOrdinals(displaySource.replace(/\\r\\n/g, '\\n').split('\\n'));\n const disp = (i: number): number => displayLine(ordinals, i);\n const atomById = new Map<string, SemanticAtom>(report.atoms.map((a) => [a.id, a]));\n const out: Diagnostic[] = [];\n\n // Pairwise equivalence per line (for lines not fully covered): the classic duplicate signal.\n // Strength = the weaker entailment direction — both high means the lines are interchangeable.\n const equivalentWith = new Map<number, Map<number, number>>();\n for (const v of report.pairs) {\n if (v.relation !== 'equivalent') continue;\n const la = atomById.get(v.a)?.line;\n const lb = atomById.get(v.b)?.line;\n if (la === undefined || lb === undefined || la === lb) continue;\n const strength = Math.min(v.entAB, v.entBA);\n for (const [self, other] of [[la, lb], [lb, la]] as const) {\n const map = equivalentWith.get(self) ?? new Map<number, number>();\n map.set(other, Math.max(map.get(other) ?? 0, strength));\n equivalentWith.set(self, map);\n }\n }\n\n for (const audit of report.lines) {\n const { start, end } = lineRange(rawLines, audit.line);\n const push = (sourceName: string, severity: 'info' | 'warn', message: string): void => {\n out.push({ source: sourceName, severity, line: audit.line, start, end, message });\n };\n\n // Only JUDGE-CONFIRMED conflicts become diagnostics: NLI-only contradiction candidates run at\n // ~0.62 precision on rule-prose (bench), which would cry wolf as editor warnings. Unconfirmed\n // candidates still surface in the findings panel, where exploratory signals belong.\n const conflict = audit.contradicts.find((c) => c.confirmed);\n if (conflict) {\n push(\n 'semantic/contradicts',\n 'warn',\n `Semantic conflict — this appears to contradict line ${disp(conflict.line)} (confidence ${conflict.conf.toFixed(2)}). Advisory: review both lines.`,\n );\n continue;\n }\n\n if (audit.proposedRemovable && audit.coveredBy.length > 0) {\n const coverLines = audit.coveredBy.map((c) => c.line);\n const minEnt = Math.min(...audit.coveredBy.map((c) => c.ent));\n // Graduated severity (owner decision): near-total coverage is HIGH redundancy — a warning,\n // because the goal is a minimal orthogonal basis. Weaker coverage stays informational.\n const high = audit.residual <= THETA_REDUNDANCY_WARN;\n push(\n 'semantic/covered',\n high ? 'warn' : 'info',\n `${high ? 'High redundancy' : 'Covered'} — everything this line asserts is already said by ${fmtLines(coverLines, disp)} (the semantic tier reads entailment ≥ ${minEnt.toFixed(2)}), leaving only ${Math.round(audit.residual * 100)}% of its meaning as its own (residual ${audit.residual.toFixed(2)}). Consolidate into one statement — and verify with the test suite before cutting.`,\n );\n continue;\n }\n\n const dupes = equivalentWith.get(audit.line);\n if (dupes && dupes.size > 0) {\n const strongest = Math.max(...dupes.values());\n const high = strongest >= THETA_EQUIVALENT_WARN;\n push(\n 'semantic/equivalent',\n high ? 'warn' : 'info',\n `${high ? 'High redundancy — interchangeable with' : 'Duplicate meaning — says the same thing as'} ${fmtLines([...dupes.keys()], disp)} (each implies the other, mutual entailment ≥ ${strongest.toFixed(2)}). State it once and reference it.`,\n );\n }\n }\n\n // One-way coverage renders as a finding only when direction is actionable (judge-confirmed);\n // below that the panel shows it as symmetric \"overlaps\" and no diagnostic is emitted — the UI\n // must never claim \"safe to cut X\" on direction the models can't back.\n for (const v of report.pairs) {\n if ((v.relation !== 'covers' && v.relation !== 'covered_by') || v.directionConfidence < THETA_DIRECTION_ACTIONABLE) continue;\n const narrowAtom = v.relation === 'covers' ? v.b : v.a;\n const broadAtom = v.relation === 'covers' ? v.a : v.b;\n const narrow = atomById.get(narrowAtom);\n const broad = atomById.get(broadAtom);\n if (!narrow || !broad || narrow.line === broad.line) continue;\n if (out.some((d) => d.line === narrow.line)) continue; // strongest-finding-per-line cap\n const { start, end } = lineRange(rawLines, narrow.line);\n out.push({\n source: 'semantic/covered',\n severity: 'info',\n line: narrow.line,\n start,\n end,\n message: `Subsumed — a broader rule on line ${disp(broad.line)} already implies this (confidence ${v.directionConfidence.toFixed(2)}). Consider removing the narrower restatement.`,\n });\n }\n\n return out;\n}\n","// ── resolve() — the compile-away step ───────────────────────────────────────────────────────────────────\n// TypeGlish is a type-checked template engine for prompts: `resolve(source, bag)` evaluates the conditionals\n// against the runtime variable bag and returns the source with them APPLIED — deterministic chains collapsed to\n// the matching arm, false-guarded sections dropped, `when=…` stripped off survivors. The model never sees a\n// `$expr`; it sees only what this turn needs. Pure and deterministic — all the checking happened at compile,\n// so this is a straight substitution of pre-verified content.\n//\n// This is the conditional pass ONLY; the usual compile (comment/declaration stripping, reference expansion,\n// XML tagging) still runs afterward, so the model-facing prompt is `compile(resolve(source, bag)).xml`.\n// A malformed conditional was already flagged by the checker; resolve keeps it (fail-open, so a broken guard\n// or switch never silently deletes content).\n\nimport { isAnnotationLine } from './clause';\nimport { type Bag, type Expr, evalExpr, exprAtoms, parseExpr } from './expr';\nimport { buildStructure } from './structure';\nimport type { ImportSymbol, StructuredDoc } from './structure';\nimport { parseSwitches, resolveInlineText, selectArm, selectPredicateArm, selectTupleArm } from './switch';\nimport type { SwitchBlock } from './switch';\n\nconst norm = (v: unknown): string => String(v ?? '').trim().toLowerCase();\n\n/** Knobs for WHERE a resolve runs. The default is the FINAL, model-facing render: an undecidable guard\n * strips fail-open (the model must never read `when=` scaffolding). The import pipeline's INTERMEDIATE\n * resolve opts into `keepUndecidedGuards`: an unbound guard's tag line stays VERBATIM (attribute and\n * `@{}` pointers intact), so conditionality SURVIVES the module boundary and the host's own resolve —\n * which holds the runtime bag — decides it. */\nexport interface ResolveOptions {\n keepUndecidedGuards?: boolean;\n}\n\nexport function resolve(source: string, bag: Bag, opts: ResolveOptions = {}): string {\n const lines = source.split('\\n');\n return applyResolve(lines, buildStructure(lines), parseSwitches(lines), bag, opts);\n}\n\n/** Coerce a set of raw string values (keyed by input) into a resolve()-ready {@link Bag}, per each declared\n * input's type: a bool → true/false, a number → its numeric value, everything else (enum / string / untyped)\n * stays a string. An unset or blank value is OMITTED — the input stays unbound, so its chain/guard renders\n * as conditional prose rather than collapsing. Pure. (Lived in the web's values panel; here so the worker and\n * the cache analysis share the one coercion.) */\nexport function buildBag(inputs: readonly ImportSymbol[], values: Record<string, string>): Bag {\n const bag: Bag = {};\n for (const im of inputs) {\n const raw = values[im.key];\n if (raw === undefined || raw === '') continue;\n const kind = im.type?.kind;\n if (kind === 'bool') bag[im.key] = raw === 'true';\n else if (kind === 'number') {\n const n = Number(raw);\n if (!Number.isNaN(n)) bag[im.key] = n;\n } else bag[im.key] = raw; // enum / string / untyped\n }\n return bag;\n}\n\n/** The resolve pass over a PRE-PARSED template — the state-dependent stage. Splitting the parse (lines, doc,\n * switches — all bag-independent) from the apply lets a server parse once and resolve per turn (prepareTemplate).\n * Pure. */\nexport function applyResolve(lines: string[], doc: StructuredDoc, switches: SwitchBlock[], bag: Bag, opts: ResolveOptions = {}): string {\n // Evaluate `$DEFINE` named states into the bag first, so a guard/switch reading `$ready_to_book` sees its\n // value. A fixpoint over the defines resolves any acyclic dependency chain (a define may read another); a\n // cycle or a malformed define was flagged by the checker, so here it simply settles to false.\n const fullBag: Bag = { ...bag };\n const defs: { name: string; ast: Expr }[] = [];\n for (const [name, d] of doc.defines) {\n const ast = parseExpr(d.expr).ast;\n if (ast) defs.push({ name, ast });\n }\n for (let pass = 0; pass < defs.length; pass += 1) for (const { name, ast } of defs) fullBag[name] = evalExpr(ast, fullBag);\n\n // null → drop the line; a string → replace it; absent → keep verbatim.\n const rewrite = new Map<number, string | null>();\n\n // The inputs a block reads — the vars whose binding decides which arm wins. resolve() is PARTIAL: it only\n // collapses a switch the bag can decide; an unbound input leaves the block for render's conditional-prose\n // pass (Layer 1). That's what makes resolve(source, {}) a no-op and resolve(source, {voice}) collapse only\n // the voice switch. A $DEFINE is always computed into fullBag, so it counts as bound.\n const blockVars = (block: SwitchBlock): string[] => {\n if (block.kind === 'value') return [block.varName];\n if (block.kind === 'tuple') return block.varNames ?? [];\n const names = new Set<string>();\n for (const arm of block.arms) {\n if (arm.predicate === undefined) continue;\n const { ast } = parseExpr(arm.predicate);\n if (ast) for (const a of exprAtoms(ast)) names.add(a.name);\n }\n return [...names];\n };\n const allBound = (vars: string[]): boolean => vars.every((v) => v in fullBag);\n\n // Chains first: drop the whole chain, then re-emit the selected arm's body. A section drop (below)\n // runs afterward and overrides these, so a switch inside a false-guarded section vanishes with the section.\n for (const block of switches) {\n if (block.error !== null) continue; // malformed → keep verbatim (the checker flagged it; it won't compile)\n if (!allBound(blockVars(block))) continue; // unbound → leave it; render prose-renders it (Layer 1)\n for (let l = block.headerLine; l < block.blockEnd; l += 1) rewrite.set(l, null); // drop the whole block\n // The `@@` documenting the block goes with it: post-resolve there is no switch to document, and a\n // surviving note would re-attach to whatever the selected arm emits (stacking onto the arm's own\n // `@@`, or mis-describing a single resolved branch as \"the switch\"). Adjacency rule as everywhere:\n // blanks and // comments may sit between the note and its statement.\n let p = block.headerLine - 1;\n while (p >= 0 && ((lines[p] ?? '').trim() === '' || (lines[p] ?? '').trim().startsWith('//'))) p -= 1;\n if (p >= 0 && isAnnotationLine(lines[p] ?? '')) rewrite.set(p, null);\n // Value → match the input's value; predicate → first arm whose condition holds (evalExpr injected); tuple →\n // first arm matching every position (a value, or wildcard when the arm omits the input).\n const arm =\n block.kind === 'predicate'\n ? selectPredicateArm(block, (expr) => {\n const { ast } = parseExpr(expr);\n return ast === null ? false : evalExpr(ast, fullBag);\n })\n : block.kind === 'tuple'\n ? selectTupleArm(block, (block.varNames ?? []).map((n) => norm(fullBag[n])))\n : selectArm(block, norm(fullBag[block.varName]));\n if (arm === null) continue; // no match + no ELSE (the checker forbids this) — the block simply disappears\n if (arm.inlineBody !== '') rewrite.set(arm.headerLine, ' '.repeat(block.indent) + arm.inlineBody);\n // The surviving body re-emits DEDENTED to the block's column: the arm header it hung under is gone,\n // so its gutter (one unit under a chain arm, two under a $SWITCH row) would strand as a layout error\n // in the resolved text — and the copilot gate COMPILES resolved text. Relative structure inside the\n // body is preserved: every line shifts by the same amount; blanks stay blank.\n const lead = (s: string): number => s.length - s.trimStart().length;\n const bodyLines: number[] = [];\n for (let l = arm.headerLine + 1; l < arm.spanEnd; l += 1) bodyLines.push(l);\n const nonBlank = bodyLines.filter((l) => (lines[l] ?? '').trim() !== '');\n if (nonBlank.length === 0) continue;\n const base = Math.min(...nonBlank.map((l) => lead(lines[l] ?? '')));\n for (const l of bodyLines) {\n const raw = lines[l] ?? '';\n if (raw.trim() === '') {\n rewrite.set(l, '');\n continue;\n }\n rewrite.set(l, ' '.repeat(block.indent + Math.max(0, lead(raw) - base)) + raw.trimStart());\n }\n }\n\n // Section guards: a false guard drops the whole section (overriding any switch keeps inside it); a true guard\n // survives with its `when=…` stripped off the open tag. Partial, like switches: if the guard reads an UNBOUND\n // input, we can't decide it — keep the section and strip the `when=` (fail-open; never hide content the bag\n // didn't speak to). Under `keepUndecidedGuards` (the import pipeline's intermediate resolve) an undecided\n // guard's line stays VERBATIM instead — deferring the decision to the host's own resolve.\n const stripWhen = (line: number): string => (lines[line] ?? '').replace(/\\s*\\bwhen=[^>]*>/i, '>');\n for (const sec of doc.sections) {\n if (sec.syntax !== 'xml' || !sec.guard) continue;\n const { ast } = parseExpr(sec.guard.text);\n const guardVars = ast ? exprAtoms(ast).map((a) => a.name) : [];\n if (!allBound(guardVars)) {\n if (opts.keepUndecidedGuards !== true) rewrite.set(sec.startLine, stripWhen(sec.startLine)); // undecidable → keep, drop the guard attr\n continue;\n }\n const keep = ast === null ? true : evalExpr(ast, fullBag);\n if (keep) rewrite.set(sec.startLine, stripWhen(sec.startLine));\n else for (let l = sec.startLine; l < sec.endLine; l += 1) rewrite.set(l, null);\n }\n\n // Inline `$SWITCH ON $x ( … )` resolves last, on each surviving line's final text — so one left inside a\n // kept arm body or guarded section collapses too, while one on a dropped line vanishes with it.\n const pick = (v: string): string => norm(fullBag[v]);\n const out: string[] = [];\n lines.forEach((line, i) => {\n if (!rewrite.has(i)) {\n out.push(resolveInlineText(line, pick));\n return;\n }\n const r = rewrite.get(i);\n if (r !== null && r !== undefined) out.push(resolveInlineText(r, pick)); // string → replace; null → drop\n });\n return out.join('\\n');\n}\n","// The TypeGlish compiler — the single entry point every front-end calls. Pure: no React, no DOM, no\n// network. Source in, a structured result out; the editor renders it, the CLI prints it, the eval scores\n// it, the server serves it. One core, many surfaces — the way tsc, rustc, and clang are built.\n//\n// The synchronous tier (parse → lower → diagnose → consistency → XML) lives here and runs anywhere,\n// including the browser. The numeric (Z3/SMT) tier is async and intentionally NOT imported here, so the\n// browser bundle never pulls in z3's wasm; Node callers (CLI/server) fold it in via checkNumeric +\n// numericDiagnostics, and the browser routes that one async check through the server.\nimport { displayLine, lineOrdinals } from './clause';\nimport { runDiagnostics } from './diagnostics';\nimport type { Diagnostic, RubricDim, Severity, SpellChecker } from './diagnostics';\nimport { lower } from './ir';\nimport type { IR } from './ir';\nimport { parseConfigBlocks } from './config-schema';\nimport type { ConfigBlock } from './config-schema';\nimport { buildStructure, resolveAnchors } from './structure';\nimport { parseServices } from './tool';\nimport type { ServiceDef, ToolDef } from './tool';\nimport { compileToXml } from './xml';\n\nexport interface CompileOptions {\n /** Rubric dimensions — lets the checker flag a constraint that nothing measures. */\n rubric?: RubricDim[];\n /** The Instructions body, compiled into the XML after the System body. */\n instructions?: string;\n /** An injected dictionary predicate (from the edge — nspell in the browser/CLI). Turns on the unknown-word\n * check; when omitted the pure core ships no dictionary and that check is skipped. */\n isWord?: SpellChecker;\n /** Extra ADDRESSEE nouns that resolve to `you` (the glish.tgc `$CONFIG addressee` dial, already parsed —\n * config-schema.ts parseAddresseeConfig). The declared rules (aliases, roles) need no opt-in. */\n addressees?: readonly string[];\n /** The project's `glish.tgc` raw source — the config-schema extension layer. When present, config diagnostics\n * resolve the glish-extended schema + cross-field rules; when absent, the built-in schema only. */\n glishConfig?: string;\n}\n\n/** Everything a `.tg` file declares BEYOND the prompt — what makes a single file a whole agent. The prompt\n * itself is `xml`; this is the rest: the compile-time settings and the inline tool definitions, ready for a\n * runner (`toolInputSchema` converts a tool to the Anthropic/OpenAI schema shape). */\n/** The resolved MODEL config: the `$CONFIG model <id>` block's id + numeric params, with `via` resolved to its\n * `$SERVICE` transport (base + headers; the runner fills the secret from env, never the file). This is the\n * agent's whole model definition — endpoint + params — living in TG, not hardcoded in the harness. */\nexport interface ResolvedModel {\n id: string;\n maxTokens?: number;\n temperature?: number;\n service?: { name: string; base: string; headers: { name: string; value: string }[] };\n}\n\nexport interface AgentBundle {\n /** Compile-time settings from `$CONFIG` — the simple, header-only kinds (modality, language, …). */\n config: Record<string, string>;\n /** The resolved model config (id + params + transport) — from `$CONFIG model <id>` + params. */\n model?: ResolvedModel;\n /** Inline `$TOOL name` definitions — interface + optional HTTP binding. */\n tools: ToolDef[];\n}\n\n/** Resolve the `$CONFIG model <id>` block into the runner-ready model config: id + numeric params, and the `via`\n * `$SERVICE` looked up for its transport. A missing/dangling `via` leaves `service` undefined (the checker flags\n * it separately). Pure. */\nfunction resolveModel(blocks: readonly ConfigBlock[], services: readonly ServiceDef[]): ResolvedModel | undefined {\n const m = blocks.find((b) => b.kind === 'model');\n if (!m || m.value === '') return undefined;\n const num = (k: string): number | undefined => {\n const v = m.params.get(k);\n const n = v === undefined ? NaN : Number(v);\n return Number.isFinite(n) ? n : undefined;\n };\n const via = m.params.get('via');\n const svc = via !== undefined && via !== '' ? services.find((s) => s.name === via) : undefined;\n return {\n id: m.value,\n maxTokens: num('max_tokens'),\n temperature: num('temperature'),\n ...(svc ? { service: { name: svc.name, base: svc.base, headers: svc.headers } } : {}),\n };\n}\n\nexport interface CompileResult {\n /** The lowered logical form: directives (with guards / numeric bounds) and declarations. */\n ir: IR;\n /** Every problem found, each with a line/column range and an optional quick-fix. */\n diagnostics: Diagnostic[];\n /** False when a hard logic error (contradiction / conflicting declaration) is present. */\n consistent: boolean;\n /** False when a structural error (missing/duplicate step, dangling reference, undeclared tool) is present.\n * Orthogonal to `consistent` — a prompt can be logically consistent yet structurally broken. */\n wellFormed: boolean;\n /** The compiled, XML-tagged prompt the agent runs. */\n xml: string;\n /** The agent bundle: `$CONFIG` settings + inline tool definitions. With `xml`, everything a runner needs. */\n agent: AgentBundle;\n}\n\n/**\n * Compile TypeGlish source: parse → lower to IR → run every diagnostic → decide consistency → emit XML.\n * Synchronous and self-contained. The numeric (Z3) tier is layered on by Node callers via checkNumeric +\n * {@link numericDiagnostics}; the browser routes that one async check through the server.\n */\nexport function compile(source: string, opts: CompileOptions = {}): CompileResult {\n const rawLines = source.split('\\n');\n const diagnostics = runDiagnostics(rawLines, opts.rubric ?? [], { isWord: opts.isWord, addressees: opts.addressees, glishConfig: opts.glishConfig });\n const doc = buildStructure(rawLines);\n const model = resolveModel(parseConfigBlocks(rawLines), parseServices(rawLines).services);\n return {\n ir: lower(source),\n diagnostics,\n agent: { config: Object.fromEntries(doc.config), model, tools: doc.toolDefs },\n consistent: !diagnostics.some((d) => d.source.startsWith('logic/') && d.severity === 'error'),\n wellFormed: !diagnostics.some((d) => d.source.startsWith('structure/') && d.severity === 'error'),\n // Step anchors (`#greet`) are author-facing identity — resolve them to step numbers and strip declarations\n // before tagging, so the compiled prompt the model runs is clean and its step references are followable.\n xml: compileToXml(resolveAnchors(source), resolveAnchors(opts.instructions ?? '')),\n };\n}\n\n/**\n * Fold numeric (Z3/SMT) conflicts into the diagnostics stream. The numeric tier runs out-of-process — in\n * Node directly, or through the server for the browser — so its results arrive separately and merge here,\n * sharing the line-range + cross-reference formatting with every other diagnostic. Kept z3-free on purpose.\n */\nexport function numericDiagnostics(\n conflicts: { lines: number[]; message: string }[],\n source: string,\n): Diagnostic[] {\n const lines = source.split('\\n');\n const ordinals = lineOrdinals(lines);\n const disp = (i: number): number => displayLine(ordinals, i);\n const out: Diagnostic[] = [];\n for (const c of conflicts) {\n for (const ln of c.lines) {\n const raw = lines[ln] ?? '';\n const lead = raw.length - raw.trimStart().length;\n const other = c.lines.find((x) => x !== ln);\n out.push({\n source: 'logic/numeric',\n severity: 'error',\n line: ln,\n start: lead,\n end: raw.length,\n message: other !== undefined ? `${c.message} (conflicts with line ${disp(other)})` : c.message,\n });\n }\n }\n return out;\n}\n\n/**\n * Fold the solver's STRUCTURAL conflicts — predicate-chain exhaustiveness gaps Z3 finds — into the\n * diagnostics stream. Same out-of-process path as {@link numericDiagnostics}, but carrying `structure/<code>`\n * and the conflict's own severity, so a solver-found gap reads identically to a sync structural one and folds\n * into `wellFormed`. Kept z3-free: the solver runs elsewhere; this only shapes its results.\n */\nexport function structuralDiagnostics(\n conflicts: { lines: number[]; message: string; code: string; severity: Severity }[],\n source: string,\n): Diagnostic[] {\n const lines = source.split('\\n');\n const ordinals = lineOrdinals(lines);\n const disp = (i: number): number => displayLine(ordinals, i);\n const out: Diagnostic[] = [];\n for (const c of conflicts) {\n for (const ln of c.lines) {\n const raw = lines[ln] ?? '';\n const lead = raw.length - raw.trimStart().length;\n const other = c.lines.find((x) => x !== ln);\n out.push({\n source: `structure/${c.code}`,\n severity: c.severity,\n line: ln,\n start: lead,\n end: raw.length,\n message: other !== undefined ? `${c.message} (conflicts with line ${disp(other)})` : c.message,\n });\n }\n }\n return out;\n}\n\n// The compiler's public surface — every front-end imports from here.\nexport { report } from './report';\nexport type { TgReport, ReportDiagnostic, ReportRange, ProgramSummary, StrictnessPolicy } from './report';\nexport { atLeastImportant, importanceOf } from './catalog';\nexport type { Importance } from './catalog';\nexport type { Diagnostic, Severity, RubricDim, SpellChecker } from './diagnostics';\nexport type { HttpMethod, ParamType, ToolBinding, ToolDef, ToolParam } from './tool';\nexport { parseTools, toolInputSchema } from './tool';\nexport type { IR, IRNode } from './ir';\nexport { applyFix, composeSpans, runDiagnostics } from './diagnostics';\nexport { compileToXml } from './xml';\nexport { rename } from './edits';\nexport type { EditResult } from './edits';\n\n// The semantic tier's PURE half — atoms, verdict math, and the advisory diagnostics fold. Like the\n// numeric tier, the model engine is intentionally NOT imported here: the NLI/judge code is\n// server-only, and the browser folds its results in via semanticDiagnostics, so the browser bundle\n// never pulls in ONNX. Semantic findings are advisory by contract — `semantic/*` sources at\n// info/warn — and structurally cannot flip `consistent`/`wellFormed` above.\nexport type {\n AtomCoverage,\n LineAudit,\n OverlapRelation,\n PairVerdict,\n ReductionStep,\n SemanticAtom,\n SemanticReport,\n} from './semantic/types';\nexport { decompose } from './semantic/atoms';\nexport { candidatePairs } from './semantic/candidates';\nexport { assembleAudits, buildReport, classifyPair, verdictFrom } from './semantic/classify';\nexport { proposeReduction } from './semantic/reduce';\nexport { semanticDiagnostics } from './semantic/report';\n\n// The conditional layer: resolve() applies section guards against a runtime variable bag (compile-away).\nexport { resolve } from './resolve';\nexport { evalExpr, exprAtoms, parseExpr } from './expr';\nexport type { Bag, Expr } from './expr';\n\n// ── The two-stage pipeline: prepare ONCE, resolve+render PER TURN ─────────────────────────────────────────\n// A prompt with chains/guards is `(source, state) → prompt`, not a pure `source → prompt`. That splits the\n// compile into a STATE-INDEPENDENT parse (done once) and a STATE-DEPENDENT resolve (done per turn). A server\n// serving many turns from one prompt parses the template once, then each turn is only the per-bag work.\n// (Measured: the parse this saves is ~15µs of a ~200µs pipeline — this seam is about clean architecture and\n// the runtime/values-panel path, not latency; the whole pipeline is <0.05% of a model turn. See\n// eval/spikes/resolve-latency.ts.)\nimport { applyResolve } from './resolve';\nimport { parseSwitches } from './switch';\nimport type { Bag } from './expr';\n\nexport interface PreparedTemplate {\n readonly source: string;\n /** Apply the bag → the resolved source (bound switches/guards collapsed; the rest left for render). */\n resolve(bag: Bag): string;\n /** Apply the bag AND render → the model-facing prompt. Unbound switches become conditional prose. */\n render(bag: Bag): string;\n}\n\n/** Parse the state-independent structure of a template ONCE; the returned object resolves/renders per bag\n * without re-parsing. Use this on the hot path where one prompt serves many turns. */\nexport function prepareTemplate(source: string): PreparedTemplate {\n const lines = source.split('\\n');\n const doc = buildStructure(lines);\n const switches = parseSwitches(lines);\n return {\n source,\n resolve: (bag) => applyResolve(lines, doc, switches, bag),\n render: (bag) => compileToXml(applyResolve(lines, doc, switches, bag), ''),\n };\n}\n","// ── Agent-consumable compile report ─────────────────────────────────────────────────────────────────────\n// TypeGlish's primary consumer is an AI agent editing prompts through a product's CRUD MCP / API — not a human\n// reading editor squiggles. So the compiler needs ONE machine-shaped envelope: a stable verdict, every\n// diagnostic normalized with a machine code + category + precise range, and a STRICTNESS policy so a product can\n// make the warnings it deems important BLOCKING — nothing important is silently ignorable. This is that\n// envelope: pure and JSON-serializable, wrapping compile() plus any async-solver diagnostics the caller folds in.\n\nimport { type Importance, atLeastImportant, importanceOf } from './catalog';\nimport { compile } from './compile';\nimport type { CompileOptions } from './compile';\nimport type { Diagnostic, Severity } from './diagnostics';\nimport { buildStructure } from './structure';\nimport { parseInlineSwitches, parseSwitches } from './switch';\n\n/** How strict to be — a product tightens the compiler here so no IMPORTANT warning slips through unblocking. */\nexport interface StrictnessPolicy {\n /** Escalate every `warn` to a blocking `error` (the blunt \"warnings as errors\" switch). `info` stays advisory. */\n strict?: boolean;\n /** Escalate specific diagnostics to `error` — by full code (`structure/unused-tool`) or whole category (`style`). */\n escalate?: string[];\n /** Escalate any diagnostic at or above this IMPORTANCE to a blocking error — the precise \"strict about what\n * MATTERS\" knob. `'important'` blocks every correctness finding (dangling refs, dead rules, leaked secrets)\n * while leaving style / quality nudges advisory; `'critical'` blocks only hard errors. */\n escalateImportance?: Importance;\n /** The ONLY way to make a warning non-blocking: name its code / category here. Explicit and auditable — never\n * silent. A relaxed diagnostic still appears in the report, demoted to `info`, so nothing disappears. */\n relax?: string[];\n}\n\nexport interface ReportRange {\n line: number; // 1-based (matches compiler-CLI / editor convention)\n column: number; // 1-based, span start\n endColumn: number; // 1-based, just past the span end\n}\n\nexport interface ReportDiagnostic {\n code: string; // the stable machine key — `category/name`, e.g. `structure/non-exhaustive-switch`\n category: string; // `structure` | `logic` | `style` | `prompt` | …\n name: string; // the code without its category\n importance: Importance; // how much it MATTERS, independent of severity — what `escalateImportance` keys off\n severity: Severity; // as declared, before the policy\n effectiveSeverity: Severity; // after the policy — what the consumer acts on\n blocking: boolean; // effectiveSeverity === 'error' → this fails the compile\n range: ReportRange;\n message: string;\n fix?: { title: string; replacement: string };\n}\n\nexport interface ProgramSummary {\n inputs: { name: string; type: string }[]; // declared `$REQUIRE variable`s + domain, e.g. `enum(free|premium)`\n defines: string[]; // `$DEFINE` names\n sections: string[]; // section tags\n tools: string[];\n routes: string[];\n steps: number;\n switches: { value: number; predicate: number; tuple: number; inline: number };\n}\n\nexport interface TgReport {\n ok: boolean; // safe to use: no blocking diagnostic under the active policy\n consistent: boolean; // no hard logic error (from compile)\n wellFormed: boolean; // no hard structural error (from compile)\n counts: { error: number; warn: number; info: number }; // by EFFECTIVE severity — what the consumer acts on\n diagnostics: ReportDiagnostic[]; // sorted by (line asc, severity desc)\n program: ProgramSummary;\n xml: string; // the compiled, model-facing prompt ('' when a hard error prevents emission)\n}\n\nconst SEV_RANK: Record<Severity, number> = { error: 3, warn: 2, info: 1 };\n\nfunction splitCode(source: string): { category: string; name: string } {\n const i = source.indexOf('/');\n return i < 0 ? { category: source, name: source } : { category: source.slice(0, i), name: source.slice(i + 1) };\n}\n\n/** A diagnostic's effective severity under the policy. `relax` wins (an explicit, named opt-out is the final say)\n * and demotes to `info` — still visible, never silently dropped; otherwise `escalate` (by code/category),\n * `escalateImportance` (by how much it matters), or `strict` (all warnings) raise it to a blocking error. */\nfunction effectiveSeverity(d: Diagnostic, category: string, importance: Importance, policy: StrictnessPolicy): Severity {\n const listed = (list: string[] | undefined): boolean => !!list && (list.includes(d.source) || list.includes(category));\n if (listed(policy.relax)) return 'info';\n if (d.severity === 'error') return 'error';\n const raise =\n listed(policy.escalate) ||\n (policy.escalateImportance !== undefined && atLeastImportant(importance, policy.escalateImportance)) ||\n (policy.strict === true && d.severity === 'warn');\n return raise ? 'error' : d.severity;\n}\n\nfunction describeType(type: { kind: string; members?: string[] } | undefined): string {\n if (!type) return 'untyped';\n return type.kind === 'enum' ? `enum(${(type.members ?? []).join('|')})` : type.kind;\n}\n\nfunction summarize(source: string): ProgramSummary {\n const lines = source.split('\\n');\n const doc = buildStructure(lines);\n const blocks = parseSwitches(lines);\n const count = (kind: string): number => blocks.filter((b) => b.kind === kind && b.error === null).length;\n return {\n inputs: doc.imports.filter((im) => im.kind === 'variable').map((im) => ({ name: im.name, type: describeType(doc.inputTypes.get(im.name)) })),\n defines: [...doc.defines.keys()],\n sections: doc.sections.map((s) => s.tag),\n tools: [...doc.index.tools],\n routes: [...doc.index.routes],\n steps: doc.steps.length,\n switches: { value: count('value'), predicate: count('predicate'), tuple: count('tuple'), inline: parseInlineSwitches(lines).filter((s) => s.error === null).length },\n };\n}\n\n/** The compile knobs a report caller may thread through — the ambient project layer (`glish.tgc`), the\n * edge-injected dictionary, and extra addressee nouns. A subset of {@link CompileOptions}: the report stays\n * the agent envelope; rubric/instructions belong to richer compile callers. */\nexport type ReportCompileOptions = Pick<CompileOptions, 'glishConfig' | 'isWord' | 'addressees'>;\n\n/**\n * The agent-consumable compile report. Pure and JSON-serializable. Pass `extraDiagnostics` to fold in the async\n * solver tiers (numeric conflicts, Z3 exhaustiveness) a Node/server caller has already computed, so the report\n * reflects the FULL check, not just the synchronous one. Pass `compile` to thread the project's `glish.tgc` /\n * dictionary / addressees into the underlying compile — same knobs, same envelope.\n */\nexport function report(source: string, opts: { policy?: StrictnessPolicy; extraDiagnostics?: Diagnostic[]; compile?: ReportCompileOptions } = {}): TgReport {\n const policy = opts.policy ?? {};\n const compiled = compile(source, opts.compile);\n const all = [...compiled.diagnostics, ...(opts.extraDiagnostics ?? [])];\n\n const diagnostics: ReportDiagnostic[] = all\n .map((d): ReportDiagnostic => {\n const { category, name } = splitCode(d.source);\n const importance = importanceOf(d.source, d.severity);\n const eff = effectiveSeverity(d, category, importance, policy);\n return {\n code: d.source,\n category,\n name,\n importance,\n severity: d.severity,\n effectiveSeverity: eff,\n blocking: eff === 'error',\n range: { line: d.line + 1, column: d.start + 1, endColumn: d.end + 1 },\n message: d.message,\n ...(d.fix ? { fix: d.fix } : {}),\n };\n })\n .sort((a, b) => a.range.line - b.range.line || SEV_RANK[b.effectiveSeverity] - SEV_RANK[a.effectiveSeverity]);\n\n const counts = {\n error: diagnostics.filter((d) => d.effectiveSeverity === 'error').length,\n warn: diagnostics.filter((d) => d.effectiveSeverity === 'warn').length,\n info: diagnostics.filter((d) => d.effectiveSeverity === 'info').length,\n };\n\n return {\n ok: counts.error === 0,\n consistent: compiled.consistent,\n wellFormed: compiled.wellFormed,\n counts,\n diagnostics,\n program: summarize(source),\n xml: compiled.xml,\n };\n}\n"]}
|