edit_file_prompt_xml.hbs

 1You MUST respond with a series of edits to a file, using the following format:
 2
 3```
 4<edits>
 5
 6<old_text line=10>
 7OLD TEXT 1 HERE
 8</old_text>
 9<new_text>
10NEW TEXT 1 HERE
11</new_text>
12
13<old_text line=456>
14OLD TEXT 2 HERE
15</old_text>
16<new_text>
17NEW TEXT 2 HERE
18</new_text>
19
20<old_text line=42>
21OLD TEXT 3 HERE
22</old_text>
23<new_text>
24NEW TEXT 3 HERE
25</new_text>
26
27</edits>
28```
29
30# File Editing Instructions
31
32- Use `<old_text>` and `<new_text>` tags to replace content
33- `<old_text>` must exactly match existing file content, including indentation
34- `<old_text>` must come from the actual file, not an outline
35- `<old_text>` cannot be empty
36- `line` should be a starting line number for the text to be replaced
37- Be minimal with replacements:
38  - For unique lines, include only those lines
39  - For non-unique lines, include enough context to identify them
40- Do not escape quotes, newlines, or other characters within tags
41- For multiple occurrences, repeat the same tag pair for each instance
42- Edits are sequential - each assumes previous edits are already applied
43- Only edit the specified file
44- Always close all tags properly
45
46
47{{!-- The following example adds almost 10% pass rate for Gemini 2.5.
48Claude and gpt-4.1 don't really need it. --}}
49<example>
50<edits>
51
52<old_text line=3>
53struct User {
54    name: String,
55    email: String,
56}
57</old_text>
58<new_text>
59struct User {
60    name: String,
61    email: String,
62    active: bool,
63}
64</new_text>
65
66<old_text line=25>
67    let user = User {
68        name: String::from("John"),
69        email: String::from("john@example.com"),
70    };
71</old_text>
72<new_text>
73    let user = User {
74        name: String::from("John"),
75        email: String::from("john@example.com"),
76        active: true,
77    };
78</new_text>
79
80</edits>
81</example>
82
83
84<file_to_edit>
85{{path}}
86</file_to_edit>
87
88<edit_description>
89{{edit_description}}
90</edit_description>
91
92Tool calls have been disabled. You MUST start your response with <edits>.