fix: strengthen default Apply prompt for local models#10486
fix: strengthen default Apply prompt for local models#10486RomneyDa merged 1 commit intocontinuedev:mainfrom
Conversation
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 <noreply@anthropic.com>
RomneyDa
left a comment
There was a problem hiding this comment.
@shanevcantwell just to double check any reason the new apply prompt is now messages instead of the raw text?
|
The messages format lets us include an assistant prefill: the The assistant prefill locks the model into continuing inside a code fence, so the output is code-only. This pattern already exists in the lazy apply prompt ( The fallback path in |
RomneyDa
left a comment
There was a problem hiding this comment.
@shanevcantwell appreciate the explanation! Looks good to me.
Summary
defaultApplyPromptreturns a single-sentence plain string with no code-only constraintdefaultApplyPromptto returnChatMessage[]with labeled ORIGINAL CODE / SUGGESTED EDIT sections, explicit "Output ONLY code" instructions, and an assistant prefill opening a code blockstreamChat(instead ofstreamComplete), and the assistant prefill forces the model to continue with code rather than prosefilterCodeBlockLinesfilter strips the closing fence from the outputContext
defaultApplyPromptis the fallback Apply prompt used when no model-specificpromptTemplates.applyis configured. It applies when a model callsedit_existing_fileand the Apply step merges the suggested code into the original file.The previous prompt was:
Local models (tested with gpt-oss-20b via LM Studio) interpreted this as a request to describe changes rather than output code. The new prompt with explicit rules and assistant prefill produces clean code diffs.
What this doesn't change
core/edit/lazy/)gptEditPrompt, notdefaultApplyPrompt)promptTemplates.applyin config (custom overridesdefaultApplyPrompt)Test plan
cd core && npm run vitest— 1654 tests pass, 0 failuresdefaultApplyPrompt)🤖 Generated with Claude Code
Summary by cubic
Make the default Apply prompt produce code (not prose) for local/open‑weight models by switching to a chat-based prompt with code-only instructions and an assistant prefill. Apply now routes through streamChat and returns the full modified file.
Written for commit 25026d7. Summary will update on new commits.