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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
feat: add objects.weight-proportionality editorial check (#1624)
[._.]/ Adam Eivy4ba49f67143f
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 590ffc6126..25d6760208 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -24,6 +24,7 @@## Editorial checks- **[issue-1622] The adverb, passive-voice, and repeated-gesture copy-edit checks are now series-tunable like their word-list siblings.** Clichés, said-bookisms, filter words, crutch words, hedge words, and gestures already accepted a house-style allowlist and an extra-words list, but `prose.adverbs` and `prose.passive-voice` didn't expose theirs (repeated-gestures already did). Now all three carry the same config: `prose.adverbs` gains an **extra-adverbs** list so a series can flag the real adverbs the `-ly` heuristic misses ("fast", "well", "hard"); `prose.passive-voice` gains a **house-style allowlist** (participles to never flag — archaic/adjectival "-ed" forms like "blessed", "beloved") and an **extra-participles** list (series-specific irregular participles the heuristic misses, e.g. "begun", "hewn"). A historical-fiction series can now whitelist archaic forms and a comedic series can mute gesture repetition without code changes. Additive config with empty-string defaults — existing series are unaffected. (`server/lib/editorial/proseTics.js`, `server/lib/editorial/checkRegistry.js`)+- **[issue-1624] A new editorial check flags objects whose narrative weight is out of proportion to their prominence.** The existing `objects.*` checks are presence tests — is a significant object attached to someone, is an interaction motivated, does an attachment's origin contradict its character — but none asked whether an object's *weight* matches how much the plot actually leans on it. The new `objects.weight-proportionality` check (series-scope, LLM, default-on) weighs each object's prominence in the prose against the depth of backstory and significance the story invests in it, and flags two failures: **over-weighted** (a minor object handed a disproportionate backstory — "a one-line locket with a three-issue origin") and **under-established** (a prominent or decisive object resting on no lineage — "an heirloom that resolves the finale, never set up"). It reads the stitched manuscript plus the canon object↔character attachment summary, judging the *proportion* rather than the absolute amount, and carries each object's established weight across manuscript chunks so a backstory planted early is weighed against a payoff that lands late. Stays distinct from `objects.unmotivated-interaction` (a single unmotivated beat) and `objects.backstory-consistency` (a contradicted origin) — the gap here is the over- or under-writing of plot machinery. Ships the prompt + stage-config for fresh installs and a boot migration (143) so existing installs seed the stage. (`server/lib/editorial/checkRegistry.js`, `data.reference/prompts/stages/pipeline-editorial-object-weight-proportionality.md`, `scripts/migrations/143-editorial-object-weight-proportionality-stage.js`)- **[issue-1623] A new editorial check flags visually dense but emotionally empty scenes.** `sensory.balance` already flags all-visual scenes and sensory-*bare* scenes, but it missed the opposite failure: a scene rich in setting and physical detail that carries almost no POV reaction — "500 words of setting, zero interiority" reads just as flat as a bare one. The new `scene.interiority-balance` check (scene-scope, default-on) weighs each scene's *description-to-interiority ratio* and flags two cases — **description swamps reaction** (long passages of scenery/blocking with little interleaved thought, feeling, or appraisal) and **emotionally inert detail** (striking images that land with no reaction from the perceiving character). It reads the stitched manuscript plus the reverse-outline scene map and degrades to a whole-issue scan when no outline exists. It judges the *ratio*, not the absolute amount, so a richly described scene filtered through a reacting mind passes — and it stays distinct from `sensory.balance` (the five senses) and `interiority.protagonist` (whole-issue interiority absence). Ships the prompt + stage-config for fresh installs and a boot migration (142) so existing installs seed the stage. (`server/lib/editorial/checkRegistry.js`, `data.reference/prompts/stages/pipeline-editorial-interiority-balance.md`, `scripts/migrations/142-editorial-interiority-balance-stage.js`)- **[issue-1621] The copy-edit pass now flags hedge / weasel distance markers, and the filter-words check catches more perception phrases.** `prose.filter-words` only caught perception *verbs* (saw, noticed, felt…) and missed the other way prose quietly backs the reader out of a moment: metaphorical distance ("it was as if he knew", "somewhere deep inside", "almost felt"), dialogue/cognitive hedges ("I kind of think", "sort of felt", "more or less"), and cognitive weasel words ("surely", "no doubt", "obviously", "of course"). A new deterministic, default-on, series-tunable `prose.hedge-words` check (its own per-1000-word density threshold, house-style allowlist, and extra-words list, exactly like the sibling word-list checks) scores these as a separate hedge/weasel bucket. The filter-words list also gained the modal-perception and reflexive phrasings of the same tic — "could see/hear/feel", "found himself/herself". (`server/lib/editorial/proseTics.js`, `server/lib/editorial/checkRegistry.js`)- **[issue-1620] A new editorial check flags POV economy — too many viewpoints for the run length, and viewpoints introduced too late to earn their place.** `pov.justified` asks whether each *individual* viewpoint earns an arc, but nothing judged the viewpoint *roster* as a whole. The new `pov.economy` check (series-scope, deterministic, default-on) reads the reverse-outline POV-per-scene map and flags two structural problems: **too many POVs for the run length** (e.g. 8 viewpoints across 12 issues, each barely developed — gated by an absolute floor so a one- or two-POV book is never called a crowd) and a **late-introduced, underdeveloped POV** (first takes the viewpoint in the final stretch of the run and holds only a scene or two). The acceptable POV-to-issue ratio, the minimum run length to judge, and the late-introduction window are all per-series tunable. Purely structural over the outline — no LLM call, no manuscript corpus — and degrades to silence when the outline carries no issue numbers (without a run length neither signal can be judged). (`server/lib/editorial/checkRegistry.js`)diff --git a/data.reference/prompts/stage-config.json b/data.reference/prompts/stage-config.jsonindex ddd03015be..9f2e5f0107 100644--- a/data.reference/prompts/stage-config.json+++ b/data.reference/prompts/stage-config.json@@ -632,6 +632,13 @@"returnsJson": true,"variables": []},+ "pipeline-editorial-object-weight-proportionality": {+ "name": "Pipeline — Editorial Check: Object narrative-weight proportionality",+ "description": "Editorial check (#1624): flags objects whose narrative weight is out of proportion to their prominence — a minor object given a disproportionate backstory or significance (over-weighted plot machinery), or a prominent/decisive object with little established lineage to earn it (under-established payoff). Weighs each object's manuscript prominence against the depth of backstory/significance the prose and canon establish. Reads the stitched manuscript plus the canon object↔character attachment summary. Distinct from objects.unmotivated-interaction (a single unmotivated beat) and objects.backstory-consistency (a contradicted origin). Returns issue-anchored findings.",+ "model": "default",+ "returnsJson": true,+ "variables": []+ },"pipeline-editorial-style-conformance": {"name": "Pipeline — Editorial Check: Style-guide conformance","description": "Editorial check (#1303): flags prose that drifts from the series style guide — wrong narrative tense, point-of-view person drift, or content/profanity beyond the configured rating ceiling. Reads the stitched manuscript plus the declared style-guide expectations. Returns issue-anchored findings.",diff --git a/data.reference/prompts/stages/pipeline-editorial-object-weight-proportionality.md b/data.reference/prompts/stages/pipeline-editorial-object-weight-proportionality.mdnew file mode 100644index 0000000000..99f0138222--- /dev/null+++ b/data.reference/prompts/stages/pipeline-editorial-object-weight-proportionality.md@@ -0,0 +1,89 @@+# Pipeline — Editorial Check: Object narrative-weight proportionality++You are a developmental editor doing a single focused pass for ONE problem:+**object weight-proportionality** — an object whose narrative weight (the depth+of backstory, lineage, and payoff the story invests in it) is out of proportion+to its prominence (how much the plot actually leans on it). The failure runs in+both directions:++- **Over-weighted** — a minor object the prose barely uses is handed a+ disproportionate backstory or significance: a one-line locket given a+ three-issue origin, a throwaway prop with a reverent history nothing pays off.+ The machinery is heavier than the moment it serves, so the setup feels like+ wasted load-bearing weight.+- **Under-established** — a prominent or decisive object carries little or no+ established lineage to earn its weight: an heirloom that resolves the finale+ but was never set up, a "legendary" relic the story treats as climactic+ without ever planting why it matters. The payoff outruns its setup, so the+ beat lands unearned.++Judge the *proportion* between weight and prominence — not the absolute amount of+either. A richly backstoried object that genuinely drives the plot is healthy; so+is a minor object with a light touch of significance. The problem is the+mismatch: heavy setup spent on a trivial object, or a pivotal object resting on+no setup at all.++## Established objects (canon)++These are the objects the canon records, with the significance and+character attachments already on file. Treat this as the *recorded* weight an+object carries going in; weigh it together with what the prose itself plants and+pays off. An object with deep canon significance and attachments but almost no+presence in the manuscript is a candidate for over-weighting; a manuscript-pivotal+object with thin canon significance and no on-page lineage is a candidate for+under-establishment.++```+{{objects}}+```++## Manuscript++The manuscript is stitched from the drafted issues. Each section begins with a+header like `# Issue 3 — Title (prose)`; use the issue number in that header to+attribute each finding to its `issueNumber`.++```+{{manuscript}}+```++## Task++Find the objects whose narrative weight and prominence are out of proportion. For+each, quote a short verbatim anchor from the text (≤ 200 characters), name the+issue number it appears in, classify the imbalance in the `location` (e.g.+`Issue 2 — over-weighted backstory`, `Issue 7 — under-established payoff`),+explain why the weight and prominence don't match, and suggest a concrete fix —+trim or cut the disproportionate setup, or plant the missing lineage earlier so a+pivotal object earns its moment. Set severity by how much the mismatch distorts+the story: a climactic object resting on no setup is more serious than a minor+prop with a slightly heavy backstory.++Do NOT flag: an object whose weight matches its role (well set up and genuinely+pivotal, or minor with a light touch); a deliberate red herring or+slow-burn mystery the story is actively and intentionally building toward; or an+object whose lineage is established off-page in canon and only lightly echoed in+prose by design.++Be specific and cite the text. If every object's weight is proportionate to its+prominence, return an empty `findings` array — do not invent issues.++## 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 imbalance + where (e.g. 'Issue 2 — over-weighted backstory')",+ "problem": "1–3 sentences naming the object and why its weight and prominence are out of proportion",+ "suggestion": "1–3 sentences proposing how to rebalance (trim the setup, or plant the missing lineage)",+ "anchorQuote": "short verbatim quote from the manuscript (≤ 200 chars)"+ }+ ]+}+```diff --git a/scripts/migrations/143-editorial-object-weight-proportionality-stage.js b/scripts/migrations/143-editorial-object-weight-proportionality-stage.jsnew file mode 100644index 0000000000..05adfb3dca--- /dev/null+++ b/scripts/migrations/143-editorial-object-weight-proportionality-stage.js@@ -0,0 +1,92 @@+/**+ * Seed the object weight-proportionality editorial-check stage into existing+ * installs (#1624).+ *+ * Mirrors `142-editorial-interiority-balance-stage.js`: copies the `.md`+ * template from `data.reference/prompts/stages/` and merges its 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+ * stage unseeded and the `objects.weight-proportionality` 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 STAGES = [+ 'pipeline-editorial-object-weight-proportionality',+];++export default {+ async up({ rootDir }) {+ const stagesDir = join(rootDir, 'data', 'prompts', 'stages');+ await mkdir(stagesDir, { recursive: true });++ // 1) Copy each prompt template if it isn't already present.+ for (const stageKey of STAGES) {+ const filename = `${stageKey}.md`;+ 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(`📝 ${stageKey} prompt: already present`);+ continue;+ }+ const sampleExists = await access(samplePath, constants.F_OK).then(() => true, () => false);+ if (!sampleExists) {+ console.warn(`⚠️ ${stageKey}: sample missing for ${filename} — skipping copy`);+ continue;+ }+ try {+ await copyFile(samplePath, dataPath);+ console.log(`✅ seeded ${filename}`);+ } catch (err) {+ console.warn(`⚠️ ${stageKey}: copy failed for ${filename}: ${err.message}`);+ }+ }++ // 2) Merge each stage-config entry (skip any already present).+ 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('⚠️ 143-editorial-object-weight-proportionality-stage: data.reference stage-config.json missing — cannot resolve entries; 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 || {};++ let added = 0;+ for (const stageKey of STAGES) {+ if (installed.stages[stageKey]) {+ console.log(`📝 ${stageKey} stage-config: already present`);+ continue;+ }+ if (!sample?.stages?.[stageKey]) {+ console.warn(`⚠️ 143-editorial-object-weight-proportionality-stage: sample stage-config missing ${stageKey} — skipping`);+ continue;+ }+ installed.stages[stageKey] = sample.stages[stageKey];+ added += 1;+ }++ if (added === 0) {+ console.log('📝 143-editorial-object-weight-proportionality-stage: no stage-config entries to add');+ return;+ }+ await mkdir(dirname(installedConfigPath), { recursive: true });+ await writeFile(installedConfigPath, JSON.stringify(installed, null, 2) + '\n', 'utf8');+ const action = installedExists ? 'merged' : 'created';+ console.log(`📝 143-editorial-object-weight-proportionality-stage stage-config (${action}): ${added} added`);+ } catch (err) {+ console.warn(`⚠️ 143-editorial-object-weight-proportionality-stage: stage-config merge failed: ${err.message}`);+ }+ },+};diff --git a/scripts/migrations/143-editorial-object-weight-proportionality-stage.test.js b/scripts/migrations/143-editorial-object-weight-proportionality-stage.test.jsnew file mode 100644index 0000000000..44e35dacf1--- /dev/null+++ b/scripts/migrations/143-editorial-object-weight-proportionality-stage.test.js@@ -0,0 +1,101 @@+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 './143-editorial-object-weight-proportionality-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 142's seed test) — no MD5 bookkeeping,+// so the seed/no-clobber behavior is asserted directly.++const FILES = [+ { filename: 'pipeline-editorial-object-weight-proportionality.md', stageKey: 'pipeline-editorial-object-weight-proportionality', body: '# Object weight proportionality\n\nshipped body\n', returnsJson: true },+];++describe('migration 143 — seed object weight-proportionality editorial stage', () => {+ let rootDir;+ let stagesDir;+ let refStagesDir;+ let installedConfigPath;++ const seedReference = ({ withConfig = true } = {}) => {+ for (const { filename, body } of FILES) {+ writeFileSync(join(refStagesDir, filename), body);+ }+ if (withConfig) {+ const refConfigPath = join(rootDir, 'data.reference', 'prompts', 'stage-config.json');+ const stages = {};+ for (const { stageKey, returnsJson } of FILES) {+ stages[stageKey] = { name: stageKey, description: `${stageKey} desc`, model: 'default', returnsJson, variables: [] };+ }+ writeFileSync(refConfigPath, JSON.stringify({ stages }, null, 2) + '\n');+ }+ };++ beforeEach(() => {+ rootDir = mkdtempSync(join(tmpdir(), 'migration-143-'));+ 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();++ for (const { filename, body } of FILES) {+ expect(readFileSync(join(stagesDir, filename), 'utf8')).toBe(body);+ }+ const installed = JSON.parse(readFileSync(installedConfigPath, 'utf8'));+ expect(installed.stages['pipeline-editorial-object-weight-proportionality']).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';+ for (const { filename } of FILES) {+ writeFileSync(join(stagesDir, filename), customBody);+ }+ writeFileSync(+ installedConfigPath,+ JSON.stringify({ stages: { [FILES[0].stageKey]: { name: 'user-tuned', model: 'custom' } } }, null, 2) + '\n',+ );++ await migration.up({ rootDir });++ for (const { filename } of FILES) {+ expect(readFileSync(join(stagesDir, filename), 'utf8')).toBe(customBody);+ }+ const installed = JSON.parse(readFileSync(installedConfigPath, 'utf8'));+ expect(installed.stages[FILES[0].stageKey]).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();+ for (const { filename } of FILES) {+ expect(existsSync(join(stagesDir, filename))).toBe(false);+ }+ });++ it('matches the live shipped stage-config keys + prompt files (drift catch)', () => {+ const refConfig = JSON.parse(+ readFileSync(join(repoRoot, 'data.reference', 'prompts', 'stage-config.json'), 'utf8'),+ );+ for (const { stageKey, filename, returnsJson } of FILES) {+ expect(refConfig.stages[stageKey], `stage-config missing ${stageKey}`).toBeTruthy();+ expect(refConfig.stages[stageKey].returnsJson).toBe(returnsJson);+ expect(existsSync(join(repoRoot, 'data.reference', 'prompts', 'stages', filename))).toBe(true);+ }+ });+});diff --git a/server/lib/editorial/checkRegistry.js b/server/lib/editorial/checkRegistry.jsindex c4e628c01b..0998d59b7f 100644--- a/server/lib/editorial/checkRegistry.js+++ b/server/lib/editorial/checkRegistry.js@@ -219,6 +219,19 @@ export const INFO_DUMPING_STAGE = 'pipeline-editorial-info-dumping';export const OBJECT_MOTIVATION_STAGE = 'pipeline-editorial-object-motivation';export const OBJECT_BACKSTORY_STAGE = 'pipeline-editorial-object-backstory';+// Stage name for the object weight-proportionality LLM check (#1624): judges+// whether an object's narrative weight (established backstory + payoff depth)+// matches its prominence in the prose — flagging a minor object given a heavy+// backstory ("a one-line locket with a 3-issue origin") or a climactic object+// with no lineage to earn it ("a heirloom that decides the finale, never set+// up"). Ships in data.reference/prompts/stages/ + stage-config.json (fresh+// installs via setup-data.js) and migrates to existing installs via migration+// 143 (boot runs migrations but NOT setup-data, so the migration is required).+// Like the two object-attachment checks above it feeds the canon's per-object+// significance/attachment summary as context and reads the stitched manuscript+// to weigh prose prominence against that established weight.+export const OBJECT_WEIGHT_STAGE = 'pipeline-editorial-object-weight-proportionality';+// Stage name for the style-guide conformance LLM check (#1303). Ships in// data.reference/prompts/stages/ + stage-config.json (fresh installs via// setup-data.js) and migrates to existing installs via migration 096 (boot runs@@ -5074,6 +5087,60 @@ export const EDITORIAL_CHECKS = [});},},+ {+ id: 'objects.weight-proportionality',+ sources: ['manuscript', 'canon'],+ label: 'Object narrative-weight proportionality',+ description:+ 'LLM check — flags objects whose narrative weight is disproportionate to their prominence: a minor item the prose barely uses yet given a heavy backstory or significance ("a one-line locket with a three-issue origin"), or a climactic / decisive object with little or no established lineage to earn its weight ("an heirloom that resolves the finale, never set up"). Weighs each object\'s prominence in the manuscript against the depth of backstory and payoff established for it — the canon\'s recorded significance/attachments plus what the prose itself plants and pays off. Distinct from objects.unattached-significant (presence of an attachment), objects.unmotivated-interaction (a single unmotivated beat), and objects.backstory-consistency (an origin that contradicts a character\'s background) — the gap here is the over- or under-writing of plot machinery.',+ scope: 'series',+ kind: 'llm',+ category: 'plot',+ severityDefault: 'low',+ // 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 large object roster 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 large object roster can not flood the review.',+ },+ ],+ gate: (ctx) => (ctx.manuscript || '').trim().length > 0,+ run: (ctx) => {+ // The per-object canon summary (established significance + attachments) is+ // fixed per-call overhead re-sent on each chunk — trimmed by the runner to+ // keep the manuscript a budget floor.+ const objects = describeObjectAttachments(ctx);+ return runManuscriptLlmCheck(ctx, {+ stage: OBJECT_WEIGHT_STAGE,+ category: 'plot',+ context: { objects },+ buildVars: (manuscript, _meta, c) => ({ manuscript, objects: c.objects }),+ // An object's backstory can be planted in an early chapter and its+ // prominence (or payoff) land much later; the findings digest stops a+ // later chunk re-flagging the same imbalance the prose only half-shows.+ crossChunkDigest: true,+ // …and a cleanly proportioned object produces no finding, so the findings+ // digest alone can't carry it forward — roll a setup summary of each+ // object and the backstory/significance the prose has established so a+ // late payoff is weighed against the full lineage, not just its chunk.+ crossChunkSetup: true,+ setupFocus: 'Objects/items the story features, how prominent or decisive each one is, and the depth '+ + 'of backstory, lineage, or significance the prose or canon has established for it (so a later '+ + 'payoff is weighed against the full established weight, not just the current part).',+ });+ },+ },{id: 'prose.info-dumping',sources: ['manuscript'],diff --git a/server/lib/editorial/checkRegistry.test.js b/server/lib/editorial/checkRegistry.test.jsindex 3e278e5c1f..5b53d6489c 100644--- a/server/lib/editorial/checkRegistry.test.js+++ b/server/lib/editorial/checkRegistry.test.js@@ -3501,6 +3501,69 @@ describe('objects.unmotivated-interaction — LLM check (#1288)', () => {});});+describe('objects.weight-proportionality — LLM check (#1624)', () => {+ const baseCtx = (overrides = {}) => {+ const manuscript = overrides.manuscript ?? 'The locket — three generations of her line had guarded it — caught the light, then she pocketed it and forgot it.';+ return {+ manuscript,+ canon: {+ objects: [{ id: 'o1', name: 'Locket', significance: 'an ancestral heirloom', attachments: [{ characterId: 'c1', emotion: 'reverence' }] }],+ characters: [{ id: 'c1', name: 'Mara' }],+ },+ config: { maxFindings: 12 },+ severityDefault: 'low',+ // Default chunker: a single whole-corpus chunk.+ planManuscriptChunks: async () => [manuscript],+ callStagedLLM: async () => ({ content: { findings: [] } }),+ ...overrides,+ };+ };++ it('passes the manuscript AND an objects-attachment summary to the model', async () => {+ let vars = null;+ await getCheck('objects.weight-proportionality').run(baseCtx({+ callStagedLLM: async (_stage, v) => { vars = v; return { content: { findings: [] } }; },+ }));+ expect(vars.manuscript).toContain('locket');+ expect(vars.objects).toContain('Locket');+ expect(vars.objects).toContain('Mara'); // resolved character name, not the id+ });++ it('budgets the objects summary as prompt overhead and re-sends it on every chunk', async () => {+ let sawObjectsContext = false;+ const objectsSeen = [];+ await getCheck('objects.weight-proportionality').run(baseCtx({+ planManuscriptChunks: async (_stage, opts) => { sawObjectsContext = Object.prototype.hasOwnProperty.call(opts.context || {}, 'objects'); return ['chunk a', 'chunk b']; },+ callStagedLLM: async (_stage, v) => { objectsSeen.push(v.objects); return { content: { findings: [] } }; },+ }));+ expect(sawObjectsContext).toBe(true);+ expect(objectsSeen).toHaveLength(2);+ expect(objectsSeen.every((o) => o.includes('Locket'))).toBe(true);+ });++ it('shapes findings into the plot category and respects maxFindings', async () => {+ const many = Array.from({ length: 30 }, (_, i) => ({ severity: 'low', problem: `p${i}`, anchorQuote: `a${i}` }));+ const findings = await getCheck('objects.weight-proportionality').run(baseCtx({+ config: { maxFindings: 4 },+ callStagedLLM: async () => ({ content: { findings: many } }),+ }));+ expect(findings).toHaveLength(4);+ expect(findings.every((f) => f.category === 'plot')).toBe(true);+ });++ it('keeps a model-supplied issue number (manuscript-scoped findings)', async () => {+ const findings = await getCheck('objects.weight-proportionality').run(baseCtx({+ callStagedLLM: async () => ({ content: { findings: [{ severity: 'medium', issueNumber: 7, problem: 'climactic relic, no setup', anchorQuote: 'the relic' }] } }),+ }));+ expect(findings).toHaveLength(1);+ expect(findings[0].issueNumber).toBe(7);+ });++ it('gates off when the manuscript is empty', () => {+ expect(getCheck('objects.weight-proportionality').gate(baseCtx({ manuscript: ' ' }))).toBe(false);+ });+});+describe('cross-chunk continuity digest (#1383)', () => {describe('editorialPriorFindingsDigest formatter', () => {it('returns empty string for no / non-array findings', () => {