From 25026d72e36e3e58deb87c9ee1a78f24d0a99e40 Mon Sep 17 00:00:00 2001 From: shanevcantwell <153727980+shanevcantwell@users.noreply.github.com> Date: Thu, 12 Feb 2026 22:23:18 -0700 Subject: [PATCH] fix: strengthen default Apply prompt for local models Local models respond to the existing single-sentence Apply prompt with prose summaries instead of code. Return ChatMessage[] with explicit code-only instructions and assistant prefill to force code output. Co-Authored-By: Claude Opus 4.6 --- core/llm/templates/edit/gpt.ts | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/core/llm/templates/edit/gpt.ts b/core/llm/templates/edit/gpt.ts index 232c9de5e34..9f2ed7c6a71 100644 --- a/core/llm/templates/edit/gpt.ts +++ b/core/llm/templates/edit/gpt.ts @@ -73,8 +73,31 @@ export const gptEditPrompt: PromptTemplateFunction = (history, otherData) => { }; export const defaultApplyPrompt: PromptTemplateFunction = ( - history, + _history, otherData, ) => { - return `${otherData.original_code}\n\nThe following code was suggested as an edit:\n\`\`\`\n${otherData.new_code}\n\`\`\`\nPlease apply it to the previous code. Leave existing comments in place unless changes require modifying them.`; + return [ + { + role: "user", + content: dedent` + ORIGINAL CODE: + \`\`\` + ${otherData.original_code} + \`\`\` + + SUGGESTED EDIT: + \`\`\` + ${otherData.new_code} + \`\`\` + + Apply the SUGGESTED EDIT to the ORIGINAL CODE. Output the complete modified file. + - Output ONLY code. Do NOT explain, summarize, or describe changes. + - Leave existing comments in place unless changes require modifying them. + - Preserve all unchanged code exactly as-is.`, + }, + { + role: "assistant", + content: `\`\`\`\n`, + }, + ]; };