Skip to content

Commit e2cf21c

Browse files
committed
docs: clarify apply_diff tool descriptions to emphasize surgical edits
- Updated multi-file-search-replace.ts to emphasize PRECISE, TARGETED modifications - Updated multi-search-replace.ts with similar clarification - Updated rules.ts to describe apply_diff as for 'surgical edits - targeted changes' - These changes help users understand that apply_diff is for specific code modifications, not broad rewrites
1 parent b73c17a commit e2cf21c

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
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/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)