If you’ve been using OpenCode for AI-assisted development, you’ve probably noticed one thing:
👉 Token usage can get out of hand—fast.
Between full file context, chat history, and agent loops, even simple tasks can burn thousands of tokens.
The good news? There’s a practical way to fix this:
Dynamic Context Pruning (DCP)
🧠 What is Dynamic Context Pruning?
Dynamic Context Pruning (DCP) is a strategy (usually implemented as a plugin or middleware) that:
Removes irrelevant context before sending it to the LLM
Keeps only what’s necessary (active code, recent errors, decisions)
Enforces token limits automatically
Think of it as a smart filter for your prompts .
⚠️ Important: It’s NOT enabled by default
Here’s where many developers get confused:
👉 OpenCode does not ship with DCP turned on out of the box.
You need to:
Install a plugin (or equivalent)
Register it
Configure it properly
⚙️ Step-by-step: Enable DCP in OpenCode
1.…