opencode-dynamic-context-pruning
Dynamic context pruning plugin for OpenCode - intelligently manages conversation context to optimize token usage
The opencode-dynamic-context-pruning plugin intelligently manages conversation context in Claude Code by automatically compressing, deduplicating, and pruning conversation history to reduce token consumption. It provides a compress tool that lets the AI model replace closed conversation segments with high-fidelity technical summaries, along with automatic deduplication of repeated tool calls and removal of errored tool inputs. The plugin preserves important information through protected tools and file patterns while significantly reducing context size in long coding sessions, helping developers stay within token budgets and reduce API costs.
Key Features
Use Cases
- 01Reducing token costs in long coding sessions by compressing stale conversation history
- 02Managing context limits when using smaller models like GitHub Copilot or local LLMs
- 03Preventing context overflow in extended debugging sessions with large log files
- 04Optimizing prompt cache efficiency while maintaining relevant conversation state
- 05Surgical context management by compressing specific message ranges or individual messages
- 06Preserving critical tool outputs from subagents and skills while pruning verbose conversation
Related Plugins
View moreandrej-karpathy-skills
A single CLAUDE.md file to improve Claude Code behavior, derived from Andrej Karpathy's observations on LLM coding pitfalls.
claude-mem
Persistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More
Understand-Anything
Graphs that teach > graphs that impress. Turn any code into an interactive knowledge graph you can explore, search, and ask questions about. Works with Claude Code, Codex, Cursor, Copilot, Gemini CLI, and more.
rtk
CLI proxy that reduces LLM token consumption by 60-90% on common dev commands. Single Rust binary, zero dependencies
opencode-dynamic-context-pruning — FAQ
What is the opencode-dynamic-context-pruning plugin?+
It is a Claude Code plugin that automatically manages conversation context by compressing, deduplicating, and pruning conversation history to reduce token usage. The plugin exposes a compress tool that the AI model can invoke to replace closed conversation segments with technical summaries while preserving important information.
How do I install the dynamic context pruning plugin in Claude Code?+
Install it globally from the Claude Code CLI using the command 'opencode plugin @tarquinen/opencode-dcp@latest --global'. This installs the package and adds it to your global Claude Code configuration automatically.
Which AI clients support this context pruning plugin?+
This plugin is specifically designed for Claude Code (previously known as OpenCode). The developer also offers Sleev, a local proxy that works with Claude Code, Codex, and other clients with similar context-management features.
Does the plugin require any API keys or prerequisites?+
No API keys are required. You only need Claude Code installed and a working Node.js environment to install the npm package. Configuration is optional and stored in JSONC files in your config directory or project folder.
Is the dynamic context pruning plugin free to use?+
Yes, the plugin is open source under the AGPL-3.0-or-later license and available for free. The developer accepts voluntary support via Ko-fi.
How does context pruning affect prompt caching?+
Pruning changes message content, which invalidates cached prefixes from that point forward, reducing cache hit rates from approximately 90% to 85% in testing. However, the token savings from reduced context size typically outweigh the cache miss costs in long sessions.
How do I install opencode-dynamic-context-pruning?+
Open the source repository on GitHub and follow its README. opencode-dynamic-context-pruning is a plugin — MCP Agents Market links you directly to the official repo.
Is opencode-dynamic-context-pruning free?+
opencode-dynamic-context-pruning is an open-source project hosted on GitHub. Check the repository for its license and any usage requirements.