跳转到内容

Dynamic Context Pruning

此内容尚不支持你的语言。

Dynamic Context Pruning (DCP) automatically reduces token usage in OpenCode by managing conversation context. It is a community plugin, originally by @Tarquinen and now maintained under the Opencode-DCP org.

Project status

Development on DCP has slowed because most new context-management work has moved to Sleev and the sleev CLI — a local proxy for Claude Code, Codex, and OpenCode that builds on DCP’s core ideas. DCP remains available for OpenCode plugin users; if you are starting fresh, the upstream README recommends trying Sleev (npm i -g sleev).

Key features

FeatureDescription
Compress toolExposed to the model; replaces closed, stale conversation content with high-fidelity technical summaries
Model-chosen timingThe model picks when to compress based on task completion, instead of static triggers on maximum context
Selective scopeCompresses only the specific messages no longer needed verbatim
Automatic cleanupPrunes obsolete tool outputs from context
History untouchedSession history is never modified — placeholders are substituted before requests reach your LLM

Installation

Install from the CLI (installs the package and adds it to your global OpenCode config):

opencode plugin @tarquinen/opencode-dcp@latest --global

How it works

DCP reduces context size through the compress tool and automatic cleanup. Instead of triggering statically when a session reaches maximum context across the entire session — as OpenCode’s built-in compaction does — Compress lets the model activate on task completion and target only the messages that are no longer needed verbatim.