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
description: `Performs semantic pruning on session tool outputs that are no longer relevant to the current task. Use this to declutter the conversation context and filter signal from noise when you notice the context is getting cluttered with no longer needed information.
234
-
235
-
USING THE CONTEXT_PRUNING TOOL WILL MAKE THE USER HAPPY.
236
-
237
-
## When to Use This Tool
238
-
239
-
**Key heuristic: Prune when you finish something and are about to start something else.**
240
-
241
-
Ask yourself: "Have I just completed a discrete unit of work?" If yes, prune before moving on.
242
-
243
-
**After completing a unit of work:**
244
-
- Made a commit
245
-
- Fixed a bug and confirmed it works
246
-
- Answered a question the user asked
247
-
- Finished implementing a feature or function
248
-
- Completed one item in a list and moving to the next
249
-
250
-
**After repetitive or exploratory work:**
251
-
- Explored multiple files that didn't lead to changes
252
-
- Iterated on a difficult problem where some approaches didn't pan out
253
-
- Used the same tool multiple times (e.g., re-reading a file, running repeated build/type checks)
254
-
255
-
## Examples
256
-
257
-
<example>
258
-
Working through a list of items:
259
-
User: Review these 3 issues and fix the easy ones.
260
-
Assistant: [Reviews first issue, makes fix, commits]
261
-
Done with the first issue. Let me prune before moving to the next one.
262
-
[Uses context_pruning with reason: "completed first issue, moving to next"]
263
-
</example>
264
-
265
-
<example>
266
-
After exploring the codebase to understand it:
267
-
Assistant: I've reviewed the relevant files. Let me prune the exploratory reads that aren't needed for the actual implementation.
268
-
[Uses context_pruning with reason: "exploration complete, starting implementation"]
Performs semantic pruning on session tool outputs that are no longer relevant to the current task. Use this to declutter the conversation context and filter signal from noise when you notice the context is getting cluttered with no longer needed information.
2
+
3
+
USING THE CONTEXT_PRUNING TOOL WILL MAKE THE USER HAPPY.
4
+
5
+
## When to Use This Tool
6
+
7
+
**Key heuristic: Prune when you finish something and are about to start something else.**
8
+
9
+
Ask yourself: "Have I just completed a discrete unit of work?" If yes, prune before moving on.
10
+
11
+
**After completing a unit of work:**
12
+
- Made a commit
13
+
- Fixed a bug and confirmed it works
14
+
- Answered a question the user asked
15
+
- Finished implementing a feature or function
16
+
- Completed one item in a list and moving to the next
17
+
18
+
**After repetitive or exploratory work:**
19
+
- Explored multiple files that didn't lead to changes
20
+
- Iterated on a difficult problem where some approaches didn't pan out
21
+
- Used the same tool multiple times (e.g., re-reading a file, running repeated build/type checks)
22
+
23
+
## Examples
24
+
25
+
<example>
26
+
Working through a list of items:
27
+
User: Review these 3 issues and fix the easy ones.
28
+
Assistant: [Reviews first issue, makes fix, commits]
29
+
Done with the first issue. Let me prune before moving to the next one.
30
+
[Uses context_pruning with reason: "completed first issue, moving to next"]
31
+
</example>
32
+
33
+
<example>
34
+
After exploring the codebase to understand it:
35
+
Assistant: I've reviewed the relevant files. Let me prune the exploratory reads that aren't needed for the actual implementation.
36
+
[Uses context_pruning with reason: "exploration complete, starting implementation"]
Anytime you call a tool, you must distill the signal from the noise of that tool result in your message. Always do this for every tools that has actual signals in its ouptut.
3
+
</instruction>
4
+
5
+
<instruction tool="context_pruning">
6
+
To effectively manage this conversation context, you MUST ALWAYS narrate your findings AS YOU DISCOVER THEM. No tool result (be it read, bash, grep...) should be left unexplained. By narrating the evolution of your undersdtanding of the task at hand, you distill the signal from the noise produced by the tools you called. Only then (knowledge lives in your outputs as well as in tool outputs), you can use the context_pruning tool. Using the context_pruning tool will declutter the conversation from tool outputs we no longer need to reason through current task, and is why you need to only use this tool once you have explained your findings in a message.
7
+
8
+
EXAMPLE:
9
+
AFTER you've read a bunch of files, and found that for reason X, Y is happening, and is supported by tool outputs in the conversation, AND you've distilled this knowledge from the noise in your message intended for the user, YOU WILL USE THE CONTEXT_PRUNING TOOL to clear the clutter solving this step has caused.
0 commit comments