CLAN Parity Field Guide
Status: Current Last updated: 2026-06-12 19:01 EDT
This page is the distilled, cross-cutting field guide for porting a CLAN
command to byte-for-byte parity in chatter-clan. It is not the mechanical
how-to (see Adding a Command) and not the per-flag record
(that lives in each command page’s audit table, e.g.
FREQ). It is the wisdom layer: the patterns,
landmines, and infrastructure that the FREQ depth-first effort surfaced, written
so the next porter (FREQ flag #N, or CLAN command #2) does not re-learn them the
hard way.
It is a living document: append a short “what this row taught” note whenever a flag or command surfaces a reusable lesson, and the accumulated result is the final porting report. Much of what follows was reconstructed from FREQ’s audit notes, the divergence ledger, and commit history; future rows should add their lesson as they land, not weeks later.
Why this exists. Completing FREQ to full parity is the vehicle for estimating the cost of porting all of CLAN. That estimate is only as good as the reusable template and shared primitives the work produces. This guide is that template made explicit.
1. The method: source-grounded, golden-first, depth-first
The unit of work is the command, not the flag (see the parity strategy in
the repo AGENTS.md). Within a command, each flag-row follows the same loop:
- Read the manual section for intent.
CLAN.htmlstates what a flag is intended to do. Cite it by section. The manual and the CHAT manual are different documents; useCLAN.htmlfor command flags. - Read the command’s own
getflagin CLAN source for behavior. This is the single most important habit. CLAN commands intercept flags in their owngetflag()(e.g.freq.cpp:621, thecase 'd'/case 'o'blocks) before falling through to the sharedmaingetflag(cutt.cpp). The book’s own draft notes are a map, not the authority, and have been wrong (the+c2and+drows both shipped with manual-only drafts that the source contradicted). Cite behaviorfile:line. - Live-probe the binary to seed the oracle. Run the real CLAN tool on a trimmed fixture, capture the exact bytes. This is not “reading the implementation”; the binary’s output is the spec. Pin the residual uncertainties (sort order, wildcard handling, exact wording) here.
- Write the failing top-level test first (golden for render parity, subprocess for CLI/rewriter/error paths); see §6.
- Implement across the five seams (§4), then GREEN.
- Localize any divergence with judgment, not reflex (§5).
Every claim about CLAN carries two citations: a manual section (intent) and a
file:line (behavior). Every claim about chatter carries a chatter file:line.
2. The biggest structural lesson: a flag prefix is rarely a scalar
CLAN overloads a single flag letter onto multiple orthogonal state variables, dispatched by the characters that follow it. Modeling such a prefix as one scalar “mode integer” is the worst kind of parity bug: it looks right and is silently wrong for the exact users (CLAN-trained researchers) the command targets.
FREQ +d (freq.cpp:838-913) is the canonical example. The one letter drives:
| Sub-form | CLAN state set | chatter flag |
|---|---|---|
+d1 | isCombineSpeakers + onlydata | --word-list-only |
+d2/+d3 | onlydata=3/4 (spreadsheet) | --spreadsheet per-word/summary |
+d4 | onlydata=5 (types/tokens text) | --types-tokens-only |
+d5 | zeroMatch (independent boolean) | --include-zero-frequency |
+d8 | isCrossTabulation | (deferred, %mor cross-tier) |
+d20 | isSpreadsheetOnePerRow | (pending) |
+d<N … | percentC + percent (forces spreadsheet) | (pending) |
FREQ +o (freq.cpp:815-837) is the same shape: +o/+o0 → isSort,
+o1 → revconc=1, +o2 → revconc=2+chatmode=0, +o3 → isCombineSpeakers.
Rule. Decompose the prefix into its independent axes and give each a
distinct, typed chatter field (an enum when there are >2 states, a single
include_*/combine_* bool only when the name fully communicates true).
Never a --display-mode N catch-all, which both squats CLAN slots and reintroduces
boolean/int blindness. The decomposition is also the honest unit of the
porting-effort estimate: count axes, not flag letters.
3. The faithfulness rule, and un-squatting
Every CLAN flag slot implements CLAN’s documented semantic byte-for-byte. Chatter conveniences (new formats, ergonomic shortcuts) get chatter-only flag names, never a CLAN slot.
FREQ shipped several squats that had to be undone: +d2/+d3 were mapped to
a chatter --format csv stdout convenience, and +d5/+d20/etc. fell through a
generic +dN → --display-mode N rewrite. Un-squatting means: route the CLAN slot
to a faithful implementation, and keep the chatter convenience reachable under
its own name. Watch for squats whenever a rewriter arm maps a CLAN slot to a
pre-existing chatter flag that does not match CLAN’s documented semantic.
4. The five implementation seams (the porting template)
A flag touches the same layers every time. Internalize this and each new flag is a fill-in-the-blanks exercise.
flowchart LR
A["CLAN +flag<br/>(clan_args/rewriter.rs)"] -->|"--flag"| B["clap field<br/>(clan_commands/mod.rs)"]
B --> C["dispatch + guards<br/>(commands/clan/analysis.rs)"]
C -->|"FreqOptions"| D["service builder<br/>(service_types/builder.rs)"]
D -->|"FreqConfig"| E["command logic<br/>(commands/freq/mod.rs)"]
E -->|"FreqResult"| F["render<br/>(commands/freq/output.rs)"]
G["golden harness<br/>(tests/clan_golden/harness.rs)"] -. "builds FreqConfig directly,<br/>bypassing A-D" .-> E
- Rewriter (
clan_args/rewriter.rs):+flag→--flag, subcommand-guarded (the same+d/+oletter means different things in FREQ vs KWAL vs COOCCUR, so every arm matches onsubcommand). Unmapped forms fall through to clap, which rejects the literal token, so an unimplemented flag errors on paste rather than silently no-oping. - Clap field (
cli/args/clan_commands/mod.rs): the typed chatter flag. Value-enums for multi-state axes; bare bool only for singleinclude_*/combine_*. - Dispatch (
commands/clan/analysis.rs): map clap args → domain options via small*_to_*free functions (house style). Flag-combination guards live here, not in the command/service; see §7. - Options → Config (
service_types/{options,builder}.rs→commands/freq/mod.rs): typed config field. Per-row mutable state goes in theStatetype; pure logic incount_utterance/finalize. - Render (
commands/freq/output.rs): the CLAN-format render is the parity target; text/JSON/CSV are chatter’s own formats and need not match CLAN.
Sixth touch point: the golden harness (tests/clan_golden/harness.rs)
constructs FreqConfig directly from the rust-side args, bypassing seams 1-4.
So a new config field needs a one-line extra_args.contains(...) / parse_*
addition in the harness too, or the golden cannot exercise it.
5. Localizing a divergence: four terminal states, not “make it match”
When chatter differs from the binary, the answer is judgment, grounded in the manual, into exactly one of:
- chatter bug → fix chatter (the default when the binary agrees with the manual).
- CLAN-binary bug → diverge deliberately; mark the golden
DivergesFromClan, document with both a manual citation and a sourcefile:line. Worked example: CLAN-DIV-003, FREQ+c1: the manual says “uppercase in the middle,” but the binary’sisRightUpperloops from position 0 and also keeps initial-caps. chatter implements the documented semantic; the golden asserts it differs from CLAN. - manual mistake / outdated text → escalate; do not decide solo.
- data /
%mortagging artifact → raise as a MOR/data matter; do not bake a workaround into the command.
There is a fourth terminal state beyond “matches/diverges”: deferred.
FREQ +o2 sets chatmode=0, reinterpreting the CHAT file as plain text and
counting whole input lines as tokens (%mor:/@ID:/@Begin included). That is
incompatible with chatter’s AST-first model (it would require bypassing the
parser), so it is a documented non-goal, not an open gap. A command is
“done” when every row is matched, diverged, or deferred, not when every row has
a golden. This is modeled by the Deferred BookStatus, which the parity
metric excludes from the provable denominator.
6. Testing: golden is the render oracle, subprocess is the CLI oracle
| The flag’s seam | Top-level test |
|---|---|
| Single-file render parity | Golden vs OSX-CLAN (tests/clan_golden/) |
| CLI parsing / rewriter / error paths | Subprocess (assert_cmd, crates/talkbank-cli/tests/) |
Multi-file / directory orchestration (+u, +re) | Subprocess (no single-file render exists by nature) |
Write the failing test before the implementation. The golden is seeded from
the binary (just regen-clan-goldens, needs CLAN_BIN_DIR); the RED is then
chatter’s render not matching the committed golden.
Harness gotchas that recur for every command
- CLAN reads stdin. The harness pipes the fixture to the binary; the banner
reads
From pipe input, and the raw output carries a doubled banner plus a carriage-return progress-garbage line (8\r\t).strip_clan_headernormalizes all of this; the committed golden starts at the first real content line. - Header-less / count-first output.
strip_clan_headerused to drop the first line whenever its first token was numeric, correct for the progress line, but it also ate a real count entry (1 Triangle) for output with noSpeaker:banner (FREQ+o3combined mode). Fixed to drop only a single numeric token line. Any command whose output can begin with a count rather than a header will hit this; the fix is in place but the lesson generalizes. - The command-echo banner echoes your search terms. A subprocess test that
asserts
out.contains("zzz")on a+szzzrun is fooled by the echoed command line. Assert on the table entry form (<count> <word>\n), not raw stdout. (Bit+c4,+u/+re, and+d5.) - Verify infra changes are benign by regenerating all goldens and confirming
zero diff to existing files (the
strip_clan_headerfix was validated this way). None(rewriter pass-through) does NOT reject a+-prefixed token, it makes it a bogus FILE argument. Many rewriter arms returnNonewith the comment “pass through so clap rejects the literal token.” That holds for--prefixed tokens (clap treats-as its option sigil and rejects unknown shorts) but is FALSE for+-prefixed tokens: clap does not treat+as an option prefix, so+d8/+QQQpass through as a positional, the shared file-discovery layer warn-skipped it as a missing file, and the command exited 0 with DEFAULT output, silently wrong for the exact CLAN-trained user the command targets. Fixed systemically (2026-06-04) at theDiscoveredChatFilesboundary (talkbank-clan/src/framework/input.rs): a positional beginning with+/-(a bare-stdin marker exempt) routes toUnrecognizedClanFlagArgs, andinto_files()is now fallible so every consumer (the analysis service for FREQ/MLU/…, CHECK,find, LSP) is forced by the type to handle it. Lesson: an unconsumed flag-shaped token must ERROR; prove it with a subprocess test asserting the unknown/unimplemented flag exits non-zero (inapplicable_flag_tests.rs), not just that the known flags work.
7. Where flag-combination guards live
CLAN rejects many flag combinations (+c2 needs a wildcard +s and forbids a
multi-word +s; +d5 forbids wildcards/duplicates in +s and requires at least
one +s). These guards depend on the extracted per-word filter, which is
assembled at the CLI dispatch (analysis.rs, take_per_word_filter). So the
guards live there, emitting exit_with_error, not in a service-layer
TryFrom.
This was a deliberate altitude call (a /simplify pass explicitly kept the
+c2 guard at dispatch): plumbing typed domain errors out of the service is
unreachable from the LSP today, so dispatch is the correct, consistent home.
New combination guards mirror the +c2/+d5 block exactly.
8. Shared framework primitives (the real porting accelerant)
Extracting reusable primitives is first-class work, not cleanup: the next command’s cost is dominated by whatever new primitive its hardest flags need. What FREQ has produced so far:
framework::diversity::moving_average_ttr(FREQ+bNMATTR): a windowed TTR average reusable by VOCD and other lexical-diversity measures.framework::multiword(FREQ+s"a b",+c3/+c4/+c7) : the multi-word search engine. Its matcher returnsMatchspans (slot→token indices), not booleans, precisely so KWAL (context windows), COMBO (combinations), and FREQ (count + matched-words display) reuse one engine. This is the de-risking that justified doing the multi-word cluster early.WordFilterwithWordFilterMode::PerWordEmitandcount_matching_includes: per-word include/exclude with+c2multiplicity.- The match-mode axes as typed enums (
MatchOrder,MatchScope,MultiWordMatch) : no boolean blindness at the seam. framework::dependent_tier_tokens(FREQ+t%X): the raw dependent-tier token stream (whitespace-split, bare-.dropped) for an arbitrary%X, keyed offDependentTier::kind(). KWAL/COMBO+t%Xreuse it; the byte-identical open-coded form inrely/keymap/chains(each behind a%codspecial-case) should migrate onto it. Kept deliberately pure (no analysis-specific excludes) so it stays a faithful tokenizer for all consumers; CLAN’s per-command default-exclude list is layered on top by the command (see §9).
When a command’s hardest flag needs logic that another command will also need
(tier scoping, cross-tabulation, context windows), build it as a framework
primitive returning typed spans/values, not a command-local helper.
9. Landmines specific to CLAN semantics (verify per command)
- Case polarity is per-command. FREQ preserves case by default
(
nomap=TRUE,cutt.cpp:7845) and+kfolds; KWAL/COMBO/FREQPOS/DIST/MAXWD fold by default and+kpreserves. Resolve once viaAnalysisCommandName::effective_case_sensitiveand thread the effective value to both the+sfilter and the table keying. Getting the polarity backwards silently changes every count. +sis a per-word emit filter for FREQ, not an utterance gate. Utterances with no matching word still appear; non-matching words inside a matching utterance are not counted. Extracted viatake_per_word_filter; the framework utterance-gate filter must NOT also carry these patterns. Other commands may use+sas a true gate; check the source.- Word identification is AST-based, not prefix-based. CLAN drops
xxx,www, andword[0] in {0,&,+,-,#}by character prefix; chatter usesis_countable_word()on semantic type, which is more precise (a filler&-umand a fragment&+frhave distinct types). This is an accepted, documented refinement, not a divergence to “fix.” - Spreadsheet output is the one byte-parity exception: compare parsed cells
(semantic equivalence), not raw SpreadsheetML, because CLAN’s
.xls/.cexcarries non-semantic version/style boilerplate. Everything else stays byte-for-byte. - The CLAN wildcard set is
* % _(isFoundWildCard), not just*. Guards that only check*are subtly incomplete. - CLAN seeds a default exclude-word list at command init, distinct from tier
tokenization.
maingetflag/maininitwordsplus per-commandmor_initwords(cutt.cpp:8827-8833:beg|*,end|*,cm|*,…) andgra_initwords(cutt.cpp:8835-8840:*|*|{BEGP,ENDP,LP,PUNCT}) add patterns every token is matched against and dropped if it hits. This is why FREQ+t%gradrops theN|M|PUNCTrelations and+t%mordrops markup morphemes, even though they are real whitespace tokens on the tier. The patterns are anchored (beg|*is a prefix,*|*|PUNCTa suffix), so exact prefix/suffix tests reproduce them without a general wildcard matcher. Crucially these lists are per-command:gra_initwords’s only caller is FREQ,mor_initwordsis shared by ~30 commands. So the default-exclude belongs with the command’s counting, not the shared tokenizer, or sibling consumers (rely/keymap, which want the raw tokens) inherit excludes they should not.
10. The metric, and reading “how done is this command”
book/src/clan-reference/parity-status.md carries a CI-guarded, generated table:
flag-rows proven (byte-parity golden) / provable rows, plus diverged
(documented) and claimed-Done-no-golden (the overclaim gap the acceptance
audit could never see). Regenerate with UPDATE_PARITY_METRIC=1. Deferred rows
are excluded from the denominator. A row counts as proven only when a golden’s
covers flag matches the book audit row, so the book table and the goldens
cross-check each other; drift in either fails CI.
11. Effort model for the whole-CLAN port (the deliverable)
What FREQ is teaching about the cost of the remaining ~60 commands:
- Cheap, once the template + primitives exist: sort variants, display modifiers, search/percent filters, speaker/tier selection: bounded, self-contained, golden-provable. These are a few hours each: audit, one golden, one subprocess test, fill the five seams.
- Expensive: anything needing a new framework primitive (multi-word engine,
cross-tabulation, context windows, tier alignment) or that reinterprets the
input (
chatmode=0). Cost is dominated by the primitive, which then amortizes across every command that reuses it. - Watch for overlap with separate commands. FREQ
+d6/+d7/+d8(%morsource/target linking, cross-tabulation) overlapmortable/freqpos; their scope is a PI decision (port inside FREQ, or share with the sibling command?), not a solo call. Flag these rather than absorb them.
The per-command estimate is therefore roughly: (source-audit time) + (Σ cheap flags × template cost) + (Σ new primitives × primitive cost). The denominator of the parity metric, read across commands, is the visible proxy for that sum.
Per-row lessons log
Append a one-paragraph note here when a flag teaches something reusable. Keep the granular per-flag behavior in the command page; keep the transferable lesson here.
-
+bNMATTR (2026-06-02): first extraction of aframework::diversityprimitive; established that a lexical-diversity measure should be a shared windowed function, not a FREQ-local loop. Also the first flag with a spreadsheet-column interaction (+badds a trailing MATTR column to+d2/+d3). -
Multi-word cluster
+s"a b"/+c3/+c4/+c7(2026-06-02): theframework::multiwordengine; the decision to returnMatchspans rather than booleans so KWAL/COMBO reuse it. Largest single de-risking of the remaining port. -
+c2(2026-06-02): source contradicted the manual-only draft (capwd==3is single-word per-pattern multiplicity, not a multi-word mode). Established the dispatch-layer guard pattern and the “read the source, not our draft” rule. -
+d2/+d3spreadsheet (2026-06-02): semantic-equivalence (parsed cells) is the one byte-parity exception; reusetalkbank-modelIDHeaderrather than re-parsing@ID. -
+d5zeroMatch (2026-06-03): an independent boolean axis squatting under the+dprefix; display-only injection that must not perturb the types/tokens/TTR statistics; guards mirror+c2. -
+o3combine-speakers ++o2deferral (2026-06-03): exposed the header-less-output bug instrip_clan_header; motivated the first-classDeferredterminal status and its exclusion from the metric denominator. -
+t%Xdependent-tier scoping (2026-06-03): first shared tier-token primitive (framework::dependent_tier_tokens); the “expensive but amortizing” kind of row (KWAL/COMBO reuse it). Three lessons. (1) A flag with a tier argument is still a count-source axis:use_mor: boolbecame a three-variantCountSourceenum (MainTier/MorStructural/DependentTierTokens(TierKind)) so the nonsensical “structural-mor AND tier-gra” state is unrepresentable; the--mor-vs---tierguard lives at dispatch (§7). (2) Tokenization and the default-exclude list are different layers (§9): the bare.is dropped in the pure tokenizer, but the%graPUNCT relations are dropped by CLAN’s FREQ-seeded exclude list (gra_initwords) layered on top in the command, keeping the primitive faithful forrely/keymap/chains. The golden RED that taught this was+t%graover-countingN|M|PUNCTby 2, localized to a chatter bug (incomplete exclusion), not a CLAN divergence, by findingcutt.cpp:8840. (3) The CLAN slot’s faithful partner is not always chatter’s existing flag:+t%morwhitespace-counts the raw line (a clitic = one token), so it maps to--tier mor, NOT chatter’s structural--mor; the prior+t%mor↔--morgoldens were incidentally byte-equal only because the fixture is clitic-free. Also: the “%mor line forms” TTR advisory is a%mor-conditional presentation row (isMorUsed,freq.cpp:1536), proven in both directions by the gra/mor golden pair. -
-t%Xdependent-tier EXCLUSION (2026-06-03): the row that proves the manual-first/probe-first discipline pays off. The prior handoff called-t%Xa “small no-op” (a dependent tier isn’t counted by default, so excluding it seemed free). The binary said otherwise:+tand-tare the two halves of CLAN’s tier-selection set, and they have OPPOSITE defaults:+t%X= “ONLY %X” (restrict),-t%X= “main tier + ALL dependent tiers EXCEPT %X” (a brand-new combined mode). The lesson: never assume a flag is a no-op; probe the binary. Implementation-wise the combined mode fell out of method extraction: pulling theMainTierandDependentTierTokensmatch arms intocount_main_tier/count_dependent_tiermethods made the new arm a literal composition (count_main_tier(...)+ per-present-tiercount_dependent_tier), no new counting logic. Two more transferable points: (1) the advisory tracks the explicit include, not the data:-t%Xkeeps the “%mor line forms” advisory even when it sweeps%morin, because CLAN setsisMorUsedonly for+t%mor; sois_mor_basedstaysfalsefor the exclude mode. (2) The+t/-tcombination (an include and an exclude together) is a separate tier-selection state machine, deferred; the dispatch guard errors on any--mor/--tier/--exclude-tiermix rather than half-implement it. -
+xutterance-length filter (2026-06-03): the first reusable utterance-gate primitive added to the sharedFilterConfig(UtteranceLengthFilter), alongside speaker/range/role/id;+xis a common CLAN limiting option, so the gate (not the FREQ command) is its home, and other commands’+xreuse it. Four transferable points. (1) A multi-form flag can be landed honestly as Partial.+x C N Uspans three units (w/c/m) plus a+xScontent form; only the word unit is clean, so the row is Partial: implementedw, and the deferred units/forms ERROR at parse (not silent no-op). (2) A Partial row should not inflate the metric. The render golden (freq_x_wordlen_eng) deliberately carriescovers: &[], so it is a regression proof without marking+x“proven”, the honest counterpart of+c4’s “Done-with-tiny-edge + cover”. (3) Reuse the project’s word identity. The gate counts via chatter’s ASTcountable_wordsrather than re-deriving CLAN’s char-level skip rules; the field-guide §9 AST-vs-char note governs any edge-token divergence. (4) The rewriter is subcommand-overloaded for a single letter.+xmeans the length filter for FREQ but a bare+xNfor MAXWD, so the rewriter arm isif subcommand == Freq, an unconditional arm shadowed MAXWD’s (caught byunreachable_patterns). -
+xchar unitc(2026-06-03): landed as the second+xunit, byte-parity goldenfreq_x_charlen_eng(+x>20cdrops*SPE’s 17-char utterance, 15→12 tokens). Two transferable points. (1) Generalize the threshold the moment a second unit lands. The word-onlyWordCountThresholdbecame unit-agnosticLengthThresholdand the filter gained a typedCountUnitaxis (Word/Char), exactly the flag-prefix-is-not-a-scalar rule the original+xentry anticipated (“needs a unit-generic sibling or rename”). Do the rename when the second case arrives, not later. (2) Reuse an existing measurement primitive. The char count iscleaned_text().chars().count()summed overcountable_words(the same primitive WDSIZE/MAXWD already use), so the char unit is byte-clean on the fixture with zero new char-tokenization logic. -
+xmorpheme unitm: the anomaly RESOLVED as a CLAN doubling bug (2026-06-03). The prior session deferredmbecause it “live-probed anomalously (more tokens than bare)”. Probe-first plus manual-first localized it. CLAN+x>0m(which should pass every utterance, so should equal the bare output) instead emits BOTH the main-tier words AND the%mor-tier tokens:*SPE15->30, withTriangleandnoun|triangleboth counted. The morpheme-count walk (cutt.cpp:16409-16507,rightUttLenCntFUttLen==2) scans the%mortier and leaks%morinclusion into FREQ’s word harvest. Manual 6405 defines+xas “include only utterances which are C than N items”: a pure utterance filter, never a change to what FREQ counts. So this is a CLAN-binary bug (localization category b), not a chatter gap and not a data artifact: chatter implementsmas a pure morpheme-count filter (no doubling), markedDivergesFromClan(a deliberate documented divergence). The transferable lesson: a flagged “anomaly” is a localization task, not a permanent unknown: run the limiting probe (>0, which should be a no-op filter) and the deviation from no-op exposes the leak; then the manual says whether the binary or chatter is wrong. The word and char units share+x’s filter slot and are unaffected; only the morpheme unit triggers the leak. -
+x…mIMPLEMENTED + the parity-vs-correctness pivot (2026-06-04): the morpheme unit landed, and getting it right forced the first place chatter deliberately OUT-CORRECTS CLAN on UD data rather than reproducing it. Five transferable points. (1) “Reuse the existing counter” can hide that the existing counter is also wrong. The plan was to reuse MLU’s morpheme counter as “the correct count”; verifying it first showed chatter’s MLU had been built to MATCH CLAN’scountMorphsand so inherited the exact same gap (UD present participle-Gerwas never traced, only the legacy-PRESP), undercounting “going” as 1 not 2. Lesson: verify the reused primitive’s correctness against the manual, never assume it because it passes its own (CLAN-matching) goldens. (2) When CLAN is incomplete on UD, “match CLAN” means shipping a bug. §7.21 traces “Present Participle”; CLAN’scountMorphsmigrated-PL→-Plurand-PAST→-Pastbut never added-Ger, so the binary under-counts. chatter adds-Ger(the like-for-like UD twin of the already-traced-PRESP), computing the CORRECT count and flipping MLU MatchesClan→DivergesFromClan. The 9-character edit is the whole pivot: from “byte-match CLAN” to “be correct, document the gap.” (3) One shared primitive, not per-command copies.framework::count_traced_morphemes_in_utterance(extracted from MLU) is the single home both MLU and FREQ+x…mconsume, so they cannot drift, the exact cross-command consistency CLAN lacks (its MLUcountMorphsand FREQ+x…mismorfchardisagree wildly, 4 vs 12 on the same UD line). (4) Implement the verified, escalate the inferred. The corpus uses-Ger(28) but also-Genpossessive(44),-Part(96),-Prog(4), none traced. Only-Geris the unambiguous like-for-like UD completion of a concept the list already traces; the §7.21 mapping of the others (is-Parta past participle, which §7.21 does NOT list? is-Genalways possessive? multilingual?) is real judgment, so it was DEFERRED to a separate grounded audit, not inferred into code. (5) A “menu of morpheme modes” can dissolve into one correct notion. The three competing counts (CLAN 12,mor_item10, MLU ~5) were not three valid choices but one manual-grounded notion (§7.21 traced) plus CLAN’s bug plus a feature-count artifact (mor_item_morpheme_count, 1+features, used by SUGAR/EVAL, kept distinct). So no force-explicit-mode framework was built;+x…mjust computes the one correct count. The morpheme-anomaly investigation (the doubling, above) and this one are recorded in the project’s investigation notes. -
+xxxx/+xyyy/+xwwwmarker restore + the byte-stride CLAN bug (2026-06-04): the+xScontent-include form re-includes a normally-stripped unintelligible marker (xxx/yyy/www) into the+xlength count. Four transferable points. (1) A “content form” can split into a high-value observable and a near-no-op; land the observable, defer the rest faithfully.+xSis two mechanisms in CLAN: the marker restore (restoreXXX, genuinely changes the count) and a general+xWORDinclude via thewdUttLenlist, which is a near-no-op (excludeUttLenalready default-counts unmatched words, so aninc='i'tag only bites as an exception to an overlapping exclude pattern). Ship the restore; keep+xWORD/+x@Ffail-closed; row stays Partial. (2) When a flag ADDS a category to an existing count, parameterize the validated walker, do not write a second walk. Restored markers must obey the same group-recursion and retrace/replacement rules as countable words, or they drift from the base+xcount chatter already byte-matches against CLAN. The fix was to thread akeep: &dyn Fn(&Word) -> boolpredicate through the existingcollect_countablerecursion (countable_wordspassesis_countable_word; the newwords_for_utterance_lengthpasses “countable OR a restored marker”), reusing one tree-walk for both. (3) CLAN’s text-buffer scans carry position-dependent bugs; when a divergence looks data-dependent, probe by BYTE OFFSET.correctForXXXYYYWWW(cutt.cpp:16260-16311) advancesi += 2once per marker check (xxx/yyy/www) plus thefor’si++= a stride of 7, so it only restoresxxxat byte offsets ≡ 0 (mod 7). The tell that this was position, not structure: a BARExxxat end-of-line (the dog ran xxx) was NOT restored while a barexxxat start (xxx fell off him) WAS, ruling out “groups exclude restore”. A controlled 7-utterance probe varying only the marker’s offset (a xxx end…abcdefg xxx end) then isolated it: only offset 7 restored. Read the source to find the stride, the probe to confirm it. (4) An “off-by-i+=2” C bug is a clear bucket-2 divergence, no escalation needed. The manual (6405) states the restore unconditionally; a byte-offset dependency has no possible intended meaning, so chatter restores correctly (AST-based, position-independent) and documents CLAN-DIV-005, the same do-the-correct-thing posture as the+x…mdefects above. (5) The sibling-x@FILE/+x@FILEfile forms split the same way the literal forms did, and show bucket-2 (fix) vs bucket-3 (escalate) side by side.-x@FILE(exclude from file) is unambiguous, mirrors-s@F’s@FILErewrite idiom (rest.starts_with('@') → --…-file), and feeds the sameexclude_from_countlist, so it just lands. The+xWORD/+x@FILEINCLUDE form is the opposite: its manual usage text (“count only this word”,cutt.cpp:9886) flatly contradicts the binary (excludeUttLendefault-counts unmatched words, so the include tag is a near-no-op with an arbitrary descending-alphabetical precedence), so its correct semantic is genuinely unknown. That is a bucket-3 escalation (maintainer call), not a thing to reproduce: keep it fail-closed and put it in the report, rather than encode an arbitrary artifact. The byte-stride bug and the include contradiction, found one flag apart, are the cleanest contrast in the guide between “the binary is wrong, fix it” and “the manual and binary disagree, ask”. -
+rNfamily audit, an audit can indict the DEFAULT, not just a flag (2026-06-04): auditing+r(word-form treatment: parentheses, prosodic symbols,[: text]replacement, retracings,%mor-combine; parsedcutt.cpp:9530-9583) surfaced that chatter’s default FREQ output diverges from CLAN’s, independent of any flag. Two transferable points. (1) A “cheap tail” label from a handoff is a hypothesis, not a finding, re-audit it.+rwas queued as cheap; the source+manual+probe pass showed it is a word-normalization parity cluster (each sub-flag tunes how a word is cleaned for counting), with a default-parity bug underneath. Always run the audit before trusting the effort estimate. (2) A key/display split can diverge from CLAN and from itself. CLAN applies its+r1default (remove omitted-material parens but keep the letters:bein(g)→being) once, so its grouping key and its display agree. chatter splits the two: the FREQ key iscleaned_text()(alreadybeing,+r1-correct) but the display isclan_display_form→raw_text()(bein(g), i.e.+r2). So the same word is grouped asbeingyet shown asbein(g), diverging from CLAN and internally inconsistent. When a command has separate normalize-for-grouping and normalize-for-display paths, audit BOTH against the binary; a flag that controls word cleaning (+r1/+r2/+r3) must drive both consistently. This was also the root cause of thebein(g)/beingcontamination that blocked a clean+xgolden on1082.cha. -
+r1/+r2/+r3IMPLEMENTED, fixing a default and scoping the blast radius to zero (2026-06-04): the parenthesis sub-family landed as a typedframework::ParenthesisMode(RemoveParensdefault /KeepParens/RemoveMaterial) threaded through the full five seams plusFreqOptions-> builder ->FreqConfig. Three transferable points. (1) One axis drives both the key and the display. The fix routed BOTHparans_normalized_key(group) andparans_display(show) through the same mode, so they can never disagree again; CLAN gets this for free because it appliesParansonce before counting, chatter has to wire the single mode into both of its split paths. (2) Render AST-first by parameterizing only the differing element, not by string-hacking the surface. The modes differ ONLY in how aWordContent::Shorteningrenders; the renderer walksWord::contentand reuses each other element’sWriteChatverbatim, special-casing just the shortening (inner letters /(inner)/ nothing). No stripping of(/)fromraw_text()(which the no-string-hacking rule bans and which would mis-fire on any literal paren). (3) A default-changing fix can still be zero-blast-radius if you gate it on the affected feature.RemoveParensreproducescleaned_text()/clan_display_formbyte-for-byte, and the new path is taken ONLY for words that actually contain a shortening (has_shortening), so every other word, and thus every existing freq golden, is untouched, verified by the full golden suite staying green through a default-output change. The honest worst-case estimate (re-seed every golden with(…)words) turned out to be zero goldens because the affected token only occurred in a subprocess fixture. -
A rewriter-MAPPING test is not a behavior test:
+r6was “Done” yet a no-op (2026-06-04). Auditing the+r5neighbor surfaced that--include-retracings(+r6) is accepted, mapped, and covered by a test, yet changes nothing: the only test (combined_flags) asserts+r6 -> --include-retracings(the rewrite), never that retracings get counted. Under the hood FREQ counts viaframework::countable_words(the non-retrace walker),FreqConfighas noinclude_retracingsfield, andcountable_words_with_retracingsis dead code with zero callers crate-wide. So the flag is wired end-to-end at the argv layer and inert at the semantic layer. Two transferable rules. (1) “Done” requires a golden (or subprocess assert) that exercises the flag’s OUTPUT against the binary, not just that the flag parses or rewrites. A row whose only evidence is a rewrite-mapping test is Wired, not Done; re-probe every such row against the binary before trusting it. (2) When a flag’s whole job is to change counts, prove it by a token-count delta against CLAN on a fixture that actually contains the construct. The one-line probefreq vs freq +flag | grep 'Total number of items'onretrace.cha(CLAN 13->18, chatter 13->13) is what exposed it; the same probe belongs in every count-affecting row’s audit. This is why the FREQ parity metric counts only rows with a behavior golden, and why+r6was downgraded from Done to a no-op bug to FIX. -
+r6FIXED, and the fix was to SEPARATE two axes CLAN keeps separate (2026-06-04). Wiring--include-retracingsinto FREQ (aFreqConfigfield + counting viacountable_words_with_retracings) made+r6count retracings, but it OVER-counted: chatter emittedmale/tika@u/lɛɾɪ@u, the ORIGINALS of[: text]replacements, which CLAN never counts. Root cause: the shared word-walker’sReplacedWordarm treatedinclude_retracingsas “count both the original AND the replacement”, conflating two independent CLAN axes,+r5([: text]replacement: count replacement vs original) and+r6(retracings: include the retraced material or not). The correct model: a[: text]replacement ALWAYS counts the replacement;+r6governs only theRetracearm; a retraced replaced word (tika@u [: kitty] [//] kitty) is reached through theRetracerecursion and contributes its replacement (kitty), so the two compose without a “both” branch. Removing that branch (dead code until+r6was wired) took chatter from 21/17 tokens to CLAN’s exact 18/16 onretrace.cha. Two transferable points. (1) When a binary has N independent flags over the same data, model N independent axes; a single “do more under this flag” branch that piggybacks one axis onto another is the conflation bug. (2) Verify a count-fix by DIFFING the full word list against the binary, not just the token total, the total can match by luck while individual words are wrong; here themale/tika@uover-count and a compensating miss elsewhere is exactly what a total-only check would hide. The retraced-replacement semantics ([: text]inside[//]) is the subtle case theretrace.chafixture exists to pin; keep using it for+r5next. -
+r5was cheap because+r6paid the untangling cost first (2026-06-04). Once the walker’sReplacedWordhandling was its own axis (the+r6fix), adding+r5(count the[: text]original vs the replacement) was a clean enum: aReplacementChoice(Replacementdefault /Original), bundled withinclude_retracingsinto oneRetraceReplaceModeso the walker carries a single mode rather than parallel flags, plus a sharedpush_replaced_wordhelper both walkers call so the two cannot drift. Onretrace.cha,male [: female] [/] male [: female]flipsfemale->male, a clean swap that byte-matches CLAN (goldenfreq_r5_replace). Two transferable points. (1) Sequencing matters: when two flags share a code path and one is buggy, fix the bug FIRST (it forces the axes apart), then the sibling flag is additive. Had+r5gone first it would have had to invent the same separation under more time pressure. (2) Bundle co-located axes into one typed mode at the seam (RetraceReplaceMode) rather than threading a growing list of bools/enums through every recursive call, the recursion stays one-argument and the relationship between the axes is documented in the type. -
+r4/+r7audit, the key/display split is a RECURRING bug, and “no-op for this command” is a real status (2026-06-04). Auditing the prosodic sub-flags surfaced two things. (1) The same key-vs-display divergence found for parens recurs for prosodic symbols. CLAN’s default strips within-word prosodic (ca:t->cat,do^g->dog,hm:->hm); chatter’s grouping key (cleaned_text(), which excludes prosodic elements) is already correct, but the display (raw_text-based) KEEPS them, so the default output diverges, the root of the pre-existinghm:->hm1082.chadiff. Two instances (parens, prosody) of one root cause (display = surface, key = cleaned) means the display path wants a single element-selective AST renderer, not per-flag patches; the fix isText + Shortening(per parens) + CompoundMarkerby default with per-symbol opt-ins (+r7). Confirmed zero golden blast radius (no FREQ golden fixture has within-word prosodic; the passing byte-identical goldens prove it), but it needs per-WordContent-element CLAN-strip probing (Lengthening and SyllablePause confirmed stripped; Stress / CA / underline not yet) so the renderer matches CLAN element by element. (2) A flag can be a genuine no-op for one command and meaningful for others, that IS its status, document it, don’t force-wire it.+r4(make#/:significant + clitic flags) is probe-confirmed identical to default for FREQ counting (its effect is+s-search and clitic-counting); recording it as “FREQ no-op” is the honest per-command audit result, not a gap to paper over with an accept-and-ignore. -
Prosodic default-strip FIXED, and the key/display renderer is now the single element-selective seam predicted (2026-06-04). The default fix landed: chatter used to keep within-word prosodic in the display (
hm:), CLAN strips it (hm);parans_displaynow renders the display AST-first asText + Shortening(per parens) + CompoundMarker, excluding every prosodic/CA/overlap/underline/clitic element. Three transferable points. (1) The third instance of the key/display split (parens, then prosody) was resolved by GENERALIZING the parens renderer, not adding a parallel one, exactly as the prior audit note predicted: the display path wanted one element-selective AST renderer keyed onWordContentvariant, and the parens work had already built the scaffold. When the same root cause bites a third time, stop patching and unify. (2) An exhaustiveWordContentmatch (no_ =>) is the safety rail: listing every element variant explicitly (Text/Shortening/Compound kept; the eight prosodic/CA/overlap variants dropped) means a future new element type is a compile error here, not a silent keep-or-drop guess. (3) Scope a default-changing display fix with a cheap predicate (has_prosodic/has_shortening) so the common case stays on the byte-identical old path, the AST renderer runs only for words that actually carry a shortening or prosodic marker, so the full golden suite stayed green through a default-output change, the same zero-blast-radius discipline as the parens fix. Probing established CLAN strips ALL within-word prosodic by default (lengthening/syllable-pause/stress/CA all confirmed), so the strip is unconditional; the+r7keep-SUBSET (only:/^/~, with buggy CLAN stress/CA artifacts) is the remaining, fiddlier toggle. -
+r7DONE, and a prior session’s “byte-identical” claim hid a real divergence (2026-06-04). The keep-toggle landed as a typedProsodyMode(Strip/Keep) driving the samerender_word_elementseam (the fourth reuse of the one element-selective renderer, never a parallel one). Five transferable points. (1) Re-run the byte diff yourself; never trust a handoff’s “parity confirmed.” The pre-compaction note said+r7was byte-identical to CLAN except a knownah@udiff. Re-diffing from the firstSpeaker:line (the header differs by design: CLAN says “From pipe input”, chatter echoes the command line) surfaced 12+3 extra CLAN tokens that the prior pass had missed. A parity claim is only as good as the last diff you personally ran. (2) A flag’s documented scope can be NARROWER than the binary’s actual effect, and the gap is a divergence, not a spec to reproduce. The manual scopes+r7to within-word/~^:(line 12418); CLAN’s binary additionally retains the whole CA / satellite-delimiter family (‡ „ ≠ ↫). The manual is the authority on intent; when the binary exceeds it, diverge. (3) Invalid UTF-8 output is an automatic divergence trigger. CLAN’s 8-bit pipeline drops the0xE2lead byte of ‡/„ and emits byte-garbage (0x80 0xA1) as a “word type”; chatter operates on the typed AST and physically cannot, so this is the cleanest CLAN-bug-chatter-fixes case, independent of any scope debate. The guard test asserts on raw stdout bytes, not a lossy string, so it actually catches the corruption. (4) You need not pin the exact buggy C line to diverge honestly. I traced the+r7parser (cutt.cpp:9569-9576), the cleanup gate (:7258,HandleSlashvsHandleSpCAs), and the ‡ classification (NOTCA_VOCATIVE), but could not fully explain why VOCATIVE survives when the parser explicitly clears only CROSSED_EQUAL/LEFT_ARROW. The honest move: prove the divergence empirically, cite the manual scope plus the source structures you DID verify, and do NOT fabricate the micro-mechanism (no-speculation rule). The decision stood on two independently-sufficient grounds (out-of-scope + invalid UTF-8). (5) Minimal CLAN-only probes bisect a divergence in seconds. Four one-utterance scratch files (one per CA class) x {default,+r7,+r4} localized “the whole CA-delimiter family flips under+r7, not+r4” far faster than more source reading; that 2-to-3-types signal is the cheapest possible discriminator. Documented as CLAN-DIV-006. -
+ddisplay-mode cluster, an audit that became a systemic fail-closed fix (2026-06-04). Picking up the+dcluster (the largest remaining FREQ block) showed the handoff’s “rewriter-only+dflags silently no-op” framing was doubly wrong; the probe (never trust the doc) foundfreq +d8 file.chaexited 0 with default output plus a stderrWarning: "+d8" is not a file ..., i.e. the flag was swallowed as a bogus positional file. This was systemic, not+d-specific (+QQQand any unconsumed+-token on any command behaved the same; see the harness-gotcha bullet for the clap mechanism). Three transferable points. (1) Fail-closed by construction beats fail-closed by convention. The hole existed becauseskipped_paths()was an accessor consumers were trusted to warn on; adding another trust-me accessor would invite the same regression, soDiscoveredChatFiles::into_files()was madeResult<_, UnrecognizedClanFlagArgs>, the compiler now forces all four consumers to handle the flag case. (2) Fail-closed vindicates the manual-first/source-first discipline. Bare+dLOOKS like “= no-flag default” per the manual, but CLAN source setsonlydata = atoi("")+1 = 1, identical to+d0(freq.cpp:838 -> cutt.cpp:9402); erroring on+duntil a per-row source analysis (and a manual-vs-source reconciliation) is done is CORRECT, implementing it from the manual alone would have shipped a subtly-wrong default. (3) An unimplemented APPLICABLE flag errors, just like an inapplicable one, until it is properly built. The implementable rows (+d20one-per-row spreadsheet, the+d<N/+d>=N/… percent filters) and the PI-gated rows (+d0/+d6/+d7/+d8) all now error fail-closed pending their own TDD cycle, the honest state, not a silent default. The status flip was Rewriter-only -> Missing for every not-yet-built+dform. -
+d20one-per-row spreadsheet, the first +d spreadsheet row that MATCHES CLAN (2026-06-04). Landed as a thirdFreqSpreadsheetMode::PerSpeakerWordalongside+d2(PerWord) /+d3(TypesTokens). Four transferable points. (1) The percent filters and+d20are a spreadsheet sub-cluster, not text rows. Both run under CLAN’sonlydata 3/4Excel path; what looks like a “display mode” in the manual is a file-output layout in the source. Audit the output MODE (text vs spreadsheet file) before estimating a+drow. (2) A flat layout is its own builder, not a column toggle.+d2/+d3differ by which columns appear;+d20is a wholly different shape (File | Code | Word | Count, one row per (file, speaker, word), no@ID/Types/TTR/caveat), soto_spreadsheetearly-returns a separateto_one_per_row_workbookrather than growing the wide builder’s match. (3)+d20MATCHES CLAN where+d2/+d3diverge, because the divergence was never about the data.+d2/+d3areDivergesFromClansolely for the%%morprintf leak in their TTR-caveat rows (CLAN-DIV-004);+d20has no caveat rows, so its cells are byte-identical to CLAN’s (live diff of<Data>cells) and it isMatchesClan. A command’s divergence is per-output-shape, not per-command. (4) Seed a spreadsheet golden surgically. Spreadsheet goldens hold chatter’s own deterministic XML (CLAN parity proven separately by a live cell diff), andseed_clan_goldenshort-circuits before any CLAN run for them, so a single golden can be seeded by writing chatter’swrite_xml()output directly, no fullregen-clan-goldensthat might perturb other goldens. The CLAN binary lives atOSX-CLAN/src/unix/bin/(pointCLAN_BIN_DIRthere); its source synced the same day it was built, so source citations and binary behavior agree. -
+dCNpercent-of-speakers filter, the last implementable+drow (2026-06-04). A comparator (</<=/=/>=/>) plus a percentage: keep words used by that fraction of speaker-rows, then report each speaker’s Types/Token/TTR over only that subset. Modeled as a payload modeFreqSpreadsheetMode::PercentOfSpeakers(SpeakerPercentFilter), rewritten from+d<=50->--speaker-percentage <=50. Six transferable points. (1) The audit’s predicted output shape was wrong; the binary is the oracle, even for a row your own audit wrote. The prior audit (and the row’s own text) said the percent filter “builds on the+d2per-word sheet”; the live binary showed a+d3-shaped SUMMARY (no per-word columns), a DIFFERENT fourth-column header (Speaker, not+d2/+d3’sCode, freq.cpp:2874), and a DIFFERENT filename (words.frq.xls, notstat.frq*.xls). The tell was in the source the whole time: instatfreq_print_percent_row(freq.cpp:2806-2828) every word-name and per-word-count cell is gated ononlydata == 3, soonlydata == 4(the percent path) emits no word cells, only the accumulateddiff/total(Types/Token). Read the gated branches, then PROBE before trusting any one-line shape claim. (2) A manual metavariable is not a literal.+dCN’sCis the comparator placeholder (CLAN.html “+dCN” lists<, <=, =, =>, >); the source has nocase 'C', only the</=/>parse at freq.cpp:841-861. Resolve such notation against the source, never the surface string. (3) A percent/spreadsheet sub-cluster row inherits its sibling’s parity AND its sibling’s divergence. The filter reuses the verified+d2/+d3per-(file x speaker) aggregation wholesale; the only NEW surface is a cross-row distinct-speaker count (how many rows used each word) plus a per-row recomputation over the kept subset. Because the aggregation was reused, every data cell came out byte-identical to CLAN on the first run, and the row landedDivergesFromClanunder the SAME CLAN-DIV-004%%morcaveat as+d2/+d3, no new divergence. This completes the+d20insight (“divergence is per-output-shape”): same machinery -> same divergence. (4) Error PRECEDENCE is part of parity, not just which errors exist. CLAN catches the percent-+d5combination at flag-parse time (freq.cpp:867/890), BEFORE its+s-content validation; chatter’s+d5-requires-+sguard ran first, so the combination guard had to move ABOVE the+c2/+d5content guards to emit “+d<=50can’t be used with+d5” rather than the unrelated “+d5needs+s”. When two guards can both fire, match CLAN’s ORDER. (5) A payload variant on a shared mode enum is fail-closed by construction. AddingPercentOfSpeakers(filter)toFreqSpreadsheetModemade everymatch mode(renderer,freq_spreadsheet_filename, the service) fail to compile until it handled the new mode, so no consumer could silently fall through to a wrong layout, the same fallible-by-type discipline as the fail-closed boundary above, applied to an output enum. (6) The golden-parity metric matches a goldencoveragainst the audit row’s FIRST CELL (backticks stripped), so that cell must be a single canonical token. A compound first cell (+dCN (+d<N/...)) made the+dCNcover dangle and pushed the row into “claimed Done, no golden”; keeping the first cell exactly`+dCN`(comparator spellings moved to the Meaning column) restored the match. The metric’s denominator is row COUNT, so this does not change47; the row moved from the (uncounted) Missing bucket to the Diverged column (3 -> 4). -
+pSword delimiters, a tokenization-change row that MATCHES CLAN (2026-06-04).+pSadds the characters ofSto CLAN’s word-delimiter set and re-tokenizes, so a counted word is split at them (+p_breakschoo_choointo twochoo). Five transferable points. (1) The “general flags FREQ inherits” table conflatescutt.cpp::mainusagegenerics with FREQ’s actualcaseoverrides; verify each against FREQ’s own getflag. The audit listed+oS/-oSas “include/exclude extra output tier” and+yas “include non-tier utterances”, but FREQ OWNScase 'o'(it is the sort flag+o/+o0/+o1/+o2/+o3and itselseREJECTS+oTIERwith “Invalid argument”, freq.cpp:815-836) and+yisy_option(raw-text line-vs-utterance granularity, cutt.cpp:9848) that only fires when!chatmode, a no-op for CHAT input. Only+pSwas a real, implementable feature; the other two are an error-row and a CHAT no-op. Read the command’s own switch, not the shared usage text. (2) A flag enabled for many commands belongs inframework, not the command.+pSis gated onP_OPTION, whichALL_OPTIONSgrants to FREQ and ~a dozen others, so the delimiter primitive is a reusable typedframework::WordDelimiters(whitespace dropped on construction, matching CLAN’s!isSpaceskip), ready for the next command rather than a FREQ-local field. (3) Gate the new behaviour onis_empty()so the default path stays byte-identical. The split re-keys each segment from the rendered display string (NormalizedWord::from_text_cased), which is NOT the same as the defaultparans_normalized_keypath (that strips compound+etc.); routing ALL words through the split keyer would have moved existing goldens. Branching on “delimiters configured?” keeps the no-+ppath untouched (zero golden blast radius) and confines the new keying to the+pcase. (4) Split the RENDERED form, and a word-form marker rides its segment for free. CLAN re-tokenizes the cleaned text, so the@oonchup_chup_chup_chup@ostays on the finalchup@obecause it is textually last; splitting chatter’s already-rendered display form (chup_chup_chup_chup@o) on_reproduces this without modelling the marker specially. Applying the split AFTER the+rtreatment matches CLAN’s order for the common case. (5) Scope the combination honestly. The+s/+cper-word filters still gate on the whole pre-split word, so+pcombined with+s/+c(and dependent-tier+t%Xsplitting) is a documented deferral, not silently half-done; the base+pSis byte-parity MatchesClan (full 79-line*MOToutput diffed against CLAN). -
FREQ depth-completion: the tail is reclassification + a deferral taxonomy, not more implementation (2026-06-04). Driving FREQ to “done” did NOT mean implementing every remaining flag; past a point the remaining rows are all decisions or inapplicabilities, and the work is to classify them honestly. Four transferable points for completing any CLAN command. (1) “Inapplicable to a CHAT-only tool” is a Done state, reached by rejection, not implementation.
+y(setschatmode = 0, raw-text mode) and the non-sort+oforms (+o2“non-CHAT”,+oSwhich FREQ rejects outright) are not features to build; CLAN itself either errors or empties its output on a CHAT file. The+wprecedent generalizes: a flag whose CLAN machinery produces nothing useful for typed CHAT is rejected, and that rejection is the correct, pinned, Done behaviour. (2) An audit row’s one-line description can mis-assign the flag’s owner. The “general flags FREQ inherits” table (copied fromcutt.cpp::mainusage) listed+oSas “extra output tier” and+yas “include non-tier utterances”; reading FREQ’s OWN getflag showed+ois the sort flag (rejects+oTIER) and+yis raw-text mode. Verify every inherited-flag row against the command’s owncase, not the shared usage text. (3) A finished command has a deferral TAXONOMY, not a “Missing” pile. Every non-Done FREQ row resolves into exactly one scope-gate category:%mor/cross-tier (needs the shared MOR-analysis subsystem:+d6/+d7/+d8/+r8/+r50/+c5), non-CHAT raw-text mode (+y/+o2), CA-construct-needs-parser (+c6, a↫repeat-segment span type), manual-vs-binary contradiction escalated to the maintainer (+xWORD/+x@FILE,+a), or output-routing infra (+f). “Missing without a reason” must reach zero; each deferral carries a sourcefile:line. (4) The completion deliverable is the maintainer report, not the code. The point of depth-first-one-command is to produce a grounded porting estimate; FREQ’s output is the maintainer porting report, which separates “decisions the maintainers owe” from “labor that reuses existing primitives”. The key finding: per-command cost is front-loaded into shared machinery, and the dominant remaining cost is verification (running CLAN vs chatter and reconciling divergences), not typing. -
MLU as the second command: the discount is real and explained (2026-06-05). Driving MLU’s remaining rows validated the “second command is cheaper” claim and sharpened it. Three transferable points for the next command. (1) A command’s rows sort into shared / nearly-free / full-price, and only the last costs. MLU was mostly already Done because it rides the shared filters / file-loader / morpheme counter FREQ built; several remaining rows (
+pS,+r1/+r2/+r3/+r4/+r5/+r7) were faithful no-ops that the FREQ domain lesson (%mor-based counting ignores main-tier word-FORM flags) let me classify on sight, with a one-line probe and avec![]rewriter arm; only the command-specific semantics (+o3combine, and the deferred clause-markers / Excel) cost full price. The effort multiplier is not one number, it is proportional to a command’s command-specific surface. (2) A no-op is a real parity row: verify it, do not assume it.+pS/+rNare ACCEPTED by MLU (P_OPTION/R_OPTION inoption_flags[MLU]) and must not error (the+w-reject rule is for flags CLAN itself rejects/empties; these CLAN accepts and ignores). Confirm “no effect” by running the binary in BOTH modes (morpheme and-bw) on a discriminating fixture, then consume the flag; pin it with a body-level byte-identical test (strip the command-echo banner line, which legitimately differs when a flag is passed, for CLAN too). (3) Reuse the flag NAME and rewriter shape, re-implement the command logic. MLU+o3reused FREQ’s--combine-speakersflag +(b'+', b'o') ... rest == "3"rewriter shape, but the combine itself (pool per-speakerutterance_lengths, render the*COMBINED*label) was MLU-specific. Extract the per-speaker aggregate (aggregate_mlu(speaker, lengths)) first, then the combine branch is “pool, call the aggregate once” with no duplicated stats math. (4) The statistic itself is a shared primitive, not just the command shape. MLU and MLT both report CLAN’s population standard deviation (/ n, “NA” whenn <= 1) over a slice of per-utterance counts; they had byte-identical inlined loops. Extractingframework::population_sd(&[u64]) -> f64(inframework/stats.rs) collapses both to one call and is the home for the next aggregate’s SD (WDLEN, MAXWD, …). The lesson generalizes the FREQ MATTR finding: when two commands compute the same number, the number belongs in the framework, keyed off the count slice, not re-derived per command. The full effort assessment is recorded internally. -
MLU default-exclusions are parity rows, and the count tier != the exclusion tier (2026-06-05): MLU’s biggest parity gaps were not flags at all but DEFAULT behavior. Three base-command bugs hid behind a passing bare golden on a clean fixture: (1)
xxx/yyy/wwwexclude the WHOLE utterance they appear in (manual §7.21 pt2), not just utterances that are entirely unintelligible; (2) the[+ mlue]postcode excludes its utterance (mlu.cpp:503); both were counted by chatter. The transferable lessons: (a) A passing bare golden on a tidy fixture does not mean the base command is correct, run it against a corpus that actually exercises the construct (thexxxbug only shows onit xxx xxx, a mixed utterance; the cleanxxx .case chatter already handled via “no countable words”). (b) The tier that DRIVES exclusion can differ from the tier that drives the count. MLU counts morphemes off%morbut excludes off the MAIN tier (and off postcodes);it xxx xxxhas%morpron|ityet is dropped because the main line carriesxxx. Localize each parity dimension to its own tier. (c) When real data is the only source of a rare construct ([+ mlue]exists in one Japanese corpus with@kconfounds), trim a fixture that isolates the dimension under test: in the DEFAULT case the tagged utterance is dropped, so its messy internal count never reaches the golden, the confound is sidestepped. Verify the trimmed fixture passes the reference-corpus roundtrip/validate gates before adding it. -
A re-include flag toggles a default exclusion AND repaints the header; model the toggle as a domain-type set, not bools (2026-06-05):
+sxxx/+syyydon’t add a filter, they SUBTRACT from the default xxx/yyy/www exclusion and switch CLAN to a different two-line header (mlu.cpp:246-253). Modeled asre_included: Vec<UntranscribedStatus>(the domain enum) rather thaninclude_xxx: bool, include_yyy: bool, so the exclusion predicate is a single!re_included.contains(status)and the header picks its branch off the same set, no boolean-blindness.wwwis simply never placed in the set. -
Manual vs binary: the binary is the
chatter-clanoracle; reproduce, then escalate the conflict, do not diverge solo (2026-06-05):+syyyis the textbook case. The binary accepts it and re-includesyyy, but the manual says yyy “cannot be included,” and the binary itself has no yyy-only header branch (so+syyyalone prints the default header while changing the count, a self-inconsistency). chatter reproduces the binary BYTE-for-byte (including the quirk) because the binary is the parity target forchatter-clanoutput, and records the manual conflict in the command’s “Documented CLAN-bug divergences” table for PI adjudication. Reproducing-plus-documenting beats a solo decision to “fix” what the manual and binary disagree on. -
A reject only fails closed if no chatter short-flag shadows the CLAN flag (2026-06-05): returning
Nonefrom the rewriter (the normal “unrecognized CLAN flag” path) did NOT fail closed for-sxxx/-syyy/-swww, because chatter’s--speakerowns the-sshort flag, so clap silently re-read-sxxxas--speaker xxx(no such speaker -> empty output, exit 0). The fix: map the reject forms to a self-documenting NON-EXISTENT long flag (--xxx-is-excluded-by-default-and-cannot-be-excluded) so clap fails closed with a message that explains itself. General rule: before relying onNoneto reject a-XCLAN flag, check whether any chatter short flag would intercept it first. (The+-prefixed reject path is safe, clap never claims+.) -
usage()lies; readgetflag(2026-06-05): MLU’susage()advertises-bc(count characters), but the character branch is#ifndef UNX(mlu.cpp:678-680), so the unix binary, our parity target, ERRORS on-bc. Parity for an advertised-but-compiled-out flag is to REJECT it, not implement it. Always confirm a flag’s real behavior in the command’sgetflag/case, not in the usage banner. -
Flag growth has a hidden platform cost: the Windows 1 MiB main stack (2026-06-12): the FREQ flag explosion (2026-06-03/04) pushed clap’s debug-build command-tree construction past 1 MiB of stack, aborting EVERY
chatterinvocation on Windows (STATUS_STACK_OVERFLOW) before parsing; the windows-latest job sat red for a week before anyone looked. Three transferable rules. (1) Each ported command’s flags add stack to one giant generatedaugment_argsframe, and debug builds give every temporary its own slot, so the cost is the SUM of all flags, ever. (2) The fix is owning the budget explicitly: the program now runs on a 16 MiBPROGRAM_STACK_BYTESthread (see the CLI Startup and the Program Stack architecture page), so porting the remaining ~60 commands cannot re-break this. (3) Watch ALL CI jobs after landing a command: a Windows-only, debug-only failure is exactly the shape a per-command porting session misses.