skald/migrations/0008_chapter_rewrite.sql
Kayos d2442f0a87 forge: rewrite pass — re-author prose in an author's voice
New Forge::rewrite + PassKind::Rewrite. An author re-authors
existing chapter prose entirely in their voice — sentence rhythm,
word choice, paragraph shape all become theirs — while canon
(names, dates, places, events, order, technical facts) is preserved
exactly. Not editing; re-authoring. SystemMode::Replace, max effort.

skald rewrite --chapter <uuid> [--author slug] overwrites body_md
with the rewritten version. The pre-rewrite prose is stashed in the
new chapters.body_md_original column on first rewrite (migration
0008, idempotent) so the original is never lost. body_md_tts is
cleared — it was annotated against the old prose and must be
regenerated by a fresh prepare-narration.

prepare-narration gains --single-voice: skips the character speaker
roster so no [voice:X] dialogue tags are inserted, only beat
markers. Right for one-voice narration.

Migration 0008 also extends generation_runs.kind to allow 'rewrite'.
2026-05-14 21:35:20 -07:00

15 lines
748 B
SQL

-- The rewrite pass: an author re-authors existing chapter prose in
-- their own voice (canon preserved, prose reworked). body_md gets
-- overwritten with the rewritten version; body_md_original keeps
-- the pre-rewrite prose so the original is never lost. Populated
-- only on the FIRST rewrite of a chapter (if NULL) — subsequent
-- rewrites leave the original alone.
ALTER TABLE chapters
ADD COLUMN IF NOT EXISTS body_md_original text;
-- Allow 'rewrite' as a generation_runs.kind.
ALTER TABLE generation_runs
DROP CONSTRAINT generation_runs_kind_check;
ALTER TABLE generation_runs
ADD CONSTRAINT generation_runs_kind_check
CHECK (kind = ANY (ARRAY['gen', 'cleanup', 'audit', 'summary', 'embed', 'narrate_prep', 'rewrite']));