npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@qdang46/opencode-dcp-plugin

v1.0.0

Published

OpenCode plugin that optimizes token usage by pruning obsolete tool outputs from conversation context (full parity port of @tarquinen/opencode-dcp, rebranded as ◆ DCP rust)

Readme

@qdang46/opencode-dcp-plugin

npm version License: MIT

Dynamic Context Pruning plugin for OpenCode

Full-parity TypeScript port of @tarquinen/opencode-dcp (v3.1.x). Same hooks, TUI panel, compress tools, notifications, persistence, and config as upstream.

Installation

Local (dev / pin)

In both ~/.config/opencode/opencode.jsonc and ~/.config/opencode/tui.json:

{
  "plugin": [
    "file:///Users/you/Projects/dynamic_context_pruning/opencode-dcp-plugin"
  ]
}

OpenCode 1.17 loads TUI plugins from tui.json separately from server plugins in opencode.jsonc. Use an absolute file:// path (outside node_modules) so OpenTUI JSX transforms correctly (opencode#33884).

npm

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

Restart OpenCode completely after install.

Usage

| Command | What happens | |---------|----------------| | /dcp | TUI dialog panel — Context / Stats / Manual mode / compress prompt hint | | /dcp-compress [focus] | Chat slash: queues a manual compress prompt; model must call compress | | /dcp context | Ignored chat message with token breakdown | | /dcp stats | Ignored chat message with session + all-time stats | | /dcp sweep | Flush pending prune strategies | | /dcp manual on\|off | Toggle manual mode (persisted) | | /dcp decompress <id> | Restore a compressed block | | /dcp recompress <id> | Re-activate a decompressed block |

LLM tools (when compress permission allows):

  • compress — range mode (startId/endId) or message mode (messageId), per config

Configuration

~/.config/opencode/dcp.jsonc (or project .opencode/dcp.jsonc):

{
  "enabled": true,
  "strategies": {
    "deduplication": { "enabled": true },
    "purgeErrors": { "enabled": true }
  },
  "compress": {
    "mode": "range",           // or "message"
    "permission": "allow",
    "showCompression": true
  },
  "pruneNotification": "detailed", // off | minimal | detailed
  "pruneNotificationType": "chat", // chat | toast
  "manualMode": { "enabled": false },
  "commands": { "enabled": true }
}

Full schema: dcp.schema.json.

Architecture

OpenCode server process
  index.ts (Plugin)
    → hooks (messages.transform, system, commands, events)
    → strategies (dedup, purge-errors)
    → compress tools (range | message)
    → state persistence (~/.local/share/opencode/storage/plugin/dcp/)

OpenCode TUI process
  tui.tsx
    → /dcp → PanelDialog (Context / Stats / Manual)

Same structure as upstream @tarquinen/opencode-dcp. Prune mutates OpenCode tool parts in place (placeholder outputs) — no IR round-trip.

Development

cd opencode-dcp-plugin
npm install --legacy-peer-deps
npm run build          # tsup → dist/index.js + tsc declarations
npm run typecheck

After changing TUI sources, restart OpenCode (TUI loads tui.tsx live via file://).

Do not leave nested node_modules/@opentui or solid-js in the plugin package when loading via file:// — OpenCode must use its host renderer.

Credits

Based on @tarquinen/opencode-dcp (AGPL-3.0) by tarquinen.

License

MIT — see LICENSE.