Skip to content

Commit fee1b25

Browse files
committed
feat: implement smart pruning
1 parent 8e3ab4a commit fee1b25

5 files changed

Lines changed: 420 additions & 29 deletions

File tree

packages/opencode/script/build.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bun
22

3-
import solidPlugin from "../node_modules/@opentui/solid/scripts/solid-plugin"
3+
import solidPlugin from "@opentui/solid/bun-plugin"
44
import path from "path"
55
import fs from "fs"
66
import { $ } from "bun"

packages/opencode/src/config/config.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,6 +1004,42 @@ export namespace Config {
10041004
prune: z.boolean().optional().describe("Enable pruning of old tool outputs (default: true)"),
10051005
})
10061006
.optional(),
1007+
pruning: z
1008+
.object({
1009+
enabled: z.boolean().optional().describe("Enable smart pruning (default: true)"),
1010+
budgets: z
1011+
.object({
1012+
content: z
1013+
.number()
1014+
.optional()
1015+
.describe("Token budget for content tools like read/webfetch (default: 60000)"),
1016+
navigation: z
1017+
.number()
1018+
.optional()
1019+
.describe("Token budget for navigation tools like grep/glob (default: 15000)"),
1020+
})
1021+
.optional(),
1022+
summarization: z
1023+
.object({
1024+
enabled: z.boolean().optional().describe("Enable LLM summarization for content tools (default: true)"),
1025+
model: z
1026+
.string()
1027+
.optional()
1028+
.describe("Model to use for summarization (default: uses small_model or provider's small model)"),
1029+
})
1030+
.optional(),
1031+
contentTools: z
1032+
.array(z.string())
1033+
.optional()
1034+
.describe("Additional tools to treat as content tools (high priority)"),
1035+
navigationTools: z
1036+
.array(z.string())
1037+
.optional()
1038+
.describe("Additional tools to treat as navigation tools (low priority)"),
1039+
protectedTools: z.array(z.string()).optional().describe("Tools that should never be pruned"),
1040+
})
1041+
.optional()
1042+
.describe("Smart pruning configuration for tiered tool output management"),
10071043
experimental: z
10081044
.object({
10091045
hook: z

0 commit comments

Comments
 (0)