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: add arc.regression editorial check for regression / circular / premature-closure arcs (#1619)

[._.]/ Adam Eivyc55922d3fb51
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 18fee3a6d4..aecdcd1059 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -23,6 +23,7 @@
## Editorial checks
+- **[issue-1619] A new editorial check flags character-arc regression, circular arcs, and premature closure.** `arc.transitions` finds the change *moments* but never judged whether each arc holds together end to end. The new `arc.regression` check (series-scope, default-on) tracks each character's progress across the issues and flags an unmotivated **regression** (a character grows then reverts with no earned reason — distinct from a dramatized relapse), a **circular arc** (ends in the same state they began, the growth cancelled out), or **premature closure** (the arc resolves early — e.g. issue 3 of 10 — then stays flat, deflating the back half). It reads the stitched manuscript plus the reverse-outline scene map and the authored per-character arcs (`series.characterArcs`), gates its whole-arc verdicts to the final manuscript part so a mid-arc character whose later growth is still ahead is not false-flagged, and degrades to a prose-only scan when no outline or authored arcs exist. Ships the prompt + stage-config for fresh installs and a boot migration (141) so existing installs seed the stage. (`server/lib/editorial/checkRegistry.js`, `data.reference/prompts/stages/pipeline-editorial-arc-regression.md`, `scripts/migrations/141-editorial-arc-regression-stage.js`)
- **[issue-1618] A new editorial check scores the series-wide pacing / intensity escalation curve.** `plot.structure-momentum` flags flat stakes as one of many macro pathologies, but nothing measured the *shape* of intensity across the whole series. The new `pacing.escalation-curve` check (series-scope, default-on) scores each issue's dramatic intensity and flags a curve that fails to build — **flat intensity** (issue 1 reads as intensely as issue N), a **front-loaded climax** (the biggest beat lands early and the back half coasts), **plateaued stakes**, or a **de-escalating arc**. It reads the stitched manuscript plus the reverse-outline scene map and a new deterministic per-issue conflict-marker density tally (a mechanical intensity proxy the model treats as a hint and confirms against the prose), gates its whole-curve verdict to the final manuscript part, and degrades to a prose-only scan when no outline exists. Subsumes "conflict escalation" as one signal of the same curve. Ships the prompt + stage-config for fresh installs and a boot migration (140) so existing installs seed the stage. (`server/lib/editorial/checkRegistry.js`, `data.reference/prompts/stages/pipeline-editorial-pacing-escalation-curve.md`, `scripts/migrations/140-editorial-pacing-escalation-stage.js`)
- **[issue-1697] Health-panel deep-links now honor the triage's session-local check mute.** Muting a check from the Editorial Findings triage (#1602) hid its findings group but the health panel kept advertising that check/category row as clickable — clicking it scrolled to an empty filtered view. The session mute state (`hiddenCheckIds`) was lifted from `EditorialFindingsTriage` up to `PipelineEditorialChecks`, which now subtracts muted checks from the filterable sets the health panel receives; a category stays clickable only while a non-muted check still contributes an open finding to it. (`client/src/pages/PipelineEditorialChecks.jsx`, `client/src/components/pipeline/editorial/EditorialFindingsTriage.jsx`)
- **[issue-1667] Final-part editorial verdicts no longer lose their carried setup context on a packed last chunk.** The cross-chunk "setup so far" digest normally yields to manuscript coverage — but two whole-story checks (`arc.climax-agency`, `emotion.reaction-proportionality`) gate their verdict to the final part and anchor it on a snippet carried in that digest (the climax candidate / the unprocessed event). When the final chunk packed to within a few hundred chars of the provider window, the digest was silently dropped and the final-only finding was missed. These checks now opt into a `reserveSetupDigest` guarantee that trims the final chunk's manuscript tail to make room for the digest (the inverse of the usual yield), scoped to the final chunk and opt-in checks only — every other chunk and every non-reserving check keeps full manuscript coverage. (`server/lib/editorial/checkRegistry.js`)
diff --git a/data.reference/prompts/stage-config.json b/data.reference/prompts/stage-config.json
index 14d73d8ccb..a355dada90 100644
--- a/data.reference/prompts/stage-config.json
+++ b/data.reference/prompts/stage-config.json
@@ -750,6 +750,13 @@
"model": "default",
"returnsJson": true,
"variables": []
+ },
+ "pipeline-editorial-arc-regression": {
+ "name": "Pipeline — Editorial Check: Character-arc regression / premature closure",
+ "description": "Editorial check (#1619): judges the SHAPE of each character's arc across the whole series and flags an unmotivated regression (growth then a purposeless revert, distinct from a dramatized relapse), a circular arc (ends where it began), or premature closure (the arc resolves early then goes flat for the rest of the series). Reads the stitched manuscript plus the reverse-outline scene map and the authored per-character arcs (series.characterArcs); degrades to a whole-manuscript scan when no outline or authored arcs exist. Whole-arc verdicts are gated to the final manuscript part. Returns character-anchored findings.",
+ "model": "default",
+ "returnsJson": true,
+ "variables": []
}
}
}
diff --git a/data.reference/prompts/stages/pipeline-editorial-arc-regression.md b/data.reference/prompts/stages/pipeline-editorial-arc-regression.md
new file mode 100644
index 0000000000..6446c9c8ae
--- /dev/null
+++ b/data.reference/prompts/stages/pipeline-editorial-arc-regression.md
@@ -0,0 +1,114 @@
+# Pipeline — Editorial Check: Character-arc regression / premature closure
+
+You are a developmental editor doing a single focused pass for ONE concern:
+**the SHAPE of each character's arc across the whole series** — not the individual
+change moments (a sibling check covers those), but whether each arc holds together
+from first issue to last. Judge the trajectory the reader actually experiences,
+character by character, in issue order.
+
+Flag only these pathologies (each is a distinct finding category):
+
+- **Regression** — a character grows, then reverts toward their old self with no
+ purpose and no earned reason; the change the story spent pages earning is simply
+ undone. This is NOT a deliberate, dramatized **relapse** (a backslide the story
+ stages as a real beat with consequences) — flag only an *unmotivated* revert that
+ reads as the author forgetting the character had changed.
+- **Circular arc** — the character ends in essentially the same state they began;
+ whatever growth happened is cancelled out, and they gain nothing they carry
+ forward. The reader watched a loop, not an arc.
+- **Premature closure** — the character's arc fully resolves early (their
+ want/need settled in, say, issue 3 of 10) and they stay flat for the rest of the
+ series — no new want, no fresh tension, no further development. The back half of
+ the series deflates because that character has nowhere left to go.
+
+Do NOT flag: a deliberately static character who is not meant to carry an arc (a
+fixed mentor, a comic foil); a dramatized relapse that the story earns and pays
+off; a character whose further growth is clearly still ahead in a manuscript you
+are reviewing in pieces (judge whole-arc shape only once the full series is in
+view — see the final-part note below).
+
+{{#characterArcs}}
+## Authored character arcs
+
+The author has recorded these per-character arcs (want, need, start → end state,
+and any transition beats they already planned). Reconcile the prose against them:
+a character whose authored end-state is growth but whose prose reverts or circles
+back is a stronger regression/circular finding; an authored arc that resolves at
+the planned ending is NOT premature closure even if it lands a little early.
+
+```
+{{characterArcs}}
+```
+{{/characterArcs}}
+
+{{#sceneMap}}
+## Scene segmentation
+
+The reverse outline below segments the manuscript into scenes (with the recorded
+setting, POV character, and characters present). Use it to attribute a finding to
+a scene and its issue; judge the arc shape itself from the prose.
+
+```
+{{sceneMap}}
+```
+{{/sceneMap}}
+
+## 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
+header to attribute every finding to its `issueNumber`.
+
+```
+{{manuscript}}
+```
+
+{{#finalPart}}
+You are seeing the FINAL part of the manuscript, so you may now judge the WHOLE
+shape of each character's arc: a regression, a circular arc, or premature closure.
+The "progress so far" digest above carries each character's start state, the peak
+of their growth, and their latest state, so you can place the late issues on the
+same trajectory and tell a true regression/closure from an arc still in motion.
+{{/finalPart}}
+{{^finalPart}}
+You are seeing an EARLIER part of a long manuscript reviewed in pieces. Do NOT yet
+flag a regression, a circular arc, or premature closure — a later part may grow,
+revert, or re-open any arc and resolve its shape. Note each character's progress
+in view (the "progress so far" digest carries this forward) but reserve every
+whole-arc verdict for the final part.
+{{/finalPart}}
+
+## Task
+
+For each named character who carries an arc, judge the shape across the whole
+series and flag the pathologies above. For each finding set `location` to the
+character name + the pathology — one of `regression`, `circular arc`, `premature
+closure` — e.g. `Mara — regression`, `Joss — premature closure`. Set `issueNumber`
+to the issue where the problem is clearest (the issue the character reverts in, or
+the issue their arc prematurely closes). Quote a short verbatim anchor (≤ 200
+chars) at the revert / closure moment where one exists (omit `anchorQuote` for a
+whole-arc shape judgment such as a circular arc). Severity: an unmotivated
+regression of a central character or premature closure of a protagonist's arc is
+high; a circular arc for a secondary character is low. If every carrying character
+has a coherent arc that develops to an earned ending, return an empty `findings`
+array — do not invent regression where the arc is sound.
+
+## 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 — character + pathology (e.g. 'Mara — regression' or 'Joss — premature closure')",
+ "problem": "1–3 sentences naming the arc-shape problem and why it weakens the series (where the arc reverts, circles back, or closes early then goes flat)",
+ "suggestion": "1–3 sentences proposing how to fix it (motivate the revert as an earned relapse, give the circled character something they carry forward, open a fresh want for the prematurely-closed arc)",
+ "anchorQuote": "short verbatim quote at the revert or closure moment (≤ 200 chars); omit for a whole-arc shape judgment"
+ }
+ ]
+}
+```
diff --git a/scripts/migrations/141-editorial-arc-regression-stage.js b/scripts/migrations/141-editorial-arc-regression-stage.js
new file mode 100644
index 0000000000..d86baacb52
--- /dev/null
+++ b/scripts/migrations/141-editorial-arc-regression-stage.js
@@ -0,0 +1,76 @@
+/**
+ * Seed the `pipeline-editorial-arc-regression` stage into existing installs
+ * (#1619).
+ *
+ * Mirrors `140-editorial-pacing-escalation-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 arc-regression stage
+ * unseeded and the `arc.regression` editorial check would throw "Stage not
+ * found" the first time it runs.
+ */
+
+import { access, copyFile, mkdir, readFile, writeFile, constants } from 'fs/promises';
+import { dirname, join } from 'path';
+
+const FILENAME = 'pipeline-editorial-arc-regression.md';
+const STAGE_KEY = 'pipeline-editorial-arc-regression';
+
+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-arc-regression prompt: already present`);
+ } else {
+ const sampleExists = await access(samplePath, constants.F_OK).then(() => true, () => false);
+ if (!sampleExists) {
+ console.warn(`⚠️ pipeline-editorial-arc-regression: sample missing for ${FILENAME} — skipping copy`);
+ } else {
+ try {
+ await copyFile(samplePath, dataPath);
+ console.log(`✅ seeded ${FILENAME}`);
+ } catch (err) {
+ console.warn(`⚠️ pipeline-editorial-arc-regression: 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-arc-regression: 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-arc-regression stage-config: already present`);
+ return;
+ }
+ if (!sample?.stages?.[STAGE_KEY]) {
+ console.warn(`⚠️ pipeline-editorial-arc-regression: 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-arc-regression stage-config (${action}): 1 added`);
+ } catch (err) {
+ console.warn(`⚠️ pipeline-editorial-arc-regression: stage-config merge failed: ${err.message}`);
+ }
+ },
+};
diff --git a/scripts/migrations/141-editorial-arc-regression-stage.test.js b/scripts/migrations/141-editorial-arc-regression-stage.test.js
new file mode 100644
index 0000000000..a4122e0ced
--- /dev/null
+++ b/scripts/migrations/141-editorial-arc-regression-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 './141-editorial-arc-regression-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 140) — no MD5 bookkeeping, so the
+// seed / no-clobber behavior is asserted directly.
+
+const FILENAME = 'pipeline-editorial-arc-regression.md';
+const STAGE_KEY = 'pipeline-editorial-arc-regression';
+const BODY = '# Character-arc regression / premature closure\n\nshipped body\n';
+
+describe('migration 141 — seed editorial-arc-regression 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-141-'));
+ 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/checkRegistry.js b/server/lib/editorial/checkRegistry.js
index 026007f48d..162200dd84 100644
--- a/server/lib/editorial/checkRegistry.js
+++ b/server/lib/editorial/checkRegistry.js
@@ -328,6 +328,18 @@ export const WHITE_ROOM_STAGE = 'pipeline-editorial-white-room';
// per-character arcs to surface genuine change moments + flat-arc warnings.
export const ARC_TRANSITIONS_STAGE = 'pipeline-editorial-arc-transitions';
+// Stage name for the character-arc regression / premature-closure LLM check
+// (#1619). Ships in data.reference/prompts/stages/ + stage-config.json (fresh
+// installs via setup-data.js) and migrates to existing installs via migration 141
+// (boot runs migrations but NOT setup-data, so the migration is required). Reads
+// the stitched manuscript plus the reverse-outline scene map and the AUTHORED
+// per-character arcs, tracks each character's progress across the issues, and
+// flags regression (growth then an unmotivated revert), a circular arc (ends
+// where it began), or premature closure (an arc resolved early then flat for the
+// rest of the series). Complements arc.transitions (which detects the change
+// MOMENTS) by judging the SHAPE of each character's progress across the whole arc.
+export const ARC_REGRESSION_STAGE = 'pipeline-editorial-arc-regression';
+
// Stage name for the telling-not-showing-emotion LLM check (#1306). Ships in
// data.reference/prompts/stages/ + stage-config.json (fresh installs via
// setup-data.js) and migrates to existing installs via migration 110 (boot runs
@@ -3999,6 +4011,90 @@ export const EDITORIAL_CHECKS = [
});
},
},
+ {
+ id: 'arc.regression',
+ sources: ['manuscript', 'reverseOutline', 'series.characterArcs'],
+ label: 'Character-arc regression / premature closure',
+ description:
+ 'LLM scan of the SHAPE of each character\'s progress across the whole series — not the change moments themselves (that is arc.transitions) but whether the arc holds together end to end. Flags an unmotivated REGRESSION (a character grows, then reverts to their old self with no purpose or earned reason — distinct from a deliberate, dramatized relapse), a CIRCULAR arc (the character ends in the same state they began, the growth cancelled out with nothing gained), and PREMATURE CLOSURE (the arc fully resolves early — e.g. issue 3 of 10 — and the character is flat for the rest of the series, deflating the back half). Reads the stitched manuscript plus the reverse-outline scene map and the AUTHORED per-character arcs (series.characterArcs) to reconcile the planned end-state against what the prose delivers; degrades to a whole-manuscript scan when no outline or authored arcs exist. Whole-arc verdicts are gated to the final manuscript part so a mid-arc character whose later growth is still ahead is not false-flagged.',
+ scope: 'series',
+ kind: 'llm',
+ category: 'arc',
+ severityDefault: 'medium',
+ defaultEnabled: true,
+ // Reads the stitched manuscript corpus — so the runner only pays the
+ // section-collection I/O when a manuscript-consuming check is enabled.
+ 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,
+ run: (ctx) => {
+ // Both blocks are fixed per-call overhead (re-sent on each chunk) and pure
+ // context: the authored arcs name each character's planned start → end state
+ // so the model can tell a regression/circular arc from the intended ending,
+ // and the scene map lets it attribute a finding to a scene + issue. The check
+ // degrades gracefully — no authored arcs ⇒ {{#characterArcs}} renders nothing
+ // and the model judges the arc shape from the prose alone; no outline ⇒
+ // {{#sceneMap}} renders nothing.
+ const characterArcs = renderCharacterArcsForPrompt(ctx.series?.characterArcs) || '';
+ const sceneMap = sceneGroundingSummary(ctx.reverseOutline);
+ return runManuscriptLlmCheck(ctx, {
+ stage: ARC_REGRESSION_STAGE,
+ category: 'arc',
+ // sceneMap grows unbounded with scene count; characterArcs is bounded by the
+ // roster — so largest-first trimming absorbs the cut into sceneMap.
+ context: { characterArcs, sceneMap },
+ // `isFinal` gates the whole-arc verdicts — regression, a circular arc, and
+ // premature closure can only be judged once the WHOLE arc is in view. An
+ // earlier chunk can't know a reverted character grows back, an apparent
+ // circle re-opens, or a "resolved" arc keeps developing — so it would
+ // false-flag. A single-chunk run is its own final part and judges the whole
+ // text.
+ buildVars: (manuscript, meta, c) => ({
+ manuscript,
+ characterArcs: c.characterArcs,
+ sceneMap: c.sceneMap,
+ finalPart: meta?.isFinal ? 'true' : '',
+ }),
+ // Each character's progress accrues across the whole manuscript — the
+ // findings digest keeps prior findings in view so a non-final chunk doesn't
+ // pre-flag, and the clean-setup digest rolls forward each character's
+ // start-state, peak growth, and latest state so the final chunk can detect a
+ // revert, a closed circle, or an arc that resolved early and went flat.
+ crossChunkDigest: true,
+ crossChunkSetup: true,
+ // #1667: this check's verdict is gated to the final part AND anchored on the
+ // carried per-character progress digest — without it the final call would
+ // judge only the last chunk plus a summary and could not tell whether a
+ // character's growth peaked then reverted earlier. So the digest must reach
+ // the final chunk even when it's packed to the window — reserve room by
+ // trimming the final chunk's manuscript tail rather than silently dropping it
+ // (mirrors arc.climax-agency / pacing.escalation-curve).
+ reserveSetupDigest: true,
+ setupFocus: 'For each named character who carries an arc, track their progress so far as a '
+ + 'short trajectory: their START state, the PEAK of their growth (the most-changed point '
+ + 'reached and which issue it landed in), and their LATEST state. Note when a character '
+ + 'who had grown reverts toward their old self (a possible regression — record whether the '
+ + 'revert is dramatized/earned or unmotivated), and when a character\'s arc appears fully '
+ + 'RESOLVED (their want/need settled) and which issue it resolved in, so a later part can '
+ + 'tell a genuinely premature closure (resolved early then flat) or a circular arc (ended '
+ + 'where it began) from an arc whose further development simply has not arrived yet.',
+ });
+ },
+ },
{
id: 'plot.structure-momentum',
sources: ['manuscript', 'reverseOutline', 'reverseOutline.plotlines', 'series.arc.readerMap'],
diff --git a/server/lib/editorial/checkRegistry.test.js b/server/lib/editorial/checkRegistry.test.js
index b56a2b3177..673ec50248 100644
--- a/server/lib/editorial/checkRegistry.test.js
+++ b/server/lib/editorial/checkRegistry.test.js
@@ -2996,6 +2996,98 @@ describe('arc.transitions — LLM check (#1293)', () => {
});
});
+describe('arc.regression — LLM check (#1619)', () => {
+ const REG = 'arc.regression';
+ const baseCtx = (overrides = {}) => ({
+ manuscript: '# Issue 1\n\nMara vowed to change, and for a while she did.',
+ series: { characterArcs: [] },
+ reverseOutline: [],
+ config: { maxFindings: 12 },
+ severityDefault: 'medium',
+ planManuscriptChunks: async () => [overrides.manuscript ?? '# Issue 1\n\nMara vowed to change.'],
+ callStagedLLM: async () => ({ content: { findings: [] } }),
+ ...overrides,
+ });
+
+ it('is registered as a series-scoped arc LLM check reading manuscript + outline + characterArcs', () => {
+ const check = getCheck(REG);
+ expect(check.kind).toBe('llm');
+ expect(check.scope).toBe('series');
+ expect(check.category).toBe('arc');
+ expect(check.sources).toEqual(['manuscript', 'reverseOutline', 'series.characterArcs']);
+ expect(check.needsManuscript).toBe(true);
+ });
+
+ it('only runs when there is drafted prose to scan', () => {
+ const check = getCheck(REG);
+ expect(check.gate({ manuscript: ' ' })).toBe(false);
+ expect(check.gate({ manuscript: '# Issue 1\n\nprose' })).toBeTruthy();
+ });
+
+ it('emits arc-category findings and ships the manuscript + both context blocks', async () => {
+ const ctx = baseCtx({
+ callStagedLLM: async (_stage, vars) => {
+ expect(vars).toHaveProperty('manuscript');
+ expect(vars).toHaveProperty('sceneMap');
+ expect(vars).toHaveProperty('characterArcs');
+ return { content: { findings: [{ severity: 'high', issueNumber: 3, location: 'Mara — premature closure', problem: 'Her arc resolves in issue 3 then goes flat' }] } };
+ },
+ });
+ const findings = await getCheck(REG).run(ctx);
+ expect(findings).toHaveLength(1);
+ expect(findings[0].category).toBe('arc');
+ expect(findings[0].location).toBe('Mara — premature closure');
+ });
+
+ it('renders the authored character arcs into the prompt vars', async () => {
+ let capturedArcs = null;
+ const ctx = baseCtx({
+ series: {
+ characterArcs: [
+ { characterName: 'Mara', want: 'revenge', transitions: [{ kind: 'sacrifice', label: 'spares the killer', atIssue: 6 }] },
+ ],
+ },
+ callStagedLLM: async (_stage, vars) => { capturedArcs = vars.characterArcs; return { content: { findings: [] } }; },
+ });
+ await getCheck(REG).run(ctx);
+ expect(capturedArcs).toContain('- Mara');
+ expect(capturedArcs).toContain('wants: revenge');
+ });
+
+ it('degrades gracefully when no authored arcs or outline exist', async () => {
+ const ctx = baseCtx({
+ series: {},
+ reverseOutline: undefined,
+ callStagedLLM: async (_stage, vars) => {
+ expect(vars.characterArcs).toBe('');
+ expect(vars.sceneMap).toBe('');
+ return { content: { findings: [] } };
+ },
+ });
+ const findings = await getCheck(REG).run(ctx);
+ expect(findings).toEqual([]);
+ });
+
+ it('marks a single-chunk run as the final part so whole-arc verdicts are enabled', async () => {
+ let seenVars = null;
+ const ctx = baseCtx({
+ callStagedLLM: async (_stage, vars) => { seenVars = vars; return { content: { findings: [] } }; },
+ });
+ await getCheck(REG).run(ctx);
+ expect(seenVars.finalPart).toBe('true');
+ });
+
+ it('flags only the LAST part as final across a chunked manuscript', async () => {
+ const finals = [];
+ const ctx = baseCtx({
+ planManuscriptChunks: async () => ['# Issue 1\n\np1', '# Issue 2\n\np2', '# Issue 3\n\np3'],
+ callStagedLLM: async (_stage, vars) => { finals.push(vars.finalPart); return { content: { findings: [] } }; },
+ });
+ await getCheck(REG).run(ctx);
+ expect(finals).toEqual(['', '', 'true']);
+ });
+});
+
describe('relationships.reciprocity — deterministic check', () => {
const run = (characters) =>
getCheck('relationships.reciprocity').run({ canon: { characters }, config: {}, severityDefault: 'low' });