edit_file_prompt.hbs

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