From 02c0d948058cb0925fc7648ad984c5c1cfb2fc55 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Mar 2026 06:06:24 +0000 Subject: [PATCH] v0.27.16: Increase document limit to 250K characters The instruction field in writeRequestSchema was capped at 5,000 characters, causing "Evolve Document" to fail when accumulated provocation responses exceeded that limit. Raised to 250K. Also increased context-builder LIMITS and hardcoded MAX_ANALYSIS_LENGTH values in routes.ts to support much larger documents throughout the provocation pipeline. https://claude.ai/code/session_013XaBTPShGEAEERwoDTQzsk --- client/src/lib/version.ts | 9 ++++++++- server/context-builder.ts | 8 ++++---- server/routes.ts | 6 +++--- shared/schema.ts | 2 +- tests/unit/server/context-builder.test.ts | 8 ++++---- 5 files changed, 20 insertions(+), 13 deletions(-) diff --git a/client/src/lib/version.ts b/client/src/lib/version.ts index 255bea41..be1ae1ad 100644 --- a/client/src/lib/version.ts +++ b/client/src/lib/version.ts @@ -9,7 +9,7 @@ * Update this file with every code change / git commit. */ -export const APP_VERSION = "0.27.15"; +export const APP_VERSION = "0.27.16"; export interface ReleaseNote { version: string; @@ -18,6 +18,13 @@ export interface ReleaseNote { } export const RELEASE_NOTES: ReleaseNote[] = [ + { + version: "0.27.16", + date: "2026-03-20", + changes: [ + "Increase document limit to 250K characters — write instruction, context builder, and analysis endpoints all support much larger documents", + ], + }, { version: "0.27.15", date: "2026-03-13", diff --git a/server/context-builder.ts b/server/context-builder.ts index cc30361c..aa8a40bd 100644 --- a/server/context-builder.ts +++ b/server/context-builder.ts @@ -45,10 +45,10 @@ export { /** Default truncation limits — one place to change them */ export const LIMITS = { - document: 8000, - documentShort: 6000, - documentBrief: 2000, - documentFull: 50000, + document: 250_000, + documentShort: 100_000, + documentBrief: 20_000, + documentFull: 250_000, reference: 500, wireframe: 3000, historyEntries: 5, diff --git a/server/routes.ts b/server/routes.ts index 64c2ade8..078d3f8f 100644 --- a/server/routes.ts +++ b/server/routes.ts @@ -953,7 +953,7 @@ You MUST respond with ONLY valid JSON in this exact format (no markdown, no expl const challengeAppConfig = getAppTypeConfig(challengeAppType); const challengeAppContext = formatAppTypeContext(challengeAppType); - const MAX_ANALYSIS_LENGTH = 8000; + const MAX_ANALYSIS_LENGTH = 250_000; const analysisText = docText.slice(0, MAX_ANALYSIS_LENGTH); // Resolve personas — use effective (DB override + code default), fall back to built-in @@ -1144,7 +1144,7 @@ Output only valid JSON, no markdown.`, const appConfig = getAppTypeConfig(appType); const appContext = formatAppTypeContext(appType); - const MAX_ANALYSIS_LENGTH = 6000; + const MAX_ANALYSIS_LENGTH = 250_000; const analysisText = docText.slice(0, MAX_ANALYSIS_LENGTH); // Build discussion history context if available @@ -4374,7 +4374,7 @@ ${docText ? `CURRENT DOCUMENT:\n${docText.slice(0, 3000)}\n\n` : ""}INTERVIEW Q& const askAppConfig = getAppTypeConfig(askAppType); const askAppContext = formatAppTypeContext(askAppType); - const MAX_DOC_LENGTH = 6000; + const MAX_DOC_LENGTH = 250_000; const analysisText = docText.slice(0, MAX_DOC_LENGTH); // Build session context section from pinned documents / captured items diff --git a/shared/schema.ts b/shared/schema.ts index 4cdf18d7..efeedfc8 100644 --- a/shared/schema.ts +++ b/shared/schema.ts @@ -335,7 +335,7 @@ export const writeRequestSchema = z.object({ selectedText: z.string().max(50_000).optional(), // Intent (required - what user wants) - instruction: z.string().min(1, "Instruction is required").max(5_000), + instruction: z.string().min(1, "Instruction is required").max(250_000), // Context (optional - additional grounding) provocation: provocationContextSchema.optional(), diff --git a/tests/unit/server/context-builder.test.ts b/tests/unit/server/context-builder.test.ts index 7122803a..7a9576ee 100644 --- a/tests/unit/server/context-builder.test.ts +++ b/tests/unit/server/context-builder.test.ts @@ -343,10 +343,10 @@ describe("buildContext", () => { // --------------------------------------------------------------------------- describe("LIMITS", () => { it("has expected defaults", () => { - expect(LIMITS.document).toBe(8000); - expect(LIMITS.documentShort).toBe(6000); - expect(LIMITS.documentBrief).toBe(2000); - expect(LIMITS.documentFull).toBe(50000); + expect(LIMITS.document).toBe(250_000); + expect(LIMITS.documentShort).toBe(100_000); + expect(LIMITS.documentBrief).toBe(20_000); + expect(LIMITS.documentFull).toBe(250_000); expect(LIMITS.reference).toBe(500); expect(LIMITS.wireframe).toBe(3000); expect(LIMITS.historyEntries).toBe(5);