Skip to content

feat: surface subagent optimization diffs in IDE's native diff view#1666

Merged
misrasaurabh1 merged 3 commits intomainfrom
feat/subagent-ide-diff
Feb 27, 2026
Merged

feat: surface subagent optimization diffs in IDE's native diff view#1666
misrasaurabh1 merged 3 commits intomainfrom
feat/subagent-ide-diff

Conversation

@aseembits93
Copy link
Contributor

Summary

  • Updated subagent mode's <action> instructions to tell Claude Code to use the Write tool instead of AskUserQuestion
  • When Claude Code writes optimized code to files, the connected IDE (VS Code, Cursor, Windsurf) surfaces the changes in its native diff viewer
  • Users can accept or reject optimizations through the IDE's diff UI rather than reading a text diff in the chat

Test plan

  • Run codeflash --subagent and verify the XML output contains the updated <action> block
  • Invoke via Claude Code in an IDE-connected session and confirm the diff appears in the IDE's diff viewer

🤖 Generated with Claude Code

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>
@aseembits93 aseembits93 requested a review from KRRT7 February 25, 2026 18:57
@aseembits93
Copy link
Contributor Author

@KRRT7 the existing style of diff would collapse if the diff is large enough, if we rely on claude's native style of diff, it handles it slightly better imo

@KRRT7
Copy link
Collaborator

KRRT7 commented Feb 25, 2026

personally, I've been using Claude Code + Warp which has a built in diff view, which allows me to view them without ever using my IDE, so I keep that open less and less, and the creator of Claude Code has said he and a lot of engineers have stopped using IDEs entirely, this will break that flow, so you should look into how to support both

@aseembits93
Copy link
Contributor Author

@KRRT7 in the current setup are you able to amend the diff, make changes which are not part of the diff?

@claude
Copy link
Contributor

claude bot commented Feb 25, 2026

PR Review Summary

Prek Checks

✅ All checks passed — ruff check and ruff format clean, no fixes needed.

Mypy

✅ All mypy errors in console.py are pre-existing (lines 125-229: paneled_text, code_print, progress_bar, test_files_progress_bar). The PR only modifies string literals at lines 470-482, which are not type-checked. No new type issues introduced.

Code Review

✅ No critical issues found.

The change is minimal and well-scoped — it updates the XML <action> instructions in subagent_log_optimization_result to:

  • IDE mode: Use the Write tool to surface diffs in the IDE's native diff viewer
  • Terminal mode: Fall back to AskUserQuestion with markdown diff preview (previous behavior)

No logic changes, no API changes, no security concerns.

Test Coverage

File Stmts (PR) Miss (PR) Cover (PR) Cover (main) Delta
codeflash/cli_cmds/console.py 267 217 19% 19% 0%
  • No coverage regression — coverage unchanged at 19% on both branches
  • The changed lines are string literals inside subagent_log_optimization_result which is a UI/output function — the low coverage is pre-existing and not introduced by this PR
  • No new files added

Codeflash Optimization PRs

No open optimization PRs targeting main.


Last updated: 2026-02-25

…agent optimizations

Emit conditional instructions so Claude Code uses the Write tool (IDE native diff)
when connected to an IDE, or AskUserQuestion with a markdown preview when running
in a plain terminal.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@aseembits93
Copy link
Contributor Author

anthropics/claude-code#6735 it's a feature request unfortunately with CC . once CC presents a diff, the user cannot manually modify it, the user can only instruct claude in english to make the necessary change

@aseembits93
Copy link
Contributor Author

anthropics/claude-code#27708 this one too

@KRRT7
Copy link
Collaborator

KRRT7 commented Feb 25, 2026

i prompt it to make the changes, or i make the changes thru nano / warp and tell claude i've made the changes and it auto shows me the changes

the workflow with Claude Code has largely changed to just prompting Claude to make the changes itself

@misrasaurabh1 thoughts?

@misrasaurabh1
Copy link
Contributor

I would need to see how this looks like compared the the alternative - at a very high level I like the native claude diff handling since it makes people feel more comfortable with the new code.

@KRRT7
Copy link
Collaborator

KRRT7 commented Feb 27, 2026

@aseembits93 I guess we can.merge?

@aseembits93
Copy link
Contributor Author

@KRRT7 let's merge, will iterate more with new PRs

@misrasaurabh1
Copy link
Contributor

i am merging so that i can try with the latest version

@misrasaurabh1 misrasaurabh1 merged commit 4843748 into main Feb 27, 2026
26 of 28 checks passed
@misrasaurabh1 misrasaurabh1 deleted the feat/subagent-ide-diff branch February 27, 2026 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants