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: preserve complete production bibles
[._.]/ Adam Eivy9dff1b5b7cf0
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 25d3971a4e..384f923ef9 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -54,7 +54,7 @@- Make over-limit world-bible retries compress the rejected draft itself instead of rerunning the original generation prompt. Two progressively tighter headroom passes preserve the draft's names, causal mechanics, costs, jurisdictions, and site operations while removing repetition, so an otherwise strong repair can converge on the persisted contract without regenerating the same oversized answer.-- Raise the Universe Builder premise ceiling from 4,000 to 8,000 characters, matching production series. The former sanity cap forced legitimate multi-site world bibles into abbreviation-heavy ledgers; complete readable prose now persists directly, while the same fail-closed validator and draft-aware compression still contain genuinely runaway responses.+- Raise the Universe Builder and production-series premise ceiling from 4,000 to 12,000 characters. The former sanity cap forced legitimate multi-site world bibles with operational route, communications, rescue, and resource rules into abbreviation-heavy ledgers; complete readable prose now persists directly, while the same fail-closed validator and draft-aware compression still contain genuinely runaway responses.- **A successful agent run is no longer failed just because someone pulled `main` while it worked.** The branch-jack detector — which watches whether a worktree-isolated agent committed into the primary checkout instead of its own worktree — treated *any* movement of the primary as a branch-jack. So an ordinary `git pull` landing an already-merged PR flipped a run that had shipped its own PR into a failure, and told the user to consider `git reset --hard origin/main` over commits that already *were* `origin/main`. The guard now reports what a branch-jack actually leaves behind: commits the branch's upstream does not have, or the checkout parked on a different branch than it started on. A pure fast-forward onto upstream commits is logged as movement and nothing more. When damage is real, the recovery advice is sharper too — it quotes the number of *stranded* commits rather than how far HEAD travelled, and a checkout merely left on the wrong branch with nothing stranded is told to `git checkout` back instead of being pointed at a `--hard` reset that would discard nothing. A branch with no upstream to compare against still reports, since an unpushed commit is unreviewed by definition.diff --git a/client/src/components/pipeline/arcCanvas/DeriveFromManuscriptPreview.jsx b/client/src/components/pipeline/arcCanvas/DeriveFromManuscriptPreview.jsxindex de8e648cad..c8dbd62034 100644--- a/client/src/components/pipeline/arcCanvas/DeriveFromManuscriptPreview.jsx+++ b/client/src/components/pipeline/arcCanvas/DeriveFromManuscriptPreview.jsx@@ -1,5 +1,6 @@import { useState } from 'react';import { Loader2, X, BookText } from 'lucide-react';+import { WORLD_PREMISE_MAX } from '../../../services/apiUniverseBuilder.js';// Field-count guard for derived synopsis textareas — mirrors the server caps so// the user isn't surprised by a 400 on commit.@@ -88,7 +89,7 @@ export default function DeriveFromManuscriptPreview({ preview, committing, onCan</div><label className="block space-y-1"><span className="text-[11px] uppercase tracking-wider text-gray-500">Premise</span>- <textarea className={`${inputCls} resize-y`} rows={3} value={bible.premise} maxLength={8000}+ <textarea className={`${inputCls} resize-y`} rows={3} value={bible.premise} maxLength={WORLD_PREMISE_MAX}onChange={(e) => { setBible((b) => ({ ...b, premise: e.target.value })); setArc((a) => ({ ...a, summary: e.target.value })); }} /></label><label className="block space-y-1">diff --git a/client/src/services/apiUniverseBuilder.js b/client/src/services/apiUniverseBuilder.jsindex b5d6652405..09fc6d2e24 100644--- a/client/src/services/apiUniverseBuilder.js+++ b/client/src/services/apiUniverseBuilder.js@@ -6,7 +6,7 @@ export const COMPOSITE_PROMPT_MAX = 4000;// Mirror of the bible-field caps in server/services/universeBuilder.js — used by// the Universe Builder + Pipeline forms for maxLength enforcement on inputs.export const WORLD_LOGLINE_MAX = 500;-export const WORLD_PREMISE_MAX = 8000;+export const WORLD_PREMISE_MAX = 12000;export const WORLD_STYLE_NOTES_MAX = 4000;// Mirror of INFLUENCE_ENTRY_MAX + INFLUENCES_PER_LIST_MAX in// server/services/universeBuilder.js — used by the chip editor for maxLengthdiff --git a/server/routes/pipeline/arcs.js b/server/routes/pipeline/arcs.jsindex 9393afe02a..4dca66c49b 100644--- a/server/routes/pipeline/arcs.js+++ b/server/routes/pipeline/arcs.js@@ -60,7 +60,7 @@ const arcDeriveCommitSchema = z.object({}).optional(),bible: z.object({logline: z.string().max(500).optional(),- premise: z.string().max(8000).optional(),+ premise: z.string().max(seriesSvc.PREMISE_MAX).optional(),issueCountTarget: z.number().int().min(0).max(9999).optional(),}).optional(),volume: z.object({diff --git a/server/services/pipeline/series.js b/server/services/pipeline/series.jsindex 40fd101357..c9e3594dd6 100644--- a/server/services/pipeline/series.js+++ b/server/services/pipeline/series.js@@ -52,7 +52,9 @@ const SERIES_ID_RE = /^ser-[A-Za-z0-9-]+$/;export const NAME_MAX = 200;export const LOGLINE_MAX = 500;-export const PREMISE_MAX = 8000;+// Large enough for a multi-site production bible with concrete route and+// resource rules; still bounded so the field cannot become an unbounded prompt.+export const PREMISE_MAX = 12000;export const STYLE_NOTES_MAX = 4000;// Author-supplied real-world fact reference (#1588) — the ground-truth facts the// opt-in `research.fact-accuracy` editorial check reconciles the prose againstdiff --git a/server/services/universeBuilder/sanitize.js b/server/services/universeBuilder/sanitize.jsindex b71984da23..6302775863 100644--- a/server/services/universeBuilder/sanitize.js+++ b/server/services/universeBuilder/sanitize.js@@ -64,10 +64,11 @@ export const VARIATION_LABEL_MAX = 120;// universe's logline/premise/style notes can seed a production series in one click.export const LOGLINE_MAX = 500;// Match the production-series premise ceiling. A universe premise that must-// carry distinct economies, jurisdictions, travel rules, and several sites can-// legitimately need more than 4k; this remains a runaway-payload guard, not an-// instruction to crush readable bible prose into an abbreviation ledger.-export const PREMISE_MAX = 8000;+// carry distinct economies, jurisdictions, travel rules, route logistics, and+// several sites can legitimately need more than 8k; this remains a+// runaway-payload guard, not an instruction to crush readable bible prose into+// an abbreviation ledger.+export const PREMISE_MAX = 12000;export const STYLE_NOTES_MAX = 4000;export const VARIATIONS_PER_CATEGORY_MAX = 50;export const COMPOSITE_SHEETS_MAX = 50;diff --git a/server/services/universeBuilderExpand.effort.test.js b/server/services/universeBuilderExpand.effort.test.jsindex caadbb8558..b59c0b3e19 100644--- a/server/services/universeBuilderExpand.effort.test.js+++ b/server/services/universeBuilderExpand.effort.test.js@@ -79,7 +79,7 @@ describe('expandWorldTemplate reasoning effort', () => {.mockResolvedValueOnce({text: JSON.stringify({logline: 'A repaired world.',- premise: 'x'.repeat(8_001),+ premise: 'x'.repeat(12_001),styleNotes: 'Specific and tactile.',}),runId: 'run-oversized',@@ -103,9 +103,9 @@ describe('expandWorldTemplate reasoning effort', () => {});expect(runPromptThroughProviderMock).toHaveBeenCalledTimes(2);- expect(runPromptThroughProviderMock.mock.calls[1][0].prompt).toContain('premise exceeds 8000 characters (got 8001)');+ expect(runPromptThroughProviderMock.mock.calls[1][0].prompt).toContain('premise exceeds 12000 characters (got 12001)');expect(runPromptThroughProviderMock.mock.calls[1][0].prompt).toContain(`"premise": "${'x'.repeat(200)}`);- expect(runPromptThroughProviderMock.mock.calls[1][0].prompt).toContain('premise: at most 7200 characters');+ expect(runPromptThroughProviderMock.mock.calls[1][0].prompt).toContain('premise: at most 10800 characters');expect(runPromptThroughProviderMock.mock.calls[1][0].prompt).toContain('Do not cut off a sentence');expect(runPromptThroughProviderMock.mock.calls[1][0].prompt).not.toContain('# Starter idea');expect(result.premise).toBe('Trade, authority, and travel now end in a complete rule.');@@ -117,7 +117,7 @@ describe('expandWorldTemplate reasoning effort', () => {.mockResolvedValueOnce({text: JSON.stringify({logline: 'A repaired world.',- premise: 'a'.repeat(9_000),+ premise: 'a'.repeat(13_000),styleNotes: 'Specific and tactile.',}),runId: 'run-oversized',@@ -125,7 +125,7 @@ describe('expandWorldTemplate reasoning effort', () => {.mockResolvedValueOnce({text: JSON.stringify({logline: 'A repaired world.',- premise: 'b'.repeat(8_200),+ premise: 'b'.repeat(12_200),styleNotes: 'Specific and tactile.',}),runId: 'run-still-oversized',@@ -150,7 +150,7 @@ describe('expandWorldTemplate reasoning effort', () => {expect(runPromptThroughProviderMock).toHaveBeenCalledTimes(3);expect(runPromptThroughProviderMock.mock.calls[2][0].prompt).toContain(`"premise": "${'b'.repeat(200)}`);- expect(runPromptThroughProviderMock.mock.calls[2][0].prompt).toContain('premise: at most 6400 characters');+ expect(runPromptThroughProviderMock.mock.calls[2][0].prompt).toContain('premise: at most 9600 characters');expect(runPromptThroughProviderMock.mock.calls[2][0].prompt).not.toContain(`"premise": "${'a'.repeat(200)}`);expect(result.premise).toBe('A complete, compact operating rule.');});