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: README.md
+18-8Lines changed: 18 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,16 +6,27 @@ Automatically reduces token usage in OpenCode by removing obsolete tool outputs
6
6
7
7

8
8
9
+
## Pruning Strategies
10
+
11
+
DCP implements two complementary strategies:
12
+
13
+
**Deduplication** — Fast, zero-cost pruning that identifies repeated tool calls (e.g., reading the same file multiple times) and keeps only the most recent output. Runs instantly with no LLM calls.
14
+
15
+
**AI Analysis** — Uses a language model to semantically analyze conversation context and identify tool outputs that are no longer relevant to the current task. More thorough but incurs LLM cost.
16
+
9
17
## Installation
10
18
11
-
Add to your OpenCode config (`~/.config/opencode/opencode.json` or `.opencode/opencode.json`):
19
+
Add to your OpenCode config:
12
20
13
-
```json
21
+
```jsonc
22
+
// opencode.jsonc
14
23
{
15
-
"plugin": ["@tarquinen/opencode-dcp"]
24
+
"plugins": ["@tarquinen/opencode-dcp@0.3.17"]
16
25
}
17
26
```
18
27
28
+
When a new version is available, DCP will show a toast notification. Update by changing the version number in your config.
29
+
19
30
Restart OpenCode. The plugin will automatically start optimizing your sessions.
20
31
21
32
> **Note:** Project `plugin` arrays override global completely—include all desired plugins in project config if using both.
@@ -36,6 +47,7 @@ DCP uses its own config file (`~/.config/opencode/dcp.jsonc` or `.opencode/dcp.j
36
47
|`debug`|`false`| Log to `~/.config/opencode/logs/dcp/`|
37
48
|`model`| (session) | Model for analysis (e.g., `"anthropic/claude-haiku-4-5"`) |
38
49
|`showModelErrorToasts`|`true`| Show notifications on model fallback |
50
+
|`strictModelSelection`|`false`| Only run AI analysis with session or configured model (disables fallback models) |
39
51
|`pruning_summary`|`"detailed"`|`"off"`, `"minimal"`, or `"detailed"`|
40
52
|`protectedTools`|`["task", "todowrite", "todoread", "context_pruning"]`| Tools that are never pruned |
41
53
|`strategies.onIdle`|`["deduplication", "ai-analysis"]`| Strategies for automatic pruning |
@@ -54,13 +66,11 @@ DCP uses its own config file (`~/.config/opencode/dcp.jsonc` or `.opencode/dcp.j
Settings are merged in order: **Defaults** → **Global** (`~/.config/opencode/dcp.jsonc`) → **Project** (`.opencode/dcp.jsonc`). Each level overrides the previous, so project settings take priority over global, which takes priority over defaults.
* Tool Hook: Exposes context_pruning tool to AI (if configured)
216
-
*/
217
177
tool: config.strategies.onTool.length>0 ? {
218
178
context_pruning: tool({
219
179
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.
0 commit comments