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

address review (codex): append recurrence verdict to problem/suggestion so visible text matches the label (#1412)

Adam Eivy6e32fddb40e0
diff --git a/data.reference/prompts/stages/pipeline-editorial-unmodeled-names.md b/data.reference/prompts/stages/pipeline-editorial-unmodeled-names.md
index 373c71e8d2..75712a3e4b 100644
--- a/data.reference/prompts/stages/pipeline-editorial-unmodeled-names.md
+++ b/data.reference/prompts/stages/pipeline-editorial-unmodeled-names.md
@@ -87,8 +87,8 @@ commentary:
"severity": "high|medium|low",
"issueNumber": 3,
"location": "string — always 'Unmodeled character — \"Name\"' (e.g. 'Unmodeled character — \"Marguerite\"'); the deterministic post-pass relabels throwaway vs recurring",
- "problem": "1–3 sentences naming the proper noun, why you classified it as a character (not a place/org/brand/honorific), and whether it recurs or appears only once",
- "suggestion": "1–3 sentences proposing how to resolve it (add to canon if it should matter, or recast as an unnamed description if it's a throwaway)",
+ "problem": "1–2 sentences naming the proper noun and why you classified it as a character (not a place/org/brand/honorific). Do NOT state how often it appears — a deterministic pass counts that across the whole manuscript and appends the recurrence sentence.",
+ "suggestion": "1 sentence: it is unmodeled, so the author should either add it to the story bible or leave it unnamed. Do NOT decide which based on frequency — the post-pass appends a frequency-specific recommendation.",
"anchorQuote": "short verbatim quote at the name's first use (≤ 200 chars)"
}
]
diff --git a/server/lib/editorial/checkRegistry.js b/server/lib/editorial/checkRegistry.js
index 4ae5be8c02..c3fd7f0a91 100644
--- a/server/lib/editorial/checkRegistry.js
+++ b/server/lib/editorial/checkRegistry.js
@@ -1861,16 +1861,21 @@ export const EDITORIAL_CHECKS = [
crossChunkDigest: true,
buildVars: (manuscript) => ({ manuscript, knownCharacters }),
});
- // Deterministic whole-corpus recurrence pass. Each finding's `location` carries
- // the surfaced name in quotes (`Unmodeled character — "Marguerite"`); count its
- // distinct-issue appearances across ALL sections (not just the chunk the LLM
- // saw) so the throwaway/recurring label is correct regardless of chunking, and
- // collapse findings that surfaced the same name in different chunks. A name the
- // matcher can't find in the prose (a stray/garbled LLM token) is left as the
- // model classified it rather than fabricating a "0 appearances" throwaway.
+ // Deterministic whole-corpus recurrence pass. The model is told NOT to judge
+ // frequency (it can't, per-chunk); it just surfaces the name in `location`
+ // ("Unmodeled character — \"Marguerite\"") and explains the person-vs-non-person
+ // call in `problem`. Here we count the name's distinct-issue appearances across
+ // ALL sections (not just the chunk the LLM saw) so the throwaway/recurring
+ // verdict is correct regardless of chunking, rewrite the location label + final
+ // severity, AND append the frequency sentence to problem/suggestion so the
+ // user-visible text can't disagree with the label. Findings surfacing the same
+ // name from different chunks collapse to one. A name the matcher can't find in
+ // the prose (a stray/garbled LLM token) is left as the model classified it
+ // rather than fabricating a "0 appearances" throwaway.
const sections = Array.isArray(ctx.sections) ? ctx.sections : [];
const seenNames = new Set();
const out = [];
+ const append = (text, extra) => (text ? `${text} ${extra}` : extra);
for (const f of findings) {
const name = (String(f.location || '').match(/"([^"]+)"/) || [])[1];
if (!name) { out.push(f); continue; }
@@ -1884,8 +1889,20 @@ export const EDITORIAL_CHECKS = [
const count = issues.size;
if (count === 0) { out.push(f); continue; }
out.push(count === 1
- ? { ...f, severity: 'low', location: `Throwaway name — "${name}" (1 appearance)` }
- : { ...f, severity: 'medium', location: `Unmodeled character — "${name}" (${count} issues)` });
+ ? {
+ ...f,
+ severity: 'low',
+ location: `Throwaway name — "${name}" (1 appearance)`,
+ problem: append(f.problem, `It appears in only one issue — a named body the reader is told to remember but who never recurs and was never bibled.`),
+ suggestion: append(f.suggestion, `Add "${name}" to canon only if they are meant to recur; otherwise recast them as an unnamed description so the reader isn't asked to track a name that goes nowhere.`),
+ }
+ : {
+ ...f,
+ severity: 'medium',
+ location: `Unmodeled character — "${name}" (${count} issues)`,
+ problem: append(f.problem, `They recur across ${count} issues but are not in the story bible.`),
+ suggestion: append(f.suggestion, `A recurring character should be modeled — add "${name}" to canon.`),
+ });
}
return out;
},
diff --git a/server/lib/editorial/checkRegistry.test.js b/server/lib/editorial/checkRegistry.test.js
index d108263166..9862fa7773 100644
--- a/server/lib/editorial/checkRegistry.test.js
+++ b/server/lib/editorial/checkRegistry.test.js
@@ -990,6 +990,9 @@ describe('roster.unmodeled-names — LLM check (#1412)', () => {
expect(findings).toHaveLength(1);
expect(findings[0].location).toBe('Throwaway name — "Old Henrik" (1 appearance)');
expect(findings[0].severity).toBe('low');
+ // The frequency sentence is appended so the visible text matches the label.
+ expect(findings[0].problem).toContain('only one issue');
+ expect(findings[0].suggestion).toContain('recast them as an unnamed description');
});
it('counts appearances across ALL sections (not just the seen chunk) and labels a recurring name medium', async () => {
@@ -1007,6 +1010,8 @@ describe('roster.unmodeled-names — LLM check (#1412)', () => {
expect(findings).toHaveLength(1);
expect(findings[0].location).toBe('Unmodeled character — "Marguerite" (2 issues)');
expect(findings[0].severity).toBe('medium');
+ expect(findings[0].problem).toContain('recur across 2 issues');
+ expect(findings[0].suggestion).toContain('add "Marguerite" to canon');
});
it('collapses the same surfaced name reported from two different chunks into one finding', async () => {