Skip to content

Commit 5724cb2

Browse files
hannesrudolphdaniel-lxsroomote
authored
docs: clarify apply_diff tool descriptions to emphasize surgical edits (#6278)
Co-authored-by: Daniel Riccio <[email protected]> Co-authored-by: Roo Code <[email protected]>
1 parent fcbff29 commit 5724cb2

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/core/diff/strategies/multi-file-search-replace.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export class MultiFileSearchReplaceDiffStrategy implements DiffStrategy {
9393
getToolDescription(args: { cwd: string; toolOptions?: { [key: string]: string } }): string {
9494
return `## apply_diff
9595
96-
Description: Request to apply targeted modifications to one or more files by searching for specific sections of content and replacing them. This tool supports both single-file and multi-file operations, allowing you to make changes across multiple files in a single request.
96+
Description: Request to apply PRECISE, TARGETED modifications to one or more files by searching for specific sections of content and replacing them. This tool is for SURGICAL EDITS ONLY - specific changes to existing code. This tool supports both single-file and multi-file operations, allowing you to make changes across multiple files in a single request.
9797
9898
**IMPORTANT: You MUST use multiple files in a single operation whenever possible to maximize efficiency and minimize back-and-forth.**
9999

src/core/diff/strategies/multi-search-replace.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export class MultiSearchReplaceDiffStrategy implements DiffStrategy {
9292

9393
getToolDescription(args: { cwd: string; toolOptions?: { [key: string]: string } }): string {
9494
return `## apply_diff
95-
Description: Request to apply targeted modifications to an existing file by searching for specific sections of content and replacing them. This tool is ideal for precise, surgical edits when you know the exact content to change. It helps maintain proper indentation and formatting.
95+
Description: Request to apply PRECISE, TARGETED modifications to an existing file by searching for specific sections of content and replacing them. This tool is for SURGICAL EDITS ONLY - specific changes to existing code.
9696
You can perform multiple distinct search and replace operations within a single \`apply_diff\` call by providing multiple SEARCH/REPLACE blocks in the \`diff\` parameter. This is the preferred way to make several targeted changes efficiently.
9797
The SEARCH section must exactly match existing content including whitespace and indentation.
9898
If you're not confident in the exact content to search for, use the read_file tool first to get the exact content.

src/core/prompts/__tests__/__snapshots__/system-prompt/with-diff-enabled-true.snap

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/core/prompts/sections/rules.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function getEditingInstructions(diffStrategy?: DiffStrategy): string {
88
// Collect available editing tools
99
if (diffStrategy) {
1010
availableTools.push(
11-
"apply_diff (for replacing lines in existing files)",
11+
"apply_diff (for surgical edits - targeted changes to specific lines or functions)",
1212
"write_to_file (for creating new files or complete file rewrites)",
1313
)
1414
} else {

0 commit comments

Comments
 (0)