/** * segment.ts — Tier-A deterministic (no-model) segmenter. * * Splits a CLAUDE.md / AGENTS.md into ATOMIC candidate rules with provenance. * Pure, deterministic, strict TS, no external deps. * * Design bias: PRECISION over recall. A missed rule costs a row; a garbage * atom costs credibility. When in doubt we UNDER-split and REJECT. */ /** A single atomic candidate rule extracted from an instructions file. */ export interface SegmentedRule { /** Normalized rule text (bullet marker stripped, continuation joined, whitespace collapsed). */ text: string; /** Source file path (as supplied by the caller), or undefined. */ file: string | undefined; /** 1-based inclusive start line in the source. */ lineStart: number; /** 1-based inclusive end line in the source. */ lineEnd: number; /** Verbatim slice of the source spanning [lineStart..lineEnd] — for UI highlight. */ exactQuote: string; /** 3/3 cues => "high"; 2/3 => "medium". (Rejected candidates are never emitted.) */ confidence: "high" | "medium"; } /** Why the segmenter decided a bullet is NOT a rule (the transparency signal — * see `research/rule-enforcer-design.md` §3). `index`/`description`/`leadin`/ * `no-signal` come from the gate; `section` means it sits under a non-rule * heading (Setup / Commands / Key Files / Architecture …). * * `leadin` is a colon-terminated procedure/enumeration HEADER ("To add a * setting:", "Run the full test suite:", "Python check:") whose enforceable * content — if any — lives in the sub-bullets/code-block it introduces (verified * on the OSS corpus: the sub-items are segmented independently, so dropping the * header loses nothing). Kept DISTINCT from `no-signal` on purpose: routing * re-surfaces `no-signal` skips in the "possible (review)" recall tier, and a * lead-in is a CONFIDENT drop that must not re-enter that tier. */ export type RejectReason = "index" | "description" | "leadin" | "no-signal" | "section"; /** A BULLET the segmenter saw but did NOT treat as a rule, with the reason — so * the audit report can be honest about what it set aside (a heuristic misses * declarative rules; showing skips lets a human eyeball a wrong drop). Bounded to * list items on purpose; rejected paragraph prose is not reported (too noisy). */ export interface SkippedBullet { readonly text: string; readonly file: string | undefined; readonly lineStart: number; readonly lineEnd: number; readonly reason: RejectReason; } /** The segmenter's full output: the confident/medium candidate rules PLUS the * bullets it rejected (with reasons), so nothing is silently dropped. */ export interface SegmentResult { readonly segments: SegmentedRule[]; readonly skipped: SkippedBullet[]; } /** * Split a CLAUDE.md / AGENTS.md into atomic candidate rules with provenance. * * Deterministic Tier-A heuristic. Code fences and tables are excluded from * candidacy. Candidate units are (a) list items with attached continuation * lines and (b) sentences of paragraphs under a rule-ish heading. This function * is a thin DISPATCHER — each block type is handled by its own pure helper * (`handleListItem` / `handleParagraph`); the state it threads is the fence * toggle and the current `HeadingState`. */ export declare function segmentInstructions(markdown: string, file?: string, skipLines?: ReadonlySet): SegmentResult; //# sourceMappingURL=segment.d.ts.map