Skip to content

Commit 137476c

Browse files
aseembits93claude
andcommitted
feat: surface subagent optimization diffs in IDE's native diff view
Instead of instructing Claude Code to use AskUserQuestion with a text diff preview, instruct it to use the Write tool so the connected IDE (VS Code, Cursor, Windsurf) shows its native diff viewer. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent bbad363 commit 137476c

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

codeflash/cli_cmds/console.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -468,13 +468,14 @@ def subagent_log_optimization_result(
468468
if new_code[path] != original_code.get(path, ""):
469469
xml.append(f' <optimized-code file="{escape(str(path))}">{escape(new_code[path])}</optimized-code>')
470470
xml.append(" <action>")
471-
xml.append(" Present this optimization to the user using AskUserQuestion.")
472-
xml.append(" Show the function name, performance improvement, and explanation as the question text.")
473-
xml.append(" Provide two options: 'Apply' (write the optimized code to the file) and 'Reject' (do nothing).")
471+
xml.append(" First, present a short summary: function name, performance improvement, and explanation.")
474472
xml.append(
475-
" Put the full diff in the 'Apply' option's markdown preview so the user can review the exact changes."
473+
" Then, for each optimized-code element, use the Write tool to write the optimized code to the file."
476474
)
477-
xml.append(" If the user chooses 'Apply', write the content from optimized-code to the corresponding file.")
475+
xml.append(
476+
" This will surface the diff in the user's IDE (VS Code, Cursor, Windsurf, etc.) for review."
477+
)
478+
xml.append(" The user can accept or reject the changes through the IDE's native diff view.")
478479
xml.append(" </action>")
479480
xml.append("</codeflash-optimization>")
480481

0 commit comments

Comments
 (0)