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: guide Pipeline planning with an authored series design brief (#7203)

[._.]/ Adam Eivydcb3e7135092
diff --git a/client/src/components/pipeline/arcCanvas/ArcContent.jsx b/client/src/components/pipeline/arcCanvas/ArcContent.jsx
index 92a1bff1be..2df716f293 100644
--- a/client/src/components/pipeline/arcCanvas/ArcContent.jsx
+++ b/client/src/components/pipeline/arcCanvas/ArcContent.jsx
@@ -7,9 +7,12 @@ import FieldLockToggle from './FieldLockToggle.jsx';
import TickingClockEditor from './TickingClockEditor.jsx';
import TickingClockCard from './TickingClockCard.jsx';
import ThemeChips from './ThemeChips.jsx';
+import SeriesDesignEditor from './SeriesDesignEditor.jsx';
export default function ArcContent({ series, onSeriesUpdate, onRegisterDraftFlush }) {
- const arc = series.arc;
+ const arc = series.arc || {};
+ const locked = series.locked?.arc === true;
+ const saveRef = useRef(null);
const [editing, setEditing] = useState(false);
const [draft, setDraft] = useState(arc);
const [saving, setSaving] = useState(false);
@@ -31,17 +34,21 @@ export default function ArcContent({ series, onSeriesUpdate, onRegisterDraftFlus
stateRef.current = { editing, draft, arc };
const persistDraft = useCallback(async (nextDraft) => {
+ if (saveRef.current) return saveRef.current;
+ if (series.locked?.arc === true) return null;
setSaving(true);
- const updated = await updatePipelineSeries(series.id, { arc: nextDraft }, { silent: true }).catch((err) => {
+ saveRef.current = updatePipelineSeries(series.id, { arc: nextDraft }, { silent: true }).catch((err) => {
toast.error(err.message || 'Save failed');
return null;
});
+ const updated = await saveRef.current;
+ saveRef.current = null;
setSaving(false);
if (!updated) return null;
onSeriesUpdate(updated);
setEditing(false);
return updated;
- }, [series.id, onSeriesUpdate]);
+ }, [series.id, series.locked?.arc, onSeriesUpdate]);
const save = async () => {
if (await persistDraft(draft)) toast.success('Arc saved');
@@ -50,21 +57,22 @@ export default function ArcContent({ series, onSeriesUpdate, onRegisterDraftFlus
// Hand the host a committer for the OPEN editor, so any "flush before you
// act" path (Lock & continue, Generate arc, Save series) persists what is on
// screen instead of silently discarding it (#3907). Returns `true` only when
- // it actually wrote. Unregisters on unmount so a torn-down editor can never
+ // it actually wrote; null means a failed save and blocks dependent actions. Unregisters on unmount so a torn-down editor can never
// be committed.
useEffect(() => {
if (!onRegisterDraftFlush) return undefined;
onRegisterDraftFlush(async () => {
const { editing: isEditing, draft: pending, arc: current } = stateRef.current;
if (!isEditing || JSON.stringify(pending ?? null) === JSON.stringify(current ?? null)) return false;
- return Boolean(await persistDraft(pending));
+ return (await persistDraft(pending)) ? true : null;
});
return () => onRegisterDraftFlush(null);
}, [onRegisterDraftFlush, persistDraft]);
if (editing) {
return (
- <div className="space-y-2">
+ <fieldset disabled={saving || locked} className="space-y-2">
+ <SeriesDesignEditor value={draft.seriesDesign} onChange={(seriesDesign) => setDraft({ ...draft, seriesDesign })} />
<textarea
aria-label="Logline"
value={draft.logline || ''}
@@ -122,7 +130,7 @@ export default function ArcContent({ series, onSeriesUpdate, onRegisterDraftFlus
Cancel
</button>
</div>
- </div>
+ </fieldset>
);
}
@@ -131,6 +139,12 @@ export default function ArcContent({ series, onSeriesUpdate, onRegisterDraftFlus
return (
<div className="grid grid-cols-1 @2xl:grid-cols-[minmax(0,1fr)_260px] gap-4">
<div className="space-y-2 min-w-0">
+ {arc.seriesDesign ? (
+ <details className="rounded border border-port-border p-2 text-xs text-gray-400">
+ <summary className="cursor-pointer text-port-accent">Series design · {arc.seriesDesign.mode}</summary>
+ <SeriesDesignEditor value={arc.seriesDesign} readOnly />
+ </details>
+ ) : null}
{arc.logline ? (
<div className="flex items-start gap-2">
<p className="text-sm text-white flex-1 leading-relaxed">{arc.logline}</p>
@@ -181,9 +195,10 @@ export default function ArcContent({ series, onSeriesUpdate, onRegisterDraftFlus
<button
type="button"
onClick={startEdit}
+ disabled={locked}
className="text-xs text-port-accent hover:underline"
>
- Edit arc
+ {series.arc ? 'Edit arc' : 'Add series design'}
</button>
</div>
<aside className="rounded border border-port-border bg-port-bg/60 p-3 space-y-2">
diff --git a/client/src/components/pipeline/arcCanvas/ArcContent.test.jsx b/client/src/components/pipeline/arcCanvas/ArcContent.test.jsx
index fc86477e5e..5bc5d321d0 100644
--- a/client/src/components/pipeline/arcCanvas/ArcContent.test.jsx
+++ b/client/src/components/pipeline/arcCanvas/ArcContent.test.jsx
@@ -81,14 +81,14 @@ describe('ArcContent draft flush registration', () => {
expect(updatePipelineSeries).not.toHaveBeenCalled();
});
- it('reports no save (and keeps the editor open) when the PATCH rejects', async () => {
+ it('reports failed save (and keeps the editor open) when the PATCH rejects', async () => {
updatePipelineSeries.mockRejectedValue(new Error('boom'));
const { registered } = renderWithRegistry();
openEditorAndType('New logline');
let did;
await act(async () => { did = await registered.fn(); });
- expect(did).toBe(false);
+ expect(did).toBe(null);
expect(toastMock.error).toHaveBeenCalled();
// Editor stays open so the unsaved text is still on screen and recoverable.
expect(screen.getByPlaceholderText('One-sentence whole-arc pitch')).toBeTruthy();
@@ -105,3 +105,40 @@ describe('ArcContent draft flush registration', () => {
expect(registered.fn).toBe(null);
});
});
+
+
+describe('Series design authoring', () => {
+ it('authors a brief before an arc exists and flushes it', async () => {
+ const { registered } = renderWithRegistry({ series: { id: 'new', arc: null } });
+ fireEvent.click(screen.getByRole('button', { name: 'Add series design' }));
+ fireEvent.change(screen.getByLabelText('Story intent'), { target: { value: 'finite' } });
+ fireEvent.change(screen.getByLabelText('Ending condition'), { target: { value: 'Solve the central case.' } });
+ expect(updatePipelineSeries).not.toHaveBeenCalled();
+ await act(async () => { await registered.fn(); });
+ expect(updatePipelineSeries).toHaveBeenCalledWith('new', { arc: { seriesDesign: { mode: 'finite', endingCondition: 'Solve the central case.' } } }, { silent: true });
+ });
+
+ it('keeps a failed brief draft available', async () => {
+ updatePipelineSeries.mockRejectedValue(new Error('offline'));
+ const { registered } = renderWithRegistry();
+ fireEvent.click(screen.getByText('Edit arc'));
+ fireEvent.change(screen.getByLabelText('Story intent'), { target: { value: 'renewable' } });
+ await act(async () => { expect(await registered.fn()).toBe(null); });
+ expect(screen.getByLabelText('Story intent').value).toBe('renewable');
+ fireEvent.click(screen.getByText('Cancel'));
+ });
+
+ it('clears a saved brief explicitly', async () => {
+ const { registered } = renderWithRegistry({ series: { ...SERIES, arc: { ...SERIES.arc, seriesDesign: { mode: 'renewable' } } } });
+ fireEvent.click(screen.getByText('Edit arc'));
+ const selectors = screen.getAllByLabelText('Story intent');
+ fireEvent.change(selectors[0], { target: { value: '' } });
+ await act(async () => { await registered.fn(); });
+ expect(updatePipelineSeries.mock.calls[0][1].arc.seriesDesign).toBe(null);
+ });
+
+ it('disables authoring when the arc is locked', () => {
+ renderWithRegistry({ series: { ...SERIES, locked: { arc: true } } });
+ expect(screen.getByText('Edit arc').disabled).toBe(true);
+ });
+});
diff --git a/client/src/components/pipeline/arcCanvas/ArcHeader.jsx b/client/src/components/pipeline/arcCanvas/ArcHeader.jsx
index 0c3a731b59..a1578d3bc5 100644
--- a/client/src/components/pipeline/arcCanvas/ArcHeader.jsx
+++ b/client/src/components/pipeline/arcCanvas/ArcHeader.jsx
@@ -61,9 +61,12 @@ export default function ArcHeader({ series, onSeriesUpdate, onIssuesUpdate, onFl
}, [series.id]);
const { busy: lockBusy, toggle: toggleArcLock } = useLockToggle({
- patchFn: (next) => updatePipelineSeries(series.id, {
- locked: { ...(series.locked || {}), arc: next },
- }, { silent: true }),
+ patchFn: async (next) => {
+ if (next && onFlushPending && await onFlushPending() === null) return null;
+ return updatePipelineSeries(series.id, {
+ locked: { ...(series.locked || {}), arc: next },
+ }, { silent: true });
+ },
onSuccess: (updated, next) => {
onSeriesUpdate(updated);
if (next) setConfirmingRegen(false);
@@ -82,7 +85,7 @@ export default function ArcHeader({ series, onSeriesUpdate, onIssuesUpdate, onFl
// so typing "32" into the issue count and clicking Regenerate runs against
// the on-screen value, not the previously-saved one.
const withFlush = async (fn) => {
- if (onFlushPending) await onFlushPending();
+ if (onFlushPending && await onFlushPending() === null) return null;
return fn();
};
@@ -347,13 +350,12 @@ export default function ArcHeader({ series, onSeriesUpdate, onIssuesUpdate, onFl
</div>
) : null}
- {arc ? (
- <ArcContent series={series} onSeriesUpdate={onSeriesUpdate} onRegisterDraftFlush={onRegisterDraftFlush} />
- ) : (
+ <ArcContent key={series.id} series={series} onSeriesUpdate={onSeriesUpdate} onRegisterDraftFlush={onRegisterDraftFlush} />
+ {!arc ? (
<p className="text-xs text-gray-500 italic">
- No arc yet — describe the series in the bible, then click <em>Generate arc</em> to have an LLM propose a multi-volume spine + volume breakdown.
+ No arc yet — describe the series in the bible, optionally add a Series design brief, then click <em>Generate arc</em> to have an LLM propose a multi-volume spine + volume breakdown.
</p>
- )}
+ ) : null}
{verifyIssues && verifyIssues.length > 0 ? (
<VerifyResults
diff --git a/client/src/components/pipeline/arcCanvas/ArcHeader.test.jsx b/client/src/components/pipeline/arcCanvas/ArcHeader.test.jsx
new file mode 100644
index 0000000000..4b8ea17cb9
--- /dev/null
+++ b/client/src/components/pipeline/arcCanvas/ArcHeader.test.jsx
@@ -0,0 +1,27 @@
+import { describe, it, expect, vi } from 'vitest';
+import { fireEvent, render, screen, waitFor } from '@testing-library/react';
+const api = vi.hoisted(() => ({
+ generatePipelineArcOverview: vi.fn(), verifyPipelineArc: vi.fn(), resolvePipelineArcIssues: vi.fn(),
+ derivePipelineArcFromManuscript: vi.fn(), commitPipelineArcFromManuscript: vi.fn(),
+ analyzePipelineManuscriptCompleteness: vi.fn(), listPipelineIssues: vi.fn().mockResolvedValue([]), updatePipelineSeries: vi.fn(),
+}));
+vi.mock('../../../services/api', () => api);
+vi.mock('../SeriesLlmPicker', () => ({ default: () => null }));
+vi.mock('./ArcContent.jsx', () => ({ default: () => null }));
+vi.mock('./DeriveFromManuscriptPreview.jsx', () => ({ default: () => null }));
+import ArcHeader from './ArcHeader.jsx';
+
+describe('ArcHeader saved-input gate', () => {
+ it('does not call the generation provider after a failed draft save, and allows retry', async () => {
+ const flush = vi.fn().mockResolvedValue(null);
+ api.generatePipelineArcOverview.mockResolvedValue({ series: { id: 's' } });
+ render(<ArcHeader series={{ id: 's', arc: null }} onSeriesUpdate={vi.fn()} onFlushPending={flush} />);
+ fireEvent.click(screen.getByRole('button', { name: 'Generate arc' }));
+ await waitFor(() => expect(flush).toHaveBeenCalledOnce());
+ await waitFor(() => expect(screen.getByRole('button', { name: 'Generate arc' }).disabled).toBe(false));
+ expect(api.generatePipelineArcOverview).not.toHaveBeenCalled();
+ flush.mockResolvedValue(true);
+ fireEvent.click(screen.getByRole('button', { name: 'Generate arc' }));
+ await waitFor(() => expect(api.generatePipelineArcOverview).toHaveBeenCalledOnce());
+ });
+});
diff --git a/client/src/components/pipeline/arcCanvas/SeriesDesignEditor.jsx b/client/src/components/pipeline/arcCanvas/SeriesDesignEditor.jsx
new file mode 100644
index 0000000000..257f699546
--- /dev/null
+++ b/client/src/components/pipeline/arcCanvas/SeriesDesignEditor.jsx
@@ -0,0 +1,40 @@
+import { useId } from 'react';
+import { SERIES_DESIGN_FIELDS, SERIES_DESIGN_TEXT_MAX } from '../../../../../server/lib/storyArcLimits.js';
+
+const HELP = {
+ episodeActivity: 'What does the cast repeatedly do in an episode?',
+ conflictSource: 'What makes that activity difficult or puts people at odds?',
+ audiencePromise: 'What experience should an episode deliver to its audience?',
+ continuingTensions: 'Which unresolved pressures can sustain varied stories?',
+ endingCondition: 'What outcome would bring this story to its intended close?',
+};
+
+export default function SeriesDesignEditor({ value, onChange, readOnly = false }) {
+ const id = useId();
+ return (
+ <fieldset disabled={readOnly} className="space-y-2 rounded border border-port-border p-3">
+ <legend className="text-sm text-white">Series design (optional)</legend>
+ <p className="text-xs text-gray-400">Your brief guides planning and review. AI keeps these choices as written.</p>
+ <label htmlFor={`${id}-mode`} className="block text-xs text-gray-400">Story intent</label>
+ <select id={`${id}-mode`} value={value?.mode || ''}
+ onChange={(event) => onChange(event.target.value ? { ...value, mode: event.target.value } : null)}
+ className="w-full rounded border border-port-border bg-port-bg p-2 text-sm text-white">
+ <option value="">No brief</option>
+ <option value="finite">Finite — working toward an ending</option>
+ <option value="renewable">Renewable — recurring stories</option>
+ </select>
+ {value?.mode ? <div className="grid grid-cols-1 md:grid-cols-2 gap-3">
+ {Object.entries(SERIES_DESIGN_FIELDS).map(([field, label]) => (
+ <div key={field}>
+ <label htmlFor={`${id}-${field}`} className="block text-xs text-gray-400">{label}</label>
+ <p id={`${id}-${field}-help`} className="text-xs text-gray-500">{HELP[field]}</p>
+ <textarea id={`${id}-${field}`} aria-describedby={`${id}-${field}-help`} rows={2}
+ value={value[field] || ''} maxLength={SERIES_DESIGN_TEXT_MAX}
+ onChange={(event) => onChange({ ...value, [field]: event.target.value })}
+ className="w-full rounded border border-port-border bg-port-bg p-2 text-sm text-white" />
+ </div>
+ ))}
+ </div> : null}
+ </fieldset>
+ );
+}
diff --git a/client/src/hooks/useArcCanvasSync.js b/client/src/hooks/useArcCanvasSync.js
index b4116e3a53..d7dedd6fec 100644
--- a/client/src/hooks/useArcCanvasSync.js
+++ b/client/src/hooks/useArcCanvasSync.js
@@ -12,7 +12,8 @@ import { updatePipelineSeries } from '../services/api';
// onFlushPending → flushPending(): if local bible fields diverged from the
// last server snapshot, PATCH so generate / verify / resolve
// run against the on-screen state. Returns `true` when a save
-// occurred so the caller can surface a confirmation toast.
+// occurred, `false` for a clean no-op, and `null` if a save failed.
+// Dependent actions must stop on `null`.
//
// A fourth callback, `onRegisterDraftFlush` → registerDraftFlush(fn), lets a
// descendant that owns an unsaved *draft* (the ArcContent logline / summary /
@@ -20,7 +21,7 @@ import { updatePipelineSeries } from '../services/api';
// bible PATCH, so "flush before you act" covers an open arc editor too — without
// which clicking Lock & continue / Generate / Save while the editor is open
// silently discards what is on screen (#3907). The registered fn returns `true`
-// when it saved, and is expected to swallow its own errors.
+// when it saved, `false` for no changes, and `null` after reporting a save error.
//
// Both PipelineSeries and the embedded StoryBuilder arc step used to hand-roll
// this identical contract; the only real divergence is WHICH bible fields each
@@ -86,14 +87,17 @@ export function useArcCanvasSync({
if (onFlushError) onFlushError(err);
return null;
});
- if (updated) {
- updateSeriesFromServer(updated);
- didSave = true;
- }
+ if (!updated) return null;
+ updateSeriesFromServer(updated);
+ didSave = true;
}
// Bible PATCH first, THEN the draft — the draft committer's response then
// carries the bible fields too, so lastSavedRef ends on the freshest record.
- if (draftFlushRef.current && await draftFlushRef.current()) didSave = true;
+ if (draftFlushRef.current) {
+ const draftSaved = await draftFlushRef.current();
+ if (draftSaved === null) return null;
+ if (draftSaved) didSave = true;
+ }
return didSave;
}, [series, flushFields, payloadDefaults, silent, onFlushError, updateSeriesFromServer]);
diff --git a/client/src/hooks/useArcCanvasSync.test.jsx b/client/src/hooks/useArcCanvasSync.test.jsx
index 945ced7391..6e943ddd9c 100644
--- a/client/src/hooks/useArcCanvasSync.test.jsx
+++ b/client/src/hooks/useArcCanvasSync.test.jsx
@@ -73,7 +73,7 @@ describe('useArcCanvasSync', () => {
expect(patch.name).toBe('B');
});
- it('calls onFlushError and returns false when the PATCH rejects', async () => {
+ it('calls onFlushError and returns null when the PATCH rejects', async () => {
const server = { id: 's1', name: 'A' };
updatePipelineSeries.mockRejectedValue(new Error('boom'));
const onFlushError = vi.fn();
@@ -84,7 +84,7 @@ describe('useArcCanvasSync', () => {
act(() => { result.current.setSeries((s) => ({ ...s, name: 'B' })); });
let did;
await act(async () => { did = await result.current.flushPending(); });
- expect(did).toBe(false);
+ expect(did).toBe(null);
expect(onFlushError).toHaveBeenCalledWith(expect.any(Error));
});
diff --git a/client/src/pages/PipelineSeries.jsx b/client/src/pages/PipelineSeries.jsx
index 4ba78a4c20..85b6f809df 100644
--- a/client/src/pages/PipelineSeries.jsx
+++ b/client/src/pages/PipelineSeries.jsx
@@ -363,7 +363,7 @@ function BibleSidebar({ series, universes, patchSeries, onSeriesUpdate, onFlushP
const [generatingLogo, setGeneratingLogo] = useState(false);
const handleGenerateLogo = async () => {
// Server reads from disk — flush dirty edits so the LLM sees fresh fields.
- if (onFlushPending) await onFlushPending();
+ if (onFlushPending && await onFlushPending() === null) return;
setGeneratingLogo(true);
const result = await generateSeriesTitleLogo(series.id, undefined, { silent: true }).catch((err) => {
toast.error(err.message || 'Failed to design logo');
@@ -652,7 +652,7 @@ function StyleGuideSection({ series, patchSeries, onFlushPending }) {
const runDiscover = async () => {
// The server reads the series from disk — flush dirty premise/style edits so
// the trial passages reflect what the user is actually looking at.
- if (onFlushPending) await onFlushPending();
+ if (onFlushPending && await onFlushPending() === null) return;
setDiscovering(true);
const result = await discoverSeriesVoice(series.id, {}, { silent: true }).catch((err) => {
toast.error(err.message || 'Voice discovery failed — try again or pick a different provider.');
diff --git a/client/src/pages/StoryBuilder.jsx b/client/src/pages/StoryBuilder.jsx
index ae8209dd48..0881bf3adb 100644
--- a/client/src/pages/StoryBuilder.jsx
+++ b/client/src/pages/StoryBuilder.jsx
@@ -1148,7 +1148,7 @@ function StoryBuilderDetail({ storyId, stepParam }) {
// last edits are silently lost (#3907). Unlocking re-opens the step and has
// nothing to preserve, so it skips the flush.
patchFn: async (next) => {
- if (next) await flushPending();
+ if (next && await flushPending() === null) return null;
return next ? lockStoryStep(storyId, activeStepId, { silent: true }) : unlockStoryStep(storyId, activeStepId, { silent: true });
},
onSuccess: (_updated, next) => {
diff --git a/data.reference/prompts/stages/pipeline-arc-overview.md b/data.reference/prompts/stages/pipeline-arc-overview.md
index 34e025094b..57d381cf3a 100644
--- a/data.reference/prompts/stages/pipeline-arc-overview.md
+++ b/data.reference/prompts/stages/pipeline-arc-overview.md
@@ -8,6 +8,8 @@ This is the most expensive single call in the pipeline (you reason over the full
{{{shapeGuidance}}}
+If a Series design brief is supplied above, treat it as authored intent. For renewable stories, consider recurring activity, varied episode problems/outcomes and continuing tensions; for finite stories, consider causal progress and the earned declared ending. Ground contradictions in the supplied episodes and use the existing actionable findings format when reviewing. At synopsis-only scope, limit conclusions to available material. A deliberate breather is valid; uncertainty alone does not warrant a finding. Do not invent a brief when absent, add sample-episode batches or future-season quotas, force character transformation, or change the configured issue count, reader map or emotional shape. Resolvers repair story material, never the brief.
+
{{#pickedShapeId}}
The user has pre-picked this shape. Your `seasonOutlines` MUST trace this fortune curve — each volume's logline and endingHook should reflect its position on the curve (low → rising → peak → falling → recovery → triumph, etc., per the shape's beats). Include `"shape": "{{pickedShapeId}}"` verbatim in your JSON output so the picked shape round-trips.
{{/pickedShapeId}}
diff --git a/data.reference/prompts/stages/pipeline-arc-resolve.md b/data.reference/prompts/stages/pipeline-arc-resolve.md
index a82c44149a..73ceec2cf7 100644
--- a/data.reference/prompts/stages/pipeline-arc-resolve.md
+++ b/data.reference/prompts/stages/pipeline-arc-resolve.md
@@ -78,6 +78,8 @@ contradiction here directly; changing only the summary leaves it in place.
{{{shapeGuidance}}}
+If a Series design brief is supplied above, treat it as authored intent. For renewable stories, consider recurring activity, varied episode problems/outcomes and continuing tensions; for finite stories, consider causal progress and the earned declared ending. Ground contradictions in the supplied episodes and use the existing actionable findings format when reviewing. At synopsis-only scope, limit conclusions to available material. A deliberate breather is valid; uncertainty alone does not warrant a finding. Do not invent a brief when absent, add sample-episode batches or future-season quotas, force character transformation, or change the configured issue count, reader map or emotional shape. Resolvers repair story material, never the brief.
+
When rewriting the arc + volume synopses, preserve the picked shape — do not change `arc.shape`. The volume-level fortune trajectory must still trace this curve after your edits.
## Current volumes + issues
diff --git a/data.reference/prompts/stages/pipeline-arc-verify.md b/data.reference/prompts/stages/pipeline-arc-verify.md
index c23081fe18..0cd6f31de9 100644
--- a/data.reference/prompts/stages/pipeline-arc-verify.md
+++ b/data.reference/prompts/stages/pipeline-arc-verify.md
@@ -80,6 +80,8 @@ flagging any entity as ungrounded.
{{{shapeGuidance}}}
+If a Series design brief is supplied above, treat it as authored intent. For renewable stories, consider recurring activity, varied episode problems/outcomes and continuing tensions; for finite stories, consider causal progress and the earned declared ending. Ground contradictions in the supplied episodes and use the existing actionable findings format when reviewing. At synopsis-only scope, limit conclusions to available material. A deliberate breather is valid; uncertainty alone does not warrant a finding. Do not invent a brief when absent, add sample-episode batches or future-season quotas, force character transformation, or change the configured issue count, reader map or emotional shape. Resolvers repair story material, never the brief.
+
## Volumes + episodes
```json
diff --git a/data.reference/prompts/stages/pipeline-season-episodes.md b/data.reference/prompts/stages/pipeline-season-episodes.md
index 4aaa914828..c7e699d28e 100644
--- a/data.reference/prompts/stages/pipeline-season-episodes.md
+++ b/data.reference/prompts/stages/pipeline-season-episodes.md
@@ -29,6 +29,8 @@ You are a writers-room showrunner planning the **episode-by-episode breakdown fo
{{{shapeGuidance}}}
+If a Series design brief is supplied above, treat it as authored intent. For renewable stories, consider recurring activity, varied episode problems/outcomes and continuing tensions; for finite stories, consider causal progress and the earned declared ending. Ground contradictions in the supplied episodes and use the existing actionable findings format when reviewing. At synopsis-only scope, limit conclusions to available material. A deliberate breather is valid; uncertainty alone does not warrant a finding. Do not invent a brief when absent, add sample-episode batches or future-season quotas, force character transformation, or change the configured issue count, reader map or emotional shape. Resolvers repair story material, never the brief.
+
**This season's expected emotional placement:** {{shapePosition}}
Pace the episodes you write so the season's fortune trajectory matches this placement. The first episode should open near the *level* implied by the prior season's ending, the finale episode should land at the *level* implied by this season's ending hook, and the in-between beats should bend the curve in the right direction — even when the per-episode `arcRole` would otherwise read as neutral.
diff --git a/data.reference/prompts/stages/pipeline-volume-verify.md b/data.reference/prompts/stages/pipeline-volume-verify.md
index aa72cee1da..9f0f0e7e09 100644
--- a/data.reference/prompts/stages/pipeline-volume-verify.md
+++ b/data.reference/prompts/stages/pipeline-volume-verify.md
@@ -60,6 +60,8 @@ The arc was authored against this World Builder world: **{{worldName}}**. Contin
{{{shapeGuidance}}}
+If a Series design brief is supplied above, treat it as authored intent. For renewable stories, consider recurring activity, varied episode problems/outcomes and continuing tensions; for finite stories, consider causal progress and the earned declared ending. Ground contradictions in the supplied episodes and use the existing actionable findings format when reviewing. At synopsis-only scope, limit conclusions to available material. A deliberate breather is valid; uncertainty alone does not warrant a finding. Do not invent a brief when absent, add sample-episode batches or future-season quotas, force character transformation, or change the configured issue count, reader map or emotional shape. Resolvers repair story material, never the brief.
+
**This volume's expected emotional placement within the curve:** {{volumeShapePosition}}
## This volume
diff --git a/scripts/migrations/003-update-pipeline-stage-prompts.js b/scripts/migrations/003-update-pipeline-stage-prompts.js
index 8a5e3df0e5..44b5e206fa 100644
--- a/scripts/migrations/003-update-pipeline-stage-prompts.js
+++ b/scripts/migrations/003-update-pipeline-stage-prompts.js
@@ -58,7 +58,7 @@ export const NEW_SHIPPED_MD5 = {
'pipeline-prose.md': '4cb3ef48309f3673570cf80e4d544b54', // post-169 (cross-issue continuity)
'pipeline-comic-script.md': '49af30c05f008b20f6998a0f113f7d87', // post-127 (scene markers)
'pipeline-tv-script.md': '376f779f4687b598f1c92ca4e770fd5a', // retired upstream (no data.reference)
- 'pipeline-season-episodes.md': '7c24df53c097c2525a52bfb766239647', // post-172 (structure rules)
+ 'pipeline-season-episodes.md': 'b3fc07d785599b5a4859af8bed3c1d4e', // post-172 (structure rules)
};
const { applyMigration, up } = makePromptReplaceMigration({
diff --git a/scripts/migrations/005-shape-aware-arc-prompts.js b/scripts/migrations/005-shape-aware-arc-prompts.js
index f3cda9e006..ba4a2c9286 100644
--- a/scripts/migrations/005-shape-aware-arc-prompts.js
+++ b/scripts/migrations/005-shape-aware-arc-prompts.js
@@ -51,11 +51,11 @@ export const ACCEPTED_OLD_MD5 = {
};
export const NEW_SHIPPED_MD5 = {
- 'pipeline-arc-overview.md': '5ed760caaf3cf88916ec28b220e2f590', // post-250 arc spine checkpoint
- 'pipeline-arc-verify.md': 'f09e81655ec897c74a2fae68ad31b9c4', // post-276 distinct climax
- 'pipeline-volume-verify.md': '9c0839d7fe1760c0891464afd4a3b8fd', // post-274 planning economy
- 'pipeline-season-episodes.md': '7c24df53c097c2525a52bfb766239647', // post-276 distinct climax
- 'pipeline-arc-resolve.md': '56926d795bd31f7e05e6bbbc646ecf9f', // post-274 planning economy
+ 'pipeline-arc-overview.md': '901557b9f146a2d279ce2e81bda24d73', // post-250 arc spine checkpoint
+ 'pipeline-arc-verify.md': '090920d816beef8dfc12ee6152511456', // post-276 distinct climax
+ 'pipeline-volume-verify.md': '6f9b4ba4d9dd9a51a1032c7f0ca90405', // post-274 planning economy
+ 'pipeline-season-episodes.md': 'b3fc07d785599b5a4859af8bed3c1d4e', // post-276 distinct climax
+ 'pipeline-arc-resolve.md': '5fb659e459a296b7d378d7711f4b78cd', // post-274 planning economy
};
const { applyMigration, up } = makePromptReplaceMigration({
diff --git a/scripts/migrations/019-arc-volume-prompts-canon-context.js b/scripts/migrations/019-arc-volume-prompts-canon-context.js
index c31e543994..c77bce4262 100644
--- a/scripts/migrations/019-arc-volume-prompts-canon-context.js
+++ b/scripts/migrations/019-arc-volume-prompts-canon-context.js
@@ -62,10 +62,10 @@ export const ACCEPTED_OLD_MD5 = {
};
export const NEW_SHIPPED_MD5 = {
- 'pipeline-arc-overview.md': '5ed760caaf3cf88916ec28b220e2f590', // post-250 arc spine checkpoint
- 'pipeline-arc-verify.md': 'f09e81655ec897c74a2fae68ad31b9c4', // post-276 distinct climax
- 'pipeline-arc-resolve.md': '56926d795bd31f7e05e6bbbc646ecf9f', // post-274 planning economy
- 'pipeline-volume-verify.md': '9c0839d7fe1760c0891464afd4a3b8fd', // post-274 planning economy
+ 'pipeline-arc-overview.md': '901557b9f146a2d279ce2e81bda24d73', // post-250 arc spine checkpoint
+ 'pipeline-arc-verify.md': '090920d816beef8dfc12ee6152511456', // post-276 distinct climax
+ 'pipeline-arc-resolve.md': '5fb659e459a296b7d378d7711f4b78cd', // post-274 planning economy
+ 'pipeline-volume-verify.md': '6f9b4ba4d9dd9a51a1032c7f0ca90405', // post-274 planning economy
};
const { applyMigration, up } = makePromptReplaceMigration({
diff --git a/scripts/migrations/023-resolve-prompt-episode-anchor.js b/scripts/migrations/023-resolve-prompt-episode-anchor.js
index 410b805459..dd82da9903 100644
--- a/scripts/migrations/023-resolve-prompt-episode-anchor.js
+++ b/scripts/migrations/023-resolve-prompt-episode-anchor.js
@@ -39,7 +39,7 @@ export const ACCEPTED_OLD_MD5 = {
// drift-catch test stays green against the live data.reference sample; a fresh
// install at the pre-123 hash still advances cleanly via the accepted-OLD list.
export const NEW_SHIPPED_MD5 = {
- 'pipeline-arc-resolve.md': '56926d795bd31f7e05e6bbbc646ecf9f', // post-274 planning economy
+ 'pipeline-arc-resolve.md': '5fb659e459a296b7d378d7711f4b78cd', // post-274 planning economy
};
const { applyMigration, up } = makePromptReplaceMigration({
diff --git a/scripts/migrations/123-arc-resolve-episode-corrections.js b/scripts/migrations/123-arc-resolve-episode-corrections.js
index 9adb40163c..0e1d8ac4b5 100644
--- a/scripts/migrations/123-arc-resolve-episode-corrections.js
+++ b/scripts/migrations/123-arc-resolve-episode-corrections.js
@@ -28,7 +28,7 @@ export const ACCEPTED_OLD_MD5 = {
};
export const NEW_SHIPPED_MD5 = {
- 'pipeline-arc-resolve.md': '56926d795bd31f7e05e6bbbc646ecf9f', // post-274 planning economy
+ 'pipeline-arc-resolve.md': '5fb659e459a296b7d378d7711f4b78cd', // post-274 planning economy
};
const { applyMigration, up } = makePromptReplaceMigration({
diff --git a/scripts/migrations/166-craft-knowledge-prompt-upgrades.js b/scripts/migrations/166-craft-knowledge-prompt-upgrades.js
index 63c3df8655..1c53dd0db8 100644
--- a/scripts/migrations/166-craft-knowledge-prompt-upgrades.js
+++ b/scripts/migrations/166-craft-knowledge-prompt-upgrades.js
@@ -54,7 +54,7 @@ export const ACCEPTED_OLD_MD5 = {
export const NEW_SHIPPED_MD5 = {
'pipeline-prose.md': '4cb3ef48309f3673570cf80e4d544b54',
'writers-room-continue.md': '458dc5ff4732befc1fb90890bdc885c2', // post-181 (voice exemplars)
- 'pipeline-arc-overview.md': '5ed760caaf3cf88916ec28b220e2f590', // post-250 arc spine checkpoint
+ 'pipeline-arc-overview.md': '901557b9f146a2d279ce2e81bda24d73', // post-250 arc spine checkpoint
};
const { applyMigration, up } = makePromptReplaceMigration({
diff --git a/scripts/migrations/172-structure-rules-season-episodes.js b/scripts/migrations/172-structure-rules-season-episodes.js
index 393428ccdc..9a5231a3a9 100644
--- a/scripts/migrations/172-structure-rules-season-episodes.js
+++ b/scripts/migrations/172-structure-rules-season-episodes.js
@@ -31,7 +31,7 @@ export const ACCEPTED_OLD_MD5 = {
// Post-change shipped hash (structure rules block added).
export const NEW_SHIPPED_MD5 = {
- 'pipeline-season-episodes.md': '7c24df53c097c2525a52bfb766239647',
+ 'pipeline-season-episodes.md': 'b3fc07d785599b5a4859af8bed3c1d4e',
};
const { applyMigration, up } = makePromptReplaceMigration({
diff --git a/scripts/migrations/173-mice-thread-nesting-arc-overview.js b/scripts/migrations/173-mice-thread-nesting-arc-overview.js
index be17bc9d5b..7f3c548767 100644
--- a/scripts/migrations/173-mice-thread-nesting-arc-overview.js
+++ b/scripts/migrations/173-mice-thread-nesting-arc-overview.js
@@ -31,7 +31,7 @@ export const ACCEPTED_OLD_MD5 = {
// Post-change shipped hash (MICE thread-nesting instruction added).
export const NEW_SHIPPED_MD5 = {
- 'pipeline-arc-overview.md': '5ed760caaf3cf88916ec28b220e2f590', // post-250 arc spine checkpoint
+ 'pipeline-arc-overview.md': '901557b9f146a2d279ce2e81bda24d73', // post-250 arc spine checkpoint
};
const { applyMigration, up } = makePromptReplaceMigration({
diff --git a/scripts/migrations/245-arc-resolve-finding-keyed-patches.js b/scripts/migrations/245-arc-resolve-finding-keyed-patches.js
index 6f50a46af9..afc156ada1 100644
--- a/scripts/migrations/245-arc-resolve-finding-keyed-patches.js
+++ b/scripts/migrations/245-arc-resolve-finding-keyed-patches.js
@@ -28,7 +28,7 @@ export const ACCEPTED_OLD_MD5 = {
};
export const NEW_SHIPPED_MD5 = {
- 'pipeline-arc-resolve.md': '56926d795bd31f7e05e6bbbc646ecf9f', // post-274 planning economy
+ 'pipeline-arc-resolve.md': '5fb659e459a296b7d378d7711f4b78cd', // post-274 planning economy
};
const { applyMigration, up } = makePromptReplaceMigration({
diff --git a/scripts/migrations/249-arc-overview-author-intent.js b/scripts/migrations/249-arc-overview-author-intent.js
index e9abd4c600..a904dae825 100644
--- a/scripts/migrations/249-arc-overview-author-intent.js
+++ b/scripts/migrations/249-arc-overview-author-intent.js
@@ -15,7 +15,7 @@ export const ACCEPTED_OLD_MD5 = {
};
export const NEW_SHIPPED_MD5 = {
- 'pipeline-arc-overview.md': '5ed760caaf3cf88916ec28b220e2f590',
+ 'pipeline-arc-overview.md': '901557b9f146a2d279ce2e81bda24d73',
};
const { applyMigration, up } = makePromptReplaceMigration({
diff --git a/scripts/migrations/250-arc-spine-checkpoint-prompts.js b/scripts/migrations/250-arc-spine-checkpoint-prompts.js
index ab2df16d32..ffb4165d50 100644
--- a/scripts/migrations/250-arc-spine-checkpoint-prompts.js
+++ b/scripts/migrations/250-arc-spine-checkpoint-prompts.js
@@ -17,8 +17,8 @@ export const ACCEPTED_OLD_MD5 = {
};
export const NEW_SHIPPED_MD5 = {
- 'pipeline-arc-overview.md': '5ed760caaf3cf88916ec28b220e2f590',
- 'pipeline-arc-verify.md': 'f09e81655ec897c74a2fae68ad31b9c4', // post-276 distinct climax
+ 'pipeline-arc-overview.md': '901557b9f146a2d279ce2e81bda24d73',
+ 'pipeline-arc-verify.md': '090920d816beef8dfc12ee6152511456', // post-276 distinct climax
};
const { applyMigration, up } = makePromptReplaceMigration({
diff --git a/scripts/migrations/251-arc-resolve-field-sparsity.js b/scripts/migrations/251-arc-resolve-field-sparsity.js
index 653c44e123..b174c35711 100644
--- a/scripts/migrations/251-arc-resolve-field-sparsity.js
+++ b/scripts/migrations/251-arc-resolve-field-sparsity.js
@@ -12,7 +12,7 @@ export const ACCEPTED_OLD_MD5 = {
};
export const NEW_SHIPPED_MD5 = {
- 'pipeline-arc-resolve.md': '56926d795bd31f7e05e6bbbc646ecf9f', // post-274 planning economy
+ 'pipeline-arc-resolve.md': '5fb659e459a296b7d378d7711f4b78cd', // post-274 planning economy
};
const { applyMigration, up } = makePromptReplaceMigration({
diff --git a/scripts/migrations/252-arc-resolve-avoid-list.js b/scripts/migrations/252-arc-resolve-avoid-list.js
index d3c031f677..dfabac1855 100644
--- a/scripts/migrations/252-arc-resolve-avoid-list.js
+++ b/scripts/migrations/252-arc-resolve-avoid-list.js
@@ -14,7 +14,7 @@ export const ACCEPTED_OLD_MD5 = {
};
export const NEW_SHIPPED_MD5 = {
- 'pipeline-arc-resolve.md': '56926d795bd31f7e05e6bbbc646ecf9f', // post-274 planning economy
+ 'pipeline-arc-resolve.md': '5fb659e459a296b7d378d7711f4b78cd', // post-274 planning economy
};
const { applyMigration, up } = makePromptReplaceMigration({
diff --git a/scripts/migrations/253-arc-resolve-spine-scope.js b/scripts/migrations/253-arc-resolve-spine-scope.js
index f267229639..896ccee9f5 100644
--- a/scripts/migrations/253-arc-resolve-spine-scope.js
+++ b/scripts/migrations/253-arc-resolve-spine-scope.js
@@ -16,7 +16,7 @@ export const ACCEPTED_OLD_MD5 = {
};
export const NEW_SHIPPED_MD5 = {
- 'pipeline-arc-resolve.md': '56926d795bd31f7e05e6bbbc646ecf9f', // post-274 planning economy
+ 'pipeline-arc-resolve.md': '5fb659e459a296b7d378d7711f4b78cd', // post-274 planning economy
};
const { applyMigration, up } = makePromptReplaceMigration({
diff --git a/scripts/migrations/254-arc-resolve-character-arcs.js b/scripts/migrations/254-arc-resolve-character-arcs.js
index 2a42e2db45..8088aed76b 100644
--- a/scripts/migrations/254-arc-resolve-character-arcs.js
+++ b/scripts/migrations/254-arc-resolve-character-arcs.js
@@ -15,7 +15,7 @@ export const ACCEPTED_OLD_MD5 = {
};
export const NEW_SHIPPED_MD5 = {
- 'pipeline-arc-resolve.md': '56926d795bd31f7e05e6bbbc646ecf9f',
+ 'pipeline-arc-resolve.md': '5fb659e459a296b7d378d7711f4b78cd',
};
const { applyMigration, up } = makePromptReplaceMigration({
diff --git a/scripts/migrations/258-arc-resolve-exact-text-patches.js b/scripts/migrations/258-arc-resolve-exact-text-patches.js
index f9d87251a4..96a8da5b0b 100644
--- a/scripts/migrations/258-arc-resolve-exact-text-patches.js
+++ b/scripts/migrations/258-arc-resolve-exact-text-patches.js
@@ -14,7 +14,7 @@ export const ACCEPTED_OLD_MD5 = {
};
export const NEW_SHIPPED_MD5 = {
- 'pipeline-arc-resolve.md': '56926d795bd31f7e05e6bbbc646ecf9f',
+ 'pipeline-arc-resolve.md': '5fb659e459a296b7d378d7711f4b78cd',
};
const { applyMigration, up } = makePromptReplaceMigration({
diff --git a/scripts/migrations/259-arc-resolve-text-budgets.js b/scripts/migrations/259-arc-resolve-text-budgets.js
index f70dcf199b..4463a27065 100644
--- a/scripts/migrations/259-arc-resolve-text-budgets.js
+++ b/scripts/migrations/259-arc-resolve-text-budgets.js
@@ -11,7 +11,7 @@ export const ACCEPTED_OLD_MD5 = {
};
export const NEW_SHIPPED_MD5 = {
- 'pipeline-arc-resolve.md': '56926d795bd31f7e05e6bbbc646ecf9f',
+ 'pipeline-arc-resolve.md': '5fb659e459a296b7d378d7711f4b78cd',
};
const { applyMigration, up } = makePromptReplaceMigration({
diff --git a/scripts/migrations/260-arc-resolve-isolated-repairs.js b/scripts/migrations/260-arc-resolve-isolated-repairs.js
index b7fec14075..849b2a162d 100644
--- a/scripts/migrations/260-arc-resolve-isolated-repairs.js
+++ b/scripts/migrations/260-arc-resolve-isolated-repairs.js
@@ -17,7 +17,7 @@ export const ACCEPTED_OLD_MD5 = {
};
export const NEW_SHIPPED_MD5 = {
- 'pipeline-arc-resolve.md': '56926d795bd31f7e05e6bbbc646ecf9f',
+ 'pipeline-arc-resolve.md': '5fb659e459a296b7d378d7711f4b78cd',
};
const { applyMigration, up } = makePromptReplaceMigration({
diff --git a/scripts/migrations/261-exhaustive-arc-verification.js b/scripts/migrations/261-exhaustive-arc-verification.js
index 7ac6998163..40ea46108e 100644
--- a/scripts/migrations/261-exhaustive-arc-verification.js
+++ b/scripts/migrations/261-exhaustive-arc-verification.js
@@ -20,7 +20,7 @@ export const ACCEPTED_OLD_MD5 = {
};
export const NEW_SHIPPED_MD5 = {
- 'pipeline-arc-verify.md': 'f09e81655ec897c74a2fae68ad31b9c4', // post-276 distinct climax
+ 'pipeline-arc-verify.md': '090920d816beef8dfc12ee6152511456', // post-276 distinct climax
};
const { applyMigration, up } = makePromptReplaceMigration({
diff --git a/scripts/migrations/263-arc-verify-world-category-canon.js b/scripts/migrations/263-arc-verify-world-category-canon.js
index 7cd1eeec53..97ec3261d6 100644
--- a/scripts/migrations/263-arc-verify-world-category-canon.js
+++ b/scripts/migrations/263-arc-verify-world-category-canon.js
@@ -26,7 +26,7 @@ export const ACCEPTED_OLD_MD5 = {
};
export const NEW_SHIPPED_MD5 = {
- 'pipeline-arc-verify.md': 'f09e81655ec897c74a2fae68ad31b9c4',
+ 'pipeline-arc-verify.md': '090920d816beef8dfc12ee6152511456',
};
const { applyMigration, up } = makePromptReplaceMigration({
diff --git a/scripts/migrations/267-arc-resolve-character-arc-budgets.js b/scripts/migrations/267-arc-resolve-character-arc-budgets.js
index 2c7b80b737..d661c36097 100644
--- a/scripts/migrations/267-arc-resolve-character-arc-budgets.js
+++ b/scripts/migrations/267-arc-resolve-character-arc-budgets.js
@@ -17,7 +17,7 @@ export const ACCEPTED_OLD_MD5 = {
};
export const NEW_SHIPPED_MD5 = {
- 'pipeline-arc-resolve.md': '56926d795bd31f7e05e6bbbc646ecf9f',
+ 'pipeline-arc-resolve.md': '5fb659e459a296b7d378d7711f4b78cd',
};
const { applyMigration, up } = makePromptReplaceMigration({
diff --git a/scripts/migrations/275-pipeline-planning-economy.js b/scripts/migrations/275-pipeline-planning-economy.js
index d5235cb811..b96e3aab57 100644
--- a/scripts/migrations/275-pipeline-planning-economy.js
+++ b/scripts/migrations/275-pipeline-planning-economy.js
@@ -24,9 +24,9 @@ export const ACCEPTED_OLD_MD5 = {
};
export const NEW_SHIPPED_MD5 = {
- 'pipeline-arc-resolve.md': '56926d795bd31f7e05e6bbbc646ecf9f',
- 'pipeline-arc-verify.md': 'f09e81655ec897c74a2fae68ad31b9c4',
- 'pipeline-volume-verify.md': '9c0839d7fe1760c0891464afd4a3b8fd',
+ 'pipeline-arc-resolve.md': '5fb659e459a296b7d378d7711f4b78cd',
+ 'pipeline-arc-verify.md': '090920d816beef8dfc12ee6152511456',
+ 'pipeline-volume-verify.md': '6f9b4ba4d9dd9a51a1032c7f0ca90405',
};
const { applyMigration, up } = makePromptReplaceMigration({
diff --git a/scripts/migrations/276-distinct-climax-arc-role-prompts.js b/scripts/migrations/276-distinct-climax-arc-role-prompts.js
index dfdc35aa24..0aa3569a07 100644
--- a/scripts/migrations/276-distinct-climax-arc-role-prompts.js
+++ b/scripts/migrations/276-distinct-climax-arc-role-prompts.js
@@ -14,9 +14,9 @@ export const ACCEPTED_OLD_MD5 = {
};
export const NEW_SHIPPED_MD5 = {
- 'pipeline-season-episodes.md': '7c24df53c097c2525a52bfb766239647',
+ 'pipeline-season-episodes.md': 'b3fc07d785599b5a4859af8bed3c1d4e',
'pipeline-idea-expansion.md': 'a032e4a724251ed3e3495d33c4dbab8e',
- 'pipeline-arc-verify.md': 'f09e81655ec897c74a2fae68ad31b9c4',
+ 'pipeline-arc-verify.md': '090920d816beef8dfc12ee6152511456',
'importer-issue-proposal.md': '9ba2ff965fba61efb85a3568bb530055',
};
diff --git a/scripts/migrations/378-arc-countdown-repair.js b/scripts/migrations/378-arc-countdown-repair.js
index 89d00697cb..482efd8fe2 100644
--- a/scripts/migrations/378-arc-countdown-repair.js
+++ b/scripts/migrations/378-arc-countdown-repair.js
@@ -1,6 +1,6 @@
import { makePromptReplaceMigration } from './_lib.js';
export const ACCEPTED_OLD_MD5 = { 'pipeline-arc-resolve.md': ['638b988c84b3e5599f7a2ce09fa149ce'] };
-export const NEW_SHIPPED_MD5 = { 'pipeline-arc-resolve.md': '56926d795bd31f7e05e6bbbc646ecf9f' };
+export const NEW_SHIPPED_MD5 = { 'pipeline-arc-resolve.md': '5fb659e459a296b7d378d7711f4b78cd' };
const { applyMigration, up } = makePromptReplaceMigration({
accepted: ACCEPTED_OLD_MD5, current: NEW_SHIPPED_MD5, label: 'Arc countdown repair',
customizedHint: () => ' Merge the countdown metadata and sparse reminder-ID repair contract from data.reference/prompts/stages/pipeline-arc-resolve.md into your customized prompt.',
diff --git a/scripts/migrations/379-arc-episode-metadata-repair.js b/scripts/migrations/379-arc-episode-metadata-repair.js
index a67fa25567..159a2a1839 100644
--- a/scripts/migrations/379-arc-episode-metadata-repair.js
+++ b/scripts/migrations/379-arc-episode-metadata-repair.js
@@ -1,6 +1,6 @@
import { makePromptReplaceMigration } from './_lib.js';
export const ACCEPTED_OLD_MD5 = { 'pipeline-arc-resolve.md': ['122950b9f5ce84708ac1510ef13b1bce'] };
-export const NEW_SHIPPED_MD5 = { 'pipeline-arc-resolve.md': '56926d795bd31f7e05e6bbbc646ecf9f' };
+export const NEW_SHIPPED_MD5 = { 'pipeline-arc-resolve.md': '5fb659e459a296b7d378d7711f4b78cd' };
const { applyMigration, up } = makePromptReplaceMigration({
accepted: ACCEPTED_OLD_MD5, current: NEW_SHIPPED_MD5, label: 'Arc episode metadata repair',
customizedHint: () => ' Merge the sparse episode role and length repair contract from data.reference/prompts/stages/pipeline-arc-resolve.md into your customized prompt.',
diff --git a/scripts/migrations/380-arc-spine-existing-plans.js b/scripts/migrations/380-arc-spine-existing-plans.js
index e9cee185d6..810a516c45 100644
--- a/scripts/migrations/380-arc-spine-existing-plans.js
+++ b/scripts/migrations/380-arc-spine-existing-plans.js
@@ -1,6 +1,6 @@
import { makePromptReplaceMigration } from './_lib.js';
export const ACCEPTED_OLD_MD5 = {"pipeline-arc-resolve.md": ["3f5ef41212890889811e4509a131c4e9"], "pipeline-arc-verify.md": ["4b60a322e35b536405d0fbf543580562"]};
-export const NEW_SHIPPED_MD5 = {"pipeline-arc-resolve.md": "56926d795bd31f7e05e6bbbc646ecf9f", "pipeline-arc-verify.md": "f09e81655ec897c74a2fae68ad31b9c4"};
+export const NEW_SHIPPED_MD5 = {"pipeline-arc-resolve.md": "5fb659e459a296b7d378d7711f4b78cd", "pipeline-arc-verify.md": "090920d816beef8dfc12ee6152511456"};
const { applyMigration, up } = makePromptReplaceMigration({
accepted: ACCEPTED_OLD_MD5, current: NEW_SHIPPED_MD5, label: 'Arc spine existing issue references',
customizedHint: () => ' Merge the arcSpineHasEpisodePlans / spineEpisodePlansJson read-only reference block from the shipped arc verify and resolve templates.',
diff --git a/scripts/migrations/383-pipeline-series-design.js b/scripts/migrations/383-pipeline-series-design.js
new file mode 100644
index 0000000000..628b10ac23
--- /dev/null
+++ b/scripts/migrations/383-pipeline-series-design.js
@@ -0,0 +1,31 @@
+import { makePromptReplaceMigration } from './_lib.js';
+export const ACCEPTED_OLD_MD5 = {
+ "pipeline-arc-overview.md": [
+ "5ed760caaf3cf88916ec28b220e2f590"
+ ],
+ "pipeline-season-episodes.md": [
+ "7c24df53c097c2525a52bfb766239647"
+ ],
+ "pipeline-arc-verify.md": [
+ "f09e81655ec897c74a2fae68ad31b9c4"
+ ],
+ "pipeline-volume-verify.md": [
+ "9c0839d7fe1760c0891464afd4a3b8fd"
+ ],
+ "pipeline-arc-resolve.md": [
+ "56926d795bd31f7e05e6bbbc646ecf9f"
+ ]
+};
+export const NEW_SHIPPED_MD5 = {
+ "pipeline-arc-overview.md": "901557b9f146a2d279ce2e81bda24d73",
+ "pipeline-season-episodes.md": "b3fc07d785599b5a4859af8bed3c1d4e",
+ "pipeline-arc-verify.md": "090920d816beef8dfc12ee6152511456",
+ "pipeline-volume-verify.md": "6f9b4ba4d9dd9a51a1032c7f0ca90405",
+ "pipeline-arc-resolve.md": "5fb659e459a296b7d378d7711f4b78cd"
+};
+const { applyMigration, up } = makePromptReplaceMigration({
+ accepted: ACCEPTED_OLD_MD5, current: NEW_SHIPPED_MD5, label: 'Pipeline series design',
+ customizedHint: filename => ` Merge the series-design guidance from data.reference/prompts/stages/${filename} into your customized prompt.`,
+});
+export { applyMigration };
+export default { up };
diff --git a/scripts/migrations/383-pipeline-series-design.test.js b/scripts/migrations/383-pipeline-series-design.test.js
new file mode 100644
index 0000000000..bba1e696ec
--- /dev/null
+++ b/scripts/migrations/383-pipeline-series-design.test.js
@@ -0,0 +1,6 @@
+import { describe } from 'vitest';
+import { runPromptMigrationTests } from './_testHelpers.js';
+import migration, { applyMigration, ACCEPTED_OLD_MD5, NEW_SHIPPED_MD5 } from './383-pipeline-series-design.js';
+describe('migration 383 — pipeline series design', () => {
+ runPromptMigrationTests({ migration, applyMigration, ACCEPTED_OLD_MD5, NEW_SHIPPED_MD5, prefix: 'migration-383-' });
+});
diff --git a/scripts/setup-data-drift.test.js b/scripts/setup-data-drift.test.js
index 934bbbf6a3..94a1388057 100644
--- a/scripts/setup-data-drift.test.js
+++ b/scripts/setup-data-drift.test.js
@@ -30,12 +30,12 @@ const EXPECTED_STAGE_OLD = {
'writers-room-continue.md': ['93bfe80543ceca39842201a78b8393fa', '67663696c97ebaeb23de25f7410cfdd4'],
'pipeline-comic-script.md': ['133d200d069c2e8173b7c129eea58f53', '1e0af305c27d0c80c4b482d2ebcb4a0d', '40e5fdc1a1e68a7419b7dad936366c1a', '7c05ecde539f04c9fa91e87543057204', 'a4303016c34b65e4b0e641fe71252de3', 'beab031951859ca13579cdb9c4dbe769', 'dea7d497d1cb38e7574f236f4ff8e644', 'e530fc76b89cedaef848ad7ec99c934c', 'e9ee70bf18888492edada6633cd9928a'],
'pipeline-teleplay.md': ['1280ef6b1ad68fa44070ca7478ec2a5f', '2568e14beaa574d43f8018a5def51d04', '376f779f4687b598f1c92ca4e770fd5a', '3f6fecc25573ed054b47db392250034a', 'afa4215330bf856429d70d7e2f856605'],
- 'pipeline-season-episodes.md': ['6e349ad26bed8a0ccb042571f03f03eb', 'c4928e2a5f833358116b29d2d669888d', '50c68a29c3ebc275db3095d06bd87100', 'a88e8e78a949b7aaf500d03314e2ea0b'],
- 'pipeline-arc-overview.md': ['6a3ecab43d1f46b7ef9aab6c69ea0326', 'd34d72b8e49ba303d38607845dd87f1c', '0a1f6ffa6908522e3690c5e9e53a6ee0', '612f8b04950e2ff26dd350dd76a062fe', '74d6c26548660d85fc345b2099c63b6c', '648e11352cd1565aee490de1f662bef0'],
- 'pipeline-arc-verify.md': ['4b60a322e35b536405d0fbf543580562', '52e31abc93e3105176236fcaa5d1575a', 'ff56d8387162017e08d5d0491060ddd6', '36aa70cdfc25d7549573a4d556e7702c', '83347e7d923580a3062033ab39b3c14b', '68f6956d7e09ebdb3870d8726b1b2a7a', '9f32e91bd33b97d30e1cbb2e697f4fc3', '90712f66ec68061ebed2147044e5baee', 'a397f158fd9c0dca1c8dbe62df253f70'],
+ 'pipeline-season-episodes.md': ['6e349ad26bed8a0ccb042571f03f03eb', 'c4928e2a5f833358116b29d2d669888d', '50c68a29c3ebc275db3095d06bd87100', 'a88e8e78a949b7aaf500d03314e2ea0b', '7c24df53c097c2525a52bfb766239647'],
+ 'pipeline-arc-overview.md': ['6a3ecab43d1f46b7ef9aab6c69ea0326', 'd34d72b8e49ba303d38607845dd87f1c', '0a1f6ffa6908522e3690c5e9e53a6ee0', '612f8b04950e2ff26dd350dd76a062fe', '74d6c26548660d85fc345b2099c63b6c', '648e11352cd1565aee490de1f662bef0', '5ed760caaf3cf88916ec28b220e2f590'],
+ 'pipeline-arc-verify.md': ['4b60a322e35b536405d0fbf543580562', '52e31abc93e3105176236fcaa5d1575a', 'ff56d8387162017e08d5d0491060ddd6', '36aa70cdfc25d7549573a4d556e7702c', '83347e7d923580a3062033ab39b3c14b', '68f6956d7e09ebdb3870d8726b1b2a7a', '9f32e91bd33b97d30e1cbb2e697f4fc3', '90712f66ec68061ebed2147044e5baee', 'a397f158fd9c0dca1c8dbe62df253f70', 'f09e81655ec897c74a2fae68ad31b9c4'],
'importer-issue-proposal.md': ['a6838832f8289932836db84ee565b870'],
- 'pipeline-volume-verify.md': ['03f3c874cb80e1c98abcf03168fa7a92', 'c6ea28e972ad6e229bafb2d602b4dda3', '49458d36700cb94e34806d536ffe2940', '3e8a8f00d5faaee9d8e08a49d801b812'],
- 'pipeline-arc-resolve.md': ['3f5ef41212890889811e4509a131c4e9', '122950b9f5ce84708ac1510ef13b1bce', '0611db539437083621e19bb88b005e8d', '0787128babf3c4c50e2f2cdb60214030', '5b340885c6e8f8afc63424d6b5bc7eb7', '87bc5c01f1a8a97b681727a38b05edc6', '8bb134554c122d1583c479ab3010e53d', '8e348f3d1894382889f9f0ee7d5c6792', '96f73a7e90526d65ef2bb100fb1cd4bf', 'a8677bbe1eb38f871fb152a5b0fec7c6', 'cc27b4da1d1a13c35e35d1c2d6183815', '31eca76b68f40de1b93734fe9bc9f4bb', '17fbb066d7957dc2e345df1795bb0d9d', 'ebd85d3a0b5949f16877c25ca498cce9', '2349bce80e9df8caafa391a6106327b6', 'aa2e463ebe0857859d79aa0c6ccb0256', '638b988c84b3e5599f7a2ce09fa149ce'],
+ 'pipeline-volume-verify.md': ['03f3c874cb80e1c98abcf03168fa7a92', 'c6ea28e972ad6e229bafb2d602b4dda3', '49458d36700cb94e34806d536ffe2940', '3e8a8f00d5faaee9d8e08a49d801b812', '9c0839d7fe1760c0891464afd4a3b8fd'],
+ 'pipeline-arc-resolve.md': ['3f5ef41212890889811e4509a131c4e9', '122950b9f5ce84708ac1510ef13b1bce', '0611db539437083621e19bb88b005e8d', '0787128babf3c4c50e2f2cdb60214030', '5b340885c6e8f8afc63424d6b5bc7eb7', '87bc5c01f1a8a97b681727a38b05edc6', '8bb134554c122d1583c479ab3010e53d', '8e348f3d1894382889f9f0ee7d5c6792', '96f73a7e90526d65ef2bb100fb1cd4bf', 'a8677bbe1eb38f871fb152a5b0fec7c6', 'cc27b4da1d1a13c35e35d1c2d6183815', '31eca76b68f40de1b93734fe9bc9f4bb', '17fbb066d7957dc2e345df1795bb0d9d', 'ebd85d3a0b5949f16877c25ca498cce9', '2349bce80e9df8caafa391a6106327b6', 'aa2e463ebe0857859d79aa0c6ccb0256', '638b988c84b3e5599f7a2ce09fa149ce', '56926d795bd31f7e05e6bbbc646ecf9f'],
'pipeline-script-verify.md': ['ed6c8101644cfe56a100eb6bfe3587f3'],
'pipeline-extract-scenes.md': ['59fa5ee305ce53d91eb15224d8b546d3', 'c51fb208568d0d903eb43b437478b0ba'],
'writers-room-places.md': ['24a33628cc94d80fa5ca60831d973daf', '7f1f80eb63d67a21161994cde115045e'],
@@ -84,12 +84,12 @@ const EXPECTED_STAGE_NEW = {
'writers-room-continue.md': '458dc5ff4732befc1fb90890bdc885c2',
'pipeline-comic-script.md': '49af30c05f008b20f6998a0f113f7d87',
'pipeline-teleplay.md': '2ea9974ac3803658b2314db1f5818b77',
- 'pipeline-season-episodes.md': '7c24df53c097c2525a52bfb766239647',
- 'pipeline-arc-overview.md': '5ed760caaf3cf88916ec28b220e2f590',
- 'pipeline-arc-verify.md': 'f09e81655ec897c74a2fae68ad31b9c4',
+ 'pipeline-season-episodes.md': 'b3fc07d785599b5a4859af8bed3c1d4e',
+ 'pipeline-arc-overview.md': '901557b9f146a2d279ce2e81bda24d73',
+ 'pipeline-arc-verify.md': '090920d816beef8dfc12ee6152511456',
'importer-issue-proposal.md': '9ba2ff965fba61efb85a3568bb530055',
- 'pipeline-volume-verify.md': '9c0839d7fe1760c0891464afd4a3b8fd',
- 'pipeline-arc-resolve.md': '56926d795bd31f7e05e6bbbc646ecf9f',
+ 'pipeline-volume-verify.md': '6f9b4ba4d9dd9a51a1032c7f0ca90405',
+ 'pipeline-arc-resolve.md': '5fb659e459a296b7d378d7711f4b78cd',
'pipeline-script-verify.md': '722c62462d05462603cf67ca0ed1dee8',
'pipeline-extract-scenes.md': '9f404b0c4721b23932a6d2dcfc1fba43',
'writers-room-places.md': 'a7f68e51dd6b4421d20f5bd9d855d9b4',
diff --git a/server/lib/README.md b/server/lib/README.md
index aca5082e4f..e8efd646b5 100644
--- a/server/lib/README.md
+++ b/server/lib/README.md
@@ -129,8 +129,8 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub
| `characterIntegrity.js` | The shared cast-integrity contract (#6415), stated in `characterIntegrityVocabulary.js`'s terms: `characterIntegrityDepth` (minor roles / flat arcs / an explained `unknown` psychology get lighter requirements), the no-provider `characterCompletenessFindings` / `buildCastIntegrityReport`, the validating `mergeSemanticFindings`, and `characterFingerprint` (reports are derived, never persisted — the fingerprint is what makes a stale one detectable). |
| `castIntegrityPrompt.js` | The prompt-facing render of a `characterIntegrity.js` report (#6415): `renderCastIntegrity` (gap rows first, header always kept, so a budget-truncated block can never read as a clean cast) and `INTEGRITY_DEPTH_NOTES` (the `explained` / `light` / `full` rulings in the reviewer's own words). Shared by the Series foundation judge and the FableLoom whole-series editor so the two cannot drift on what a `light` character owes. |
| `bibleLimits.js` | `BIBLE_LIMITS` — the canon field length/count caps every story-bible sanitizer, Zod schema, and catalog payload upgrade measures against. A pure leaf split out of `storyBible.js` (which pulls `crypto` + `fileUtils`) so `catalogTypes.js` and the browser bundle can read the numbers alone. |
-| `storyArc.js` | Canonical Arc + Season + Reader-Map shapes for pipeline arc planning. |
-| `storyArcLimits.js` | Pure canonical length and count caps shared by story arc sanitizers and browser previews. |
+| `storyArc.js` | Canonical Arc + Season + Reader-Map shapes, plus sanitizeSeriesDesign/renderSeriesDesign for author-owned series intent. |
+| `storyArcLimits.js` | Pure canonical length/count caps and series-design field/mode contract shared by sanitizers, schemas and browser editors. |
| `styleGuide.js` | Per-series house style (tense/POV/audience/rating/reading-level/tone/conventions): `sanitizeStyleGuide` + `renderStyleGuide` generation block + enums. |
| `storyBuilderSteps.js` | Unified Story Builder ordered step definitions + helpers (`STEPS`, `STEP_IDS`, `STEP_STATUSES`, `isValidStepId`, `stepIndex`). |
| `streamLines.js` | `createLineReader(onLine, {splitRe?, maxCarry?})` + `createOutputTail({budget?})` — buffered chunk→line splitter for child-process stdout/stderr. Carries the partial trailing line across `data` chunks and `flush()`es the final unterminated line on `close`; carry clamp guards a newline-less runaway stream. One reader per stream (a shared buffer corrupts marker lines). `splitRe: /[\r\n]+/` handles torch/tqdm bare-`\r` progress redraws. `createOutputTail` is the sibling rolling buffer of recent lines (char-budgeted, decoration-only lines skipped so an ASCII-art banner cannot push the real error out) that turns "exited with code 1" into what the tool actually printed — used by `streamingSpawn.js`. |
diff --git a/server/lib/schemaVersions.js b/server/lib/schemaVersions.js
index dbd76634a9..181b3e3b00 100644
--- a/server/lib/schemaVersions.js
+++ b/server/lib/schemaVersions.js
@@ -194,7 +194,8 @@ export const PORTOS_SCHEMA_VERSIONS = Object.freeze({
// a wholly-absent `characterArcs`, not a present-but-sub-field-stripped
// one). Bump makes the older peer reject the ahead-version series transfer
// instead. Per-category gate → only series sync pauses with old peers.
- pipelineSeries: 13,
+ // v14: author-owned arc.seriesDesign; older sanitizers must not erase it.
+ pipelineSeries: 14,
// NOT bumped for the manuscript-review sibling doc now bundled on series
// pushes/exports (`data/pipeline-series/{id}/manuscript-review.json`).
// Unlike `readerMap` (v2), the review is NOT a field inside the series
diff --git a/server/lib/schemaVersions.test.js b/server/lib/schemaVersions.test.js
index e1d1b9d7f9..ac38168cf2 100644
--- a/server/lib/schemaVersions.test.js
+++ b/server/lib/schemaVersions.test.js
@@ -30,13 +30,13 @@ describe('PORTOS_SCHEMA_VERSIONS', () => {
it('declares pipeline collection layout versions', () => {
// pipelineIssues v3 adds the independently persisted climax arc role.
expect(PORTOS_SCHEMA_VERSIONS.pipelineIssues).toBe(3);
- // pipelineSeries bumped to 13 when characterArcs[].evolution was added
+ // pipelineSeries bumped to 14 for authored arc.seriesDesign; v13 added characterArcs[].evolution
// (#6440) (v2 = readerMap, v3 = tickingClock, v4 = styleGuide,
// v5 = coverImage, v6 = characterArcs, v7 = factCritical + factReference,
// v8 = editorialCheckConfig, v9 = severityWeights + blockingSeverities,
// v10 = arc.foreshadowing, v11 = styleGuide.voiceExemplars +
// voiceAntiExemplars, v12 = exportSettings).
- expect(PORTOS_SCHEMA_VERSIONS.pipelineSeries).toBe(13);
+ expect(PORTOS_SCHEMA_VERSIONS.pipelineSeries).toBe(14);
});
it('declares mediaCollections layout version', () => {
@@ -62,7 +62,7 @@ describe('buildPortosMeta', () => {
expect(meta.portosVersion).toMatch(/^\d+\.\d+\.\d+/);
expect(meta.schemaVersions.universes).toBe(11);
expect(meta.schemaVersions.pipelineIssues).toBe(3);
- expect(meta.schemaVersions.pipelineSeries).toBe(13);
+ expect(meta.schemaVersions.pipelineSeries).toBe(14);
});
it('overrides merge into schemaVersions', async () => {
diff --git a/server/lib/sharedSchemas.js b/server/lib/sharedSchemas.js
index b29dd5b670..8aa571d315 100644
--- a/server/lib/sharedSchemas.js
+++ b/server/lib/sharedSchemas.js
@@ -1,4 +1,6 @@
import { z } from 'zod';
+import { SERIES_DESIGN_MODES, SERIES_DESIGN_TEXT_MAX, SERIES_DESIGN_FIELDS } from './storyArcLimits.js';
+
import { RENDER_TARGET_BACKEND_AUTO, RECORD_RENDER_MODEL_MAX } from './renderTargets.js';
import { QUEUEABLE_IMAGE_MODES } from './generationModes.js';
import { GROK_VIDEO_DURATIONS } from './grokVideoClip.js';
@@ -21,6 +23,11 @@ import { GROK_VIDEO_DURATIONS } from './grokVideoClip.js';
* zodCompat from accumulating imports on renderTargets/imageGen/grok modules.
*/
+// Optional author-owned story intent, shared by Pipeline and other story consumers.
+export const seriesDesignSchema = z.object({
+ mode: z.enum(SERIES_DESIGN_MODES),
+ ...Object.fromEntries(Object.keys(SERIES_DESIGN_FIELDS).map((field) => [field, z.string().trim().max(SERIES_DESIGN_TEXT_MAX).optional()])),
+});
// Clip lengths grok's image_to_video delivers, as a Zod union built from the
// single shared list (see grokVideoClip.js). `z.literal` per value rather than
// `z.number().refine()` keeps the "expected 6 | 10" error message the
diff --git a/server/lib/storyArc.js b/server/lib/storyArc.js
index a183df8267..d3457f636e 100644
--- a/server/lib/storyArc.js
+++ b/server/lib/storyArc.js
@@ -18,7 +18,7 @@
import { randomUUID } from 'crypto';
import { sanitizeCoverLike } from './renderSlot.js';
-import { ARC_LIMITS } from './storyArcLimits.js';
+import { ARC_LIMITS, SERIES_DESIGN_MODES, SERIES_DESIGN_TEXT_MAX, SERIES_DESIGN_FIELDS } from './storyArcLimits.js';
import { isStr, trimTo, trimToClause } from './textUtils.js';
export { ARC_LIMITS } from './storyArcLimits.js';
@@ -466,6 +466,31 @@ export function sanitizeForeshadowing(raw) {
return out;
}
+/** Normalize only author-supplied intent; legacy arcs acquire no invented brief. */
+export function sanitizeSeriesDesign(raw) {
+ if (!raw || !SERIES_DESIGN_MODES.includes(raw.mode)) return null;
+ return {
+ mode: raw.mode,
+ ...Object.fromEntries(Object.keys(SERIES_DESIGN_FIELDS).map((field) => [field, trimTo(raw[field], SERIES_DESIGN_TEXT_MAX)])),
+ };
+}
+
+/** Read-only authored intent shared by planning, verification and other story consumers. */
+export function renderSeriesDesign(raw) {
+ const design = sanitizeSeriesDesign(raw);
+ if (!design) return '';
+ return [
+ 'Series design (author-owned; do not rewrite this brief):',
+ `Mode: ${design.mode}`,
+ ...Object.entries(SERIES_DESIGN_FIELDS).filter(([field]) => design[field]).map(([field, label]) => `${label}: ${design[field]}`),
+ design.mode === 'finite'
+ ? 'Evaluate causal progress toward the declared ending and whether that ending is earned. Do not demand more seasons after the intended conclusion.'
+ : 'Evaluate recognizable recurring activity, variation in episode problems and outcomes, and whether declared continuing tensions are exhausted prematurely.',
+ 'Use only the supplied story material. Name existing episodes as evidence for concrete contradictions and return them through the existing actionable findings contract. Missing detail or uncertainty alone is not a finding; at spine-only scope do not invent episode evidence. An intentional one-off or breather can serve the series without matching every pattern.',
+ 'Preserve the configured issue count, reader map and emotional shape. Do not require sample episodes, future-season quotas, a prescribed act count, or forced character transformation. Repair the plan, never the authored brief.',
+ ].join('\n');
+}
+
/**
* Sanitize the optional `series.arc` field. Returns `null` if the input is
* empty (no identifying fields) — callers store `null` to mean "no arc yet."
@@ -497,9 +522,10 @@ export function sanitizeArc(raw) {
// The foreshadowing ledger is identifying content too — an arc whose only
// authored content is a set of planted seeds must survive.
const foreshadowing = sanitizeForeshadowing(raw.foreshadowing);
- if (!logline && !summary && !protagonistArc && themes.length === 0 && !shape && !readerMap && !tickingClock && foreshadowing.length === 0) return null;
+ const seriesDesign = sanitizeSeriesDesign(raw.seriesDesign);
+ if (!logline && !summary && !protagonistArc && themes.length === 0 && !shape && !readerMap && !tickingClock && foreshadowing.length === 0 && !seriesDesign) return null;
const status = ARC_STATUSES.includes(raw.status) ? raw.status : 'draft';
- return { logline, summary, protagonistArc, themes, shape, readerMap, tickingClock, foreshadowing, status };
+ return { logline, summary, protagonistArc, themes, shape, readerMap, tickingClock, foreshadowing, ...(seriesDesign ? { seriesDesign } : {}), status };
}
/**
diff --git a/server/lib/storyArcLimits.js b/server/lib/storyArcLimits.js
index 6cb142dba9..b8bfb09ade 100644
--- a/server/lib/storyArcLimits.js
+++ b/server/lib/storyArcLimits.js
@@ -27,3 +27,14 @@ export const ARC_LIMITS = Object.freeze({
EPISODE_LOGLINE_MAX: 500,
EPISODE_SYNOPSIS_MAX: 4000,
});
+
+// Shared authoring contract, also consumed by the Arc Canvas and API schema.
+export const SERIES_DESIGN_MODES = Object.freeze(['finite', 'renewable']);
+export const SERIES_DESIGN_TEXT_MAX = 1000;
+export const SERIES_DESIGN_FIELDS = Object.freeze({
+ episodeActivity: 'Episode activity',
+ conflictSource: 'Conflict source',
+ audiencePromise: 'Audience promise',
+ continuingTensions: 'Continuing tensions',
+ endingCondition: 'Ending condition',
+});
diff --git a/server/routes/pipeline.test.js b/server/routes/pipeline.test.js
index 3776e8254c..e7661eaece 100644
--- a/server/routes/pipeline.test.js
+++ b/server/routes/pipeline.test.js
@@ -654,6 +654,26 @@ describe('pipeline routes', () => {
expect(r.status).toBe(404);
});
+ it('round-trips an authored series design, validates its shape, preserves omission and honors clear and lock', async () => {
+ const app = makeApp();
+ const brief = { mode: 'finite', endingCondition: 'Solve the central case.', episodeActivity: '' };
+ const created = await request(app).post('/api/pipeline/series').send({ name: 'The Case', universeId: 'u-test', arc: { seriesDesign: brief } });
+ expect(created.status).toBe(201);
+ const url = `/api/pipeline/series/${created.body.id}`;
+ expect((await request(app).get(url)).body.arc.seriesDesign).toMatchObject(brief);
+ const edited = await request(app).patch(url).send({ arc: { logline: 'A finite investigation.' } });
+ expect(edited.body.arc.seriesDesign).toMatchObject(brief);
+ expect((await request(app).patch(url).send({ arc: { seriesDesign: { mode: 'infinite' } } })).status).toBe(400);
+ expect((await request(app).patch(url).send({ arc: { seriesDesign: { ...brief, conflictSource: 'x'.repeat(1001) } } })).status).toBe(400);
+ await request(app).patch(url).send({ locked: { arc: true } });
+ expect((await request(app).patch(url).send({ arc: { seriesDesign: null } })).status).toBe(400);
+ await request(app).patch(url).send({ locked: { arc: false } });
+ const cleared = await request(app).patch(url).send({ arc: { logline: 'Kept', seriesDesign: null } });
+ expect(cleared.status).toBe(200);
+ expect(cleared.body.arc.seriesDesign).toBeUndefined();
+ expect(cleared.body.arc.logline).toBe('Kept');
+ });
+
it('PATCH /series/:id preserves arc.readerMap through the route schema (no key-strip)', async () => {
// Regression: arcSchema must list readerMap, or Zod strips it and the
// wholesale arc replace in updateSeries silently wipes the user's map.
diff --git a/server/routes/pipeline/series.js b/server/routes/pipeline/series.js
index 1b2005f5a1..54fc18505b 100644
--- a/server/routes/pipeline/series.js
+++ b/server/routes/pipeline/series.js
@@ -10,7 +10,7 @@ import { asyncHandler, ServerError } from '../../lib/errorHandler.js';
import {
validateRequest, optionalBooleanMap, llmSchema, isPaginationRequested, paginateArray,
} from '../../lib/validation.js';
-import { recordRenderPinFields } from '../../lib/sharedSchemas.js';
+import { recordRenderPinFields, seriesDesignSchema } from '../../lib/sharedSchemas.js';
import { characterEvolutionSchema } from '../../lib/characterEvolutionValidation.js';
import * as seriesSvc from '../../services/pipeline/series.js';
import { TRIM_SIZES, INTERIOR_FONTS } from '../../lib/proseExportSettings.js';
@@ -55,6 +55,7 @@ const router = Router();
// record itself; seasons get their own resource so the route layer can take
// per-record CRUD without forcing the caller to PATCH the whole series.
const arcSchema = z.object({
+ seriesDesign: seriesDesignSchema.nullable().optional(),
logline: z.string().trim().max(ARC_LIMITS.LOGLINE_MAX).optional().default(''),
summary: z.string().trim().max(ARC_LIMITS.SUMMARY_MAX).optional().default(''),
protagonistArc: z.string().trim().max(ARC_LIMITS.PROTAGONIST_ARC_MAX).optional().default(''),
diff --git a/server/services/pipeline/arcPlanner.test.js b/server/services/pipeline/arcPlanner.test.js
index 3030c34778..223c8b9c43 100644
--- a/server/services/pipeline/arcPlanner.test.js
+++ b/server/services/pipeline/arcPlanner.test.js
@@ -59,6 +59,52 @@ describe('arcPlanner — generateArcOverview', () => {
stageRunnerSpy = undefined;
});
+ it.each([
+ { mode: 'finite', episodeActivity: 'Investigate the case.', endingCondition: 'Solve the central case.' },
+ { mode: 'renewable', episodeActivity: 'Repair a different neighborhood machine.', continuingTensions: 'The crew disagree about risk.' },
+ null,
+ ])('carries saved design through planning, reviews, model rewrites and rollback: %j', async (seriesDesign) => {
+ const series = await setupSeries({ arc: { logline: 'Spine', shape: 'man-in-hole', seriesDesign, readerMap: { hooks: [{ label: 'What will the crew discover?' }] } }, seasons: [{ number: 1, title: 'First jobs', synopsis: 'The crew handles its first cases.', episodeCountTarget: 2 }] });
+ const saved = series.arc.seriesDesign;
+ stageRunnerSpy = vi.fn(async () => ({ content: { logline: 'New spine', summary: 'Progress', seriesDesign: { mode: 'finite', endingCondition: 'AI overwrite' }, episodes: [{ number: 1, title: 'Broken pump', synopsis: 'The crew fixes a pump.' }], issues: [], edits: {}, changes: [], rationale: '' }, runId: 'r', providerId: 'p', model: 'm' }));
+ const overview = await planner.generateArcOverview(series.id);
+ expect(overview.arc.seriesDesign).toEqual(saved);
+ const refine = await planner.refineArc(series.id, 'Tighten the spine.');
+ expect(refine.arc.seriesDesign).toEqual(saved);
+ await planner.generateSeasonEpisodes(series.id, series.seasons[0].id);
+ await planner.verifyArc(series.id);
+ await planner.verifyVolume(series.id, series.seasons[0].id);
+ await planner.resolveVerifyIssues(series.id, { findings: [{ severity: 'medium', problem: 'Clarify the episode connection.', suggestion: 'Connect the existing episodes.' }] });
+ for (const [, context] of stageRunnerSpy.mock.calls) {
+ if (saved) {
+ expect(context.shapeGuidance).toContain(`Mode: ${saved.mode}`);
+ expect(context.shapeGuidance).toContain(saved.episodeActivity);
+ } else expect(context.shapeGuidance).not.toContain('Series design (author-owned');
+ }
+ const snapshot = await planner.snapshotArcState(series.id);
+ await planner.commitSeasonsWithRemap(series, { arc: { ...overview.arc, seriesDesign: { mode: 'finite', endingCondition: 'AI overwrite' } }, seasons: series.seasons });
+ await planner.restoreArcState(series.id, snapshot);
+ const restored = await seriesSvc.getSeries(series.id);
+ expect(restored.arc.seriesDesign).toEqual(saved);
+ expect(restored.arc.readerMap).toEqual(series.arc.readerMap);
+ expect(restored.arc.shape).toBe('man-in-hole');
+ expect(restored.issueCountTarget).toBe(24);
+ });
+
+ it('keeps a later author edit through a stale generation commit and resolver snapshot restoration', async () => {
+ const series = await setupSeries({ arc: { logline: 'Before', seriesDesign: { mode: 'renewable' } } });
+ const snapshot = await planner.snapshotArcState(series.id);
+ const authored = await seriesSvc.updateSeries(series.id, { arc: { ...series.arc, seriesDesign: { mode: 'finite', endingCondition: 'Solve the case.' } } });
+ await planner.commitSeasonsWithRemap(series, { arc: { ...series.arc, summary: 'Generated summary' }, seasons: [] });
+ expect((await seriesSvc.getSeries(series.id)).arc.seriesDesign).toEqual(authored.arc.seriesDesign);
+ await seriesSvc.updateSeries(series.id, { locked: { arc: true } });
+ await planner.restoreArcState(series.id, snapshot);
+ const restored = await seriesSvc.getSeries(series.id);
+ expect(restored.arc.seriesDesign).toEqual(authored.arc.seriesDesign);
+ expect(restored.locked.arc).toBe(true);
+ expect(restored.arc.summary).toBe('');
+ });
+
it('runs the prompt and returns sanitized arc + seasons preview', async () => {
const s = await setupSeries({ targetFormat: 'tv' });
stageRunnerSpy = vi.fn(async () => ({
diff --git a/server/services/pipeline/arcPlanner/arcCore.js b/server/services/pipeline/arcPlanner/arcCore.js
index 42efc6ab11..8bb927fbbb 100644
--- a/server/services/pipeline/arcPlanner/arcCore.js
+++ b/server/services/pipeline/arcPlanner/arcCore.js
@@ -58,6 +58,7 @@ export async function generateArcOverview(seriesId, options = {}) {
// The arc-overview prompt doesn't author the reader map — preserve any
// existing one (like `shape`) so regenerating the arc never silently wipes
// a reader map the user already built on the next step.
+ seriesDesign: series.arc?.seriesDesign ?? null,
readerMap: series.arc?.readerMap ?? null,
// Same for the ticking clock — the overview prompt doesn't author it, so
// preserve any existing countdown across a regenerate.
@@ -234,6 +235,7 @@ export async function refineArc(seriesId, feedback, options = {}) {
protagonistArc: refinedStr(content.protagonistArc, arc.protagonistArc),
themes: refinedThemes,
shape: arc.shape ?? null,
+ seriesDesign: arc.seriesDesign ?? null,
readerMap: arc.readerMap ?? null,
// The arc-refine prompt edits the narrative fields only — preserve the
// ticking clock (like readerMap/shape) so a refine never wipes it.
@@ -899,6 +901,7 @@ export async function resolveVerifyIssues(seriesId, options = {}) {
// The resolve prompt doesn't author the reader map — preserve any existing
// one so auto-resolve never silently wipes a reader map the user already
// built on the next step. Mirrors `generateArcOverview` above.
+ seriesDesign: series.arc?.seriesDesign ?? null,
readerMap: series.arc?.readerMap ?? null,
// A sparse repair can move existing countdown beats without replacing them.
tickingClock: mergeTickingClockPatch(series.arc?.tickingClock, edits.arc?.tickingClock).value ?? null,
@@ -1317,7 +1320,7 @@ export async function restoreArcState(seriesId, snapshot, { episodeEdits = null
// `series.seasons[]`.
await withReexportSuppressed('series', seriesId, async () => {
await updateSeries(seriesId, {
- arc: snapshot.arc,
+ arc: { ...snapshot.arc, seriesDesign: (await getSeries(seriesId)).arc?.seriesDesign ?? null },
seasons: snapshot.seasons,
...(Array.isArray(snapshot.characterArcs) ? { characterArcs: snapshot.characterArcs } : {}),
});
@@ -1622,7 +1625,7 @@ export async function commitSeasonsWithRemap(currentSeries, { arc, seasons }, op
{ status: 400, code: ERR_VALIDATION },
);
}
- const mergedArc = mergeArcWithLocks(latestSeries.arc, arc, latestSeries.locked?.arcFields);
+ const mergedArc = mergeArcWithLocks(latestSeries.arc, { ...arc, seriesDesign: latestSeries.arc?.seriesDesign ?? null }, latestSeries.locked?.arcFields);
// Per-season locks: restore any locked existing seasons over LLM-proposed
// rewrites, and re-insert any locked seasons the LLM dropped. Re-sanitize
// so the locked records merge with the new shape (sort by number, dedup).
diff --git a/server/services/pipeline/arcPlanner/context.js b/server/services/pipeline/arcPlanner/context.js
index 97be276c51..ef38034b32 100644
--- a/server/services/pipeline/arcPlanner/context.js
+++ b/server/services/pipeline/arcPlanner/context.js
@@ -10,7 +10,7 @@ import { compareIssuesInSeries } from '../../../lib/pipelineIssueOrder.js';
import { MANUSCRIPT_TYPES } from '../series.js';
import { listIssues, STAGE_INPUT_MAX } from '../issues.js';
-import { ARC_LIMITS, ARC_ROLES as ARC_ROLE_LIST, ARC_SHAPE_IDS, READER_MAP_BEAT_KINDS, buildSeason, renderArcShapeGuidance, renderTickingClock, sanitizeSeasonList } from '../../../lib/storyArc.js';
+import { ARC_LIMITS, ARC_ROLES as ARC_ROLE_LIST, ARC_SHAPE_IDS, READER_MAP_BEAT_KINDS, buildSeason, renderArcShapeGuidance, renderTickingClock, renderSeriesDesign, sanitizeSeasonList } from '../../../lib/storyArc.js';
import { composeStyleNotes } from '../../../lib/styleGuide.js';
import {
CHARACTER_ARC_LIMITS,
@@ -319,15 +319,15 @@ export async function collectManuscriptByType(seriesId) {
// "the bible block" — both passes must see the same series identity.
export const SHAPE_GUIDANCE_NONE = '(no Vonnegut story shape selected — the verifier should not flag shape adherence)';
-// Append the ticking-clock guidance (only when the clock is enabled) to an
+// Append the optional ticking-clock and authored series-design guidance to an
// arc-level shape-guidance block. Every arc/reader-map prompt already renders
// `{{{shapeGuidance}}}`, so folding the countdown in here surfaces it to
// generation without adding a new template variable — and therefore without a
// stage-prompt migration. Returns the guidance unchanged when there's no
-// enabled clock.
+// enabled clock or authored brief.
export function appendTickingClock(shapeGuidance, arc) {
const clock = renderTickingClock(arc?.tickingClock);
- return clock ? `${shapeGuidance}\n\n${clock}` : shapeGuidance;
+ return [shapeGuidance, clock, renderSeriesDesign(arc?.seriesDesign)].filter(Boolean).join('\n\n');
}
export async function buildArcBaseContext(series, preloadedWorld) {
diff --git a/server/services/pipeline/series.js b/server/services/pipeline/series.js
index 7fb43f97cb..871a52c3ee 100644
--- a/server/services/pipeline/series.js
+++ b/server/services/pipeline/series.js
@@ -13,7 +13,7 @@
import { randomUUID } from 'crypto';
import { getSeriesStore } from './seriesStore/store.js';
-import { sanitizeArc, sanitizeSeasonList } from '../../lib/storyArc.js';
+import { sanitizeArc, sanitizeSeasonList, sanitizeSeriesDesign } from '../../lib/storyArc.js';
import { sanitizeCharacterArcList } from '../../lib/seriesCharacterArc.js';
import { sanitizeStyleGuide } from '../../lib/styleGuide.js';
import { sanitizeProseExportSettings } from '../../lib/proseExportSettings.js';
@@ -903,6 +903,11 @@ export async function updateSeries(id, patch = {}) {
const cur = await store().loadOne(id);
if (!cur) throw makeErr(`Series not found: ${id}`, ERR_NOT_FOUND);
if (cur.deleted) throw makeErr(`Series not found: ${id}`, ERR_NOT_FOUND);
+ if (cur.locked?.arc === true && Object.hasOwn(patch, 'arc')
+ && (patch.arc === null || Object.hasOwn(patch.arc || {}, 'seriesDesign'))
+ && JSON.stringify(sanitizeSeriesDesign(patch.arc?.seriesDesign)) !== JSON.stringify(cur.arc?.seriesDesign ?? null)) {
+ throw makeErr('Arc is locked — unlock it before changing the series design', ERR_VALIDATION);
+ }
// Hierarchy invariant: a series lives in exactly one universe. Reject
// clearing the link once it's set — moving to a *different* non-empty
// universe is fine, and a legacy orphan (cur.universeId === null) is still
@@ -931,7 +936,8 @@ export async function updateSeries(id, patch = {}) {
...('premise' in patch ? { premise: patch.premise } : {}),
...('universeId' in patch ? { universeId: patch.universeId } : {}),
...('writersRoomWorkId' in patch ? { writersRoomWorkId: patch.writersRoomWorkId } : {}),
- ...('arc' in patch ? { arc: patch.arc } : {}),
+ ...('arc' in patch ? { arc: patch.arc && !Object.hasOwn(patch.arc, 'seriesDesign') && cur.arc?.seriesDesign
+ ? { ...patch.arc, seriesDesign: cur.arc.seriesDesign } : patch.arc } : {}),
...('seasons' in patch ? { seasons: patch.seasons } : {}),
// Wholesale replace — `characterArcs: []` clears all arcs; omission
// preserves. sanitizeCharacterArcList drops empties + dedupes by identity.
@@ -1198,7 +1204,7 @@ const ADDITIVE_SERIES_FIELDS = ['arc', 'seasons', 'styleGuide', 'styleNotes', 'c
// still sends an `arc` object — just without these keys — so the erasure for
// them happens one level down. (The v10 gate rejects OLDER peers; this list
// additionally guards a SAME-version peer whose arc simply omits the key.)
-const ADDITIVE_ARC_FIELDS = ['readerMap', 'tickingClock', 'foreshadowing'];
+const ADDITIVE_ARC_FIELDS = ['readerMap', 'tickingClock', 'foreshadowing', 'seriesDesign'];
const keyAbsent = (obj, key) => !obj || typeof obj !== 'object' || !(key in obj) || obj[key] === undefined;
@@ -1215,6 +1221,12 @@ export const preserveAbsentAdditiveFields = (sanitized, rawRemote, local) => {
for (const field of ADDITIVE_SERIES_FIELDS) {
if (keyAbsent(rawRemote, field)) sanitized[field] = local[field];
}
+ // An older arc containing no remaining identifying fields sanitizes to null.
+ // Recover authored design before the nested merge so omission still preserves it.
+ if (!sanitized.arc && rawRemote.arc && typeof rawRemote.arc === 'object'
+ && keyAbsent(rawRemote.arc, 'seriesDesign') && local.arc?.seriesDesign) {
+ sanitized.arc = sanitizeArc({ ...rawRemote.arc, seriesDesign: local.arc.seriesDesign });
+ }
// Nested arc sub-fields: only when the remote DID send an `arc` object (so the
// top-level preserve above didn't already restore the whole arc) and both the
// sanitized result and the local record carry an arc object to merge into.
diff --git a/server/services/pipeline/series.test.js b/server/services/pipeline/series.test.js
index e24ae4e39d..7446c3dac7 100644
--- a/server/services/pipeline/series.test.js
+++ b/server/services/pipeline/series.test.js
@@ -65,6 +65,14 @@ describe('pipeline series service', () => {
});
+ it('sync preserves an omitted authored brief even in an otherwise empty old arc, but honors explicit clear', async () => {
+ const local = await svc.createSeries({ name: 'Repair crew', arc: { seriesDesign: { mode: 'renewable', continuingTensions: 'Rival approaches to repair.' } } });
+ await svc.mergeSeriesFromSync([{ ...local, arc: {}, updatedAt: '2099-01-01T00:00:00.000Z' }]);
+ expect((await svc.getSeries(local.id)).arc.seriesDesign).toEqual(local.arc.seriesDesign);
+ await svc.mergeSeriesFromSync([{ ...local, arc: { logline: 'Crew', seriesDesign: null }, updatedAt: '2099-01-02T00:00:00.000Z' }]);
+ expect((await svc.getSeries(local.id)).arc.seriesDesign).toBeUndefined();
+ });
+
it('projects names and summaries while retaining full editor records and hiding tombstones', async () => {
await svc.createSeries({
name: 'Story', universeId: 'u-test', logline: 'A city goes silent.',
diff --git a/server/services/storyBuilder.js b/server/services/storyBuilder.js
index 32ed2cdba3..74bad32c4c 100644
--- a/server/services/storyBuilder.js
+++ b/server/services/storyBuilder.js
@@ -509,6 +509,7 @@ function projectArc(series) {
protagonistArc: arc.protagonistArc || '',
themes: Array.isArray(arc.themes) ? arc.themes : [],
shape: arc.shape || null,
+ ...(arc.seriesDesign ? { seriesDesign: arc.seriesDesign } : {}),
};
}
// Project the SEMANTIC content of each canon character — the same prompt-field
@@ -1058,7 +1059,7 @@ export async function refineStep(id, stepId, { feedback, entryId, providerId, mo
if (latest.locked?.arc === true) {
throw makeErr('Arc is locked — unlock it on the Arc Canvas before refining', ARC_ERR_VALIDATION);
}
- const mergedArc = mergeArcWithLocks(latest.arc, arc, latest.locked?.arcFields);
+ const mergedArc = mergeArcWithLocks(latest.arc, { ...arc, seriesDesign: latest.arc?.seriesDesign ?? null }, latest.locked?.arcFields);
const updated = await updateSeries(session.seriesId, { arc: mergedArc });
return { result: updated, changes, rationale, runId, providerId: usedProviderId, model: usedModel };
}
diff --git a/server/services/storyBuilder.test.js b/server/services/storyBuilder.test.js
index 817c212ca8..fe0a454880 100644
--- a/server/services/storyBuilder.test.js
+++ b/server/services/storyBuilder.test.js
@@ -364,6 +364,15 @@ describe('storyBuilder — lock state machine + gating', () => {
});
describe('storyBuilder — integrity / staleness', () => {
+ it('marks reviewed story steps stale when the authored design changes', async () => {
+ const session = await sb.createStorySession({ title: 'Repair crew' });
+ await seriesSvc.updateSeries(session.seriesId, { arc: { seriesDesign: { mode: 'renewable' } } });
+ await sb.lockStep(session.id, 'readerMap');
+ expect((await sb.getStorySessionView(session.id)).staleSteps).not.toContain('readerMap');
+ await seriesSvc.updateSeries(session.seriesId, { arc: { seriesDesign: { mode: 'finite', endingCondition: 'Finish the final repair.' } } });
+ expect((await sb.getStorySessionView(session.id)).staleSteps).toContain('readerMap');
+ });
+
it('flags a locked downstream step stale when an upstream record changes', async () => {
const s = await sb.createStorySession({ title: 'X' });
// Give the series an arc + reader map, then lock the readerMap step.
@@ -727,6 +736,17 @@ describe('storyBuilder — generate delegation', () => {
});
describe('storyBuilder — refine delegation', () => {
+ it('refineStep(plotArc) preserves a brief edited while the model is running', async () => {
+ const session = await sb.createStorySession({ title: 'The case' });
+ await seriesSvc.updateSeries(session.seriesId, { arc: { logline: 'Case', seriesDesign: { mode: 'renewable' } } });
+ stageRunnerSpy = vi.fn(async () => {
+ await seriesSvc.updateSeries(session.seriesId, { arc: { logline: 'Case', seriesDesign: { mode: 'finite', endingCondition: 'Resolve the case.' } } });
+ return { content: { logline: 'Refined', seriesDesign: { mode: 'renewable' } }, runId: 'r', providerId: 'p', model: 'm' };
+ });
+ await sb.refineStep(session.id, 'plotArc', { feedback: 'Tighten the pitch.' });
+ expect((await seriesSvc.getSeries(session.seriesId)).arc.seriesDesign).toMatchObject({ mode: 'finite', endingCondition: 'Resolve the case.' });
+ });
+
it('refineStep(plotArc) persists the refined arc narrative onto the series', async () => {
const s = await sb.createStorySession({ title: 'X' });
await seriesSvc.updateSeries(s.seriesId, { arc: { logline: 'old', summary: 'old summary', shape: 'man-in-hole' } });