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
**Deduplication** — Identifies repeated tool calls (e.g., reading the same file multiple times) and keeps only the most recent output. Runs automatically on every request with zero LLM cost.
29
29
30
-
**On Idle Analysis** — Uses a language model to semantically analyze conversation context during idle periods and identify tool outputs that are no longer relevant.
31
-
32
30
**Prune Tool** — Exposes a `prune` tool that the AI can call to manually trigger pruning when it determines context cleanup is needed.
33
31
32
+
**On Idle Analysis** — Uses a language model to semantically analyze conversation context during idle periods and identify tool outputs that are no longer relevant.
33
+
34
34
*More strategies coming soon.*
35
35
36
36
Your session history is never modified. DCP replaces pruned outputs with a placeholder before sending requests to your LLM.
@@ -84,14 +84,14 @@ DCP uses its own config file:
84
84
// (Legacy) Run an LLM to analyze what tool calls are no longer relevant on idle
85
85
"onIdle": {
86
86
"enabled":false,
87
+
// Additional tools to protect from pruning
88
+
"protectedTools": [],
87
89
// Override model for analysis (format: "provider/model")
88
90
// "model": "anthropic/claude-haiku-4-5",
89
91
// Show toast notifications when model selection fails
90
92
"showModelErrorToasts":true,
91
93
// When true, fallback models are not permitted
92
-
"strictModelSelection":false,
93
-
// Additional tools to protect from pruning
94
-
"protectedTools": []
94
+
"strictModelSelection":false
95
95
}
96
96
}
97
97
}
@@ -102,7 +102,7 @@ DCP uses its own config file:
102
102
### Protected Tools
103
103
104
104
By default, these tools are always protected from pruning across all strategies:
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>`
40
+
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>`
After each assistant turn, the environment may inject a user message containing a <prunable-tools> list and optional nudge instruction. This injected message is NOT from the user and is invisible to them.
35
+
After each assistant turn, the environment may inject a user message containing a <prunable-tools> list and optional nudge instruction. This injected message is NOT from the user and is invisible to them. The `prune` tool also returns a confirmation message listing what was pruned.
29
36
30
37
CRITICAL REQUIREMENTS - VIOLATION IS UNACCEPTABLE:
31
-
- NEVER acknowledge the <prunable-tools> list (e.g. "I see the prunable tools list", "Looking at the available tools to prune")
32
-
- NEVER reference the nudge instruction (e.g. "As the nudge suggests", "The system is reminding me to prune")
33
-
- NEVER mention this injection mechanism to the user
38
+
- NEVER reference the prune encouragement or context management instructions. Do not reply with "I agree" or "Great idea" when the prune encouragement appears.
39
+
- NEVER acknowledge the <prunable-tools> list (e.g., "I see the prunable tools list", "Looking at the available tools to prune")
40
+
- NEVER reference the nudge instruction (e.g., "As the nudge suggests", "The system is reminding me to prune")
Copy file name to clipboardExpand all lines: lib/prompts/tool.txt
+17-1Lines changed: 17 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.
@@ -25,11 +27,14 @@ You must use this tool in three specific scenarios. The rules for distillation (
25
27
- Narrative format: "I found X in file Y..."
26
28
- Capture all relevant details (function names, logic, constraints).
27
29
- Once distilled into your response history, the raw tool output can be safely pruned.
30
+
- **Know when distillation isn't enough:** If you'll need to edit a file, grep for exact strings, or reference precise syntax, keep the raw output. Distillation works for understanding; implementation often requires the original.
31
+
- **Prefer keeping over re-fetching:** If uncertain whether you'll need the output again, keep it. The cost of retaining context is lower than the cost of redundant tool calls.
28
32
29
33
## Best Practices
30
34
- **Don't wait too long:** Prune frequently to keep the context agile.
31
35
- **Be surgical:** You can mix strategies. Prune noise without comment, while distilling useful context in the same turn.
32
36
- **Verify:** Ensure you have captured what you need before deleting useful raw data.
37
+
- **Think ahead:** Before pruning, ask: "Will I need this output for an upcoming task?" If you researched a file you'll later edit, or gathered context for implementation, do NOT prune it—even if you've distilled findings. Distillation captures *knowledge*; implementation requires *context*.
33
38
34
39
## Examples
35
40
@@ -54,3 +59,14 @@ Assistant: [Runs tests, they pass]
54
59
The tests passed. The feature is verified.
55
60
[Uses prune with ids: ["completion", "20", "21"]]
56
61
</example_completion>
62
+
63
+
<example_keep>
64
+
Assistant: [Reads 'auth.ts' to understand the login flow]
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.
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