About this project

Dynamic Context Pruning (DCP) is a plugin for OpenCode that optimizes token usage by intelligently managing conversation context. It operates by replacing closed or stale conversation content with high-fidelity technical summaries before sending requests to the LLM, ensuring the original session history is never modified. Core capabilities include: - Compression: A tool exposed to the model that replaces stale content with summaries. It supports "range" mode for contiguous spans and experimental "message" mode for individual messages. Overlapping summaries are nested to preserve information, and protected tool outputs or file patterns are retained. - Deduplication: Identifies repeated tool calls with identical arguments, keeping only the most recent output. - Purge Errors: Removes large inputs from errored tool calls after a set number of turns while preserving the error messages. DCP is highly configurable through global or project-specific JSON files. Users can adjust compression modes, context limits, and protected tools. It provides a TUI panel and slash commands (/dcp, /dcp-compress) for manual control and statistics. Additionally, it supports custom prompt overrides for its internal instructions, allowing users to tailor the compression behavior to their specific needs.