Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

feat: editorial checks for clichés, dead/mixed metaphor & overwriting (#1308)

[._.]/ Adam Eivyd0eb7a05e1c0
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index a6794d6c1a..2962a2fd96 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -6,6 +6,8 @@
- **[issue-1299] Editorial check flags broken setups and payoffs (Chekhov's guns).** A new **Chekhov's guns (setups & payoffs)** editorial check (Create → Editorial Checks) reads your drafted manuscript across the whole series and enforces the craft rule *things planted must go off; things that go off should have been planted.* It tracks concrete planted elements — weapons/objects/clues, secrets, stated fears, promises/vows, threats, and notable skills — and flags the two failure modes: **planted, never fired** ("the locked drawer in Issue 2 is never opened," "Mara's fear of water is set up but never confronted") and **fired, never planted** ("the antidote appears in Issue 7 with no prior setup"). Because a setup and its payoff can sit chapters apart, the check carries a rolling cross-chunk digest of what's been planted-but-not-yet-paid so a late payoff isn't mis-flagged "no setup" and a never-fired plant is still caught at the end. It also reconciles its detected setups/payoffs against the **authored reader-map hooks/payoffs** you've logged on the series arc, so an authored hook with no payoff in the prose surfaces as a strong finding. Each finding classifies the problem in its location, anchors a verbatim quote + issue number, and suggests the fix (plant earlier, pay off later, or cut). Runs on demand or as part of Series Autopilot's editorial pass; one new stage prompt (`pipeline-editorial-chekhov`) ships + migrates for existing installs. (#1299)
+- **[issue-1308] Editorial checks flag clichés, mixed/dead metaphors, and overwriting.** Three new style checks (Create → Editorial Checks) target *tired and overwrought language* — the stock phrasing that pulls readers out. **Cliché phrases** is a deterministic scan of a seed list of stock similes/idioms ("time stood still", "little did they know", "all hell broke loose"), anchored to the issue it appears in and deduped so a repeated cliché is one tic to fix, not many; a per-series **house-style allowlist** mutes intentional clichés in a character's voice, and an **extra-phrases** list adds your own. **Overwriting — stacked adjectives/adverbs** is a deterministic, high-precision flag for cumulative no-comma piles of three-or-more modifiers ("big red shiny new"), with the run length configurable. **Dead / mixed metaphor & overwriting** is the LLM judgment layer that catches what the lists can't — metaphors that collide or have gone invisible, lightly-reworded novel clichés, and purple prose — while leaving knowingly in-voice clichés alone. Severity is advisory; findings anchor a verbatim quote + issue number so you can jump straight to the spot. The deterministic checks need no model; the LLM check ships one stage prompt (`pipeline-editorial-dead-metaphor`) that migrates for existing installs. (`server/lib/editorial/cliches.js`, `server/lib/editorial/checkRegistry.js`) (#1308)
+
- **[issue-1296] Editorial check flags flat, single-mode scenes.** A new **Scene component balance** editorial check (Create → Editorial Checks) reads your reverse-outline scene segmentation and flags scenes that lean on a single mode — a wall of narration, talking heads with no action, or pure action with no interiority or voice. The craft rule is that a scene should mix at least two of **narrative, action, and dialogue**; the check names exactly which modes a flagged scene is missing and suggests how to ground it, anchoring to the issue the scene belongs to. The minimum (default 2 of 3, up to all 3) is configurable, and scenes the outline hasn't classified are left alone rather than false-flagged. Requires a generated reverse outline. (#1296)
- **[issue-1294] Editorial check flags POV scenes with thin protagonist interiority.** A new **Protagonist interiority** editorial check (Create → Editorial Checks) reads your drafted manuscript and flags POV scenes that move a viewpoint character through events without ever getting us inside their head. It scores each POV scene across four distinct dimensions — **mind** (their thoughts and feelings in the moment), **objective** (what they want here and *why*), **emotional response** (to twists, betrayals, shocks), and **decision** (the reasoning behind their choices) — and surfaces the gaps: "we're in X's POV but never learn what they want," "a betrayal lands with no emotional response," "X decides but we don't see the reasoning." Each finding names which dimension is missing in its location so you can group gaps by kind, anchors a verbatim quote + issue number so you can jump straight to the spot, and scales severity by how POV-central the scene is. POV is read from the prose, so the check works even before scenes are explicitly POV-tagged. Runs on demand or as part of Series Autopilot's editorial pass; one new stage prompt (`pipeline-editorial-interiority`) ships + migrates for existing installs. (#1294)
diff --git a/data.reference/prompts/stage-config.json b/data.reference/prompts/stage-config.json
index d9ec1b49c1..160a21a05d 100644
--- a/data.reference/prompts/stage-config.json
+++ b/data.reference/prompts/stage-config.json
@@ -499,6 +499,13 @@
"returnsJson": true,
"variables": []
},
+ "pipeline-editorial-dead-metaphor": {
+ "name": "Pipeline — Editorial Check: Dead / mixed metaphor & overwriting",
+ "description": "Editorial check (#1308): the judgment layer for tired language the deterministic cliché scan can't catch — dead or mixed metaphors, lightly-reworded novel clichés, and overwrought / purple prose. Reads the stitched manuscript; severity is advisory; skips knowing in-voice clichés. Returns issue-anchored findings.",
+ "model": "default",
+ "returnsJson": true,
+ "variables": []
+ },
"pipeline-editorial-object-motivation": {
"name": "Pipeline — Editorial Check: Unmotivated object interaction",
"description": "Editorial check (#1288): flags moments where a character treats an object as significant without earned motivation — no recorded attachment and no on-page setup. Reads the stitched manuscript plus the canon object↔character attachments. Returns issue-anchored findings.",
diff --git a/data.reference/prompts/stages/pipeline-editorial-dead-metaphor.md b/data.reference/prompts/stages/pipeline-editorial-dead-metaphor.md
new file mode 100644
index 0000000000..ed4da9bb16
--- /dev/null
+++ b/data.reference/prompts/stages/pipeline-editorial-dead-metaphor.md
@@ -0,0 +1,70 @@
+# Pipeline — Editorial Check: Dead / mixed metaphor, novel clichés & overwriting
+
+You are a line editor doing a single focused pass for ONE family of problems:
+**tired and overwrought language** that pulls a reader out of the prose. You are
+the judgment layer that catches what a fixed phrase list cannot. Flag three kinds
+of problem:
+
+- **Dead / mixed metaphor** — a metaphor so worn it has gone invisible ("a
+ beacon of hope", "the wheels were turning"), or two images that collide and
+ can't both be true ("a virgin field pregnant with possibilities", "we'll burn
+ that bridge when we cross it", "it's not rocket surgery").
+- **Novel / fresh-sounding clichés** — stock similes and idioms a phrase list
+ would miss because they're lightly reworded ("her heart hammered like a
+ trapped bird", "silence hung thick as fog"). Judge the *pattern*, not an exact
+ string.
+- **Overwriting / purple prose** — overwrought description: piled-up adjectives
+ and adverbs, strained or ornate phrasing, three images where one would land,
+ emotion narrated in the most florid available terms.
+
+Do NOT flag: a cliché clearly used **knowingly** in a character's voice or
+dialogue, deliberately heightened style that is consistent and earned (genre
+voice, an unreliable narrator), or a single vivid image that simply isn't to
+your taste. The bar is language that is *stock, mixed, or overwrought* enough to
+distract a reader, not merely ornate.
+
+Severity is **advisory**: most findings are `low`; reserve `medium` for a
+genuinely mixed metaphor or a passage thick with overwriting, and `high` only
+when tired language repeatedly undercuts a pivotal moment.
+
+## Manuscript
+
+The manuscript is stitched from the drafted issues. Section headers attribute
+each chunk to an issue (e.g. `# Issue 3 — Title (prose)`). Use the issue number
+in each section header to attribute every finding to its `issueNumber`.
+
+```
+{{manuscript}}
+```
+
+## Task
+
+Find the tired, mixed, and overwrought phrasings. For each one, quote a short
+verbatim anchor from the text (≤ 200 characters) so the editor can jump to it,
+name the issue number it appears in, name which kind of problem it is in the
+`location` (e.g. `Issue 3 — mixed metaphor`, `Issue 3 — cliché`,
+`Issue 3 — overwriting`), explain why it pulls the reader out, and suggest a
+plainer or fresher rewrite.
+
+Be specific and cite the text. If the prose is clean of stock and overwrought
+language, return an empty `findings` array — do not invent problems.
+
+## Output contract
+
+Return ONLY valid JSON matching this shape — no prose, no markdown fence, no
+commentary:
+
+```json
+{
+ "findings": [
+ {
+ "severity": "high|medium|low",
+ "issueNumber": 3,
+ "location": "string — the problem kind + where (e.g. 'Issue 3 — mixed metaphor')",
+ "problem": "1–3 sentences naming the tired/mixed/overwrought phrasing and why it distracts",
+ "suggestion": "1–3 sentences with a plainer or fresher rewrite",
+ "anchorQuote": "short verbatim quote from the manuscript (≤ 200 chars)"
+ }
+ ]
+}
+```
diff --git a/scripts/migrations/101-editorial-dead-metaphor-stage.js b/scripts/migrations/101-editorial-dead-metaphor-stage.js
new file mode 100644
index 0000000000..917c6041de
--- /dev/null
+++ b/scripts/migrations/101-editorial-dead-metaphor-stage.js
@@ -0,0 +1,75 @@
+/**
+ * Seed the `pipeline-editorial-dead-metaphor` stage into existing installs (#1308).
+ *
+ * Mirrors `099-editorial-interiority-stage.js`: copies the `.md` template from
+ * `data.reference/prompts/stages/` and merges the stage-config entry into
+ * `data/prompts/stage-config.json`. Boot runs migrations (server/index.js) but
+ * NOT `setup-data.js`, so an upgrade that pulls + `pm2 restart`s (rather than
+ * running `update.sh`) would otherwise leave the new dead-metaphor stage unseeded
+ * and the `prose.dead-metaphor` editorial check would throw "Stage not found" the
+ * first time it runs. (The deterministic siblings need no stage.)
+ */
+
+import { access, copyFile, mkdir, readFile, writeFile, constants } from 'fs/promises';
+import { dirname, join } from 'path';
+
+const FILENAME = 'pipeline-editorial-dead-metaphor.md';
+const STAGE_KEY = 'pipeline-editorial-dead-metaphor';
+
+export default {
+ async up({ rootDir }) {
+ const stagesDir = join(rootDir, 'data', 'prompts', 'stages');
+ await mkdir(stagesDir, { recursive: true });
+
+ const dataPath = join(stagesDir, FILENAME);
+ const samplePath = join(rootDir, 'data.reference', 'prompts', 'stages', FILENAME);
+
+ const exists = await access(dataPath, constants.F_OK).then(() => true, () => false);
+ if (exists) {
+ console.log(`📝 pipeline-editorial-dead-metaphor prompt: already present`);
+ } else {
+ const sampleExists = await access(samplePath, constants.F_OK).then(() => true, () => false);
+ if (!sampleExists) {
+ console.warn(`⚠️ pipeline-editorial-dead-metaphor: sample missing for ${FILENAME} — skipping copy`);
+ } else {
+ try {
+ await copyFile(samplePath, dataPath);
+ console.log(`✅ seeded ${FILENAME}`);
+ } catch (err) {
+ console.warn(`⚠️ pipeline-editorial-dead-metaphor: copy failed for ${FILENAME}: ${err.message}`);
+ }
+ }
+ }
+
+ const installedConfigPath = join(rootDir, 'data', 'prompts', 'stage-config.json');
+ const sampleConfigPath = join(rootDir, 'data.reference', 'prompts', 'stage-config.json');
+ const sampleConfigExists = await access(sampleConfigPath, constants.F_OK).then(() => true, () => false);
+ if (!sampleConfigExists) {
+ console.warn('⚠️ pipeline-editorial-dead-metaphor: data.reference stage-config.json missing — cannot resolve entry; skipping config write');
+ return;
+ }
+ try {
+ const sample = JSON.parse(await readFile(sampleConfigPath, 'utf8'));
+ const installedExists = await access(installedConfigPath, constants.F_OK).then(() => true, () => false);
+ const installed = installedExists
+ ? JSON.parse(await readFile(installedConfigPath, 'utf8'))
+ : { stages: {} };
+ installed.stages = installed.stages || {};
+ if (installed.stages[STAGE_KEY]) {
+ console.log(`📝 pipeline-editorial-dead-metaphor stage-config: already present`);
+ return;
+ }
+ if (!sample?.stages?.[STAGE_KEY]) {
+ console.warn(`⚠️ pipeline-editorial-dead-metaphor: sample stage-config missing ${STAGE_KEY} — skipping`);
+ return;
+ }
+ installed.stages[STAGE_KEY] = sample.stages[STAGE_KEY];
+ await mkdir(dirname(installedConfigPath), { recursive: true });
+ await writeFile(installedConfigPath, JSON.stringify(installed, null, 2) + '\n', 'utf8');
+ const action = installedExists ? 'merged' : 'created';
+ console.log(`📝 pipeline-editorial-dead-metaphor stage-config (${action}): 1 added`);
+ } catch (err) {
+ console.warn(`⚠️ pipeline-editorial-dead-metaphor: stage-config merge failed: ${err.message}`);
+ }
+ },
+};
diff --git a/scripts/migrations/101-editorial-dead-metaphor-stage.test.js b/scripts/migrations/101-editorial-dead-metaphor-stage.test.js
new file mode 100644
index 0000000000..fddb5a9ba3
--- /dev/null
+++ b/scripts/migrations/101-editorial-dead-metaphor-stage.test.js
@@ -0,0 +1,86 @@
+import { describe, it, expect, beforeEach, afterEach } from 'vitest';
+import { mkdtempSync, rmSync, mkdirSync, writeFileSync, readFileSync, existsSync } from 'fs';
+import { tmpdir } from 'os';
+import { join, dirname } from 'path';
+import { fileURLToPath } from 'url';
+
+import migration from './101-editorial-dead-metaphor-stage.js';
+
+// scripts/migrations/<this> → ../.. is the repo root (matches _testHelpers.js).
+const repoRoot = join(dirname(fileURLToPath(import.meta.url)), '..', '..');
+
+// First-shipment seed migration (mirrors 099) — no MD5 bookkeeping, so the
+// seed / no-clobber behavior is asserted directly.
+
+const FILENAME = 'pipeline-editorial-dead-metaphor.md';
+const STAGE_KEY = 'pipeline-editorial-dead-metaphor';
+const BODY = '# Dead / mixed metaphor\n\nshipped body\n';
+
+describe('migration 101 — seed editorial-dead-metaphor stage', () => {
+ let rootDir;
+ let stagesDir;
+ let refStagesDir;
+ let installedConfigPath;
+
+ const seedReference = ({ withConfig = true } = {}) => {
+ writeFileSync(join(refStagesDir, FILENAME), BODY);
+ if (withConfig) {
+ const refConfigPath = join(rootDir, 'data.reference', 'prompts', 'stage-config.json');
+ writeFileSync(
+ refConfigPath,
+ JSON.stringify({ stages: { [STAGE_KEY]: { name: STAGE_KEY, description: 'desc', model: 'default', returnsJson: true, variables: [] } } }, null, 2) + '\n',
+ );
+ }
+ };
+
+ beforeEach(() => {
+ rootDir = mkdtempSync(join(tmpdir(), 'migration-101-'));
+ stagesDir = join(rootDir, 'data', 'prompts', 'stages');
+ refStagesDir = join(rootDir, 'data.reference', 'prompts', 'stages');
+ installedConfigPath = join(rootDir, 'data', 'prompts', 'stage-config.json');
+ mkdirSync(stagesDir, { recursive: true });
+ mkdirSync(refStagesDir, { recursive: true });
+ });
+
+ afterEach(() => {
+ rmSync(rootDir, { recursive: true, force: true });
+ });
+
+ it('seeds the .md template and merges the stage-config entry on a fresh install', async () => {
+ seedReference();
+ await expect(migration.up({ rootDir })).resolves.not.toThrow();
+ expect(readFileSync(join(stagesDir, FILENAME), 'utf8')).toBe(BODY);
+ const installed = JSON.parse(readFileSync(installedConfigPath, 'utf8'));
+ expect(installed.stages[STAGE_KEY]).toMatchObject({ returnsJson: true });
+ });
+
+ it('is idempotent and never clobbers a customized .md or an existing stage-config entry', async () => {
+ seedReference();
+ const customBody = '# CUSTOMIZED — do not overwrite\n';
+ writeFileSync(join(stagesDir, FILENAME), customBody);
+ writeFileSync(
+ installedConfigPath,
+ JSON.stringify({ stages: { [STAGE_KEY]: { name: 'user-tuned', model: 'custom' } } }, null, 2) + '\n',
+ );
+
+ await migration.up({ rootDir });
+
+ expect(readFileSync(join(stagesDir, FILENAME), 'utf8')).toBe(customBody);
+ const installed = JSON.parse(readFileSync(installedConfigPath, 'utf8'));
+ expect(installed.stages[STAGE_KEY]).toEqual({ name: 'user-tuned', model: 'custom' });
+ });
+
+ it('does not throw when the data.reference samples are missing', async () => {
+ await expect(migration.up({ rootDir })).resolves.not.toThrow();
+ expect(existsSync(join(stagesDir, FILENAME))).toBe(false);
+ });
+
+ it('matches the live shipped stage-config key + prompt file (drift catch)', () => {
+ const refConfig = JSON.parse(
+ readFileSync(join(repoRoot, 'data.reference', 'prompts', 'stage-config.json'), 'utf8'),
+ );
+ expect(refConfig.stages[STAGE_KEY], `stage-config missing ${STAGE_KEY}`).toBeTruthy();
+ expect(refConfig.stages[STAGE_KEY].returnsJson).toBe(true);
+ expect(existsSync(join(repoRoot, 'data.reference', 'prompts', 'stages', FILENAME))).toBe(true);
+ });
+});
diff --git a/server/lib/editorial/README.md b/server/lib/editorial/README.md
index 85f1555a61..11fa2ed1d5 100644
--- a/server/lib/editorial/README.md
+++ b/server/lib/editorial/README.md
@@ -92,4 +92,5 @@ runner-injected `ctx.callInlineLLM` (an inline-prompt sibling of
|---|---|
| `checkRegistry.js` | `EDITORIAL_CHECKS` array + `EDITORIAL_SOURCES` (the per-check `sources` vocabulary the staleness runner fingerprints, #1387) + fail-fast guards + lookup/state helpers (`getCheck`, `getCheckById`, `getAllChecks`, `listChecks`, `resolveCheckState`, `getEnabledChecks`, `resolveCheckConfig`). User-defined-check helpers (`buildCustomCheck`, `buildCustomCheckPrompt`, `readCustomCheckDefs`, `isCustomCheckId`, `isValidCustomCheckDef`). Ships two reference checks: `naming.dissimilar-names` (deterministic) and `prose.info-dumping` (LLM). |
| `nameSimilarity.js` | Pure, dependency-free name-confusability primitives for `naming.dissimilar-names` (#1291): `normalizeName`, `vowelSkeleton`, `soundex` (phonetic key), `levenshtein` (edit distance), `nameSimilaritySignals` (the per-pair signal list, with option toggles), and `firstLetterHistogram` / `findFirstLetterClusters` (cast first-letter crowding). |
+| `cliches.js` | Pure, dependency-free cliché + overwriting primitives for `prose.cliches` and `prose.modifier-stacking` (#1308): `CLICHE_PHRASES` (seed stock-simile/idiom list), `findCliches` (whole-word phrase scan with house-style allow/extra lists), and `findModifierStacking` (cumulative no-comma runs of 3+ stacked adjectives/adverbs). The LLM sibling `prose.dead-metaphor` handles the judgment cases (mixed/dead metaphor, novel clichés, purple prose). |
| `index.js` | Barrel re-export of the above. |
diff --git a/server/lib/editorial/checkRegistry.js b/server/lib/editorial/checkRegistry.js
index 5b45a640ab..53ebc10c4c 100644
--- a/server/lib/editorial/checkRegistry.js
+++ b/server/lib/editorial/checkRegistry.js
@@ -27,6 +27,7 @@
import { z } from 'zod';
import { estimateTokens } from '../contextBudget.js';
import { analyzeNamePair, findFirstLetterClusters, normalizeName } from './nameSimilarity.js';
+import { findCliches, findModifierStacking } from './cliches.js';
export const CHECK_SCOPES = Object.freeze(['series', 'issue', 'scene', 'noun']);
export const CHECK_KINDS = Object.freeze(['deterministic', 'llm']);
@@ -145,6 +146,13 @@ export function authoredSetupPayoffSummary(readerMap) {
return parts.join('\n\n');
}
+// Stage name for the cliché / dead-metaphor / overwriting LLM check (#1308).
+// Ships in data.reference/prompts/stages/ + stage-config.json (fresh installs
+// via setup-data.js) and migrates to existing installs via migration 101 (boot
+// runs migrations but NOT setup-data, so the migration is required). The
+// deterministic siblings (prose.cliches, prose.modifier-stacking) need no stage.
+export const DEAD_METAPHOR_STAGE = 'pipeline-editorial-dead-metaphor';
+
// ---------------------------------------------------------------------------
// Character-name dissimilarity (#1291) reads cast names + aliases and respects
// locked entries. The pure similarity primitives live in ./nameSimilarity.js;
@@ -828,6 +836,13 @@ const sceneLabel = (s) => {
// Registry entries.
// ---------------------------------------------------------------------------
+// Split a UI text field holding a phrase list (comma- or newline-separated) into
+// trimmed, non-empty phrases — used by prose.cliches' allow/extra config fields.
+function splitPhraseList(value) {
+ if (typeof value !== 'string' || !value.trim()) return [];
+ return value.split(/[,\n]/).map((p) => p.trim()).filter(Boolean);
+}
+
export const EDITORIAL_CHECKS = [
{
id: 'naming.dissimilar-names',
@@ -1909,6 +1924,189 @@ export const EDITORIAL_CHECKS = [
});
},
},
+ {
+ id: 'prose.cliches',
+ sources: ['manuscript'],
+ label: 'Cliché phrases (stock similes / idioms)',
+ description:
+ 'Flags stock similes and idioms — "heart pounding like a drum", "time stood still", "little did they know" — tired phrasing that pulls readers out. Deterministic scan of a seed phrase list; extend or mute entries per house style. The LLM sibling catches novel clichés the list misses.',
+ scope: 'issue',
+ kind: 'deterministic',
+ category: 'style',
+ severityDefault: 'low',
+ defaultEnabled: true,
+ // Reads the stitched manuscript (per-issue sections) to anchor each cliché.
+ needsManuscript: true,
+ configSchema: z.object({
+ // Cap findings per run so a cliché-heavy draft can't flood the review.
+ maxFindings: z.number().int().min(1).max(50).default(20),
+ // House-style allowlist: clichés to leave alone (one per line or comma-separated)
+ // — an intentional cliché in a character's voice or a genre beat.
+ allowPhrases: z.string().default(''),
+ // Series-specific clichés to add to the seed list (one per line or comma-separated).
+ extraPhrases: z.string().default(''),
+ }),
+ configFields: [
+ {
+ key: 'maxFindings',
+ label: 'Max findings per run',
+ type: 'number',
+ min: 1,
+ max: 50,
+ step: 1,
+ help: 'Cap findings so a cliché-heavy draft can not flood the review.',
+ },
+ {
+ key: 'allowPhrases',
+ label: 'House-style allowlist',
+ type: 'text',
+ help: 'Clichés to leave alone (comma-separated or one per line) — intentional voice or genre beats.',
+ },
+ {
+ key: 'extraPhrases',
+ label: 'Extra clichés to flag',
+ type: 'text',
+ help: 'Series-specific stock phrases to add to the seed list (comma-separated or one per line).',
+ },
+ ],
+ gate: (ctx) => (ctx.manuscript || '').trim().length > 0,
+ run: (ctx) => {
+ const cfg = ctx.config || {};
+ const max = cfg.maxFindings ?? 20;
+ const allowPhrases = splitPhraseList(cfg.allowPhrases);
+ const extraPhrases = splitPhraseList(cfg.extraPhrases);
+ const sections = Array.isArray(ctx.sections) ? ctx.sections : [];
+ const findings = [];
+ // One finding per distinct cliché (anchored to the first issue it appears
+ // in) — a cliché repeated across the draft is one tic to fix, not many.
+ const seenPhrases = new Set();
+ for (const s of sections) {
+ if (findings.length >= max) break;
+ const hits = findCliches(s?.content || '', { allowPhrases, extraPhrases });
+ for (const hit of hits) {
+ if (findings.length >= max) break;
+ const key = hit.phrase.toLowerCase();
+ if (seenPhrases.has(key)) continue;
+ seenPhrases.add(key);
+ const issueNumber = Number.isInteger(s?.number) ? s.number : null;
+ findings.push({
+ severity: ctx.severityDefault,
+ category: 'style',
+ location: issueNumber != null ? `Issue ${issueNumber}` : 'Manuscript',
+ problem: `Cliché phrase "${hit.anchor}" — a stock simile/idiom that reads as filler and pulls readers out of the prose.`,
+ suggestion: 'Replace with fresh, specific phrasing true to this moment — or add it to this check\'s house-style allowlist if the cliché is intentional voice.',
+ anchorQuote: hit.anchor,
+ issueNumber,
+ });
+ }
+ }
+ return findings;
+ },
+ },
+ {
+ id: 'prose.modifier-stacking',
+ sources: ['manuscript'],
+ label: 'Overwriting — stacked adjectives / adverbs',
+ description:
+ 'Flags overwriting: runs of three or more piled-up single-word modifiers ("big red shiny new") before a noun. Deterministic and high-precision (cumulative, no-comma runs only); coordinate lists and purple prose beyond a simple stack are left to the LLM sibling.',
+ scope: 'issue',
+ kind: 'deterministic',
+ category: 'style',
+ severityDefault: 'low',
+ defaultEnabled: true,
+ needsManuscript: true,
+ configSchema: z.object({
+ // Run length (consecutive modifiers) to flag. 3 is the classic "too many
+ // adjectives" threshold; raise it to only catch the most egregious piles.
+ minStack: z.number().int().min(3).max(8).default(3),
+ // Cap findings per run so an adjective-heavy draft can't flood the review.
+ maxFindings: z.number().int().min(1).max(50).default(20),
+ }),
+ configFields: [
+ {
+ key: 'minStack',
+ label: 'Modifiers in a row to flag',
+ type: 'number',
+ min: 3,
+ max: 8,
+ step: 1,
+ help: 'How many consecutive single-word modifiers (with no commas between them) before a noun trips the check. 3 catches "big red shiny new"; raise it for only the worst piles.',
+ },
+ {
+ key: 'maxFindings',
+ label: 'Max findings per run',
+ type: 'number',
+ min: 1,
+ max: 50,
+ step: 1,
+ help: 'Cap findings so an adjective-heavy draft can not flood the review.',
+ },
+ ],
+ gate: (ctx) => (ctx.manuscript || '').trim().length > 0,
+ run: (ctx) => {
+ const cfg = ctx.config || {};
+ const minStack = cfg.minStack ?? 3;
+ const max = cfg.maxFindings ?? 20;
+ const sections = Array.isArray(ctx.sections) ? ctx.sections : [];
+ const findings = [];
+ for (const s of sections) {
+ if (findings.length >= max) break;
+ const runs = findModifierStacking(s?.content || '', { minStack });
+ for (const run of runs) {
+ if (findings.length >= max) break;
+ const issueNumber = Number.isInteger(s?.number) ? s.number : null;
+ findings.push({
+ // A longer pile (5+) is more clearly overwriting — escalate above the low floor.
+ severity: escalateSeverity(ctx.severityDefault, run.count >= 5 ? 1 : 0),
+ category: 'style',
+ location: issueNumber != null ? `Issue ${issueNumber}` : 'Manuscript',
+ problem: `${run.count} modifiers stacked in a row ("${run.anchor}") — piling adjectives/adverbs dilutes each one and reads as overwriting.`,
+ suggestion: 'Cut to the one or two strongest, most specific modifiers (or replace the noun phrase with a stronger noun/verb).',
+ anchorQuote: run.anchor,
+ issueNumber,
+ });
+ }
+ }
+ return findings;
+ },
+ },
+ {
+ id: 'prose.dead-metaphor',
+ sources: ['manuscript'],
+ label: 'Dead / mixed metaphor, novel clichés & overwriting (LLM)',
+ description:
+ 'LLM scan for tired stock language the deterministic checks miss — mixed or dead metaphors that collide or have gone invisible, novel clichés beyond the seed list, and overwrought / purple description. Complements the kill-your-darlings check (#1300) by targeting stock rather than precious prose.',
+ scope: 'issue',
+ kind: 'llm',
+ category: 'style',
+ severityDefault: 'low',
+ defaultEnabled: true,
+ needsManuscript: true,
+ configSchema: z.object({
+ // Cap findings per run so a long manuscript can't flood the review.
+ maxFindings: z.number().int().min(1).max(50).default(12),
+ }),
+ configFields: [
+ {
+ key: 'maxFindings',
+ label: 'Max findings per run',
+ type: 'number',
+ min: 1,
+ max: 50,
+ step: 1,
+ help: 'Cap findings so a long manuscript can not flood the review.',
+ },
+ ],
+ gate: (ctx) => (ctx.manuscript || '').trim().length > 0,
+ // Localized prose-level findings (one tired phrase = one spot), so this stays
+ // a plain per-chunk run with no cross-chunk digest — mirrors prose.info-dumping.
+ run: (ctx) => runManuscriptLlmCheck(ctx, {
+ stage: DEAD_METAPHOR_STAGE,
+ category: 'style',
+ overheadTokens: EDITORIAL_PROMPT_OVERHEAD_TOKENS,
+ buildVars: (manuscript) => ({ manuscript }),
+ }),
+ },
];
// ---------------------------------------------------------------------------
diff --git a/server/lib/editorial/checkRegistry.test.js b/server/lib/editorial/checkRegistry.test.js
index 0998d1186a..d272753fcd 100644
--- a/server/lib/editorial/checkRegistry.test.js
+++ b/server/lib/editorial/checkRegistry.test.js
@@ -1856,3 +1856,74 @@ describe('custom checks (#1346)', () => {
});
});
});
+
+describe('prose.cliches / prose.modifier-stacking / prose.dead-metaphor (#1308)', () => {
+ const CLICHES = 'prose.cliches';
+ const STACKING = 'prose.modifier-stacking';
+ const DEADMETA = 'prose.dead-metaphor';
+
+ it('registers all three as manuscript-scoped style checks of the right kind', () => {
+ expect(getCheck(CLICHES).kind).toBe('deterministic');
+ expect(getCheck(STACKING).kind).toBe('deterministic');
+ expect(getCheck(DEADMETA).kind).toBe('llm');
+ for (const id of [CLICHES, STACKING, DEADMETA]) {
+ const c = getCheck(id);
+ expect(c.category).toBe('style');
+ expect(c.sources).toEqual(['manuscript']);
+ expect(c.needsManuscript).toBe(true);
+ expect(c.gate({ manuscript: '' })).toBe(false);
+ expect(c.gate({ manuscript: '# Issue 1\n\nprose' })).toBeTruthy();
+ }
+ });
+
+ it('prose.cliches anchors a stock phrase to its issue and dedupes across the draft', () => {
+ const sections = [
+ { number: 1, content: 'And then time stood still in the hall.' },
+ { number: 2, content: 'Once more, time stood still — but also all hell broke loose.' },
+ ];
+ const findings = getCheck(CLICHES).run({ sections, config: {}, severityDefault: 'low' });
+ // "time stood still" deduped to issue 1; "all hell broke loose" from issue 2.
+ expect(findings.map((f) => f.anchorQuote)).toEqual(['time stood still', 'all hell broke loose']);
+ expect(findings[0].issueNumber).toBe(1);
+ expect(findings[0].category).toBe('style');
+ expect(findings[1].issueNumber).toBe(2);
+ });
+
+ it('prose.cliches honors the house-style allowlist and the findings cap', () => {
+ const sections = [{ number: 1, content: 'time stood still and all hell broke loose' }];
+ const muted = getCheck(CLICHES).run({ sections, config: { allowPhrases: 'time stood still' }, severityDefault: 'low' });
+ expect(muted.map((f) => f.anchorQuote)).toEqual(['all hell broke loose']);
+ const capped = getCheck(CLICHES).run({ sections, config: { maxFindings: 1 }, severityDefault: 'low' });
+ expect(capped).toHaveLength(1);
+ });
+
+ it('prose.modifier-stacking flags a no-comma adjective pile and escalates a long run', () => {
+ const sections = [{ number: 3, content: 'a big red shiny new old battered car rolled by' }];
+ const findings = getCheck(STACKING).run({ sections, config: {}, severityDefault: 'low' });
+ expect(findings).toHaveLength(1);
+ expect(findings[0].issueNumber).toBe(3);
+ // 6-modifier pile (>=5) escalates above the low floor.
+ expect(findings[0].severity).toBe('medium');
+ });
+
+ it('prose.dead-metaphor passes the planned chunk to the model and forces the style category', async () => {
+ let seen = null;
+ const findings = await getCheck(DEADMETA).run({
+ manuscript: '# Issue 4\n\nThe beacon of hope shone.',
+ config: { maxFindings: 12 },
+ severityDefault: 'low',
+ planManuscriptChunks: async (_stage, opts) => {
+ expect(opts.overheadTokens).toBeGreaterThan(0);
+ return ['# Issue 4\n\nThe beacon of hope shone.'];
+ },
+ callStagedLLM: async (_stage, vars) => {
+ seen = vars.manuscript;
+ return { content: { findings: [{ severity: 'low', issueNumber: 4, location: 'Issue 4 — cliché', problem: 'dead metaphor', anchorQuote: 'beacon of hope' }] } };
+ },
+ });
+ expect(seen).toBe('# Issue 4\n\nThe beacon of hope shone.');
+ expect(findings).toHaveLength(1);
+ expect(findings[0].category).toBe('style');
+ expect(findings[0].issueNumber).toBe(4);
+ });
+});
diff --git a/server/lib/editorial/cliches.js b/server/lib/editorial/cliches.js
new file mode 100644
index 0000000000..3bec849844
--- /dev/null
+++ b/server/lib/editorial/cliches.js
@@ -0,0 +1,233 @@
+/**
+ * Cliché + overwriting deterministic primitives (#1308) for the editorial check
+ * registry. Pure and dependency-free (no side-effecting imports) so it stays
+ * unit-testable in isolation — mirrors ./nameSimilarity.js.
+ *
+ * Two scanners back two deterministic checks in checkRegistry.js:
+ * - findCliches() → `prose.cliches` (stock simile/idiom phrases)
+ * - findModifierStacking() → `prose.modifier-stacking` (overwriting: 3+ stacked modifiers)
+ *
+ * Their LLM sibling `prose.dead-metaphor` handles the judgment cases these pure
+ * scanners can't: mixed/dead metaphors, novel clichés the seed list misses, and
+ * purple-prose overwriting beyond a simple adjective run.
+ */
+
+// Seed cliché phrase list — stock similes/idioms that pull readers out of the
+// prose. Curated, not exhaustive; a series can extend it (extraPhrases) or mute
+// entries for voice/genre (allowPhrases). Phrases are matched whole-word and
+// case-insensitively, with flexible internal whitespace, against the manuscript.
+// Keep entries lowercase and free of leading/trailing punctuation.
+export const CLICHE_PHRASES = Object.freeze([
+ 'heart pounding like a drum',
+ 'time stood still',
+ 'little did they know',
+ 'little did she know',
+ 'little did he know',
+ 'all hell broke loose',
+ 'at the end of the day',
+ 'calm before the storm',
+ 'avoid like the plague',
+ 'blood ran cold',
+ 'heart skipped a beat',
+ 'in the nick of time',
+ 'fell on deaf ears',
+ 'needle in a haystack',
+ 'tip of the iceberg',
+ 'weight of the world',
+ 'dead of night',
+ 'crack of dawn',
+ 'white as a sheet',
+ 'quiet as the grave',
+ 'easier said than done',
+ 'only time will tell',
+ 'every fiber of her being',
+ 'every fiber of his being',
+ 'tears streamed down',
+ 'a single tear',
+ 'butterflies in her stomach',
+ 'butterflies in his stomach',
+ 'heart of gold',
+ 'nerves of steel',
+ 'deafening silence',
+ 'ice in his veins',
+ 'ice in her veins',
+ 'world came crashing down',
+ 'against all odds',
+ 'by the skin of his teeth',
+ 'like a deer in the headlights',
+ 'thick as thieves',
+ 'head over heels',
+ 'weak in the knees',
+ 'breath caught in her throat',
+ 'breath caught in his throat',
+ "couldn't believe her eyes",
+ "couldn't believe his eyes",
+ 'without a second thought',
+ 'in the blink of an eye',
+ 'raining cats and dogs',
+ 'the apple of his eye',
+ 'cold sweat',
+ 'few and far between',
+ 'last but not least',
+ 'when push comes to shove',
+ 'lo and behold',
+ 'needless to say',
+ 'a force to be reckoned with',
+ 'wrong side of the bed',
+ 'hook line and sinker',
+ 'tip of the tongue',
+ 'better late than never',
+]);
+
+// Common short adjectives that lack a tell-tale adjective suffix — the suffix
+// heuristic below misses these, so they're enumerated. Lowercase.
+const COMMON_ADJECTIVES = new Set([
+ 'big', 'small', 'old', 'new', 'young', 'tall', 'short', 'long', 'wide',
+ 'deep', 'high', 'low', 'huge', 'tiny', 'thin', 'thick', 'soft', 'hard',
+ 'warm', 'cold', 'hot', 'cool', 'dark', 'light', 'pale', 'bright', 'dull',
+ 'dim', 'grim', 'vast', 'wet', 'dry', 'fat', 'lean', 'rich', 'poor', 'fine',
+ 'rough', 'smooth', 'sharp', 'flat', 'round', 'square', 'fierce', 'gentle',
+ 'quiet', 'loud', 'still', 'slow', 'quick', 'fast', 'weak', 'strong', 'proud',
+ 'plain', 'odd', 'sweet', 'bitter', 'sour', 'clean', 'dirty', 'fresh', 'stale',
+ 'red', 'blue', 'green', 'black', 'white', 'gray', 'grey', 'brown', 'gold',
+ 'golden', 'silver', 'crimson', 'azure', 'amber',
+ // Frequent descriptive adjectives ending in -y — enumerated rather than caught
+ // by a blanket -y suffix rule (which would sweep up -y nouns: city, body, army).
+ 'shiny', 'pretty', 'ugly', 'happy', 'angry', 'weary', 'dreary', 'empty',
+ 'heavy', 'busy', 'lazy', 'dirty', 'dusty', 'rusty', 'foggy', 'misty', 'murky',
+ 'silky', 'wispy', 'gloomy', 'creepy', 'spooky', 'sleepy', 'lonely', 'lovely',
+]);
+
+// Adjective / participle suffixes that reliably mark a descriptive modifier.
+// Bare -y and -s are deliberately excluded (too noisy: "city", "boys");
+// -ing/-ed are included because the no-comma run requirement below excludes the
+// gerund/verb-list shapes that would otherwise be false positives.
+const MODIFIER_SUFFIX = /(?:ous|ful|ive|ent|ant|ical|ic|less|able|ible|ish|ese|like|some|ward|most|ed|ing|ly)$/i;
+
+function escapeRegExp(s) {
+ return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
+}
+
+// A phrase matches with word boundaries on each edge and flexible internal
+// whitespace, so "time stood\nstill" still trips "time stood still". Internal
+// non-word characters (apostrophes) are matched literally.
+function clichePattern(phrase) {
+ const escaped = escapeRegExp(phrase.trim()).replace(/\s+/g, '\\s+');
+ return new RegExp(`\\b${escaped}\\b`, 'i');
+}
+
+function normalizePhrase(p) {
+ return typeof p === 'string' ? p.trim().toLowerCase() : '';
+}
+
+/**
+ * Find stock-cliché phrase occurrences in `text`. Returns the FIRST occurrence
+ * of each distinct phrase (deduped — a cliché repeated five times is one tic to
+ * fix, not five findings), sorted by position.
+ *
+ * @param {string} text
+ * @param {{ allowPhrases?: string[], extraPhrases?: string[] }} [opts]
+ * allowPhrases — house-style allowlist; muted (case-insensitive) so an
+ * intentional cliché in a character's voice doesn't flag.
+ * extraPhrases — series-specific additions to the seed list.
+ * @returns {Array<{ phrase: string, index: number, anchor: string }>}
+ * phrase — the canonical seed/extra phrase; anchor — the verbatim text matched.
+ */
+export function findCliches(text, opts = {}) {
+ if (typeof text !== 'string' || !text) return [];
+ const allow = new Set((Array.isArray(opts.allowPhrases) ? opts.allowPhrases : []).map(normalizePhrase).filter(Boolean));
+ const extra = (Array.isArray(opts.extraPhrases) ? opts.extraPhrases : [])
+ .map((p) => (typeof p === 'string' ? p.trim() : ''))
+ .filter(Boolean);
+ // Seed + extras, deduped by normalized form, with the house-style allowlist removed.
+ const seen = new Set();
+ const phrases = [];
+ for (const p of [...CLICHE_PHRASES, ...extra]) {
+ const norm = normalizePhrase(p);
+ if (!norm || seen.has(norm) || allow.has(norm)) continue;
+ seen.add(norm);
+ phrases.push(p);
+ }
+ const found = [];
+ for (const phrase of phrases) {
+ const m = clichePattern(phrase).exec(text);
+ if (m) found.push({ phrase, index: m.index, anchor: m[0] });
+ }
+ return found.sort((a, b) => a.index - b.index);
+}
+
+function isModifierWord(word) {
+ const w = word.toLowerCase();
+ return COMMON_ADJECTIVES.has(w) || MODIFIER_SUFFIX.test(w);
+}
+
+/**
+ * Find runs of `minStack`+ consecutive single-word modifiers separated only by
+ * single spaces (no commas, within one sentence) — the cumulative-adjective
+ * "big red shiny new" overwriting tell. Comma-coordinate lists and
+ * cross-sentence spans are intentionally NOT flagged here (left to the LLM
+ * sibling) to keep the deterministic scanner high-precision and advisory.
+ *
+ * @param {string} text
+ * @param {{ minStack?: number }} [opts] minStack — run length to flag (default 3, min 3).
+ * @returns {Array<{ words: string[], index: number, anchor: string, count: number }>}
+ */
+export function findModifierStacking(text, opts = {}) {
+ if (typeof text !== 'string' || !text) return [];
+ const minStack = Math.max(3, Number.isInteger(opts.minStack) ? opts.minStack : 3);
+ const runs = [];
+ // Walk space-delimited tokens, tracking each token's absolute offset so a run
+ // can be anchored verbatim. A comma (or any non-space gap) breaks the run.
+ const tokenRe = /\S+/g;
+ let m;
+ let runStart = -1; // char offset of the first word in the current run
+ let runWords = []; // bare modifier words in the current run
+ let prevEnd = -1; // char offset just past the previous token
+ const flush = () => {
+ if (runWords.length >= minStack && runStart >= 0) {
+ const end = prevEnd;
+ runs.push({
+ words: runWords.slice(),
+ index: runStart,
+ anchor: text.slice(runStart, end),
+ count: runWords.length,
+ });
+ }
+ runStart = -1;
+ runWords = [];
+ };
+ while ((m = tokenRe.exec(text)) !== null) {
+ const raw = m[0];
+ const start = m.index;
+ // Separator since the previous token: a run only continues across a single
+ // space. A comma, newline, sentence break, or any trailing punctuation on the
+ // previous token ends the current run.
+ const gap = prevEnd >= 0 ? text.slice(prevEnd, start) : '';
+ const cleanGap = gap === ' ';
+ // The bare alphabetic word (strip surrounding punctuation); trailing
+ // punctuation on a token (comma, period) also ends the run after it.
+ const bare = raw.replace(/^[^A-Za-z']+|[^A-Za-z']+$/g, '');
+ // Trailing punctuation (a comma after this modifier, or sentence-ending
+ // .!?) closes the run after it — sentence breaks attach their punctuation to
+ // the preceding token, so this also stops a run at a sentence boundary.
+ const hadTrailingPunct = /[^A-Za-z']$/.test(raw);
+ const isMod = bare.length > 0 && isModifierWord(bare);
+
+ if (isMod && (runWords.length === 0 || cleanGap)) {
+ if (runWords.length === 0) runStart = start;
+ runWords.push(bare);
+ } else {
+ flush();
+ if (isMod) {
+ runStart = start;
+ runWords = [bare];
+ }
+ }
+ prevEnd = start + raw.length;
+ // Trailing punctuation (comma after this modifier, end of sentence) closes
+ // the run even when the next token is also a modifier.
+ if (hadTrailingPunct) flush();
+ }
+ flush();
+ return runs;
+}
diff --git a/server/lib/editorial/cliches.test.js b/server/lib/editorial/cliches.test.js
new file mode 100644
index 0000000000..c24e9a983e
--- /dev/null
+++ b/server/lib/editorial/cliches.test.js
@@ -0,0 +1,118 @@
+import { describe, it, expect } from 'vitest';
+import { CLICHE_PHRASES, findCliches, findModifierStacking } from './cliches.js';
+
+describe('CLICHE_PHRASES', () => {
+ it('is a non-empty frozen list of lowercase, trimmed phrases', () => {
+ expect(Array.isArray(CLICHE_PHRASES)).toBe(true);
+ expect(CLICHE_PHRASES.length).toBeGreaterThan(20);
+ expect(Object.isFrozen(CLICHE_PHRASES)).toBe(true);
+ for (const p of CLICHE_PHRASES) {
+ expect(p).toBe(p.toLowerCase());
+ expect(p).toBe(p.trim());
+ expect(p.length).toBeGreaterThan(0);
+ }
+ });
+});
+
+describe('findCliches', () => {
+ it('returns [] for empty / non-string input', () => {
+ expect(findCliches('')).toEqual([]);
+ expect(findCliches(null)).toEqual([]);
+ expect(findCliches(undefined)).toEqual([]);
+ expect(findCliches(42)).toEqual([]);
+ });
+
+ it('finds a seed cliché case-insensitively and anchors the verbatim text', () => {
+ const text = 'And then TIME STOOD STILL as the door opened.';
+ const hits = findCliches(text);
+ expect(hits).toHaveLength(1);
+ expect(hits[0].phrase).toBe('time stood still');
+ expect(hits[0].anchor).toBe('TIME STOOD STILL'); // verbatim casing from the text
+ expect(text.slice(hits[0].index, hits[0].index + hits[0].anchor.length)).toBe('TIME STOOD STILL');
+ });
+
+ it('matches across flexible internal whitespace and newlines', () => {
+ const hits = findCliches('the silence was a\n deafening silence indeed');
+ expect(hits.map((h) => h.phrase)).toContain('deafening silence');
+ });
+
+ it('requires whole-word boundaries (no mid-word matches)', () => {
+ // "cold sweat" should NOT match inside "scolded sweater"
+ expect(findCliches('he scolded sweater makers')).toEqual([]);
+ expect(findCliches('a cold sweat broke out').map((h) => h.phrase)).toContain('cold sweat');
+ });
+
+ it('returns one finding per distinct phrase, sorted by position', () => {
+ const text = 'little did they know. Later, all hell broke loose, and little did they know again.';
+ const hits = findCliches(text);
+ // "little did they know" deduped to its first occurrence; both phrases present.
+ expect(hits.map((h) => h.phrase)).toEqual(['little did they know', 'all hell broke loose']);
+ expect(hits[0].index).toBeLessThan(hits[1].index);
+ });
+
+ it('mutes phrases in the house-style allowlist (case-insensitively)', () => {
+ const text = 'Time stood still.';
+ expect(findCliches(text)).toHaveLength(1);
+ expect(findCliches(text, { allowPhrases: ['TIME stood still'] })).toEqual([]);
+ });
+
+ it('flags series-specific extra phrases', () => {
+ const text = 'It was a dark and stormy night.';
+ expect(findCliches(text)).toEqual([]);
+ const hits = findCliches(text, { extraPhrases: ['a dark and stormy night'] });
+ expect(hits.map((h) => h.phrase)).toContain('a dark and stormy night');
+ });
+
+ it('ignores non-array allow/extra options', () => {
+ expect(() => findCliches('time stood still', { allowPhrases: 'x', extraPhrases: 5 })).not.toThrow();
+ expect(findCliches('time stood still', { allowPhrases: 'x', extraPhrases: 5 })).toHaveLength(1);
+ });
+});
+
+describe('findModifierStacking', () => {
+ it('returns [] for empty / non-string input', () => {
+ expect(findModifierStacking('')).toEqual([]);
+ expect(findModifierStacking(null)).toEqual([]);
+ });
+
+ it('flags a no-comma run of 3+ stacked modifiers before a noun', () => {
+ const runs = findModifierStacking('It was a big red shiny new car.');
+ expect(runs).toHaveLength(1);
+ expect(runs[0].count).toBe(4);
+ expect(runs[0].words).toEqual(['big', 'red', 'shiny', 'new']);
+ expect(runs[0].anchor).toBe('big red shiny new');
+ });
+
+ it('does not flag a run of 2', () => {
+ expect(findModifierStacking('a big red car')).toEqual([]);
+ });
+
+ it('does NOT flag comma-coordinate adjective lists (left to the LLM)', () => {
+ expect(findModifierStacking('a cold, dark, lonely night')).toEqual([]);
+ });
+
+ it('does NOT flag a comma-separated enumeration of nouns', () => {
+ expect(findModifierStacking('apples, oranges, bananas and pears')).toEqual([]);
+ });
+
+ it('breaks runs at sentence and clause boundaries', () => {
+ // "tired" ends one sentence; "broken defeated" only 2 → no flag.
+ expect(findModifierStacking('He was tired. Broken, defeated, he left.')).toEqual([]);
+ });
+
+ it('flags participial adjective stacks (no commas)', () => {
+ const runs = findModifierStacking('a tired wounded battered man');
+ expect(runs).toHaveLength(1);
+ expect(runs[0].count).toBe(3);
+ });
+
+ it('honors a higher minStack threshold', () => {
+ expect(findModifierStacking('big red shiny new car', { minStack: 5 })).toEqual([]);
+ expect(findModifierStacking('big red shiny new old car', { minStack: 5 })).toHaveLength(1);
+ });
+
+ it('clamps minStack to a floor of 3', () => {
+ // minStack below 3 is meaningless ("a big car" isn't overwriting) — clamp to 3.
+ expect(findModifierStacking('a big red car', { minStack: 2 })).toEqual([]);
+ });
+});
diff --git a/server/lib/editorial/index.js b/server/lib/editorial/index.js
index d5a303cc44..8ce758db22 100644
--- a/server/lib/editorial/index.js
+++ b/server/lib/editorial/index.js
@@ -1,4 +1,5 @@
// Barrel for server/lib/editorial/ — the extensible editorial-check registry
// (#1284). See README.md for the catalog. Re-export every public module here.
export * from './checkRegistry.js';
+export * from './cliches.js';
export * from './nameSimilarity.js';