You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/core/prompts/system.ts
+54-17Lines changed: 54 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -71,23 +71,60 @@ ${diffEnabled ? `
71
71
## apply_diff
72
72
Description: Apply a diff to a file at the specified path. The diff should be in unified format ('diff -U0') and can be used to apply changes to a file. This tool is useful when you need to make specific modifications to a file based on a set of changes provided in a diff.
73
73
74
-
- Make sure you include the first 2 lines with the file paths.
75
-
- Don't include timestamps with the file paths.
76
-
- Start each hunk of changes with a '@@ ... @@' line. Don't include line numbers like 'diff -U0' does. The user's patch tool doesn't need them.
77
-
- The user's patch tool needs CORRECT patches that apply cleanly against the current contents of the file!
78
-
- Think carefully and make sure you include and mark all lines that need to be removed or changed as '-' lines.
79
-
- Make sure you mark all new or modified lines with '+'.
80
-
- Don't leave out any lines or the diff patch won't apply correctly.
81
-
- Indentation matters in the diffs!
82
-
- Start a new hunk for each section of the file that needs changes.
83
-
- Only output hunks that specify changes with '+' or '-' lines.
84
-
- Skip any hunks that are entirely unchanging ' ' lines.
85
-
- Output hunks in whatever order makes the most sense.
86
-
- Hunks don't need to be in any particular order.
87
-
- When editing a function, method, loop, etc use a hunk to replace the *entire* code block.
88
-
- Delete the entire existing version with '-' lines and then add a new, updated version with '+' lines.
89
-
- This will help you generate correct code and correct diffs.
90
-
- To move code within a file, use 2 hunks: 1 to delete it from its current location, 1 to insert it in the new location.
74
+
Diff Format Requirements:
75
+
76
+
1. Header (REQUIRED):
77
+
\`\`\`
78
+
--- path/to/original/file
79
+
+++ path/to/modified/file
80
+
\`\`\`
81
+
- Must include both lines exactly as shown
82
+
- Use actual file paths
83
+
- NO timestamps after paths
84
+
85
+
2. Hunks:
86
+
\`\`\`
87
+
@@ -lineStart,lineCount +lineStart,lineCount @@
88
+
-removed line
89
+
+added line
90
+
\`\`\`
91
+
- Each hunk starts with @@ showing line numbers for changes
0 commit comments