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
return`<prunable-tools>\nThe following tools have been invoked and are available for pruning. This list does not mandate immediate action. Consider your current goals and the resources you need before discarding valuable tool outputs. Keep the context free of noise.\n${lines.join('\n')}\n</prunable-tools>`
43
+
return`<prunable-tools>\nThe following tools have been invoked and are available for pruning. This list does not mandate immediate action. Consider your current goals and the resources you need before discarding valuable tool inputs or outputs. Keep the context free of noise.\n${lines.join('\n')}\n</prunable-tools>`
43
44
}
44
45
45
46
exportconstinsertPruneToolContext=(
@@ -101,7 +102,7 @@ export const prune = (
101
102
messages: WithParts[]
102
103
): void=>{
103
104
pruneToolOutputs(state,logger,messages)
104
-
// more prune methods coming here
105
+
pruneToolInputs(state,logger,messages)
105
106
}
106
107
107
108
constpruneToolOutputs=(
@@ -117,9 +118,37 @@ const pruneToolOutputs = (
117
118
if(!state.prune.toolIds.includes(part.callID)){
118
119
continue
119
120
}
121
+
// Skip write and edit tools - their inputs are pruned instead
Copy file name to clipboardExpand all lines: lib/prompts/tool.txt
+9-1Lines changed: 9 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,10 @@
1
-
Prunes tool outputs from context to manage conversation size and reduce noise.
1
+
Prunes tool outputs from context to manage conversation size and reduce noise. For `write` and `edit` tools, the input content is pruned instead of the output.
2
2
3
3
## IMPORTANT: The Prunable List
4
4
A `<prunable-tools>` list is injected into user messages showing available tool outputs you can prune. Each line has the format `ID: tool, parameter` (e.g., `20: read, /path/to/file.ts`). You MUST only use numeric IDs that appear in this list to select which tools to prune.
5
5
6
+
**Note:** For `write` and `edit` tools, pruning removes the input content (the code being written/edited) while preserving the output confirmation. This is useful after completing a file modification when you no longer need the raw content in context.
7
+
6
8
## CRITICAL: When and How to Prune
7
9
8
10
You must use this tool in three specific scenarios. The rules for distillation (summarizing findings) differ for each. **You must specify the reason as the first element of the `ids` array** to indicate which scenario applies.
@@ -62,3 +64,9 @@ The tests passed. The feature is verified.
62
64
Assistant: [Reads 'auth.ts' to understand the login flow]
63
65
I've understood the auth flow. I'll need to modify this file to add the new validation, so I'm keeping this read in context rather than distilling and pruning.
64
66
</example_keep>
67
+
68
+
<example_edit_completion>
69
+
Assistant: [Edits 'auth.ts' to add validation]
70
+
The edit was successful. I no longer need the raw edit content in context.
0 commit comments