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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: constrain arc auto-resolve patches
[._.]/ Adam Eivy438b50e01bdf
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex e450d1b600..2b7c0a8cf2 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -8,5 +8,6 @@- **Series Autopilot now validates the arc spine before spending on episodes.** A protected-intent checkpoint runs immediately after the macro arc, uses only canon demonstrably tied to the current series, honors the recommended volume count (including a single 12-issue volume), and blocks or auto-corrects an incompatible premise before issue generation. Existing empty issue placeholders are reused as an exact set so their ids, history, and visual links survive episode seeding.- **Stopping Series Autopilot now stops the active AI run.** Direct arc, episode, foundation, correction, and fallback runs publish their concrete run ids to the conductor, so Stop no longer waits for a long provider call to finish. Runs History also exposes Stop for active rows.- **Runs History safely displays structured model output.** Prompt and output endpoints are read as plain text, preventing valid JSON completions from crashing React when a run is expanded.+- **Arc auto-resolve keeps corrections field-scoped and within storage limits.** A resolver fixing one synopsis now omits unrelated volume fields instead of paraphrasing them, and its prompt carries explicit headroom below every persisted arc/volume string cap so a well-intended rewrite cannot be silently clipped into the next verification failure.- **Continuing a video carries its prompt forward.** Continuing or extending a clip we generated now prefills the Video Gen prompt (and negative prompt) with the one that produced the source, instead of dropping you into an empty box. This covers both entry points: the **Continue** action on a video card/lightbox, and picking a prior render in Extend mode. Text you typed yourself is never overwritten — only a blank box or a value an earlier pick filled — and a clip we didn't generate (an import, or a legacy render with no stored prompt) leaves the field alone rather than clearing it. The style preset is dropped along with the prefill, since history stores the already-composed prompt and re-applying a preset would prefix it twice.- **Subscription Usage cards now lay out in four quadrants.** The provider quota grid orders Claude, Antigravity, Codex, Grok — and because Codex and Grok typically report only a single weekly meter, they now share one grid cell stacked vertically instead of each stretching to a full-height card. Cards render at their natural height, so the Image Gen card floats into the fourth quadrant and the whole section fits above the fold on desktop.diff --git a/data.reference/prompts/stages/pipeline-arc-resolve.md b/data.reference/prompts/stages/pipeline-arc-resolve.mdindex 168702e31b..6e1eb87ef1 100644--- a/data.reference/prompts/stages/pipeline-arc-resolve.md+++ b/data.reference/prompts/stages/pipeline-arc-resolve.md@@ -91,6 +91,8 @@ The verification pass flagged these problems. Resolve **every** one of them in y7. **Preserve volume `id`** for every existing volume you edit. Only assign no `id` to brand-new volumes you are adding. Never delete a volume — if a finding could only be resolved by removing one, write that in the `notes` field instead of doing it.8. **Correct an episode synopsis when the contradiction *originates* in that episode.** Sometimes a finding can't be fixed at the volume level because the wrong content lives in a specific episode's `synopsis` — e.g. an episode stages an event that a later volume reserves as its own "first" occurrence, or a promised through-line silently disappears from the episodes that should carry it. In those cases the only convergent fix is to rewrite the offending episode's `synopsis` so it stops contradicting the rest of the arc. Return those rewrites in the `episodes[]` output array below, keyed by `seasonNumber` + `episodeNumber`. These are early planning synopses (no script has been drafted yet), so editing them is safe and is preferred over papering over the conflict at the volume level. Rules: edit an episode synopsis ONLY when a finding genuinely originates there; make the smallest change that removes the contradiction while preserving the episode's dramatic purpose; never delete an episode (omit it from `episodes[]` to leave it untouched). If a finding could only be resolved by removing issues entirely, write that in the `notes` field instead of doing it.9. **Return only the records you actually edited, and key every one of them to a finding.** `seasons[]` and `episodes[]` are SPARSE patch lists: include a volume only if you rewrote it, an episode only if you rewrote it, and the `arc` block only if you rewrote the arc itself. Every entry — including `arc` — carries `resolves: ["f2", ...]`, the ids of the findings that edit closes. An edit that names no finding is discarded by the server, so do not return untouched records "for completeness": that is the single biggest source of NEW contradictions, because every untargeted rewrite is a chance to break something the verification pass had not flagged.+10. **Within an edited record, return only the fields that must change.** A season may need a new `synopsis` without needing a new `logline`, `endingHook`, title, count, or themes. Omit every untouched key instead of paraphrasing the stored value "for completeness". The server preserves omitted fields. This field-level sparsity is load-bearing: rewriting an unrelated field can create the next round's contradiction even when the targeted finding was fixed.+11. **Stay safely inside persisted string limits and end every field cleanly.** Hard limits are: arc logline 500 characters; arc summary 8,000; protagonist arc 4,000; volume logline 500; volume synopsis 8,000; volume ending hook 1,000. Target at most 450 / 7,500 / 3,700 / 450 / 7,500 / 900 characters respectively so punctuation and later edits have headroom. Before returning, check every changed string: it must be below its target and end at a complete clause or sentence. Never rely on the server to truncate prose. Keep a volume synopsis near 200 words when that can carry the issue allocation; expand only as much as the finding genuinely requires.## Output contract@@ -134,4 +136,4 @@ The `seasons[]` array is a SPARSE list of volume rewrites — include only the vThe `episodes[]` array is a SPARSE list of episode-synopsis corrections — include only the episodes you actually rewrote (per rule 8). Omit the array entirely (or leave it empty) when every finding was resolved at the arc/volume level. Episodes you don't list are left exactly as they are.-Omit the `arc` block entirely when the arc itself needed no rewrite. Every field you do include in a record you're editing must be complete — the server keeps the stored value for any field you leave out, but it does not merge two halves of a sentence.+Omit the `arc` block entirely when the arc itself needed no rewrite. Within every record you do return, omit fields that do not need to change. Every field you include must be complete and within the limits above — the server keeps the stored value for any field you leave out, but it does not merge two halves of a sentence.diff --git a/scripts/migrations/005-shape-aware-arc-prompts.js b/scripts/migrations/005-shape-aware-arc-prompts.jsindex f1a0e9af9b..c4ee00e169 100644--- a/scripts/migrations/005-shape-aware-arc-prompts.js+++ b/scripts/migrations/005-shape-aware-arc-prompts.js@@ -53,7 +53,7 @@ export const NEW_SHIPPED_MD5 = {'pipeline-arc-verify.md': '83347e7d923580a3062033ab39b3c14b', // post-250 arc spine checkpoint'pipeline-volume-verify.md': '49458d36700cb94e34806d536ffe2940', // post-019'pipeline-season-episodes.md': 'a88e8e78a949b7aaf500d03314e2ea0b', // post-172 (structure rules)- 'pipeline-arc-resolve.md': '8bb134554c122d1583c479ab3010e53d', // post-245 (finding-keyed sparse patches)+ 'pipeline-arc-resolve.md': '96f73a7e90526d65ef2bb100fb1cd4bf', // post-251 (field-sparse bounded patches)};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.jsindex c52e9c698e..133688b7f4 100644--- a/scripts/migrations/019-arc-volume-prompts-canon-context.js+++ b/scripts/migrations/019-arc-volume-prompts-canon-context.js@@ -62,7 +62,7 @@ export const ACCEPTED_OLD_MD5 = {export const NEW_SHIPPED_MD5 = {'pipeline-arc-overview.md': '5ed760caaf3cf88916ec28b220e2f590', // post-250 arc spine checkpoint'pipeline-arc-verify.md': '83347e7d923580a3062033ab39b3c14b', // post-250 arc spine checkpoint- 'pipeline-arc-resolve.md': '8bb134554c122d1583c479ab3010e53d', // post-245 (finding-keyed sparse patches)+ 'pipeline-arc-resolve.md': '96f73a7e90526d65ef2bb100fb1cd4bf', // post-251 (field-sparse bounded patches)'pipeline-volume-verify.md': '49458d36700cb94e34806d536ffe2940', // post-019};diff --git a/scripts/migrations/023-resolve-prompt-episode-anchor.js b/scripts/migrations/023-resolve-prompt-episode-anchor.jsindex 2a16b94867..fdeae1255d 100644--- a/scripts/migrations/023-resolve-prompt-episode-anchor.js+++ b/scripts/migrations/023-resolve-prompt-episode-anchor.js@@ -40,7 +40,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': '8bb134554c122d1583c479ab3010e53d', // post-245 (finding-keyed sparse patches)+ 'pipeline-arc-resolve.md': '96f73a7e90526d65ef2bb100fb1cd4bf', // post-251 (field-sparse bounded patches)};const { applyMigration, up } = makePromptReplaceMigration({diff --git a/scripts/migrations/123-arc-resolve-episode-corrections.js b/scripts/migrations/123-arc-resolve-episode-corrections.jsindex fca1df222c..b5b5644234 100644--- a/scripts/migrations/123-arc-resolve-episode-corrections.js+++ b/scripts/migrations/123-arc-resolve-episode-corrections.js@@ -27,7 +27,7 @@ export const ACCEPTED_OLD_MD5 = {};export const NEW_SHIPPED_MD5 = {- 'pipeline-arc-resolve.md': '8bb134554c122d1583c479ab3010e53d', // post-245 (finding-keyed sparse patches)+ 'pipeline-arc-resolve.md': '96f73a7e90526d65ef2bb100fb1cd4bf', // post-251 (field-sparse bounded patches)};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.jsindex 24d3614aeb..6e2b69505d 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': '8bb134554c122d1583c479ab3010e53d', // post-245 (finding-keyed sparse patches)+ 'pipeline-arc-resolve.md': '96f73a7e90526d65ef2bb100fb1cd4bf', // post-251 (field-sparse bounded patches)};const { applyMigration, up } = makePromptReplaceMigration({diff --git a/scripts/migrations/251-arc-resolve-field-sparsity.js b/scripts/migrations/251-arc-resolve-field-sparsity.jsnew file mode 100644index 0000000000..1e9ae10b75--- /dev/null+++ b/scripts/migrations/251-arc-resolve-field-sparsity.js@@ -0,0 +1,28 @@+/**+ * Keep arc auto-resolve patches sparse at the field level and teach the prompt+ * the persisted arc/volume string budgets. This prevents a targeted synopsis+ * correction from needlessly rewriting a valid logline and prevents the store+ * sanitizer from clipping an oversized LLM field mid-sentence.+ */++import { makePromptReplaceMigration } from './_lib.js';++export const ACCEPTED_OLD_MD5 = {+ 'pipeline-arc-resolve.md': ['8bb134554c122d1583c479ab3010e53d'],+};++export const NEW_SHIPPED_MD5 = {+ 'pipeline-arc-resolve.md': '96f73a7e90526d65ef2bb100fb1cd4bf',+};++const { applyMigration, up } = makePromptReplaceMigration({+ accepted: ACCEPTED_OLD_MD5,+ current: NEW_SHIPPED_MD5,+ label: 'arc-resolve field-sparse bounded patches',+ customizedHint: (filename) =>+ ` To upgrade it manually, diff data.reference/prompts/stages/${filename}\n` ++ ` against data/prompts/stages/${filename} and add field-level sparsity plus the persisted string limits.`,+});++export { applyMigration };+export default { up };diff --git a/scripts/migrations/251-arc-resolve-field-sparsity.test.js b/scripts/migrations/251-arc-resolve-field-sparsity.test.jsnew file mode 100644index 0000000000..3423cf9576--- /dev/null+++ b/scripts/migrations/251-arc-resolve-field-sparsity.test.js@@ -0,0 +1,30 @@+import { readFileSync } from 'fs';+import { describe, expect, it } from 'vitest';++import { repoRoot, runPromptMigrationTests } from './_testHelpers.js';+import migration, {+ ACCEPTED_OLD_MD5,+ NEW_SHIPPED_MD5,+ applyMigration,+} from './251-arc-resolve-field-sparsity.js';++describe('migration 251 — field-sparse bounded arc resolution', () => {+ runPromptMigrationTests({+ migration,+ applyMigration,+ ACCEPTED_OLD_MD5,+ NEW_SHIPPED_MD5,+ prefix: 'migration-251-arc-resolve-',+ });++ it('documents field sparsity and every persisted string limit', () => {+ const prompt = readFileSync(+ `${repoRoot}/data.reference/prompts/stages/pipeline-arc-resolve.md`,+ 'utf8',+ );+ expect(prompt).toContain('return only the fields that must change');+ expect(prompt).toContain('arc logline 500 characters');+ expect(prompt).toContain('volume synopsis 8,000');+ expect(prompt).toContain('Never rely on the server to truncate prose');+ });+});