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

fix(#1585): use canon names roster for modeled-vs-incidental + traits for baseline

[._.]/ Adam Eivy6bd097ac69b9
diff --git a/data.reference/prompts/stages/pipeline-editorial-secondary-arc.md b/data.reference/prompts/stages/pipeline-editorial-secondary-arc.md
index 7417b2b4a6..a111233e05 100644
--- a/data.reference/prompts/stages/pipeline-editorial-secondary-arc.md
+++ b/data.reference/prompts/stages/pipeline-editorial-secondary-arc.md
@@ -49,15 +49,25 @@ NOT on this list is either a POV character or too minor to hold to an arc.
{{#canonRoster}}
## Canon character roster
-The established character bible — use it to tell a modeled, recurring character
-(who genuinely carries weight) from an incidental name, and to ground each
-character's established traits so you can judge change against a real baseline.
+The named characters already in the story bible — use this to tell a modeled,
+recurring character (who genuinely carries weight) from an incidental name.
```
{{canonRoster}}
```
{{/canonRoster}}
+{{#canonTraits}}
+## Canon character traits
+
+The established traits for the modeled characters — use this to ground each
+character's starting point so you can judge change against a real baseline.
+
+```
+{{canonTraits}}
+```
+{{/canonTraits}}
+
## Manuscript
The manuscript is stitched from the drafted issues. Section headers attribute
diff --git a/server/lib/editorial/checkRegistry.js b/server/lib/editorial/checkRegistry.js
index 606155f7ad..438260520f 100644
--- a/server/lib/editorial/checkRegistry.js
+++ b/server/lib/editorial/checkRegistry.js
@@ -3347,25 +3347,30 @@ export const EDITORIAL_CHECKS = [
],
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 secondary-cast roster names which recurring non-POV
+ // All three blocks are fixed per-call overhead (re-sent on each chunk) and
+ // pure context: the secondary-cast roster names which recurring non-POV
// characters to hold to an arc (so the model focuses on the side characters
- // that carry weight, not every walk-on), and the canon roster lets the model
- // tell a modeled recurring character from an incidental name. The check
+ // that carry weight, not every walk-on); the canon names roster lets the
+ // model tell a MODELED recurring character from an incidental name (it lists
+ // every named bible character, including trait-less ones — so it stays
+ // useful where the richer traits block is empty); and the canon traits give
+ // the established baseline a change must be measured against. The check
// degrades gracefully — no outline ⇒ {{#secondaryCast}} renders nothing and
// the model identifies the recurring side cast from the prose; no canon ⇒
- // {{#canonRoster}} renders nothing.
+ // {{#canonRoster}} / {{#canonTraits}} render nothing.
const minScenes = ctx.config?.minScenes ?? 2;
const secondaryCast = secondaryCharacterPresenceSummary(ctx.reverseOutline, { minScenes });
- const canonRoster = canonCharacterTraitsSummary(ctx.canon);
+ const canonRoster = canonRosterNamesSummary(ctx.canon);
+ const canonTraits = canonCharacterTraitsSummary(ctx.canon);
return runManuscriptLlmCheck(ctx, {
stage: SECONDARY_ARC_STAGE,
category: 'arc',
- context: { secondaryCast, canonRoster },
+ context: { secondaryCast, canonRoster, canonTraits },
buildVars: (manuscript, meta, c) => ({
manuscript,
secondaryCast: c.secondaryCast,
canonRoster: c.canonRoster,
+ canonTraits: c.canonTraits,
finalPart: meta?.isFinal ? 'true' : '',
}),
// A flat arc is only visible across the WHOLE story — a character
diff --git a/server/lib/editorial/checkRegistry.test.js b/server/lib/editorial/checkRegistry.test.js
index 90fa6fd02c..ba24e007cd 100644
--- a/server/lib/editorial/checkRegistry.test.js
+++ b/server/lib/editorial/checkRegistry.test.js
@@ -1464,12 +1464,13 @@ describe('character.secondary-arc — LLM check (#1585)', () => {
expect(check.gate({ manuscript: '# Issue 1\n\nprose' })).toBeTruthy();
});
- it('passes the manuscript, recurring secondary roster, and canon roster and forces the arc category', async () => {
+ it('passes the manuscript, recurring secondary roster, canon names roster, and canon traits and forces the arc category', async () => {
let seenVars = null;
const ctx = wholeCtx({
planManuscriptChunks: async (_stage, opts) => {
expect(opts.context).toHaveProperty('secondaryCast');
expect(opts.context).toHaveProperty('canonRoster');
+ expect(opts.context).toHaveProperty('canonTraits');
expect(opts.fixedOverheadTokens).toBeGreaterThan(0);
return ['# Issue 1\n\nReza poured the coffee, said nothing, and left — as always.'];
},
@@ -1480,12 +1481,30 @@ describe('character.secondary-arc — LLM check (#1585)', () => {
});
const findings = await getCheck(SECONDARY_ARC).run(ctx);
expect(seenVars.secondaryCast).toContain('Reza');
+ // Canon names roster surfaces every named bible character (so the modeled-vs-
+ // incidental distinction works even for a trait-less row), and the traits
+ // block carries the established baseline a change is measured against.
expect(seenVars.canonRoster).toContain('Reza');
+ expect(seenVars.canonTraits).toContain('stoic and quiet');
expect(findings).toHaveLength(1);
expect(findings[0].category).toBe('arc');
expect(findings[0].location).toBe('Issue 2 — Reza — flat arc');
});
+ it('still names a modeled character with no recorded traits in the canon roster (modeled-vs-incidental)', async () => {
+ let seenVars = null;
+ const ctx = wholeCtx({
+ // A modeled character with a name but no trait fields — the traits summary
+ // drops it, but the names roster must still list it so the model can tell
+ // it apart from an incidental walk-on.
+ canon: { characters: [{ name: 'Reza' }] },
+ callStagedLLM: async (_stage, vars) => { seenVars = vars; return { content: { findings: [] } }; },
+ });
+ await getCheck(SECONDARY_ARC).run(ctx);
+ expect(seenVars.canonRoster).toContain('Reza');
+ expect(seenVars.canonTraits).toBe('');
+ });
+
it('honors the minScenes config when building the secondary roster', async () => {
let seenVars = null;
const ctx = wholeCtx({
@@ -1507,6 +1526,7 @@ describe('character.secondary-arc — LLM check (#1585)', () => {
await getCheck(SECONDARY_ARC).run(ctx);
expect(seenVars.secondaryCast).toBe('');
expect(seenVars.canonRoster).toBe('');
+ expect(seenVars.canonTraits).toBe('');
});
it('marks a single-chunk run as the final part so the flat-arc verdict is enabled', async () => {