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

4.9 KB
Raw Blame
/**
 * Two related prompt updates, bundled because they touch overlapping files:
 *
 *   (a) Add `{{worldEntitiesSummary}}` block to the three per-issue text-stage
 *       prompts so they receive a compact one-line-per-kind synopsis of the
 *       linked Universe Builder's canon.
 *
 *   (b) Pipe the new `speechPattern` (and accompanying `speechAccent`)
 *       character bible field through the same three script-stage prompts +
 *       the universe-character-expand prompt so dialogue carries the
 *       character's prose voice on the page.
 *
 * Updates (per ACCEPTED_OLD_MD5 below):
 *   - data/prompts/stages/pipeline-prose.md
 *   - data/prompts/stages/pipeline-teleplay.md
 *   - data/prompts/stages/pipeline-comic-script.md
 *   - data/prompts/stages/universe-character-expand.md
 *
 * Why:
 *   Text stages historically only got `{{#series.characters}}` (the series
 *   bible). When a series is linked to a Universe Builder world, that bible
 *   excludes universe-level places/objects and other characters that haven't
 *   been pulled into the series canon — so scripts could namelessly drift
 *   from established continuity even when the universe had a rich roster.
 *   `worldEntitiesSummary` is a budget-aware alternative to the full
 *   `worldCanonText` block: one tagged line per kind, capped at 8 entries.
 *
 *   Separately, `speechAccent` historically conflated regional accent with
 *   speech patterns (cadence/lexicon/tics). Splitting it into a dedicated
 *   `speechPattern` field lets the universe-character-expand pass populate
 *   them independently, and lets the three script stages quote both for
 *   dialogue continuity.
 *
 * Implementation: hash-driven prompt-replace via `./_lib.js`. Idempotent.
 */

import { makePromptReplaceMigration } from './_lib.js';

export const ACCEPTED_OLD_MD5 = {
  'pipeline-prose.md': [ '84523d531eeafa60959c65c553b2563f',
    '30ac30ec2b9d3e2a9eb869c181732cc6', // post-003 / pre-027 shipped
    'bfea5aeeb471aae9749baee765b473a7', // pre-003 (in setup-data OLD list)
    'd1f8e3f1d214725b5aa67f309a81cd7d', // post-027 / pre-054
    'bef1bc2767b78f585f2bd89f3d615130', // post-054 / pre-054-fence
    '25e3d58c2741bd98acd5d08ba70d8a5e', // post-127 / pre-166 (scene markers)
    '430d38ed2da59e0d4212e65edc499a74', // post-166 / pre-169 (craft anti-patterns)
  ],
  'pipeline-teleplay.md': [
    '376f779f4687b598f1c92ca4e770fd5a', // pre-027 shipped
    '3f6fecc25573ed054b47db392250034a', // pre-shape (in setup-data OLD list)
    '1280ef6b1ad68fa44070ca7478ec2a5f', // post-027 / pre-054
    '2568e14beaa574d43f8018a5def51d04', // post-054 / pre-054-fence
    'afa4215330bf856429d70d7e2f856605', // post-054-fence / pre-128 (canonical scene list)
  ],
  'pipeline-comic-script.md': [ 'a4303016c34b65e4b0e641fe71252de3',
    '1e0af305c27d0c80c4b482d2ebcb4a0d', // post-011 / pre-027 shipped
    'beab031951859ca13579cdb9c4dbe769', // pre-011 (in setup-data OLD list)
    '40e5fdc1a1e68a7419b7dad936366c1a', // pre-003 (in setup-data OLD list)
    '133d200d069c2e8173b7c129eea58f53', // post-027 / pre-054
    'e530fc76b89cedaef848ad7ec99c934c', // post-054 / pre-054-fence
    'dea7d497d1cb38e7574f236f4ff8e644', // post-054-fence / pre-063
    'e9ee70bf18888492edada6633cd9928a', // post-063 / pre-121
    '7c05ecde539f04c9fa91e87543057204', // pre-121 reference body
  ],
  'universe-character-expand.md': [
    'ef109eb8e12ddb664c11c790271b5139', // pre-027 shipped
    '67b6e73ed47f318451a730088b4cff14', // post-027 / pre-171 (character framework)
    '177b6e4e8bdf445308cf8ac423cd5ad8', // post-171 / pre-257 (complete expand fields)
  ],
};

export const NEW_SHIPPED_MD5 = {
  'pipeline-prose.md':            '4cb3ef48309f3673570cf80e4d544b54', // post-169 (cross-issue continuity)
  'pipeline-teleplay.md':         '2ea9974ac3803658b2314db1f5818b77', // post-128 (canonical scene list)
  'pipeline-comic-script.md':     '49af30c05f008b20f6998a0f113f7d87', // post-127 (scene markers)
  'universe-character-expand.md': '961b73ba6e50df5d49f0cc76505e50bd', // post-257 (complete expand fields)
};

const { applyMigration, up } = makePromptReplaceMigration({
  accepted: ACCEPTED_OLD_MD5,
  current: NEW_SHIPPED_MD5,
  label: 'text-stage entities-summary + speechPattern',
  customizedHint: (filename) =>
    `   To pick up {{worldEntitiesSummary}} + {{speechPattern}} / {{speechAccent}} manually, diff:\n` +
    `     data.reference/prompts/stages/${filename}\n` +
    `   against your current:\n` +
    `     data/prompts/stages/${filename}\n` +
    `   and merge the new blocks in the same position as in the sample template.`,
  skipFooter: (count) =>
    `⚠️  ${count} prompt(s) could not be auto-updated because they were customized.\n` +
    `   The {{worldEntitiesSummary}} block + {{speechPattern}} / {{speechAccent}} renderers\n` +
    `   will not appear in those prompts until the files are merged manually. See\n` +
    `   data.reference/prompts/stages/.`,
});

export { applyMigration };
export default { up };