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: make arc verification exhaustive
[._.]/ Adam Eivy04d14521cdca
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 5092e64661..b07975b4f8 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -20,6 +20,7 @@- **Legacy canon prompts can be promoted into their missing description fields.** Universe expansion and promotion historically persisted image-ready `prompt` text while leaving the canonical `physicalDescription`/`description` blank, so the Cast/Places/Objects tabs and readiness gate disagreed with the renderer. A deterministic fill-blanks-only API now copies that already-authored text without an LLM call, preserving locks, IDs, kinds, prompts, and every existing asset.- **Arc verification can now repair the per-character milestones it judges.** The verifier already read canonical per-character arcs, but its resolver could only edit the series arc, volumes, and issue synopses, so a contradiction in a character transition was impossible to close and repeated retries rewrote unrelated records instead. Finding-keyed character-arc patches now preserve character and transition IDs, merge only named fields, participate in regression rollback, and migrate existing prompt installations to the sparse contract.+- **Arc verification now inventories the whole plan before returning findings.** The verifier's checklist did not explicitly require a complete pass, so successive judges could reveal a new sample of latent geography, manifest, permission, clock, character-milestone, or issue-load contradictions after every otherwise-valid exact repair. The stage prompt now requires an exhaustive cross-record reconciliation, consolidation by root cause, and every evidence-backed high/medium finding in one response, reducing repair waterfalls without weakening the sparse-patch rollback guard.- **Arc verification repairs long prose without rewriting the whole plan around one sentence.** A localized finding inside a volume synopsis previously forced the model to return the entire field, so a one-clause correction could rewrite more than 8,000 characters, introduce unrelated continuity failures, and be clipped at the storage limit. The resolver now emits bounded exact-match replacements for arc summaries, protagonist arcs, volume synopses, and ending hooks; missing, ambiguous, wholesale-long-field, and over-limit patches fail closed while legacy customized prompts keep their existing contract. Each prompt carries measured current/max/remaining field lengths so the replacement fits on its first attempt, and a rejected exact-only response is recorded as a no-op and retried without paying an independent judge to reread an unchanged plan. Because these patches are finding-keyed and bounded, an exhaustive later judge may expose unrelated latent blockers without the guard falsely blaming them on the patch and rewinding a correction that closed its target; legacy whole-field resolvers retain the stricter total-count guard. A graceful Pause requested during arc convergence now lands immediately after the active independent judgment instead of silently dispatching another repair/judge pair.- **Completed CoS agents no longer strand a worktree because of their own completion marker.** The `.agent-done` sentinel is consumed before worktree cleanup, but Git still reported the untracked file as ordinary authored work and the safety gate preserved the otherwise-clean checkout with a high-priority warning. Cleanup now ignores only that runtime marker: sentinel-only trees are removed normally, while any real source change still preserves the worktree and is named in the warning.diff --git a/data.reference/prompts/stages/pipeline-arc-verify.md b/data.reference/prompts/stages/pipeline-arc-verify.mdindex 5a2462ae97..278184a0d0 100644--- a/data.reference/prompts/stages/pipeline-arc-verify.md+++ b/data.reference/prompts/stages/pipeline-arc-verify.md@@ -77,7 +77,14 @@ to expand before episode generation begins.## What to look for-Walk the volumes in order. Score each volume + each episode against the arc. Specifically check:+This is an **exhaustive inventory, not a sample**. Walk the whole arc and every+volume in order, finish every check below, and reconcile every repeated fact+before drafting the response. Finding one defect must not stop the audit. Return+every distinct, evidence-backed high/medium issue in this response; consolidate+duplicates that share one root cause, but do not hold valid findings for a later+pass. A clean result means the entire supplied plan was checked.++Score each volume + each episode against the arc. Specifically check:1. **Protected-intent drift.** Does the plan replace the originating protagonists, ontology, or core story engine with an incompatible cast, villain, institution, or conflict? Does it demote a living nonhuman principal into a tool when the premise gives it an independent need?2. **Character causality and contradictions.** Do the active principals' wants, needs, choices, and relationships cause the major turns? Did a major character end volume N in a state that contradicts volume N+1's opening, or die and later speak without explanation?@@ -87,6 +94,13 @@ Walk the volumes in order. Score each volume + each episode against the arc. Spe6. **Arc-role imbalance.** Once episodes exist, a volume with 8 episodes and zero `pilot` / `finale` `arcRole` entries (or duplicate pilots/finales).7. **Theme drift.** A theme is named in `arc.themes` but does not appear in any volume synopsis or episode logline.8. **Story-shape adherence.** If a Vonnegut shape was selected, verify the volume-level fortune trajectory traces that curve. The whole-series finale must land at the shape's terminal level.+9. **Cross-record fact reconciliation.** Compare the full-arc summary,+ protagonist arc, and volume/episode synopses for:+ - travel geography and whether ordinary movement is actually local after each extraordinary crossing;+ - authorization scope, passenger/cargo manifests, custody, consent, and recall rights;+ - resource quantities, deadlines, extensions, and who approves them;+ - the issue/episode where each irreversible character choice happens, so a milestone is neither spent early nor repeated;+ - issue/episode load, so independent climaxes have room for setup, resistance, choice, and consequence.## Output contractdiff --git a/scripts/migrations/005-shape-aware-arc-prompts.js b/scripts/migrations/005-shape-aware-arc-prompts.jsindex cd9249e05f..003215a68e 100644--- a/scripts/migrations/005-shape-aware-arc-prompts.js+++ b/scripts/migrations/005-shape-aware-arc-prompts.js@@ -30,6 +30,7 @@ export const ACCEPTED_OLD_MD5 = {'pipeline-arc-verify.md': ['52e31abc93e3105176236fcaa5d1575a', // pre-005 (original)'ff56d8387162017e08d5d0491060ddd6', // post-005 / pre-019 — the hash this migration originally produced+ '83347e7d923580a3062033ab39b3c14b', // post-250 / pre-261 — arc spine checkpoint before exhaustive verification],'pipeline-volume-verify.md': ['c6ea28e972ad6e229bafb2d602b4dda3', // pre-005 (original)@@ -50,7 +51,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-verify.md': '68f6956d7e09ebdb3870d8726b1b2a7a', // post-261 exhaustive arc verification'pipeline-volume-verify.md': '49458d36700cb94e34806d536ffe2940', // post-019'pipeline-season-episodes.md': 'a88e8e78a949b7aaf500d03314e2ea0b', // post-172 (structure rules)'pipeline-arc-resolve.md': '2349bce80e9df8caafa391a6106327b6', // post-259 (measured text budgets)diff --git a/scripts/migrations/019-arc-volume-prompts-canon-context.js b/scripts/migrations/019-arc-volume-prompts-canon-context.jsindex 8ca78f1c3c..2a91ede881 100644--- a/scripts/migrations/019-arc-volume-prompts-canon-context.js+++ b/scripts/migrations/019-arc-volume-prompts-canon-context.js@@ -45,6 +45,7 @@ export const ACCEPTED_OLD_MD5 = {'pipeline-arc-verify.md': ['ff56d8387162017e08d5d0491060ddd6', // current (pre-Phase B) shipped'52e31abc93e3105176236fcaa5d1575a', // pre-005 (shape-aware), still in setup-data.js OLD list+ '83347e7d923580a3062033ab39b3c14b', // post-250 / pre-261 — arc spine checkpoint before exhaustive verification],'pipeline-arc-resolve.md': ['cc27b4da1d1a13c35e35d1c2d6183815', // post-123 / pre-245 — the episodes[] channel, before edits had to name a finding@@ -61,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-verify.md': '68f6956d7e09ebdb3870d8726b1b2a7a', // post-261 exhaustive arc verification'pipeline-arc-resolve.md': '2349bce80e9df8caafa391a6106327b6', // post-259 (measured text budgets)'pipeline-volume-verify.md': '49458d36700cb94e34806d536ffe2940', // post-019};diff --git a/scripts/migrations/250-arc-spine-checkpoint-prompts.js b/scripts/migrations/250-arc-spine-checkpoint-prompts.jsindex f31d226109..63102e7c3e 100644--- a/scripts/migrations/250-arc-spine-checkpoint-prompts.js+++ b/scripts/migrations/250-arc-spine-checkpoint-prompts.js@@ -9,12 +9,15 @@ import { makePromptReplaceMigration } from './_lib.js';export const ACCEPTED_OLD_MD5 = {'pipeline-arc-overview.md': ['648e11352cd1565aee490de1f662bef0'],- 'pipeline-arc-verify.md': ['36aa70cdfc25d7549573a4d556e7702c'],+ 'pipeline-arc-verify.md': [+ '36aa70cdfc25d7549573a4d556e7702c',+ '83347e7d923580a3062033ab39b3c14b', // post-250 / pre-261+ ],};export const NEW_SHIPPED_MD5 = {'pipeline-arc-overview.md': '5ed760caaf3cf88916ec28b220e2f590',- 'pipeline-arc-verify.md': '83347e7d923580a3062033ab39b3c14b',+ 'pipeline-arc-verify.md': '68f6956d7e09ebdb3870d8726b1b2a7a',};const { applyMigration, up } = makePromptReplaceMigration({diff --git a/scripts/migrations/261-exhaustive-arc-verification.js b/scripts/migrations/261-exhaustive-arc-verification.jsnew file mode 100644index 0000000000..0211cc0a2e--- /dev/null+++ b/scripts/migrations/261-exhaustive-arc-verification.js@@ -0,0 +1,33 @@+/**+ * Make arc verification return one complete defect inventory instead of+ * revealing a fresh sample of latent contradictions after every repair.+ *+ * The convergence gate safely retains finding-keyed exact patches that close+ * their owned targets. That contract depends on the independent verifier being+ * exhaustive: a sampling judge turns real progress into a long waterfall of+ * newly discovered geography, manifest, clock, milestone, and issue-load+ * defects. The shipped prompt now requires a full cross-record reconciliation+ * before it returns.+ */++import { makePromptReplaceMigration } from './_lib.js';++export const ACCEPTED_OLD_MD5 = {+ 'pipeline-arc-verify.md': ['83347e7d923580a3062033ab39b3c14b'],+};++export const NEW_SHIPPED_MD5 = {+ 'pipeline-arc-verify.md': '68f6956d7e09ebdb3870d8726b1b2a7a',+};++const { applyMigration, up } = makePromptReplaceMigration({+ accepted: ACCEPTED_OLD_MD5,+ current: NEW_SHIPPED_MD5,+ label: 'exhaustive arc verification',+ customizedHint: (filename) =>+ ` To upgrade it manually, diff data.reference/prompts/stages/${filename}\n` ++ ` against data/prompts/stages/${filename} and add the exhaustive inventory plus cross-record reconciliation rules.`,+});++export { applyMigration };+export default { up };diff --git a/scripts/migrations/261-exhaustive-arc-verification.test.js b/scripts/migrations/261-exhaustive-arc-verification.test.jsnew file mode 100644index 0000000000..fd2ba46d08--- /dev/null+++ b/scripts/migrations/261-exhaustive-arc-verification.test.js@@ -0,0 +1,31 @@+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 './261-exhaustive-arc-verification.js';++describe('migration 261 — exhaustive arc verification', () => {+ runPromptMigrationTests({+ migration,+ applyMigration,+ ACCEPTED_OLD_MD5,+ NEW_SHIPPED_MD5,+ prefix: 'migration-261-exhaustive-arc-verification-',+ });++ it('requires a complete cross-record defect inventory', () => {+ const prompt = readFileSync(+ `${repoRoot}/data.reference/prompts/stages/pipeline-arc-verify.md`,+ 'utf8',+ );+ expect(prompt).toContain('exhaustive inventory, not a sample');+ expect(prompt).toContain('Finding one defect must not stop the audit');+ expect(prompt).toContain('Cross-record fact reconciliation');+ expect(prompt).toContain('passenger/cargo manifests');+ expect(prompt).toContain('milestone is neither spent early nor repeated');+ });+});