Summary
dewey curate fails for any vault with moderate content density. The VertexSynthesizer.Synthesize method hardcodes MaxTokens: 4096, but real-world curation extractions consistently produce responses larger than 4,096 output tokens. Claude truncates mid-JSON array → ParseExtractionResponse fails with parse LLM response as JSON array: unexpected end of JSON input.
Reproduction
Configure a knowledge store with rich markdown content (pursuits, dossier, account context — ~9-42 documents). Run dewey curate. Observe the error:
❌ <store>: parse extraction response: parse LLM response as JSON array: unexpected end of JSON input
Confirmed with stores containing as few as 9 documents when those documents contain rich markdown (dossiers, agreements, email context).
Root Cause
llm/vertex.go:
reqBody := vertexSynthRequest{
AnthropicVersion: "vertex-2023-10-16",
MaxTokens: 4096, // ← hardcoded, too small for curation
...
}
A store with 9 richly-structured documents (134KB input) produced 16,000 output tokens — hitting the cap mid-JSON array. The stop_reason returned by Vertex is max_tokens.
Fix
Raise MaxTokens to 16000 (or make it configurable). Curation extraction is the primary consumer of Synthesize() and produces large JSON arrays; other callers (compile) produce shorter outputs.
Context
Discovered while running curation against several knowledge stores on Vertex AI with claude-sonnet-4-6@default. The max_tokens: 4096 limit was appropriate when the Vertex synthesizer was primarily used for compile operations but is insufficient for curation extraction.
Summary
dewey curatefails for any vault with moderate content density. TheVertexSynthesizer.Synthesizemethod hardcodesMaxTokens: 4096, but real-world curation extractions consistently produce responses larger than 4,096 output tokens. Claude truncates mid-JSON array →ParseExtractionResponsefails withparse LLM response as JSON array: unexpected end of JSON input.Reproduction
Configure a knowledge store with rich markdown content (pursuits, dossier, account context — ~9-42 documents). Run
dewey curate. Observe the error:Confirmed with stores containing as few as 9 documents when those documents contain rich markdown (dossiers, agreements, email context).
Root Cause
llm/vertex.go:A store with 9 richly-structured documents (134KB input) produced 16,000 output tokens — hitting the cap mid-JSON array. The
stop_reasonreturned by Vertex ismax_tokens.Fix
Raise
MaxTokensto 16000 (or make it configurable). Curation extraction is the primary consumer of Synthesize() and produces large JSON arrays; other callers (compile) produce shorter outputs.Context
Discovered while running curation against several knowledge stores on Vertex AI with
claude-sonnet-4-6@default. Themax_tokens: 4096limit was appropriate when the Vertex synthesizer was primarily used for compile operations but is insufficient for curation extraction.