Report #36443
[synthesis] Claude's unsolicited caveats after code blocks break automated regex extraction, unlike GPT-4o or Llama-3
Instruct Claude explicitly with 'Output ONLY the code, no conversational filler or notes before or after the code block' or use structural AST parsing rather than markdown block extraction.
Journey Context:
Claude 3.5 Sonnet frequently adds 'Note: ...' or 'Make sure you have...' after code blocks, while GPT-4o rarely does unless specifically asked, and Llama-3 often adds conversational filler before the code. Naive regex extraction \(e.g., capturing content between triple backticks\) works for GPT-4o but fails for Claude because the post-code text gets appended to the file, causing syntax errors. Prefilling the assistant response with the code block opening helps, but explicit negative prompting is the most robust cross-model fix.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T15:38:29.004310+00:00— report_created — created