#2166·LifeOS

The em-dash cap is implemented twice with two different definitions of prose: FormatGate ignores blockquotes, DriftReminder counts them

Author: IvanLeontev-stackCreated Sep 19, 2026Updated Sep 29, 2026

Version

LifeOS 7.40.4 / FormatGate 1.0.1 and DriftReminder 1.2.0 — also reproduced on a clean checkout of main at 5e2f2e8c.

What is broken

Two hooks enforce the same output-format rule — max 2 em-dashes in prose — with two independent implementations that disagree about what prose is. FormatGate counts over stripNonProse(), which strips fenced code, inline code and blockquote lines. DriftReminder counts over its own stripCode(), which strips fenced and inline code only. A response that quotes source material in a blockquote therefore passes the gate and trips the drift reminder: the quoted author's punctuation is attributed to the DA's voice, and the more faithfully a response quotes, the more it is nagged. Separately, the cap counts a character rather than a style: in languages where the dash occupies the sentence's verb slot when the copula is omitted, ordinary correct prose exceeds the cap on nearly every paragraph, with no stylistic flourish available to remove.

Where (file:line)

hooks/FormatGate.hook.ts:134 (emdashes > 2, counted over stripNonProse() at :61) and hooks/DriftReminder.hook.ts:192 (m.emDashes > 2, counted over stripCode() at :164, called from measure() at :176). Same threshold literal, two files, two prose definitions.

Repro on a clean tree

bash
gh api repos/danielmiessler/LifeOS/tarball/5e2f2e8c > main.tar.gz
mkdir clean && tar xzf main.tar.gz -C clean --strip-components=1

cat > r2.ts <<'TS'
import { readFileSync } from "node:fs";
const ROOT = process.env.LIFEOS_ROOT!;
const { stripNonProse, checkFormat } = await import(`${ROOT}/hooks/FormatGate.hook.ts`);
// DriftReminder exports nothing; lift its stripCode() out of the shipped source.
const drift = readFileSync(`${ROOT}/hooks/DriftReminder.hook.ts`, "utf8");
const sc = drift.match(/function stripCode\((\w+): string\): string \{([\s\S]*?)\n\}/)!;
const stripCode = new Function(sc[1], sc[2]) as (s: string) => string;
const em = (s: string) => (s.match(/—/g) ?? []).length;

// A. English response with zero em-dashes of its own, quoting a source that has three.
const quoting = [
  "════ LifeOS ═══════════════════════════", "",
  "The upstream note says this, verbatim:", "",
  "> Hooks are deterministic — they run before the model — and that is the point — always.",
  "", "So the registration order is what matters here.", "",
  "️ DA: done.",
].join("\n");
console.log("A. authored em-dashes: 0, quoted em-dashes: 3");
console.log("   FormatGate    prose ->", em(stripNonProse(quoting)), "| checkFormat:", JSON.stringify(checkFormat(quoting, false, false)));
console.log("   DriftReminder prose ->", em(stripCode(quoting)), "| breaksIn() reports this as drift");

// B. Russian: the dash is the sentence's verb slot, not a flourish.
const ru = [
  "════ LifeOS ═══════════════════════════", "",
  "Скрапинг — сбор данных со страниц. Хук — это обработчик события.",
  "Кириллица — не ASCII. Вывод — правило надо чинить.", "",
  "️ DA: готово.",
].join("\n");
const en = [
  "════ LifeOS ═══════════════════════════", "",
  "Scraping is collecting page data. A hook is an event handler.",
  "Cyrillic is not ASCII. So the rule needs a fix.", "",
  "️ DA: done.",
].join("\n");
console.log("B. RU (4 obligatory dashes, 0 AI tells):", JSON.stringify(checkFormat(ru, false, false)));
console.log("   EN (same sentences, no dashes):     ", JSON.stringify(checkFormat(en, false, false)));
TS

LIFEOS_ROOT="$PWD/clean/LifeOS/install" bun r2.ts

The four Russian lines say what the four English lines say: "Scraping is collecting page data. A hook is an event handler. Cyrillic is not ASCII. So the rule needs a fix."

Negative control

On unpatched main@5e2f2e8c the probe is red on both halves:

A. authored em-dashes: 0, quoted em-dashes: 3
   FormatGate    prose -> 0 | checkFormat: null
   DriftReminder prose -> 3 | breaksIn() reports this as drift
B. RU (4 obligatory dashes, 0 AI tells): {"code":"too-many-emdashes","detail":"4 em-dashes in prose (max 2)"}
   EN (same sentences, no dashes):       null

Stated without reference to any fix: one response, measured by two hooks that enforce the same rule, is simultaneously clean and in violation. And four grammatically required dashes are reported as "4 em-dashes in prose (max 2)" on text that contains no AI tell at all.

Suggested fix

Not "make the cap configurable" — #2019's reasoning applies: a contract wired across many sites does not move in a three-file patch. Two contained changes, both worth doing independently of any language question:

  1. One prose definition. stripNonProse is already exported from FormatGate.hook.ts; calling it inside DriftReminder.measure() in place of the local stripCode() is a one-line change and makes the blockquote case consistent. Two hooks measuring the same property should not be able to disagree.
  2. One constant instead of two literals. The cap is > 2 in two files today, so the next change to it ships half-applied by construction — the same shape as #1564, where two copies of this hook's rule drifted apart and the fix reached only one of them.

Whether the count should additionally be script-aware is a separate call and yours to make; item 1 fixes a monolingual English bug on its own. Both untested as patches — I have not written them.

Related

#2019, #1564, #1585.


  • I searched open and closed issues for this defect.
  • The repro runs against a clean tree of the version above, not against a modified install.
  • The pasted output carries no personal data — no names, no home paths, no tokens, no own content. The Russian lines are invented test sentences.