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): gate seed-scope language behind {{^hasSourceMaterials}} so backfill runs aren't misdirected

Adam Eivy7b7c043542ec
diff --git a/data.reference/prompts/stages/pipeline-idea-expansion.md b/data.reference/prompts/stages/pipeline-idea-expansion.md
index 1a79bd468f..87da2eb22e 100644
--- a/data.reference/prompts/stages/pipeline-idea-expansion.md
+++ b/data.reference/prompts/stages/pipeline-idea-expansion.md
@@ -130,11 +130,13 @@ This next issue's events are OUT OF SCOPE for your beat sheet — it is a bounda
{{seed}}
```
+{{^hasSourceMaterials}}
**This seed defines THIS issue's scope.** Dramatize only the events it assigns to this issue. Any neighboring issues shown above are hard boundaries — do NOT cross into them. It is better to land at the LOW end of the beat range than to absorb a neighbor's events to fill space; end on this issue's own cliffhanger.
{{#paddingRisk}}
**Scope warning — terse seed, long issue.** This issue's seed is short relative to its {{lengthTargets.pageTarget}}-page target, which tempts the beat sheet to pad by annexing the next issue's events. Do NOT do that. A focused beat sheet at the low end of the {{lengthTargets.beatsMin}}–{{lengthTargets.beatsMax}} range that stays in scope is correct; overrunning into the next issue is not. Expand by deepening the events the seed already implies — texture, complication, character beats — never by pulling forward what a later issue owns.
{{/paddingRisk}}
+{{/hasSourceMaterials}}
{{#hasSourceMaterials}}
## Existing source material to back-fill from
@@ -162,7 +164,7 @@ A markdown document with the following sections, in this exact order:
1. **`# Issue Title`** — one line, your refined title for this issue/episode (override the working title if the seed implies a better one).
2. **`## Logline`** — one sentence pitching the issue.
3. **`## Theme`** — one sentence on the emotional/thematic core. What is this issue *about* underneath the plot?
-4. **`## Beat sheet`** — **{{lengthTargets.beatsMin}}–{{lengthTargets.beatsMax}} beats** numbered as a markdown list. Each beat is one sentence describing a concrete dramatic event. Cover **hook (Saga-style opening — a single arresting image or moment, not exposition) → setup → rising action → midpoint reversal → second-half escalation → climax → cliffhanger / lead-in to the next issue.** This beat sheet feeds a {{lengthTargets.proseWordsMin}}–{{lengthTargets.proseWordsMax}} word prose draft, which feeds a {{lengthTargets.pageTarget}}-page comic script — too few beats and the downstream stages have nothing to pace against. Every beat must stay within THIS issue's scope (the seed above); do not dramatize events the neighboring issues own. The final beat MUST be a cliffhanger, reveal, or strong lead-in to the next issue, not a tidy resolution — and it must be THIS issue's cliffhanger, not the next issue's climax.
+4. **`## Beat sheet`** — **{{lengthTargets.beatsMin}}–{{lengthTargets.beatsMax}} beats** numbered as a markdown list. Each beat is one sentence describing a concrete dramatic event. Cover **hook (Saga-style opening — a single arresting image or moment, not exposition) → setup → rising action → midpoint reversal → second-half escalation → climax → cliffhanger / lead-in to the next issue.** This beat sheet feeds a {{lengthTargets.proseWordsMin}}–{{lengthTargets.proseWordsMax}} word prose draft, which feeds a {{lengthTargets.pageTarget}}-page comic script — too few beats and the downstream stages have nothing to pace against. Every beat must stay within THIS issue's scope (the seed — or, when back-filling, the source material — above); do not dramatize events the neighboring issues own. The final beat MUST be a cliffhanger, reveal, or strong lead-in to the next issue, not a tidy resolution — and it must be THIS issue's cliffhanger, not the next issue's climax.
5. **`## Setting`** — 2–3 sentences naming the locations this issue uses and how they look. Reference the world's visual style.
6. **`## New characters (if any)`** — for any character the seed introduces that isn't in the series bible, give a one-line `**Name** — physical + role description`. Skip the section if there are none.
7. **`## Open questions` (OPTIONAL — usually omit)** — ONLY include this section when something fundamentally cannot be decided without user input (e.g. the seed asks the writer to choose between two specific named entities, or references off-canvas information only the user knows). Do NOT use this section for choices you could make yourself by leaning on the series bible. If every beat is committed, omit the section entirely.
diff --git a/scripts/migrations/003-update-pipeline-stage-prompts.js b/scripts/migrations/003-update-pipeline-stage-prompts.js
index e280826eb6..3cfbd796e6 100644
--- a/scripts/migrations/003-update-pipeline-stage-prompts.js
+++ b/scripts/migrations/003-update-pipeline-stage-prompts.js
@@ -51,7 +51,7 @@ export const ACCEPTED_OLD_MD5 = {
};
export const NEW_SHIPPED_MD5 = {
- 'pipeline-idea-expansion.md': 'c5b2e719e232a281b3829a5348cb29c1', // post-124 (scope-discipline + {{#paddingRisk}})
+ 'pipeline-idea-expansion.md': '93e9552c6662811e597a97296f3776a4', // post-124 (scope-discipline + {{#paddingRisk}})
'pipeline-prose.md': '84523d531eeafa60959c65c553b2563f', // post-054-fence
'pipeline-comic-script.md': 'a4303016c34b65e4b0e641fe71252de3', // post-121 (visible text exactness)
'pipeline-tv-script.md': '376f779f4687b598f1c92ca4e770fd5a', // retired upstream (no data.reference)
diff --git a/scripts/migrations/004-augment-idea-expansion-context.js b/scripts/migrations/004-augment-idea-expansion-context.js
index 9a965bee70..94ddd1b9f3 100644
--- a/scripts/migrations/004-augment-idea-expansion-context.js
+++ b/scripts/migrations/004-augment-idea-expansion-context.js
@@ -22,7 +22,7 @@ export const ACCEPTED_OLD_MD5 = {
};
export const NEW_SHIPPED_MD5 = {
- 'pipeline-idea-expansion.md': 'c5b2e719e232a281b3829a5348cb29c1', // post-124 (scope-discipline + {{#paddingRisk}})
+ 'pipeline-idea-expansion.md': '93e9552c6662811e597a97296f3776a4', // post-124 (scope-discipline + {{#paddingRisk}})
};
const { applyMigration, up } = makePromptReplaceMigration({
diff --git a/scripts/migrations/025-idea-stage-character-detail.js b/scripts/migrations/025-idea-stage-character-detail.js
index adfcaa5212..8fded641a9 100644
--- a/scripts/migrations/025-idea-stage-character-detail.js
+++ b/scripts/migrations/025-idea-stage-character-detail.js
@@ -37,7 +37,7 @@ export const ACCEPTED_OLD_MD5 = {
// New shipped hash — what data.reference carries post-migration.
export const NEW_SHIPPED_MD5 = {
- 'pipeline-idea-expansion.md': 'c5b2e719e232a281b3829a5348cb29c1', // post-124 (scope-discipline + {{#paddingRisk}})
+ 'pipeline-idea-expansion.md': '93e9552c6662811e597a97296f3776a4', // post-124 (scope-discipline + {{#paddingRisk}})
};
const { applyMigration, up } = makePromptReplaceMigration({
diff --git a/scripts/migrations/054-source-agnostic-stage-prompts.js b/scripts/migrations/054-source-agnostic-stage-prompts.js
index dce43aea1e..921760d595 100644
--- a/scripts/migrations/054-source-agnostic-stage-prompts.js
+++ b/scripts/migrations/054-source-agnostic-stage-prompts.js
@@ -33,7 +33,7 @@ export const ACCEPTED_OLD_MD5 = {
// Post-change shipped hashes (the source-agnostic + tilde-fence templates this
// migration installs). Mirror these into setup-data.js's drift table.
export const NEW_SHIPPED_MD5 = {
- 'pipeline-idea-expansion.md': 'c5b2e719e232a281b3829a5348cb29c1', // post-124 (scope-discipline + {{#paddingRisk}})
+ 'pipeline-idea-expansion.md': '93e9552c6662811e597a97296f3776a4', // post-124 (scope-discipline + {{#paddingRisk}})
'pipeline-prose.md': '84523d531eeafa60959c65c553b2563f',
'pipeline-comic-script.md': 'a4303016c34b65e4b0e641fe71252de3',
'pipeline-teleplay.md': 'afa4215330bf856429d70d7e2f856605',
diff --git a/scripts/migrations/098-idea-stage-ticking-clock.js b/scripts/migrations/098-idea-stage-ticking-clock.js
index 15ff2d57bb..75a192d85d 100644
--- a/scripts/migrations/098-idea-stage-ticking-clock.js
+++ b/scripts/migrations/098-idea-stage-ticking-clock.js
@@ -41,7 +41,7 @@ export const ACCEPTED_OLD_MD5 = {
// migration edits this file, so the drift-catch test (NEW == live sample) stays
// green. Latest: post-124 (scope-discipline + {{#paddingRisk}}).
export const NEW_SHIPPED_MD5 = {
- 'pipeline-idea-expansion.md': 'c5b2e719e232a281b3829a5348cb29c1',
+ 'pipeline-idea-expansion.md': '93e9552c6662811e597a97296f3776a4',
};
const { applyMigration, up } = makePromptReplaceMigration({
diff --git a/scripts/migrations/124-idea-stage-scope-discipline.js b/scripts/migrations/124-idea-stage-scope-discipline.js
index 55be2f1b4f..98ed868df4 100644
--- a/scripts/migrations/124-idea-stage-scope-discipline.js
+++ b/scripts/migrations/124-idea-stage-scope-discipline.js
@@ -37,7 +37,7 @@ export const ACCEPTED_OLD_MD5 = {
// Mirror this into every earlier migration that tracks the same file
// (003/004/025/054/098) so their drift-catch tests stay green.
export const NEW_SHIPPED_MD5 = {
- 'pipeline-idea-expansion.md': 'c5b2e719e232a281b3829a5348cb29c1',
+ 'pipeline-idea-expansion.md': '93e9552c6662811e597a97296f3776a4',
};
const { applyMigration, up } = makePromptReplaceMigration({
diff --git a/scripts/setup-data-drift.test.js b/scripts/setup-data-drift.test.js
index e81c655c67..460fdb6969 100644
--- a/scripts/setup-data-drift.test.js
+++ b/scripts/setup-data-drift.test.js
@@ -45,7 +45,7 @@ const EXPECTED_STAGE_OLD = {
'pipeline-tv-script.md': ['3f6fecc25573ed054b47db392250034a'],
};
const EXPECTED_STAGE_NEW = {
- 'pipeline-idea-expansion.md': 'c5b2e719e232a281b3829a5348cb29c1',
+ 'pipeline-idea-expansion.md': '93e9552c6662811e597a97296f3776a4',
'pipeline-prose.md': '84523d531eeafa60959c65c553b2563f',
'pipeline-comic-script.md': 'a4303016c34b65e4b0e641fe71252de3',
'pipeline-teleplay.md': 'afa4215330bf856429d70d7e2f856605',
diff --git a/server/services/pipeline/textStages.test.js b/server/services/pipeline/textStages.test.js
index 1b28bd61a0..389b5e1d17 100644
--- a/server/services/pipeline/textStages.test.js
+++ b/server/services/pipeline/textStages.test.js
@@ -604,10 +604,25 @@ describe('pipeline-idea-expansion template render', () => {
const out = applyTemplate(ideaTemplate, renderCtx());
// Next-issue block: its events are out of scope, not material to continue into.
expect(out).toContain('OUT OF SCOPE');
- // The always-on seed scope note.
+ // The seed scope note (non-backfill runs).
expect(out).toContain("This seed defines THIS issue's scope.");
});
+ it('suppresses the seed-scope note + padding warning on a backfill run (#1513)', () => {
+ // Backfill mode: beats are reverse-engineered from existing source material,
+ // so the seed is not the scope — the source is. The seed-scope language must
+ // NOT fire (it would tell the model to drop events present only in the source).
+ const out = applyTemplate(ideaTemplate, renderCtx({
+ paddingRisk: true,
+ hasSourceMaterials: true,
+ sourceMaterials: [{ label: 'Prose Draft', content: 'PROSE-SOURCE-BODY' }],
+ }));
+ expect(out).not.toContain("This seed defines THIS issue's scope.");
+ expect(out).not.toContain('Scope warning'); // paddingRisk gated under {{^hasSourceMaterials}}
+ expect(out).toContain('reverse-engineering this beat sheet'); // backfill block still renders
+ expect(out).toContain('PROSE-SOURCE-BODY');
+ });
+
it('renders the ticking-clock section when enabled and omits it otherwise', () => {
const clock = renderTickingClock({ enabled: true, label: 'TICK-LABEL', kind: 'deadline', stakes: 'TICK-STAKES' });
const withClock = applyTemplate(ideaTemplate, renderCtx({ tickingClock: clock }));