diff --git a/src/core/tools/writeToFileTool.ts b/src/core/tools/writeToFileTool.ts index 5abd96a20a..74638971c7 100644 --- a/src/core/tools/writeToFileTool.ts +++ b/src/core/tools/writeToFileTool.ts @@ -86,6 +86,10 @@ export async function writeToFileTool( if (!cline.api.getModel().id.includes("claude")) { newContent = unescapeHtmlEntities(newContent) } + // Strip accidental XML-like parameter spillover that can appear at the end of content + // e.g., "\n1" + newContent = newContent.replace(/\n<\/parameter>\s*\n[\s\S]*$/i, "") + newContent = newContent.replace(/\n<\/parameter>\s*$/i, "") // Determine if the path is outside the workspace const fullPath = relPath ? path.resolve(cline.cwd, removeClosingTag("path", relPath)) : ""